Files
wgpu/wgpu-core
Jim Blandy e136c379cb [core] Validate pipeline stages with a shared StageCompiler helper.
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.
2026-10-26 23:42:33 +00:00
..
2025-10-01 19:36:18 -04:00
2026-09-18 15:06:10 +00:00