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

Merged
timorjay merged 1 commit from upstream-pr/1204 into main 2026-11-29 08:16:57 +00:00
timorjay commented 2026-11-28 15:31:25 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by timorjay on 2026-11-28T15:31:25Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5541749133 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1204). Originally posted by [timorjay](https://github.com/timorjay) on 2026-11-28T15:31:25Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
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.

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