Skip to content

[Frame Looping] Rework solution for looped descriptor set allocations#2935

Merged
nickdriscoll-lunarg merged 16 commits into
LunarG:devfrom
nickdriscoll-lunarg:nick-fix-descriptor-pool-looping
Jun 10, 2026
Merged

[Frame Looping] Rework solution for looped descriptor set allocations#2935
nickdriscoll-lunarg merged 16 commits into
LunarG:devfrom
nickdriscoll-lunarg:nick-fix-descriptor-pool-looping

Conversation

@nickdriscoll-lunarg

@nickdriscoll-lunarg nickdriscoll-lunarg commented May 7, 2026

Copy link
Copy Markdown
Contributor

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.

@nickdriscoll-lunarg
nickdriscoll-lunarg force-pushed the nick-fix-descriptor-pool-looping branch 6 times, most recently from 335c57a to c2ce2ec Compare May 15, 2026 13:51
@nickdriscoll-lunarg
nickdriscoll-lunarg force-pushed the nick-fix-descriptor-pool-looping branch 3 times, most recently from 9e33c23 to 2fc798c Compare May 27, 2026 13:19
@antonio-lunarg

Copy link
Copy Markdown
Contributor

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.

@antonio-lunarg

Copy link
Copy Markdown
Contributor

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.

@nickdriscoll-lunarg

nickdriscoll-lunarg commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

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

  • Created before loop range but destroyed in the loop range
    • Omit destruction enitrely
  • Created before loop range but destroyed after loop range
    • No special handling
  • Created during loop range, destroyed after
    • Only create on first iteration
  • Created during loop range, destroyed during
    • No special handling

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
- Created during the loop range but destroyed after it
or
- Created before the loop range but destroyed during it

Please let me know what you think @antonio-lunarg

@nickdriscoll-lunarg
nickdriscoll-lunarg force-pushed the nick-fix-descriptor-pool-looping branch from ea948da to 2b088c4 Compare May 28, 2026 15:35

@antonio-lunarg antonio-lunarg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great approach, I wonder if we would be able to unit test this logic in some way.

Comment thread framework/decode/vulkan_replay_frame_loop_consumer.h Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated

@antonio-lunarg antonio-lunarg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's starting to look good!

Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
@nickdriscoll-lunarg
nickdriscoll-lunarg force-pushed the nick-fix-descriptor-pool-looping branch 2 times, most recently from e0c16fb to b766c64 Compare June 4, 2026 20:17

@antonio-lunarg antonio-lunarg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once last comments are addressed, this is good to go IMO. 👍

Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
@nickdriscoll-lunarg
nickdriscoll-lunarg force-pushed the nick-fix-descriptor-pool-looping branch 4 times, most recently from 570deba to fb93998 Compare June 9, 2026 16:59
@nickdriscoll-lunarg
nickdriscoll-lunarg force-pushed the nick-fix-descriptor-pool-looping branch from fb93998 to 5401dd0 Compare June 10, 2026 12:58
@nickdriscoll-lunarg
nickdriscoll-lunarg added this pull request to the merge queue Jun 10, 2026
Merged via the queue into LunarG:dev with commit eed5f4a Jun 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-to-run-ci Can run CI check on internal LunarG machines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants