Traverse-Research / gpu-allocator

🦀 GPU memory allocator for Vulkan, DirectX 12 and Metal. Written in pure Rust
https://traverse.nl/
Apache License 2.0
373 stars 49 forks source link

Add memory properties and make it accessible for Vulkan allocation #134

Closed SiebenCorgie closed 1 year ago

SiebenCorgie commented 1 year ago

This pull request exposes the vk::MemoryPropertyFlags of an Allocation via the memory_properties function.

The reason for the request is, that I was not able to obtain the flags on the current release. If it is possible and i just did not find it, please close the request.

I need the flags when checking what the properties of an allocation using the MemoryLocation::CpuToGpu requirement are. Specifically, it is interesting if it contains the DEVICE_LOCAL bit or not. Depending on this code the outcome can be different.

If there is anything you'd like me to add, please let me know!

SiebenCorgie commented 1 year ago

Yeah, I came across this while trying to use/implement resizable BAR. Checking for all those flags is needed to identify if you need to flush and whether the memory is DeviceLocal.

SiebenCorgie commented 1 year ago

Is anything missing for it to be merged? I force-pushed a small update for the PR to not conflict with main.