pub struct UniformStorage<H = NoUniformBinder, C = Option<()>, U = Box<[u8]>, P = Box<[u8]>>
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> UniformStorage<H, C, U, P>
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> UniformStorage<H, C, U, P>
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 )
where H: BindUniform<C, T>,

Bind a scalar to the given offset.

source

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

Create a new UniformStorage with the given backing storage

source§

impl<H, C, U> UniformStorage<H, C, U, Box<[u8]>>
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]>>

Create a new UniformStorage with the given backing storage

source§

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

source

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

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

source§

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

source

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

Bind a vec4 to the given offset.

source§

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

source

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

Bind a mat4 to the given offset.

Trait Implementations§

source§

impl<T, H, U, P> UniformStorageAccess for UniformStorage<T, H, U, P>
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> RefUnwindSafe for UniformStorage<H, C, U, P>

§

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

§

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

§

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

§

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

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>,

§

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>,

§

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.