[−][src]Struct nobs_vkmem::Buffer
Builder pattern for creating buffer resources
A new builder will be initialized with the default configuration.
After the buffer has been configured, it can be created and bound to an allocator with bind.
One can create multiple buffers/images in bulk by calling next_buffer or next_image. This has the benefit, that then they are more likely to share a commen momory block.
see Allocator for more details on creating and binding buffers.
Methods
impl<'a> Buffer<'a>
[src]
pub fn new(handle: &'a mut u64) -> Self
[src]
Creates a new builder.
By default the builder will be initialized with
- memory properties:
vk::MEMORY_PROPERTY_DEVICE_LOCAL_BIT
- size: 0
- usage: 0
- sharingMode:
vk::SHARING_MODE_EXCLUSIVE
(no queue indices)
After bind is called, the created buffer will be copied into the specified handle
pub fn size(self, size: DeviceSize) -> Self
[src]
Sets the buffer size in bytes
pub fn usage(self, usage: BufferUsageFlags) -> Self
[src]
Sets the buffer usage
pub fn sharing(self, sharing: SharingMode) -> Self
[src]
Sets the buffer sharing mode
pub fn queues(self, queue_family_indices: &[u32]) -> Self
[src]
Sets the buffers queue indices for sharing
This will be ignored if the sharing mode is vk::SHARING_MODE_EXCLUSIVE
pub fn mem_properties(self, properties: MemoryPropertyFlags) -> Self
[src]
Sets the memory properties of the buffer
pub fn devicelocal(self, local: bool) -> Self
[src]
Setst the memory properties of the buffer
Sets the properties to vk::MEMORY_PROPERTY_DEVICE_LOCAL_BIT
if local
is true.
Other wise sets properties to vk::MEMORY_PROPERTY_HOST_VISIBLE_BIT | vk::MEMORY_PROPERTY_HOST_COHERENT_BIT
.
pub fn submit(self) -> Resource<'a>
[src]
Finishes configuration of this buffer
Returns
A Resource so that we can continue configuring new buffers/images.
pub fn new_buffer(self, handle: &'a mut u64) -> Self
[src]
Short hand for submit()
.new_buffer(handle)
pub fn new_image(self, handle: &'a mut u64) -> Image
[src]
Short hand for submit()
.new_image(handle)
pub fn bind(
self,
allocator: &mut Allocator,
bindtype: BindType
) -> Result<(), Error>
[src]
self,
allocator: &mut Allocator,
bindtype: BindType
) -> Result<(), Error>
Short hand for submit()
.bind(handle)
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,