Work in progress to add VMA support using vk_mem_rs.
Some noteworthy things:
added a "vma" feature
defined a Memory type which maps to vk::DeviceMemory by default and to vk_mem::Allocation when enabling the "vma" feature (this is a trick),
added an Allocator struct that abstracts out how to work with buffers, images and memory.
Some issues:
user provided allocator is not yet implemented
had to add allocator argument to many functions (position where it is added is not consistent)
test code is impacted in a bad way (some imgui-rs-wulkan internal functions are exposed to and used by tests...)
Biggest problems in my opinion are:
1/ The Allocator abstraction needs to clone the device.
This cloning is artificial and could be avoided in the non VMA case.
But for the VMA case it is mandatory as the vk_mem_rs mandates it (see AllocatorCreateInfo).
It should be possible to get rid of this cloning for the non VMA case.
For the VMA case, it is possible to get rid of it too by making it mandatory for the user to provide the allocator (make it a user problem...).
But this would mean no support for "internal" only use of VMA.
2/ Many function now take deviceandallocator arguments which is messy.
3/ Test code that uses internal functions.
See custom_textures.rs.
Work in progress to add VMA support using vk_mem_rs.
Some noteworthy things:
Memory
type which maps tovk::DeviceMemory
by default and tovk_mem::Allocation
when enabling the "vma" feature (this is a trick),Allocator
struct that abstracts out how to work with buffers, images and memory.Some issues:
allocator
argument to many functions (position where it is added is not consistent)Biggest problems in my opinion are:
1/ The
Allocator
abstraction needs to clone the device. This cloning is artificial and could be avoided in the non VMA case. But for the VMA case it is mandatory as the vk_mem_rs mandates it (seeAllocatorCreateInfo
).It should be possible to get rid of this cloning for the non VMA case. For the VMA case, it is possible to get rid of it too by making it mandatory for the user to provide the allocator (make it a user problem...). But this would mean no support for "internal" only use of VMA.
2/ Many function now take
device
andallocator
arguments which is messy.3/ Test code that uses internal functions. See custom_textures.rs.