Skip to content

WebGPU: Preserve shader entry points when archiving render state cache pipelines, Fixes #813 - #814

Open
hzqst wants to merge 1 commit into
DiligentGraphics:developmentfrom
hzqst:rsc-missing-entry-name
Open

hzqst wants to merge 1 commit into
DiligentGraphics:developmentfrom
hzqst:rsc-missing-entry-name

Conversation

@hzqst

@hzqst hzqst commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

When RenderStateCache serializes a PSO using device shaders, it reconstructs ShaderCreateInfo from their WGSL but leaves EntryPoint at its default "main". Shaders with valid entry points such as vertexMain, fragmentMain, or computeMain then fail reflection and PSO archiving. This also affects shaders restored from an existing shader archive. A ready device PSO does not prove archiving succeeded because the cache catches serialization exceptions.

Changes

  • Expose the existing backend GetEntryPoint() through IShaderWebGPU, returning the actual selected WGSL entry point.
  • Add GetWebGPUShaderEntryPoint() using the existing WebGPU utility pattern, including a stub for builds without WebGPU.
  • Restore that entry point when RenderStateCache reconstructs the shader creation info for serialization. The archive format already stores entry points and requires no changes.
  • Add four WebGPU regression tests covering single-entry and multi-entry WGSL, both device-created shaders and shaders restored from a shader-only archive. Each test exercises non-main vertex, fragment, and compute entry points, stores the resulting PSOs, destroys and recreates the cache, and requires archive hits with ready pipelines. Multi-entry modules place an unused entry point of the same stage first and give it additional resources; the restored pipeline must preserve the selected entry point's resource layout.

Validation

Windows x64 Debug, NVIDIA GPU:

  • Before the production fix, all four initial regression tests failed with Entry point 'main' is not found, shader serialization errors, and missing PSO archive hits. The archive-restored cases first logged successful shader archive hits, reproducing the reported sequence.
  • WebGPU build succeeded. RenderStateCacheTest.*, ArchiveTest.WGSLEntryPointRemapping, and ShaderCreationTest.WGSLEntryPointRemapping: 34 passed, 5 skipped, 0 failures, including all four final regression tests.
  • Build with WebGPU disabled succeeded. Vulkan RenderStateCacheTest.*: 31 passed, 6 skipped, 0 failures.
  • Repository clang-format 10 validation passed for all seven changed files; git diff --check passed.

Run the API tests from Tests/DiligentCoreAPITest/assets:

DiligentCoreAPITest.exe --mode=wgpu --gtest_filter=RenderStateCacheTest.*:ArchiveTest.WGSLEntryPointRemapping:ShaderCreationTest.WGSLEntryPointRemapping
DiligentCoreAPITest.exe --mode=vk --gtest_filter=RenderStateCacheTest.*

The regressions recreate caches and reload archives on the same device. A full application restart/device recreation and the original HLND2T scenario were not run.

Compatibility

Adding a virtual method to IShaderWebGPU changes its C++ vtable; consumers and implementations must be rebuilt together. The archive format is unchanged.

Closes #813

@hzqst hzqst changed the title WebGPU: Preserve shader entry points when archiving render state cache pipelines WebGPU: Preserve shader entry points when archiving render state cache pipelines, Fixes #813 Oct 21, 2026
hzqst added a commit to hzqst/DiligentCore that referenced this pull request Oct 25, 2026
Integrate DiligentGraphics/DiligentCore PRs DiligentGraphics#812, DiligentGraphics#814 and DiligentGraphics#817 into RTXPT-ray-reconstruction without importing the development merge from PR DiligentGraphics#814.

Sources: DiligentGraphics#812 2a7f66e, 55f8504, fbb9a27; DiligentGraphics#814 f3a3a04; DiligentGraphics#817 acac729, 720904a. Add a three-pass native PSO/render-state archive round-trip regression and update modified copyright years.

Validated Release Core/API tests and RTXPT builds, 556 unit tests, 59 D3D12 tests, 54 Vulkan tests and 6 WebGPU tests. Three Metal-only mesh tests skipped. D3D12 reference and RR captures exited successfully; RR executed twice. clang-format 10 validated all 15 changed files.

Co-Authored-By: Codex <codex@openai.com>

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hzqst
hzqst force-pushed the rsc-missing-entry-name branch from 6a9c806 to 71b801c Compare October 25, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant