Repository navigation
GPU: use native root type codes in the shader cache - #415
enzoduarte1 wants to merge 1 commit into
Conversation
|
Thanks @enzoduarte1 for aligning cached root types with their native codes. I tested head Result: 3 passed, 0 failed (42 filtered out). The tests check native root-type code round trips, cache entry encoding/decoding with damaged-entry rejection, and reuse of cached translations. These are cache-format unit tests; they do not exercise a title’s shader workload. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 6924b09 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).
- Checked against
RootType::from_rawinvictory-shader/src/native.rs. It maps 0/1/3/4/5/6 to the named variants and everything else toOther(n), so the newroot_code/root_typeare exact inverses for every valuefrom_rawcan produce. The old6 + xcould overflow onOther(x). - Old cache entries:
shader_cache.rskeys on the BLAKE3 of our owncurrent_exe(). Any build with this change has a different fingerprint, so entries written with the old numbering are never decoded with the new one.
No issues found.
AI-assisted (Claude Code).
…e shader cache Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Merge candidate. CI: no check runs on the head commit. Generated by Claude Code |
…ndmask-415-111a Shaders: track uniform and constant masks for v_cndmask (Marvisak#415)
|
Automated triage for the maintainers, second look (a review against current Closing because the overflow it guards against cannot occur, and the change has a cost. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution. |
What
shader_cache.rsencodedRootTypewith its own numbering that disagreed with the one the console shader uses (RootType::from_rawinvictory-shader/src/native.rs):2isOther(2)in the native parser, but the cache decoded it asTable;Other(x)was written as6 + x, which overflows in debug builds and wraps into a known code in release builds for anyx >= u32::MAX - 5. The native parser reads that value straight from shader bytes, so it is reachable.The cache now stores the native raw values directly, making encode/decode bijective for every value the parser can produce. The cache key already includes the executable's BLAKE3, so entries written by an older build are not reused. A round-trip test covers all native codes plus
Other(u32::MAX).Tested
x86_64-pc-windows-gnu(no MSVC linker on this machine).cargo test -p victory-gpu --lib shader_cache::: 3 passed.cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.cargo clippy -p victory-gpu --all-targets -- -A clippy::undocumented_unsafe_blocks -D warnings: clean. The allowed lint is the pre-existing warning fixed by PR Chore: clear two workspace Clippy errors #355.rustfmt --edition 2024 --check crates/victory-gpu/src/shader_cache.rsandgit diff --check: clean.cargo xtask policy: 151 files ok. No game files or data taken from them were added.cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's/DELAYLOADflag, which MinGW rejects here; the same failure occurs on unmodifiedmain.cargo fmt --all --checkalso has unrelated pre-existing diffs, so no other files were reformatted.Checklist
cargo fmt,cargo clippy --workspace --all-targetsandcargo test --workspacepass — see the toolchain limitations above; the changed crate is clean.cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).