Skip to content

[Frame Looping] Manage fences that are signaled/waited-on during the looping frame#2936

Open
nickdriscoll-lunarg wants to merge 2 commits into
LunarG:devfrom
nickdriscoll-lunarg:nick-frame-loop-fix-fence-real
Open

[Frame Looping] Manage fences that are signaled/waited-on during the looping frame#2936
nickdriscoll-lunarg wants to merge 2 commits into
LunarG:devfrom
nickdriscoll-lunarg:nick-frame-loop-fix-fence-real

Conversation

@nickdriscoll-lunarg
Copy link
Copy Markdown
Contributor

This PR is based on top of #2935 so it will need to be merged first.

In the case of naive looping, it is easy to see how a fence can be double-signaled or double-waited-on, so we need to handle those situations.

Regarding a fence that is used during the looping frame, there are three cases:

  1. The fence is signaled as many times as it is waited upon
  2. The fence is signaled more times than it is waited upon
  3. The fence is signaled fewer times than it is waited upon

In the first case, no special handling is needed, as the final fence operation will put the fence in the state that the first fence operation expects.

In the second case, we need to synthetically wait-on the fence so that it's in the unsignaled state at the start of the next iteration of the looping frame.

In the third case, we need to synthetically signal the fence so that it's in the signaled state at the start of the next iteration of the looping frame.

@nickdriscoll-lunarg nickdriscoll-lunarg requested a review from a team as a code owner May 7, 2026 14:36
@nickdriscoll-lunarg nickdriscoll-lunarg added the approved-to-run-ci Can run CI check on internal LunarG machines label May 7, 2026
@nickdriscoll-lunarg nickdriscoll-lunarg force-pushed the nick-frame-loop-fix-fence-real branch from fe91c37 to dff761a Compare May 7, 2026 18:14
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp
Copy link
Copy Markdown
Contributor

@antonio-lunarg antonio-lunarg left a comment

Choose a reason for hiding this comment

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

Mmh.. what if the collected fences belong to different devices?
Maybe it is not that common as a case, but the replay consumer is grouping various things per-device to avoid this kind of issue.

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
Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
@nickdriscoll-lunarg nickdriscoll-lunarg force-pushed the nick-frame-loop-fix-fence-real branch from dff761a to aa871ef Compare May 11, 2026 13:30
@nickdriscoll-lunarg
Copy link
Copy Markdown
Contributor Author

Good catch that my code assumes a single VkDevice. I should be able to extend it to handle multiple devices without too much suffering.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 11, 2026

CLA assistant check
All committers have signed the CLA.

Comment thread framework/decode/vulkan_replay_frame_loop_consumer.cpp Outdated
@nickdriscoll-lunarg nickdriscoll-lunarg force-pushed the nick-frame-loop-fix-fence-real branch from d58effd to f26b299 Compare May 12, 2026 15:29
Copy link
Copy Markdown
Contributor

@antonio-lunarg antonio-lunarg left a comment

Choose a reason for hiding this comment

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

Make sure to squash all commits together. Anyway, LGTM.

@nickdriscoll-lunarg nickdriscoll-lunarg force-pushed the nick-frame-loop-fix-fence-real branch 7 times, most recently from ed4e0b8 to 6ab2f4a Compare May 14, 2026 20:14
@nickdriscoll-lunarg nickdriscoll-lunarg force-pushed the nick-frame-loop-fix-fence-real branch from 6ab2f4a to 0920d5c Compare May 15, 2026 13:52
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