pub struct Buffer {
pub handle: u32,
}Expand description
A GPU buffer (VBO or EBO).
Created by GfxContext::create_buffer. Must be deleted with
GfxContext::delete_buffer when done.
Fields§
§handle: u32Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn upload_bytes(&self, ctx: &GfxContext, data: &[u8], dynamic: bool)
pub fn upload_bytes(&self, ctx: &GfxContext, data: &[u8], dynamic: bool)
Upload bytes to this buffer.
dynamic: hint that the buffer will be updated frequently.
Sourcepub unsafe fn upload<T>(&self, ctx: &GfxContext, data: &[T], dynamic: bool)
pub unsafe fn upload<T>(&self, ctx: &GfxContext, data: &[T], dynamic: bool)
Upload typed data to this buffer. T must be a plain-old-data type
(the bytes are used as-is, in the layout T has in memory).
§Safety
The byte representation of T must be well-defined (no padding traps,
no floats encoding NaN, etc.). Use #[repr(C)] structs or primitive types.
Sourcepub fn subdata_bytes(&self, ctx: &GfxContext, offset: u32, data: &[u8])
pub fn subdata_bytes(&self, ctx: &GfxContext, offset: u32, data: &[u8])
Overwrite a sub-range of this buffer starting at offset bytes.
Trait Implementations§
impl Copy for Buffer
impl Eq for Buffer
impl StructuralPartialEq for Buffer
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnsafeUnpin for Buffer
impl UnwindSafe for Buffer
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