[Frame Looping] Rework solution for looped descriptor set allocations#2935
Conversation
f4afc83 to
b534ecd
Compare
335c57a to
c2ce2ec
Compare
9e33c23 to
2fc798c
Compare
|
I wonder.. what if descriptors are originally created and freed within the same frame? I think we should have some way of tracking whether descriptors are still alive before skipping creation after the first iteration. |
|
Same reasoning for "destroy" calls. If a frame uses a resource (that has been created in previous frames), we might want to skip any destroy call otherwise the next iteration of the loop would attempt to use a resource that has been destroyed. |
|
So I think I have a new implementation that covers what you brought up: Here are the possible cases for descriptor pool/set creation/destruction
The solution here is to track all "dangling" pools/sets, then ignore their destruction entirely, and only create them on the first iteration of the loop range. A "dangling" resource is one that was either Please let me know what you think @antonio-lunarg |
ea948da to
2b088c4
Compare
antonio-lunarg
left a comment
There was a problem hiding this comment.
That's a great approach, I wonder if we would be able to unit test this logic in some way.
a20fb0b to
3cf4807
Compare
4775620 to
2b49dd9
Compare
antonio-lunarg
left a comment
There was a problem hiding this comment.
It's starting to look good!
e0c16fb to
b766c64
Compare
antonio-lunarg
left a comment
There was a problem hiding this comment.
Once last comments are addressed, this is good to go IMO. 👍
570deba to
fb93998
Compare
…found to be dangling
…umer::Process_vkFreeDescriptorSets()
fb93998 to
5401dd0
Compare
In my original solution, the code tracks which pools have been allocated from during the looping frame, and resets them after
vkQueuePresent(). This solution has a flaw.Example: Descriptor Pool 1 is used to allocate set A before the looping frame, then it allocates set B during the looping frame. Pool 1 will have been marked for reset because of set B's allocation, but when it is reset, set A goes along with it. If set A is used during the looping frame, this is invalid usage.
I realized that I was overthinking this, and we can simply skip allocating descriptor sets during repetitions of the looping frame in order to solve this issue in a simpler way, and without the flaw described above.
That's also to say,
Process_vkAllocateDescriptorSets()can eventually just be generated like the rest of the resource allocating functions.