pub struct ComputeBuffer {
pub data: Vec<f32>,
pub usage: BufferUsage,
pub label: String,
}Expand description
A CPU-resident buffer that mirrors a GPU buffer.
Fields§
§data: Vec<f32>Raw f32 elements.
usage: BufferUsageIntended GPU usage hint.
label: StringHuman-readable label (useful for debugging).
Implementations§
Source§impl ComputeBuffer
impl ComputeBuffer
Sourcepub fn new(size: usize, usage: BufferUsage, label: &str) -> Self
pub fn new(size: usize, usage: BufferUsage, label: &str) -> Self
Allocate a zero-initialised buffer of size f32 elements.
Sourcepub fn write_f32(&mut self, offset: usize, values: &[f32])
pub fn write_f32(&mut self, offset: usize, values: &[f32])
Write values into the buffer starting at element offset.
§Panics
Panics if offset + values.len() > self.data.len().
Trait Implementations§
Source§impl Clone for ComputeBuffer
impl Clone for ComputeBuffer
Source§fn clone(&self) -> ComputeBuffer
fn clone(&self) -> ComputeBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ComputeBuffer
impl RefUnwindSafe for ComputeBuffer
impl Send for ComputeBuffer
impl Sync for ComputeBuffer
impl Unpin for ComputeBuffer
impl UnsafeUnpin for ComputeBuffer
impl UnwindSafe for ComputeBuffer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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