euv_engine/renderer/status/struct.rs
1use super::*;
2
3/// One or more pipeline stages a bind group layout slot is visible to.
4///
5/// WebGPU's `visibility` is a `GPUShaderStage` bitmask, not a single
6/// stage: a uniform block that both the vertex and fragment stages read
7/// is the most common binding there is, and naming one stage produces a
8/// layout the other stage cannot see. [`ShaderStage`] alone cannot carry
9/// that, so this newtype holds the combined mask while keeping the
10/// variants spelled out rather than written as a raw `0x1 | 0x2`.
11///
12/// Build one with `|`, or from a single stage (which is what the
13/// `Into` impl is for):
14///
15/// ```
16/// use euv_engine::{ShaderStage, ShaderStages};
17///
18/// let both: ShaderStages = ShaderStage::Vertex | ShaderStage::Fragment;
19/// let one: ShaderStages = ShaderStage::Compute.into();
20/// assert!(both.contains(ShaderStage::Vertex));
21/// assert_eq!(one.bits(), 0x4);
22/// ```
23#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
24pub struct ShaderStages(pub(crate) u32);