GPU: cache the raw SRV byte-bias flag when building the root bindings #1204

Manually merged
github merged 1 commit from github-bot/gh-1204 into main 2026-11-29 08:22:19 +00:00 AGit
Owner

@⁠timorjay on GitHub · 2026-11-28 15:31 UTC · original
timorjay:perf/cache-root-srv-bias-in-binding → main · +57 −17 · 2 files · 1 commits · merged 2026-11-29 08:16 UTC

While recording a draw, State::bind walks the translated shader's user-data words once per bound root SRV to check for USER_VIEW_BIAS. Those words and the title slot are already fixed when the host pipeline is created.

This change records that one bit in the root view binding alongside the title slot and host parameter. Both one-view tables and direct root descriptors use it. The record occupies the same 8 bytes as the previous pair on x64 and handles the full range of title slots without a mask or a fallback scan.

The idea came from Vilocity, which credits ProjectLeonida/mandy and maren-halv/VIctory-DXR. This implementation keeps the flag on each binding in VIctory-NVIDIA. Vilocity commit

Verification

  • The new CPU test covers every byte-sized slot for CBVs, SRVs and UAVs, including duplicate bias words, a different word for the same slot, and empty user data.
  • On Windows x64 I ran cargo test --release --locked -p victory-gpu --lib root_view_bias_is_specific_to_the_srv_and_its_title_slot, cargo check --release --locked --all-features -p victory-gpu, and cargo build --release --locked -p victory.
  • A synthetic Ryzen 7 9800X3D benchmark timed only the four lookups for SRV slots 2, 7, 14 and 255. Two matched, at the midpoint and end of the word list. With 4, 16 and 32 words, the median time for all four scans was 4.02, 12.72 and 23.80 ns respectively. Reading the four precomputed flags took 0.99, 0.97 and 0.97 ns. Inputs went through black_box, and the order alternated across nine rounds. The impact on whole-frame time is unmeasured.

AI-assisted with OpenAI Codex.

**@⁠timorjay** on GitHub · 2026-11-28 15:31 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1204) `timorjay:perf/cache-root-srv-bias-in-binding` → `main` · +57 −17 · 2 files · 1 commits · merged 2026-11-29 08:16 UTC While recording a draw, `State::bind` walks the translated shader's user-data words once per bound root SRV to check for `USER_VIEW_BIAS`. Those words and the title slot are already fixed when the host pipeline is created. This change records that one bit in the root view binding alongside the title slot and host parameter. Both one-view tables and direct root descriptors use it. The record occupies the same 8 bytes as the previous pair on x64 and handles the full range of title slots without a mask or a fallback scan. The idea came from Vilocity, which credits ProjectLeonida/mandy and maren-halv/VIctory-DXR. This implementation keeps the flag on each binding in VIctory-NVIDIA. [Vilocity commit](https://github.com/voidopcode/vilocity/commit/10b81fc5b4ddf7a5d9bbf28153c4205cb8d0f699) ### Verification - The new CPU test covers every byte-sized slot for CBVs, SRVs and UAVs, including duplicate bias words, a different word for the same slot, and empty user data. - On Windows x64 I ran `cargo test --release --locked -p victory-gpu --lib root_view_bias_is_specific_to_the_srv_and_its_title_slot`, `cargo check --release --locked --all-features -p victory-gpu`, and `cargo build --release --locked -p victory`. - A synthetic Ryzen 7 9800X3D benchmark timed only the four lookups for SRV slots 2, 7, 14 and 255. Two matched, at the midpoint and end of the word list. With 4, 16 and 32 words, the median time for all four scans was 4.02, 12.72 and 23.80 ns respectively. Reading the four precomputed flags took 0.99, 0.97 and 0.97 ns. Inputs went through `black_box`, and the order alternated across nine rounds. The impact on whole-frame time is unmeasured. AI-assisted with OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 15:32:55 +00:00
github manually merged commit 8c6cc8b991 into main 2026-11-29 08:22:19 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1204
No description provided.