pub struct Buffer { /* private fields */ }Available on
vulkan only.Implementations§
Source§impl Buffer
impl Buffer
Sourcepub unsafe fn from_raw(vk_buffer: Buffer) -> Self
pub unsafe fn from_raw(vk_buffer: Buffer) -> Self
§Safety
vk_buffer’s memory must be managed by the caller- Externally imported buffers can’t be mapped by
wgpu
Sourcepub unsafe fn from_raw_externally_owned(
vk_buffer: Buffer,
drop_callback: DropCallback,
) -> Self
pub unsafe fn from_raw_externally_owned( vk_buffer: Buffer, drop_callback: DropCallback, ) -> Self
§Safety
vk_buffermust outlive the returnedBuffer.- wgpu-hal will NOT call
vkDestroyBuffer; the caller remains responsible for the buffer handle’s destruction. Thedrop_callbackruns when theBufferdrops and may be used to release caller-side bookkeeping. - Externally imported buffers can’t be mapped by
wgpu.
Sourcepub unsafe fn from_raw_managed(
vk_buffer: Buffer,
memory: DeviceMemory,
offset: u64,
size: u64,
) -> Self
pub unsafe fn from_raw_managed( vk_buffer: Buffer, memory: DeviceMemory, offset: u64, size: u64, ) -> Self
§Safety
- We will use this buffer and the buffer’s backing memory range as if we have exclusive ownership over it, until the wgpu resource is dropped and the wgpu-hal object is cleaned up
- Externally imported buffers can’t be mapped by
wgpu offsetandsizemust be valid with the allocation ofmemory
Sourcepub unsafe fn raw_handle(&self) -> Buffer
pub unsafe fn raw_handle(&self) -> Buffer
§Safety
- The buffer handle must not be manually destroyed
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Buffer
impl !RefUnwindSafe for Buffer
impl !UnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnsafeUnpin 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