pub struct GpuBuffer {
pub buffer_type: GpuBufferType,
/* private fields */
}Expand description
A CPU-side mock for a typed GPU buffer backed by a Vecu8`.
Fields§
§buffer_type: GpuBufferTypeLogical type.
Implementations§
Source§impl GpuBuffer
impl GpuBuffer
Sourcepub fn new(buffer_type: GpuBufferType, size: usize) -> Self
pub fn new(buffer_type: GpuBufferType, size: usize) -> Self
Allocate a new zero-initialised buffer of size bytes.
Sourcepub fn read(&self, offset: usize, dst: &mut [u8]) -> usize
pub fn read(&self, offset: usize, dst: &mut [u8]) -> usize
Read bytes at offset into dst. Returns the number of bytes copied.
Sourcepub fn write(&mut self, offset: usize, src: &[u8]) -> usize
pub fn write(&mut self, offset: usize, src: &[u8]) -> usize
Write bytes from src at offset. Returns bytes written.
Sourcepub fn resize(&mut self, new_size: usize)
pub fn resize(&mut self, new_size: usize)
Resize the buffer (data is zero-initialised for new regions).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuBuffer
impl RefUnwindSafe for GpuBuffer
impl Send for GpuBuffer
impl Sync for GpuBuffer
impl Unpin for GpuBuffer
impl UnsafeUnpin for GpuBuffer
impl UnwindSafe for GpuBuffer
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