Repository navigation
Skip the pass-hazard scan of every sampled texture. - #416
Merged
Merged
Conversation
added 2 commits
November 7, 2026 19:20
A read-only bind is remembered until its pool changes. Uniform words that sit outside an inline update keep the gap around them, and the word memo stays. A pass keeps a mask of the targets earlier draws sampled.
The read-only bind memo and the uniform gap are on main now. This keeps the pass-hazard mask.
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
draw_hazardswalks every texture the open pass has sampled, on every draw, to see whether this draw writes one of them. A dense Kokiri frame is about 1627 draws and the submit is about 12.7 ms (issue #384). The list grows through the pass, so the check is draws times textures sampled so far.The read-only bind memo and the uniform gap landed in #392 and #397 while this was being prepared. Those stay as they are.
Change
A pass keeps
sampled_targets(colour i is bit i, depth is bit 8). The bit is set when a sampled texture is first recorded, after the hazard check, so only earlier draws count. The second scan is that mask. A new pass clears it with the sampled list. The list itself stays, for the pass trace.A draw that samples a target it also writes is still left as it is. A draw that samples a target an earlier draw wrote still takes the first loop, over this draw's own samples.
Why this is safe
The bit uses the same slot as the old loop: colour target i, or depth as bit 8. It is recorded after
draw_hazards, which is when the old loop would have seen the texture on the next draw. Starting a pass clears the mask inbegin_passtogether withpass.sampled.Testing
All passed on current main plus this change. With
vk_draw.cpprestored and the new test kept,test_pass_hazard.pyfails because the scan ofpass.sampledis still there.No renderer rebuild, and no Kokiri fps measurement, for this change.
Scope
Left out: the AMD
vkQueueSubmitstalls (#312), the movie upscale threshold (#336), and skipping a repeatedvkCmdBindIndexBuffer. The exposure flicker (#371) is already on main.Happy to rename the mask if another name fits the file better.