pub struct Buffer {
raw: Buffer,
ownership: BufferOwnership,
}Available on
vulkan only.Fields§
§raw: Buffer§ownership: BufferOwnershipImplementations§
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 Send for Buffer
impl Sync for Buffer
impl Unpin 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
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