Repository navigation
merge queue: checking #10430 on trunk (0c7c121), stacked on #10719 and #10630 - #10740
Closed
mergify[bot] wants to merge 14 commits into
Closed
mergify[bot] wants to merge 14 commits into
mergify[bot] wants to merge 14 commits into
Conversation
Rename the `ShaderMetaData::Interface` variant to `NagaModule`, and make it a struct-like variant. Delete `ShaderMetaData::interface`, and update its call sites to use a `match` expression directly on the enum instead. This makes the use sites clearer, by making it apparent which style of module we're processing.
Slightly reorder the sites that consume `ShaderMetaData` values, so that the code for the `NagaModule` and `Passthrough` cases can be gathered into `match` statements.
Move the definitions of `ShaderMetaData` and `PassthroughInterface` from `wgpu_core::validation`, which does not use them, to `wgpu_core::pipeline`, where they are used in `ShaderModuleState`, and created.
In `wgpu_core::pipeline`, delete `ShaderMetaData` and turn `ShaderModuleState` into the equivalent enum, giving both the `NagaModule` and `Passthrough` variants their own `raw` field. Arrange for uses of `ShaderModuleState` to extract the raw `wgpu_hal` module in the `match` expression that handles the two variants. In isolation, this change looks like mere rearrangement, not a cleanup, but hopefully either way it's easy to see that it has no effect on behavior. Subsequent commits will remove `raw` from the `NagaModule` variant; this refactor will allow that to affect only the `NagaModule` `match` arms, leaving the passthrough code unaffected.
In `wgpu_core/src/device/resource.rs`, in the function `Device::create_render_pipeline_or_error_inner`, remove the leading `_` from the following local variables' names, and simply leave them uninitialized in their declaration: - `_vertex_entry_point_name` - `_task_entry_point_name` - `_mesh_entry_point_name` Rust is smart enough to see that these are always initialized before they are used, and thus don't need to be initialized at their declaration.
Gather the state that `Interface::check_stage` accumulates across all of a pipeline's stages (the bind group layouts, minimum binding sizes, and immediate data usage) into a new `PipelineResources` struct, which `check_stage` takes by `&mut`. Remove `immediates` from `StageIo`, so that `StageIo` holds only the information one stage passes to the next. Use `layout` to refer to the `BindingLayoutSource`, not `layouts`, since that value describes a single pipeline layout. In the derived case, it does hold an array of bind group layouts, but that is only one variant; the value's name should make sense regardless which variant is present.
Introduce `StageCompiler`, in the new `wgpu_core::device::stage_compiler` module, which performs the per-stage work that `create_compute_pipeline_or_error_inner` and `create_render_pipeline_or_error_inner` previously repeated for each stage: checking the shader module's validity and device, choosing the entry point, checking the stage against the module's interface, and tracking which stages were validated. `StageCompiler::compile` returns a `CompiledStage`, which borrows the module the stage should use, and records the entry point name. From this we can build a `hal::ProgrammableStage` to use when creating the hal pipeline. Have `StageCompiler::compile` reject a passthrough stage immediately if the pipeline's layout is being derived. `ImplicitLayoutError::Passthrough` now names only that stage, rather than every passthrough stage in the pipeline. Remove `ImplicitLayoutError::ReflectionError`, along with the check that reported it. The condition it was concerned with, deriving a layout from a stage we couldn't reflect, is already rejected as `ImplicitLayoutError::Passthrough`. The only way left to reach it was a bug: for mesh pipelines without a fragment stage, it expected the last stage to be a vertex stage, and so rejected them incorrectly. In this commit, `StageCompiler` only does validation, but by the end of this pull request, it will be compiling shader modules. Having its name overstate its role for one commit seems clearer than introducing everything in one commit and renaming it in the next. The comments, however, are accurate in each commit. This commit also changes compute pipelines to report errors in the same way as render pipelines: an invalid shader module is now reported as a `CreatePipelineError::Stage` error, and the shader module is checked after the pipeline layout, not before.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is a merge queue draft opened by Mergify. Nobody needs to act on it.
Mergify opened it for batch printed-kouign-4bh82j of the
rebasequeue, to test #10430 before it merges intotrunk.What this draft tests
Mergify checks that #10430 still passes CI once combined with everything queued ahead of it. CI runs on this draft's code, built in this order:
trunkat0c7c121cb23ca4The check is speculative: it assumes the pull requests ahead will merge, so it starts without waiting for them.
✨ Where it stands: closed
Pull request #10630 ahead in the queue was removed (reason:
checks interrupted).Follow the
rebasequeue in the dashboardWhat happens next
Tip
A red check is not necessarily caused by this batch. These checks run on a tip that also carries the commits of the 2 pull requests ahead, so a failure here can come from them as much as from #10430. See only this batch's changes.
Queued ahead of this batch
These pull requests entered the queue before this batch and are not part of it.
Metadata for CI tooling, read by
mergify ciRequired conditions of queue rule
rebasefor mergecheck-neutral = Clippy MacOS aarch64check-skipped = Clippy MacOS aarch64check-success = Clippy MacOS aarch64check-neutral = Clippy MacOS x86_64check-skipped = Clippy MacOS x86_64check-success = Clippy MacOS x86_64check-neutral = Clippy Android aarch64check-skipped = Clippy Android aarch64check-success = Clippy Android aarch64check-neutral = Clippy IOS aarch64check-skipped = Clippy IOS aarch64check-success = Clippy IOS aarch64check-neutral = Clippy Linux aarch64check-skipped = Clippy Linux aarch64check-success = Clippy Linux aarch64check-neutral = Clippy Linux x86_64check-skipped = Clippy Linux x86_64check-success = Clippy Linux x86_64check-neutral = Clippy WebAssemblycheck-skipped = Clippy WebAssemblycheck-success = Clippy WebAssemblycheck-neutral = Clippy Windows x86_64check-skipped = Clippy Windows x86_64check-success = Clippy Windows x86_64check-neutral = Clippy cts_runnercheck-skipped = Clippy cts_runnercheck-success = Clippy cts_runnercheck-neutral = Doctestcheck-skipped = Doctestcheck-success = Doctestcheck-neutral = Test Windows x86_64check-skipped = Test Windows x86_64check-success = Test Windows x86_64check-neutral = Clippy Emscriptencheck-skipped = Clippy Emscriptencheck-success = Clippy Emscriptencheck-neutral = Test WebAssemblycheck-skipped = Test WebAssemblycheck-success = Test WebAssemblycheck-neutral = cargo-denycheck-skipped = cargo-denycheck-success = cargo-denycheck-neutral = Validate: HLSLcheck-skipped = Validate: HLSLcheck-success = Validate: HLSLcheck-neutral = Validate: MSLcheck-skipped = Validate: MSLcheck-success = Validate: MSLcheck-neutral = Validate: SPIR-V/GLSL/DOT/WGSLcheck-skipped = Validate: SPIR-V/GLSL/DOT/WGSLcheck-success = Validate: SPIR-V/GLSL/DOT/WGSLcheck-neutral = Test Linux x86_64check-skipped = Test Linux x86_64check-success = Test Linux x86_64check-neutral = Test Mac aarch64check-skipped = Test Mac aarch64check-success = Test Mac aarch64check-neutral = Format & Typoscheck-skipped = Format & Typoscheck-success = Format & Typoscheck-neutral = Clippy Windows aarch64check-skipped = Clippy Windows aarch64check-success = Clippy Windows aarch64check-neutral = Clippy VisionOS aarch64check-skipped = Clippy VisionOS aarch64check-success = Clippy VisionOS aarch64check-neutral = 01-hello-computecheck-skipped = 01-hello-computecheck-success = 01-hello-computecheck-neutral = 02-hello-windowcheck-skipped = 02-hello-windowcheck-success = 02-hello-windowcheck-neutral = Clippy OpenHarmony aarch64check-skipped = Clippy OpenHarmony aarch64check-success = Clippy OpenHarmony aarch64check-neutral = Clippy Linux ppc32check-skipped = Clippy Linux ppc32check-success = Clippy Linux ppc32check-neutral = Clippy WebAssembly Core 1.0check-skipped = Clippy WebAssembly Core 1.0check-success = Clippy WebAssembly Core 1.0check-neutral = Clippy Android ARMv7check-skipped = Clippy Android ARMv7check-success = Clippy Android ARMv7check-neutral = Clippy Android x86_64check-skipped = Clippy Android x86_64check-success = Clippy Android x86_64check-neutral = Clippy FreeBSD x86_64check-skipped = Clippy FreeBSD x86_64check-success = Clippy FreeBSD x86_64check-neutral = API Operation Linux x86_64check-skipped = API Operation Linux x86_64check-success = API Operation Linux x86_64check-neutral = API Operation Mac aarch64check-skipped = API Operation Mac aarch64check-success = API Operation Mac aarch64check-neutral = API Operation Windows x86_64check-skipped = API Operation Windows x86_64check-success = API Operation Windows x86_64check-neutral = API Validation Linux x86_64check-skipped = API Validation Linux x86_64check-success = API Validation Linux x86_64check-neutral = API Validation Mac aarch64check-skipped = API Validation Mac aarch64check-success = API Validation Mac aarch64check-neutral = API Validation Windows x86_64check-skipped = API Validation Windows x86_64check-success = API Validation Windows x86_64check-neutral = Other Linux x86_64check-skipped = Other Linux x86_64check-success = Other Linux x86_64check-neutral = Other Mac aarch64check-skipped = Other Mac aarch64check-success = Other Mac aarch64check-neutral = Other Windows x86_64check-skipped = Other Windows x86_64check-success = Other Windows x86_64check-neutral = Core MSRV Check MacOS x86_64check-skipped = Core MSRV Check MacOS x86_64check-success = Core MSRV Check MacOS x86_64check-neutral = Core MSRV Check Linux x86_64check-skipped = Core MSRV Check Linux x86_64check-success = Core MSRV Check Linux x86_64check-neutral = Core MSRV Check Windows x86_64check-skipped = Core MSRV Check Windows x86_64check-success = Core MSRV Check Windows x86_64check-neutral = wgpu MSRV Check MacOS x86_64check-skipped = wgpu MSRV Check MacOS x86_64check-success = wgpu MSRV Check MacOS x86_64check-neutral = wgpu MSRV Check Linux x86_64check-skipped = wgpu MSRV Check Linux x86_64check-success = wgpu MSRV Check Linux x86_64check-neutral = wgpu MSRV Check WebAssemblycheck-skipped = wgpu MSRV Check WebAssemblycheck-success = wgpu MSRV Check WebAssemblycheck-neutral = wgpu MSRV Check Windows x86_64check-skipped = wgpu MSRV Check Windows x86_64check-success = wgpu MSRV Check Windows x86_64check-neutral = Miri (limited scope)check-skipped = Miri (limited scope)check-success = Miri (limited scope)check-neutral = MSRV Minimal Versionscheck-skipped = MSRV Minimal Versionscheck-success = MSRV Minimal Versionscheck-neutral = Validate Shaders: Dota2check-skipped = Validate Shaders: Dota2check-success = Validate Shaders: Dota2check-neutral = Validate Shaders: Sascha Willems Vulkan Tutorialcheck-skipped = Validate Shaders: Sascha Willems Vulkan Tutorialcheck-success = Validate Shaders: Sascha Willems Vulkan Tutorialcheck-neutral = Validate Shaders: dneto0 spirv-samplescheck-skipped = Validate Shaders: dneto0 spirv-samplescheck-success = Validate Shaders: dneto0 spirv-samplescheck-neutral = publishcheck-skipped = publishcheck-success = publishcheck-neutral = buildcheck-skipped = buildcheck-success = buildcheck-neutral = 03-hdr-surfacecheck-skipped = 03-hdr-surfacecheck-success = 03-hdr-surfacecheck-neutral = custom-backendcheck-skipped = custom-backendcheck-success = custom-backendcheck-neutral = Clippy NetBSD x86_64check-skipped = Clippy NetBSD x86_64check-success = Clippy NetBSD x86_64check-neutral = Clippy WebAssembly 64-bitcheck-skipped = Clippy WebAssembly 64-bitcheck-success = Clippy WebAssembly 64-bitcheck-neutral = Zizmorcheck-skipped = Zizmorcheck-success = Zizmorcheck-neutral = zizmorcheck-skipped = zizmorcheck-success = zizmorgithub-review-approved[🛡 GitHub branch protection]Required conditions to stay in the queue
github-review-approved[🛡 GitHub branch protection]label = "merge: rebase"check-success = Clippy MacOS aarch64check-neutral = Clippy MacOS aarch64check-skipped = Clippy MacOS aarch64check-success = Clippy MacOS x86_64check-neutral = Clippy MacOS x86_64check-skipped = Clippy MacOS x86_64check-success = Clippy Android aarch64check-neutral = Clippy Android aarch64check-skipped = Clippy Android aarch64check-success = Clippy IOS aarch64check-neutral = Clippy IOS aarch64check-skipped = Clippy IOS aarch64check-success = Clippy Linux aarch64check-neutral = Clippy Linux aarch64check-skipped = Clippy Linux aarch64check-success = Clippy Linux x86_64check-neutral = Clippy Linux x86_64check-skipped = Clippy Linux x86_64check-success = Clippy WebAssemblycheck-neutral = Clippy WebAssemblycheck-skipped = Clippy WebAssemblycheck-success = Clippy Windows x86_64check-neutral = Clippy Windows x86_64check-skipped = Clippy Windows x86_64check-success = Clippy cts_runnercheck-neutral = Clippy cts_runnercheck-skipped = Clippy cts_runnercheck-success = Doctestcheck-neutral = Doctestcheck-skipped = Doctestcheck-success = Test Windows x86_64check-neutral = Test Windows x86_64check-skipped = Test Windows x86_64check-success = Clippy Emscriptencheck-neutral = Clippy Emscriptencheck-skipped = Clippy Emscriptencheck-success = Test WebAssemblycheck-neutral = Test WebAssemblycheck-skipped = Test WebAssemblycheck-success = cargo-denycheck-neutral = cargo-denycheck-skipped = cargo-denycheck-success = Validate: HLSLcheck-neutral = Validate: HLSLcheck-skipped = Validate: HLSLcheck-success = Validate: MSLcheck-neutral = Validate: MSLcheck-skipped = Validate: MSLcheck-success = Validate: SPIR-V/GLSL/DOT/WGSLcheck-neutral = Validate: SPIR-V/GLSL/DOT/WGSLcheck-skipped = Validate: SPIR-V/GLSL/DOT/WGSLcheck-success = Test Linux x86_64check-neutral = Test Linux x86_64check-skipped = Test Linux x86_64check-success = Test Mac aarch64check-neutral = Test Mac aarch64check-skipped = Test Mac aarch64check-success = Format & Typoscheck-neutral = Format & Typoscheck-skipped = Format & Typoscheck-success = Clippy Windows aarch64check-neutral = Clippy Windows aarch64check-skipped = Clippy Windows aarch64check-success = Clippy VisionOS aarch64check-neutral = Clippy VisionOS aarch64check-skipped = Clippy VisionOS aarch64check-success = 01-hello-computecheck-neutral = 01-hello-computecheck-skipped = 01-hello-computecheck-success = 02-hello-windowcheck-neutral = 02-hello-windowcheck-skipped = 02-hello-windowcheck-success = Clippy OpenHarmony aarch64check-neutral = Clippy OpenHarmony aarch64check-skipped = Clippy OpenHarmony aarch64check-success = Clippy Linux ppc32check-neutral = Clippy Linux ppc32check-skipped = Clippy Linux ppc32check-success = Clippy WebAssembly Core 1.0check-neutral = Clippy WebAssembly Core 1.0check-skipped = Clippy WebAssembly Core 1.0check-success = Clippy Android ARMv7check-neutral = Clippy Android ARMv7check-skipped = Clippy Android ARMv7check-success = Clippy Android x86_64check-neutral = Clippy Android x86_64check-skipped = Clippy Android x86_64check-success = Clippy FreeBSD x86_64check-neutral = Clippy FreeBSD x86_64check-skipped = Clippy FreeBSD x86_64check-success = API Operation Linux x86_64check-neutral = API Operation Linux x86_64check-skipped = API Operation Linux x86_64check-success = API Operation Mac aarch64check-neutral = API Operation Mac aarch64check-skipped = API Operation Mac aarch64check-success = API Operation Windows x86_64check-neutral = API Operation Windows x86_64check-skipped = API Operation Windows x86_64check-success = API Validation Linux x86_64check-neutral = API Validation Linux x86_64check-skipped = API Validation Linux x86_64check-success = API Validation Mac aarch64check-neutral = API Validation Mac aarch64check-skipped = API Validation Mac aarch64check-success = API Validation Windows x86_64check-neutral = API Validation Windows x86_64check-skipped = API Validation Windows x86_64check-success = Other Linux x86_64check-neutral = Other Linux x86_64check-skipped = Other Linux x86_64check-success = Other Mac aarch64check-neutral = Other Mac aarch64check-skipped = Other Mac aarch64check-success = Other Windows x86_64check-neutral = Other Windows x86_64check-skipped = Other Windows x86_64check-success = Core MSRV Check MacOS x86_64check-neutral = Core MSRV Check MacOS x86_64check-skipped = Core MSRV Check MacOS x86_64check-success = Core MSRV Check Linux x86_64check-neutral = Core MSRV Check Linux x86_64check-skipped = Core MSRV Check Linux x86_64check-success = Core MSRV Check Windows x86_64check-neutral = Core MSRV Check Windows x86_64check-skipped = Core MSRV Check Windows x86_64check-success = wgpu MSRV Check MacOS x86_64check-neutral = wgpu MSRV Check MacOS x86_64check-skipped = wgpu MSRV Check MacOS x86_64check-success = wgpu MSRV Check Linux x86_64check-neutral = wgpu MSRV Check Linux x86_64check-skipped = wgpu MSRV Check Linux x86_64check-success = wgpu MSRV Check WebAssemblycheck-neutral = wgpu MSRV Check WebAssemblycheck-skipped = wgpu MSRV Check WebAssemblycheck-success = wgpu MSRV Check Windows x86_64check-neutral = wgpu MSRV Check Windows x86_64check-skipped = wgpu MSRV Check Windows x86_64check-success = Miri (limited scope)check-neutral = Miri (limited scope)check-skipped = Miri (limited scope)check-success = MSRV Minimal Versionscheck-neutral = MSRV Minimal Versionscheck-skipped = MSRV Minimal Versionscheck-success = Validate Shaders: Dota2check-neutral = Validate Shaders: Dota2check-skipped = Validate Shaders: Dota2check-success = Validate Shaders: Sascha Willems Vulkan Tutorialcheck-neutral = Validate Shaders: Sascha Willems Vulkan Tutorialcheck-skipped = Validate Shaders: Sascha Willems Vulkan Tutorialcheck-success = Validate Shaders: dneto0 spirv-samplescheck-neutral = Validate Shaders: dneto0 spirv-samplescheck-skipped = Validate Shaders: dneto0 spirv-samplescheck-success = publishcheck-neutral = publishcheck-skipped = publishcheck-success = buildcheck-neutral = buildcheck-skipped = buildcheck-success = 03-hdr-surfacecheck-neutral = 03-hdr-surfacecheck-skipped = 03-hdr-surfacecheck-success = custom-backendcheck-neutral = custom-backendcheck-skipped = custom-backendcheck-success = Clippy NetBSD x86_64check-neutral = Clippy NetBSD x86_64check-skipped = Clippy NetBSD x86_64check-success = Clippy WebAssembly 64-bitcheck-neutral = Clippy WebAssembly 64-bitcheck-skipped = Clippy WebAssembly 64-bitcheck-success = Zizmorcheck-neutral = Zizmorcheck-skipped = Zizmorcheck-success = zizmorcheck-neutral = zizmorcheck-skipped = zizmor