Struct 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.