vulkano
vulkano copied to clipboard
Support for UPDATE_AFTER_BIND descriptors.
I think this would be a cool feature to have. If I understand it correctly it would allow much better reuse of a command buffer where everything is the same except for the descriptor sets in use. Only safety caveat would be that two threads can't update a set at the same time. This has been promoted to core in vulkan 1.2 and is supported by the majority of devices.
Changes required that I can think of:
-
UnsafeDescriptorPool
would need an additional field or a flags struct similar toImageCreateFlags
. -
DescriptorSetLayout
would also need to set this flag. Currently creating this doesn't take any flags. - Would need to ensure that both the pool and the layout agree on the flags.
- Somehow would need to have mutable access to
UnsafeDescriptorSet
if we were to use this feature in thePersistentDescriptorSet
andSingleLayoutDescSet
.- Perhaps this would be stored in a mutex?
There would need to be some locking mechanism to ensure that descriptor sets aren't updated while the GPU is using them. This requires changes to SyncCommandBuffer
. Buffers and images currently have locking, but there's no provision for locking of other types of resources. This is the reason why queries aren't fully safe to use yet, so they should also be considered in any refactoring.
Something else I realised while investigating #1743: Because the descriptors can change after the descriptor set was bound in a command buffer, the only way to validate them would be at submission time. This will require quite a bit more refactoring.