pub struct RawBuffer { /* private fields */ }
Expand description
A raw buffer, with no memory backing it.
This is the basic buffer type, a direct translation of a VkBuffer
object, but it is mostly
useless in this form. After creating a raw buffer, you must call bind_memory
to make a
complete buffer object.
Implementations
sourceimpl RawBuffer
impl RawBuffer
sourcepub fn new(
device: Arc<Device>,
create_info: BufferCreateInfo
) -> Result<Self, BufferError>
pub fn new(
device: Arc<Device>,
create_info: BufferCreateInfo
) -> Result<Self, BufferError>
Creates a new RawBuffer
.
Panics
- Panics if
create_info.sharing
isConcurrent
with less than 2 items. - Panics if
create_info.size
is zero. - Panics if
create_info.usage
is empty.
sourcepub unsafe fn from_handle(
device: Arc<Device>,
handle: Buffer,
create_info: BufferCreateInfo
) -> Self
pub unsafe fn from_handle(
device: Arc<Device>,
handle: Buffer,
create_info: BufferCreateInfo
) -> Self
Creates a new RawBuffer
from a raw object handle.
Safety
handle
must be a valid Vulkan object handle created fromdevice
.handle
must refer to a buffer that has not yet had memory bound to it.create_info
must match the info used to create the object.
sourcepub fn bind_memory(
self,
allocation: MemoryAlloc
) -> Result<Buffer, (BufferError, RawBuffer, MemoryAlloc)>
pub fn bind_memory(
self,
allocation: MemoryAlloc
) -> Result<Buffer, (BufferError, RawBuffer, MemoryAlloc)>
Binds device memory to this buffer.
sourcepub fn memory_requirements(&self) -> &MemoryRequirements
pub fn memory_requirements(&self) -> &MemoryRequirements
Returns the memory requirements for this buffer.
sourcepub fn flags(&self) -> BufferCreateFlags
pub fn flags(&self) -> BufferCreateFlags
Returns the flags the buffer was created with.
sourcepub fn size(&self) -> DeviceSize
pub fn size(&self) -> DeviceSize
Returns the size of the buffer in bytes.
sourcepub fn usage(&self) -> &BufferUsage
pub fn usage(&self) -> &BufferUsage
Returns the usage the buffer was created with.
sourcepub fn sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>
pub fn sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>
Returns the sharing the buffer was created with.
sourcepub fn external_memory_handle_types(&self) -> ExternalMemoryHandleTypes
pub fn external_memory_handle_types(&self) -> ExternalMemoryHandleTypes
Returns the external memory handle types that are supported with this buffer.
Trait Implementations
sourceimpl DeviceOwned for RawBuffer
impl DeviceOwned for RawBuffer
sourceimpl VulkanObject for RawBuffer
impl VulkanObject for RawBuffer
impl Eq for RawBuffer
Auto Trait Implementations
impl !RefUnwindSafe for RawBuffer
impl Send for RawBuffer
impl Sync for RawBuffer
impl Unpin for RawBuffer
impl !UnwindSafe for RawBuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more