pub struct ShaderStages(/* private fields */);Expand description
One or more pipeline stages a bind group layout slot is visible to.
WebGPU’s visibility is a GPUShaderStage bitmask, not a single
stage: a uniform block that both the vertex and fragment stages read
is the most common binding there is, and naming one stage produces a
layout the other stage cannot see. ShaderStage alone cannot carry
that, so this newtype holds the combined mask while keeping the
variants spelled out rather than written as a raw 0x1 | 0x2.
Build one with |, or from a single stage (which is what the
Into impl is for):
use euv_engine::{ShaderStage, ShaderStages};
let both: ShaderStages = ShaderStage::Vertex | ShaderStage::Fragment;
let one: ShaderStages = ShaderStage::Compute.into();
assert!(both.contains(ShaderStage::Vertex));
assert_eq!(one.bits(), 0x4);Implementations§
Source§impl ShaderStages
The mask arithmetic behind ShaderStages, kept next to the
BitOr impl for ShaderStage that produces one.
impl ShaderStages
The mask arithmetic behind ShaderStages, kept next to the
BitOr impl for ShaderStage that produces one.
Sourcepub fn bits(self) -> u32
pub fn bits(self) -> u32
The raw GPUShaderStage bitmask this mask stands for.
§Returns
u32- The combined bits, ready for the wire.
Trait Implementations§
Source§impl BitOr for ShaderStages
Combining two masks, which is what a caller reaches for when the two
halves of a layout entry are built independently.
impl BitOr for ShaderStages
Combining two masks, which is what a caller reaches for when the two halves of a layout entry are built independently.
Source§impl BitOr<ShaderStage> for ShaderStages
Adding a stage to a mask that already names others.
impl BitOr<ShaderStage> for ShaderStages
Adding a stage to a mask that already names others.
Source§impl Clone for ShaderStages
impl Clone for ShaderStages
impl Copy for ShaderStages
Source§impl Debug for ShaderStages
impl Debug for ShaderStages
Source§impl Default for ShaderStages
impl Default for ShaderStages
impl Eq for ShaderStages
Source§impl From<ShaderStage> for ShaderStages
Lets a lone stage stand in where a mask is expected, so every
single-stage call site keeps reading as one.
impl From<ShaderStage> for ShaderStages
Lets a lone stage stand in where a mask is expected, so every single-stage call site keeps reading as one.