Struct librashader_runtime::uniforms::UniformStorage

source ·
pub struct UniformStorage<H = NoUniformBinder, C = Option<()>, U = Box<[u8]>, P = Box<[u8]>, D = ()>
where U: Deref<Target = [u8]> + DerefMut, P: Deref<Target = [u8]> + DerefMut,
{ /* private fields */ }
Expand description

A helper to bind uniform variables to UBO or Push Constant Buffers.

Implementations§

source§

impl<H, C, U, P, D> UniformStorage<H, C, U, P, D>
where U: Deref<Target = [u8]> + DerefMut, P: Deref<Target = [u8]> + DerefMut,

source

pub fn inner_ubo(&self) -> &U

Access the backing storage for the UBO.

source

pub fn inner_push(&self) -> &P

Access the backing storage for the Push storage.

source§

impl<H, C, U, P, D> UniformStorage<H, C, U, P, D>
where C: Copy, U: Deref<Target = [u8]> + DerefMut, P: Deref<Target = [u8]> + DerefMut,

source

pub fn bind_scalar<T: UniformScalar>( &mut self, offset: MemberOffset, value: T, ctx: C, device: &D, )
where H: BindUniform<C, T, D>,

Bind a scalar to the given offset.

source

pub fn new_with_storage(ubo: U, push: P) -> UniformStorage<H, C, U, P, D>

Create a new UniformStorage with the given backing storage

source§

impl<H, C, U, D> UniformStorage<H, C, U, Box<[u8]>, D>
where C: Copy, U: Deref<Target = [u8]> + DerefMut,

source

pub fn new_with_ubo_storage( storage: U, push_size: usize, ) -> UniformStorage<H, C, U, Box<[u8]>, D>

Create a new UniformStorage with the given backing storage

source§

impl<H, C, D> UniformStorage<H, C, Box<[u8]>, Box<[u8]>, D>

source

pub fn new( ubo_size: usize, push_size: usize, ) -> UniformStorage<H, C, Box<[u8]>, Box<[u8]>, D>

Create a new UniformStorage with the given size for UBO and Push Constant Buffer sizes.

source§

impl<H, C, U, P, D> UniformStorage<H, C, U, P, D>
where C: Copy, U: Deref<Target = [u8]> + DerefMut, P: Deref<Target = [u8]> + DerefMut, H: for<'a> BindUniform<C, &'a [f32; 4], D>,

source

pub fn bind_vec4( &mut self, offset: MemberOffset, value: impl Into<[f32; 4]>, ctx: C, device: &D, )

Bind a vec4 to the given offset.

source§

impl<H, C, U, P, D> UniformStorage<H, C, U, P, D>
where C: Copy, U: Deref<Target = [u8]> + DerefMut, P: Deref<Target = [u8]> + DerefMut, H: for<'a> BindUniform<C, &'a [f32; 16], D>,

source

pub fn bind_mat4( &mut self, offset: MemberOffset, value: &[f32; 16], ctx: C, device: &D, )

Bind a mat4 to the given offset.

Trait Implementations§

source§

impl<D, T, H, U, P> UniformStorageAccess for UniformStorage<T, H, U, P, D>
where U: Deref<Target = [u8]> + DerefMut, P: Deref<Target = [u8]> + DerefMut,

source§

fn ubo_pointer(&self) -> *const u8

Get a pointer to the backing UBO storage. This pointer must be valid for the lifetime of the implementing struct.
source§

fn ubo_slice(&self) -> &[u8]

Get a pointer to the backing UBO storage. This pointer must be valid for the lifetime of the implementing struct.
source§

fn push_pointer(&self) -> *const u8

Get a pointer to the backing Push Constant buffer storage. This pointer must be valid for the lifetime of the implementing struct.
source§

fn push_slice(&self) -> &[u8]

Get a slice to the backing Push Constant buffer storage. This pointer must be valid for the lifetime of the implementing struct.

Auto Trait Implementations§

§

impl<H, C, U, P, D> Freeze for UniformStorage<H, C, U, P, D>
where U: Freeze, P: Freeze,

§

impl<H, C, U, P, D> RefUnwindSafe for UniformStorage<H, C, U, P, D>

§

impl<H, C, U, P, D> Send for UniformStorage<H, C, U, P, D>
where U: Send, P: Send, H: Send, C: Send, D: Send,

§

impl<H, C, U, P, D> Sync for UniformStorage<H, C, U, P, D>
where U: Sync, P: Sync, H: Sync, C: Sync, D: Sync,

§

impl<H, C, U, P, D> Unpin for UniformStorage<H, C, U, P, D>
where U: Unpin, P: Unpin, H: Unpin, C: Unpin, D: Unpin,

§

impl<H, C, U, P, D> UnwindSafe for UniformStorage<H, C, U, P, D>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.