pub struct PushConstantsLayout {
pub ranges: Vec<PushConstantRange>,
pub total_size: u32,
}Expand description
Describes all push-constant data ranges used by a pipeline.
In wgpu 29 only the total byte size matters at pipeline-creation time (set
via wgpu::PipelineLayoutDescriptor::immediate_size). The per-range
breakdown is kept here for documentation and validation purposes.
§Invariants
All ranges must individually satisfy PushConstantRange::validate, and
total_size must equal end of the last range (or the extent of all
non-overlapping ranges combined).
Fields§
§ranges: Vec<PushConstantRange>Individual data ranges (may overlap in theory, though callers should keep them distinct for clarity).
total_size: u32Total number of bytes reserved in the immediate-data block. Must
be 4-byte aligned and ≤ MAX_PUSH_CONSTANTS_SIZE_BYTES.
Implementations§
Source§impl PushConstantsLayout
impl PushConstantsLayout
Sourcepub fn compute_only(size: u32) -> Self
pub fn compute_only(size: u32) -> Self
Create a layout with a single compute-only range covering [0, size).
§Examples
use oxigdal_gpu::push_constants::PushConstantsLayout;
let l = PushConstantsLayout::compute_only(64);
assert_eq!(l.total_size, 64);
assert_eq!(l.ranges.len(), 1);
assert!(l.validate().is_ok());Sourcepub fn validate(&self) -> GpuResult<()>
pub fn validate(&self) -> GpuResult<()>
Validate all contained ranges.
§Errors
Propagates the first validation error from any constituent
PushConstantRange::validate call. Also returns an error when
total_size exceeds MAX_PUSH_CONSTANTS_SIZE_BYTES or is not
4-byte aligned.
Sourcepub fn immediate_size_for_wgpu(&self) -> u32
pub fn immediate_size_for_wgpu(&self) -> u32
Return the immediate_size value to pass to
wgpu::PipelineLayoutDescriptor.
This is simply self.total_size.
Sourcepub fn to_wgpu_ranges(&self) -> Vec<PushConstantRangeDesc>
pub fn to_wgpu_ranges(&self) -> Vec<PushConstantRangeDesc>
Convert all ranges to a vector of descriptive strings (for logging).
Trait Implementations§
Source§impl Clone for PushConstantsLayout
impl Clone for PushConstantsLayout
Source§fn clone(&self) -> PushConstantsLayout
fn clone(&self) -> PushConstantsLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more