pub struct UniformBlock {
pub params: Vec<ShaderParam>,
pub name: String,
}Expand description
A named uniform block containing multiple ShaderParam entries.
Fields§
§params: Vec<ShaderParam>Ordered list of parameters in this block.
name: StringName of the uniform block (e.g. "Globals").
Implementations§
Source§impl UniformBlock
impl UniformBlock
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a new empty UniformBlock with the given name.
Sourcepub fn add_param(&mut self, param: ShaderParam)
pub fn add_param(&mut self, param: ShaderParam)
Appends a parameter to the block.
Sourcepub fn find(&self, name: &str) -> Option<&ShaderParam>
pub fn find(&self, name: &str) -> Option<&ShaderParam>
Finds the first parameter with the given name.
Sourcepub fn total_size_bytes(&self) -> u32
pub fn total_size_bytes(&self) -> u32
Returns the total size in bytes of all parameters in this block.
This is the sum of each parameter’s byte size (not the end offset of the last parameter, since params may not be tightly packed).
Sourcepub fn param_count(&self) -> usize
pub fn param_count(&self) -> usize
Returns the number of parameters in this block.
Sourcepub fn is_aligned(&self) -> bool
pub fn is_aligned(&self) -> bool
Returns true if the total size is a multiple of 16 (std140 alignment).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UniformBlock
impl RefUnwindSafe for UniformBlock
impl Send for UniformBlock
impl Sync for UniformBlock
impl Unpin for UniformBlock
impl UnsafeUnpin for UniformBlock
impl UnwindSafe for UniformBlock
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more