Repository navigation
vk: descriptor slotgen and sampler cache - #1330
Merged
Merged
Conversation
bibigurl-yum
force-pushed
the
pr/vk-descriptor-slotgen
branch
from
November 9, 2026 22:08
6460cd5 to
452e4f3
Compare
bronze-ff
added a commit
to bronze-ff/Hookshot
that referenced
this pull request
Nov 9, 2026
Leave option 10 free for the Frame rate row in NotRexed#1330. Assisted-by: OpenAI Codex Co-authored-by: Codex <codex@openai.com>
…s while the slots it samples are unchanged, and sampler ids answer their parameters without the registrations' lock
bibigurl-yum
force-pushed
the
pr/vk-descriptor-slotgen
branch
from
November 9, 2026 23:24
c7acdca to
9861144
Compare
Contributor
Author
|
Split as requested: this PR is now only the slotgen + sampler cache (rebased on current main, merged with the #792 fallback fix in Your points, in this branch:
|
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.
What
Replay-thread optimizations for descriptor and sampler resolution, default off and switchable by menu row and environment variable (one shared code path).
1. Descriptor slotgen (
RX_VK_DESC_SLOTGEN=1, menu: Graphics → Descriptor reuse)Descriptor reuse currently keys on the global registrations' generation, so any texture registration anywhere (the game streams constantly) rebuilds every draw's descriptors. A draw now keeps its descriptors while the texture slots it actually samples are unchanged: the build records
(slot, version)for every handle it resolved and the same draw revalidates by slot version instead of the global generation. Draws that sampled an unregistered slot keep the old global-generation check (a registration is the only thing that could make such a handle resolve). An eviction sweep (destroy_later) retires views behind the slots' backs without bumping any slot or sampler version, so the keep-check revalidatestexture_destroy_generation()as well — this also covers thetexture_view_ofstaleness question.2. Sampler cache (
RX_VK_SAMPLER_CACHE, menu: Graphics → Sampler cache)Each texture of each draw resolved its sampler through
reg_mu+ a copy of the registration + hash + map lookup (~48k times per frame at 3000 draws). Sampler ids now answer from a per-thread table keyed on the id's slot version (thesamp_versionstable in vk_bank, like the texture slots'slot_versions): resolving an id that was not registered anew takes no lock. One switch, documented at the declaration:RX_VK_SAMPLER_CACHE=0turns off both the outer id table and the inner parameters' cache;=1or the menu row turns the inner cache on (the outer table stays on, exactly as it is without the option — so the menu row never silently changes the old default-on path).Measurements (RTX 4090, 5120x1440, TOTK)
Same binary, environment variables off = the old path (A/B identity):
(median "a frame's replay time" over 240 s scripted gameplay runs, ~3200 draws/frame; the replay thread is the fps ceiling — at 1000/4.64 ms it moves from ~84 to ~215 fps of headroom. Item-2-alone numbers follow in a comment.)
Response to the review
texture_destroy_generation()now participates in the slotgen keep-check, so adestroy_latersweep invalidates the kept descriptors on its own.seenmap insampler_make: dropped the unreachablesize() > 4096clear (ids are < 4096, the map cannot outgrow them).draw().