Files
wgpu/tests
Jim Blandy ad5a70aea1 [core] Validate shader stages after applying pipeline overrides.
The WebGPU specification requires pipeline creation to validate
properties of shader stages, like workgroup sizes, that may depend on
the values of pipeline-overridable constants. Previously, wgpu-core
validated stages using an `Interface` built from the module before
overrides were applied, with results contrary to spec. Override
processing was then carried out by `wgpu_hal`, after all validation
had supposedly been taken care of.

This commit has `create_shader_module` save the validated Naga module
instead of creating a `wgpu_hal` shader module. At pipeline creation
time, `StageCompiler::compile` now applies the stage's override values
with `process_overrides`, validates the stage using an `Interface`
built from the result, and, if that validation succeeds, returns a
`CompiledStage` holding the `wgpu_hal` `ShaderModule` created from it.
Dropping the `CompiledStage` destroys that module once the pipeline
has been created.

Since the override values have already been applied, we pass
`wgpu_hal` empty sets of constants for these modules.

Since the `naga::back::pipeline_constants` module is now used by
`wgpu_core` rather than `wgpu_hal` backends, it can't be conditionally
available based on Naga's backend features. Include it
unconditionally.

This change removes `Interface::finalize_entry_point_name`, since we
no longer build an `Interface` at shader module creation. Instead, we
choose entry points from the `naga::Module` directly.

Add new tests: `tests/tests/wgpu-validation/api/overrides.rs`

Fixes #9774.
2026-10-26 23:42:33 +00:00
..