GPUOpen-Archive / Anvil

Anvil is a cross-platform framework for Vulkan
MIT License
594 stars 62 forks source link

Suggestion/Request: Access to vmaCalculateStats #99

Open Silverlan opened 6 years ago

Silverlan commented 6 years ago

As far as I can tell, Anvil uses the VMA library, which includes the function vmaCalculateStats, which is handy for determining how much memory is currently in use (approximately) for each memory type. It would be useful to get access to that function (or something similar) through Anvil, for benchmarking and debugging purposes.

DominikWitczakAMD commented 6 years ago

There's a couple of problems if we were to re-use their implementation:

1) There's another memory allocator backend supported by Anvil, called "one-shot". It doesn't provide similar functionality 2) Memory allocators can be released at any time. This means any info gathered by VMA allocator 1 is going to be lost the moment it is destroyed. 3) What if you had two VMA allocators? vmaCalculateStats() takes VmaAllocator instance. This means we'd need Anvil's memory allocator to sum info returned by the function before passing it down to the app. 4) VMA does not support mGPU (ie. the device group extensions), while public Anvil is just about to :)

That being said, if you feel like this is something that could come in handy, I believe it shouldn't be a lot of effort to provide memory usage information per each created Vulkan instance. Would that work?

Silverlan commented 6 years ago

Absolutely, all I really need is a way to retrieve the total amount of memory my program has allocated on the GPU. Thank you!

DominikWitczakAMD commented 5 years ago

Does EXT_memory_budget support, which is already implemented in Anvil, address this request? At this point, adding manual tracking of the allocated device-local memory feels like duplicating the functionality provided by the extension.