pub struct PushConstantRange {
pub stages: ShaderStages,
pub start: u32,
pub end: u32,
}Expand description
Describes one logical push-constant range within a pipeline layout.
In wgpu 29 the underlying API does not support per-stage or per-range configurations — the immediate-data block covers the whole shader and is addressed by byte offset. This struct deliberately mirrors the pre-wgpu-29 interface so that callers can model their data layout without change.
§Layout constraints
start < endend − start ≤MAX_PUSH_CONSTANTS_SIZE_BYTES- Both
startandendmust be 4-byte aligned.
Fields§
§stages: ShaderStagesShader stages this range is visible to. Stored for documentation purposes; in wgpu 29 stage visibility is controlled at the bind-group layout level, not the pipeline layout level.
start: u32Byte offset of the first byte in this range (inclusive).
end: u32Byte offset one past the last byte in this range (exclusive).
Implementations§
Source§impl PushConstantRange
impl PushConstantRange
Sourcepub fn compute(size: u32) -> Self
pub fn compute(size: u32) -> Self
Create a compute-only range that starts at offset 0 with the given
size in bytes.
§Examples
use oxigdal_gpu::push_constants::PushConstantRange;
let r = PushConstantRange::compute(32);
assert_eq!(r.start, 0);
assert_eq!(r.end, 32);
assert!(r.validate().is_ok());Sourcepub fn validate(&self) -> GpuResult<()>
pub fn validate(&self) -> GpuResult<()>
Validate that this range satisfies all layout constraints.
§Errors
Returns GpuError::InvalidKernelParams when:
end <= start(zero or negative size).- The range size exceeds
MAX_PUSH_CONSTANTS_SIZE_BYTES. startorendis not 4-byte aligned.
Trait Implementations§
Source§impl Clone for PushConstantRange
impl Clone for PushConstantRange
Source§fn clone(&self) -> PushConstantRange
fn clone(&self) -> PushConstantRange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PushConstantRange
impl Debug for PushConstantRange
impl Eq for PushConstantRange
Source§impl PartialEq for PushConstantRange
impl PartialEq for PushConstantRange
Source§fn eq(&self, other: &PushConstantRange) -> bool
fn eq(&self, other: &PushConstantRange) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PushConstantRange
Auto Trait Implementations§
impl Freeze for PushConstantRange
impl RefUnwindSafe for PushConstantRange
impl Send for PushConstantRange
impl Sync for PushConstantRange
impl Unpin for PushConstantRange
impl UnsafeUnpin for PushConstantRange
impl UnwindSafe for PushConstantRange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.