pub struct UniformStorage<H = NoUniformBinder, C = Option<()>, S = Box<[u8]>>where
    S: 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, S> UniformStorage<H, C, S>where
    S: Deref<Target = [u8]> + DerefMut,

source

pub fn inner_ubo(&self) -> &S

Access the backing storage for the UBO.

source§

impl<H, C, S> UniformStorage<H, C, S>where
    C: Copy,
    S: 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(storage: S, push_size: usize) -> UniformStorage<H, C, S>

Create a new UniformStorage with the given backing storage

source§

impl<H, C> UniformStorage<H, C, 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, S> UniformStorage<H, C, S>where
    C: Copy,
    S: 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, S> UniformStorage<H, C, S>where
    C: Copy,
    S: 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, S> UniformStorageAccess for UniformStorage<T, H, S>where
    S: 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, S> RefUnwindSafe for UniformStorage<H, C, S>where
    C: RefUnwindSafe,
    H: RefUnwindSafe,
    S: RefUnwindSafe,

§

impl<H, C, S> Send for UniformStorage<H, C, S>where
    C: Send,
    H: Send,
    S: Send,

§

impl<H, C, S> Sync for UniformStorage<H, C, S>where
    C: Sync,
    H: Sync,
    S: Sync,

§

impl<H, C, S> Unpin for UniformStorage<H, C, S>where
    C: Unpin,
    H: Unpin,
    S: Unpin,

§

impl<H, C, S> UnwindSafe for UniformStorage<H, C, S>where
    C: UnwindSafe,
    H: UnwindSafe,
    S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.