mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
In order to prepare for spec.-compliant validation of shader I/O, we
need to create a new `enum` that will have the same set of _variants_ as
`naga::ShaderStage`, but will carry additional information relevant to
validation. As a preparatory step, create the new `enum` (called
`ShaderStageForValidation`), and use it as the source of truth for
details of the stage being validated. This yields several immediate
benefits, even before making adjustments for the new validation:
- Stage-specific stage is now properly encapsulated. `compare_function`,
which was previously passed as a `Option`al sibling argument, is now
properly associated with only the vertex shader stage.
- This led to an odd discovery that `compare_function` was being
provided to `check_stages` with other stages, but not actually
actually checked. This seems like a rightfully squashed bug.
- Instead of passing a `wgpu_types::ShaderStages` (with a single bit)
and `naga::ShaderStage` side-by-side, encapsulate both into conversion
methods for an instance of `ShaderStageForValidation`, so errors are
impossible to make.