-
Notifications
You must be signed in to change notification settings - Fork 69
Ability to allocate transient buffers/textures + hint to lazy allocate #219
Description
Popped up during discussion in #213
The current Memory enum and TextureUsage still doesn't quite allow expressing what in vulkan becomes a lazilly allocated texture with transient flags set as is ideal for MSAA as outlined in https://docs.vulkan.org/samples/latest/samples/performance/msaa/README.html
I still have not measured what the drivers do when given user-code that uses textures allocated in the current way, but the link seems to suggest there is measurable bandwidth differences if one can correctly specify these options.
Vulkan
The gpu_allocator that is used by blade's vulkan backend has a UsageFlags::TRANSIENT and some special code paths to make those allocations more optimal. It also has MemoryPropertyFlags::LAZILY_ALLOCATED
I think the lazilly_allocated bit is marked as a valid one if supported (
blade/blade-graphics/src/vulkan/init.rs
Line 621 in 5309b49
| let known_memory_flags = vk::MemoryPropertyFlags::DEVICE_LOCAL |
blade_graphics::Memory profile would be needed | let alloc_usage = match memory { |
The final piece would then be to also be able to specify the requirement of being lazilly-allocated for image creation at
blade/blade-graphics/src/vulkan/resource.rs
Line 276 in 5309b49
| let requirements = unsafe { self.device.core.get_image_memory_requirements(raw) }; |
Metal
At least the Metal docs on multisampling seem to indicate nothing this granular is required to be specified by the user https://developer.apple.com/documentation/metal/mtlrenderpassattachmentdescriptor#1968767
The concept of transient attachments seems not explicit in Metal
Opengl Es
Even possible to specify this?