[][src]Crate nobs_vkmem

Vulkan memory management as extension to nobs-vk.

Buffer and image creation in vulkan is tricky in comparison to e.g. OpenGL, because

  1. We have to create the buffer/image and then later bind it to a vkDeviceMemory that has to be created separately.
  2. Creating a single vkDeviceMemory allocation for every buffer/image is bad practice, in fact it is encouraged to bind esources that are used together on the same allocation.
  3. Another layer of difficulty is introduced with memory types, since not all resources (should) share the same memory properties - which is different for each Driver/Vendor

nobs-vkmem provides convenient and accessible methods for creating buffers and images and binding them to physical memory. This dramatically reduces boiler plate code, while still offers the user considerable control over how resources are bound to memory.

  1. Easy buffer and image creation with builder patterns.
  2. Device memory is allocated in larger pages. The library keeps track of free and used regions in a page.
  3. Offers different allocation strategies for different purposes, including forcing the binding of several resources to a continuous block, or binding resources on private pages.
  4. Easy mapping of host accessible buffers

Interfacing with this library is mainly handled in Allocator, with which buffers and images are bound to device memory.

Buffer and Image provide a convenient way to configure buffers/images and bind them to the allocator in bulk.

See Allocator to get a quick overview on how to use this library.



Allocator for buffer and image resources


Defines meta information for the Allocator


Bundles all information for the Allocator to perform a resource memory binding.


Builder pattern for creating buffer resources


Builder pattern for creating image resources


A mapped memory region


Generic builder for buffers and images



Strategy how resources are bound in the Allocator


Errors that can be occure when using this crate


Enum defining resource types that can be bound