Shaders: lower buffer cache invalidations as no-ops #368

Manually merged
github merged 1 commit from gh-pr/368/head into gh-pr/368/base 2026-11-26 04:01:11 +00:00
Owner

@⁠Quat3rnion on GitHub · 2026-11-24 02:40 UTC · original
Quat3rnion:victory-shader-coverage → main · +27 −1 · 2 files · 1 commits · merged 2026-11-25 00:19 UTC

What

buffer_gl0_inv and buffer_gl1_inv were the only buffer cache
instructions the translator refused: resource::track demanded a resource
descriptor even though the instructions carry no data operand, and lowering
had no arm for their names. The host has no console buffer cache to drop,
so this skips descriptor tracking for _inv buffer instructions and lowers
the pair as no-ops — the same treatment the scalar s_gl1_inv and
s_dcache_inv already get. A synthetic full-pipeline test covers both
opcodes.

This was one of the refusals listed in PR #163's audit. That PR only prints
a notice when a listed opcode begins to lower, so the two lines become
stale rather than failing.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace with PR #112's Linux build fix applied locally (not part of this PR): 165 passed, 0 failed, 3 ignored. One new test runs both opcodes through decoding, resource tracking, structure and lowering.
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.
  • Not tested: a real title. Shader binaries live in a 393 MB shaders.rpf with no reader in the repo, so the test uses synthetic instruction words.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
**@⁠Quat3rnion** on GitHub · 2026-11-24 02:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/368) `Quat3rnion:victory-shader-coverage` → `main` · +27 −1 · 2 files · 1 commits · merged 2026-11-25 00:19 UTC ## What `buffer_gl0_inv` and `buffer_gl1_inv` were the only buffer cache instructions the translator refused: `resource::track` demanded a resource descriptor even though the instructions carry no data operand, and lowering had no arm for their names. The host has no console buffer cache to drop, so this skips descriptor tracking for `_inv` buffer instructions and lowers the pair as no-ops — the same treatment the scalar `s_gl1_inv` and `s_dcache_inv` already get. A synthetic full-pipeline test covers both opcodes. This was one of the refusals listed in PR #163's audit. That PR only prints a notice when a listed opcode begins to lower, so the two lines become stale rather than failing. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace` with PR #112's Linux build fix applied locally (not part of this PR): 165 passed, 0 failed, 3 ignored. One new test runs both opcodes through decoding, resource tracking, structure and lowering. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. - Not tested: a real title. Shader binaries live in a 393 MB `shaders.rpf` with no reader in the repo, so the test uses synthetic instruction words. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
buffer_gl0_inv and buffer_gl1_inv name a buffer but read no descriptor, so resource tracking refused them before lowering. Skip descriptor tracking for _inv buffer instructions and lower the pair to nothing, as the existing scalar cache instructions already are. Add a synthetic full-pipeline test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:01:09 +00:00
github manually merged commit f47ebd83f3 into gh-pr/368/base 2026-11-26 04:01:11 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:03 UTC · original

Thanks @⁠Quat3rnion for this change. I tested head d3c40da1c8371648774e11963cd880539e3d8085 with:

cargo test --locked -p victory-shader --lib buffer_cache_invalidations_lower_as_no_ops -- --test-threads=1

Result: 1 passed, 0 failed (61 filtered out). The synthetic lowering test decodes and lowers both buffer_gl0_inv and buffer_gl1_inv through the shader pipeline. This validates translator acceptance and no-op lowering; it does not exercise behavior in a real title or GPU dispatch.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/368#issuecomment-7121664155) Thanks @⁠Quat3rnion for this change. I tested head `d3c40da1c8371648774e11963cd880539e3d8085` with: ``` cargo test --locked -p victory-shader --lib buffer_cache_invalidations_lower_as_no_ops -- --test-threads=1 ``` Result: 1 passed, 0 failed (61 filtered out). The synthetic lowering test decodes and lowers both `buffer_gl0_inv` and `buffer_gl1_inv` through the shader pipeline. This validates translator acceptance and no-op lowering; it does not exercise behavior in a real title or GPU dispatch.
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/Marvisak--VIctory!368
No description provided.