GPU: cache shader resource metadata with DXIL #1929

Closed
nicolasveilleux wants to merge 3 commits from upstream-pr/1931 into main
nicolasveilleux commented 2026-11-25 01:09:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nicolasveilleux on 2026-11-25T01:09:00Z.


Store the native program’s resource ranges alongside its translated DXIL so pipeline creation no longer parses the original container on cache hits. The tests cover round-trips, invalid entries and resource metadata on a synthetic shader.

Validation: all 3 shader-cache tests passed on Windows 11. The RTX 2070 Super integration branch also passed 478 workspace tests (0 failed, 7 ignored). No game files or gameplay measurements. Claimed in #1633.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6594778414 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1931). Originally posted by [nicolasveilleux](https://github.com/nicolasveilleux) on 2026-11-25T01:09:00Z. --- Store the native program’s resource ranges alongside its translated DXIL so pipeline creation no longer parses the original container on cache hits. The tests cover round-trips, invalid entries and resource metadata on a synthetic shader. Validation: all 3 shader-cache tests passed on Windows 11. The RTX 2070 Super integration branch also passed 478 workspace tests (0 failed, 7 ignored). No game files or gameplay measurements. Claimed in #1633.
Marvisak commented 2026-11-25 03:03:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:18:34Z.


Automated triage for the maintainers.

Merge candidate. On a cache hit, pipeline creation no longer re-parses the console container for its resource ranges. translate_with_resources returns native.used from the same program translate_with picks (the first Vs/Ps/Cs/Ms in the DXIL or ACCC part), which is what pipeline.rs::with_resources used to find. The cache entry format moves to VSH2, and the key already hashes shader_cache.rs, so old entries become misses. decode rejects bad kinds, root codes, reserved bytes and counts, and the new tests cover the round trip, damaged entries and the resource metadata of a synthetic shader. A minor point: the doc comment on translate_with and the pointer to crate::shadow::copy_back_marks were reworded or dropped without need; restoring them would be nice. This PR edits host_shader's options next to #1563, so whichever merges second needs a small rebase. CI (check) passes.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150560778 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1931#issuecomment-7150560778). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:18:34Z. --- <!-- victory-triage v1 head=3845de8e6afa2f1fe49faa673884dfb8f7d625d5 verdict=merge-candidate at=2026-11-25T03:24:10Z --> Automated triage for the maintainers. **Merge candidate.** On a cache hit, pipeline creation no longer re-parses the console container for its resource ranges. `translate_with_resources` returns `native.used` from the same program `translate_with` picks (the first Vs/Ps/Cs/Ms in the DXIL or ACCC part), which is what `pipeline.rs::with_resources` used to find. The cache entry format moves to `VSH2`, and the key already hashes `shader_cache.rs`, so old entries become misses. `decode` rejects bad kinds, root codes, reserved bytes and counts, and the new tests cover the round trip, damaged entries and the resource metadata of a synthetic shader. A minor point: the doc comment on `translate_with` and the pointer to `crate::shadow::copy_back_marks` were reworded or dropped without need; restoring them would be nice. This PR edits `host_shader`'s options next to #1563, so whichever merges second needs a small rebase. CI (`check`) passes. --- _Generated by [Claude Code](https://claude.ai/code)_
StExpeditus commented 2026-11-25 05:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T04:23:55Z.


Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at 3845de8. cargo test --workspace --locked --no-fail-fast -> all green: 0 passed, 0 ignored, 0 failed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152805905 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1931#issuecomment-7152805905). Originally posted by [StExpeditus](https://github.com/StExpeditus) on 2026-11-25T04:23:55Z. --- **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `3845de8`. `cargo test --workspace --locked --no-fail-fast` -> **all green**: 0 passed, 0 ignored, 0 failed.
StExpeditus commented 2026-11-25 10:07:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:10:32Z.


Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at 3845de8. cargo test --workspace --locked --no-fail-fast -> 696 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157975078 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1931#issuecomment-7157975078). Originally posted by [StExpeditus](https://github.com/StExpeditus) on 2026-11-25T09:10:32Z. --- **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `3845de8`. `cargo test --workspace --locked --no-fail-fast` -> 696 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.
sinan-cmyk commented 2026-11-25 12:03:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T11:24:15Z.


Offline measurement on a retail dump

Result: no count change against main.

I merged head 3845de8e onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161000765 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1931#issuecomment-7161000765). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T11:24:15Z. --- ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 3845de8e onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 22:04:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:04:24Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because it buys nothing measurable and has a cost. In a title run the 2,787 shader-cache hits took 0 ms in 2,543 cases and 1 ms in 229, once per shader per process, on the pipeline workers; the PR offers no measurement. Against that it changes the cache format and the shader crate's public API, both of which invalidate every user's shader cache and pre-built pipeline list, and it collides with #2055.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175899942 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1931#issuecomment-7175899942). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:04:24Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because it buys nothing measurable and has a cost. In a title run the 2,787 shader-cache hits took 0 ms in 2,543 cases and 1 ms in 229, once per shader per process, on the pipeline workers; the PR offers no measurement. Against that it changes the cache format and the shader crate's public API, both of which invalidate every user's shader cache and pre-built pipeline list, and it collides with #2055. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
upstream-sync closed this pull request 2026-11-25 23:03:25 +00:00

Pull request closed

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
Marvisak/VIctory!1929
No description provided.