Skip to content

GPU: cache shader resource metadata with DXIL - #1931

Closed
nicolasveilleux wants to merge 3 commits into
Marvisak:mainfrom
nicolasveilleux:upstream/shader-resource-cache
Closed

nicolasveilleux wants to merge 3 commits into
Marvisak:mainfrom
nicolasveilleux:upstream/shader-resource-cache

Conversation

@nicolasveilleux

Copy link
Copy Markdown

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.

Return the selected native program resource ranges with its DXIL and read both from the versioned cache entry. Avoid parsing and unpacking the original container again in pipeline creation. Cover round-trips, damaged and old entries, and resource extraction on a synthetic ACCC program.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

@StExpeditus

Copy link
Copy Markdown

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

Copy link
Copy Markdown

Offline measurement on a retail dump

Result: no count change against main.

I merged head 3845de8 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).

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
@Marvisak

Copy link
Copy Markdown
Owner

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.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants