Add first-class DescriptorSet types - #115
Conversation
|
I don't see a super clear way to update already allocated descriptor sets, is it possible to add API for that? |
|
This was intentionally skipped in the safe API; because the sets cannot be updated while in use by any submission. I thought about encoding this as either The easy path out of that was to offer let write = vk::WriteDescriptorSet::default().dst_set(set.handle())
.dst_binding(binding)
.dst_array_element(0)
.descriptor_type(vk::DescriptorType::STORAGE_BUFFER)
.buffer_info(...);
unsafe {
// SAFETY: This is UB unless we have observed all submissions which used this set to have completed
set.device().update_descriptor_sets(&[write], &[]);
}This pattern could be wrapped up into a type-level update safety through a very tiny custom tracker/wrapper. Due to the nature of having to wait for availability, and it being very annoying to track that concept, it would be easier if possible to separate out the descriptors that change from the static ones and keep those bound in a regular dynamic/automatic descriptor set index. |
Additive change to allow manually-specified descriptor set writes and copies. This should reduce CPU/driver usage during graph submission for most common workloads. Regular automatic descriptor set usage remains unchanged.
See
examples/bindless.rsfor the change, which is quite minimal. This builds set0with a bunch of images bound to descriptor1:The rest, including declaring access, remains unchanged. I think that could be relaxed in practice, but each program can decide that.