Shaders: a refusal names the instruction that made its missing value #1424
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1425"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by ThomasSAMP on 2026-11-24T17:57:23Z.
What
A value the emitter has no DXIL form for is kept as missing and only stops the program where something with an effect needs it (a branch, an export, a store). The refusal is reported there. So
victory translate --listnames the consumer, ans_cbranch_execzor av_mul_legacy_f32, rather than the cause, which can be hundreds of instructions earlier. Two reasons in #293's table look unclaimed for that reason, and both are already covered by open PRs:v_writelane_b32and 11v_readlane_b32with a constant lane. That is #309's subject.s_load_dwordx4/x8carried through joins into a branch. That is the territory of #1230 and #699.This PR makes the refusal name the instruction that made the missing value:
emit::lowerrecords an origin for every missing value. It is the instruction whose own refusal made the value missing. If that instruction only read a missing value, the origin is that value's origin. Phis refused on retry keep the origin of their incoming value, and lane masks whose compare failed keep theirs. Inputs and lane-mask joins have none.emit::emit_tracedreturns aRefusal { error, from: Option<Origin> }.emit,ShaderErrorand the runtime path are unchanged, so no other PR's constructors or matches need touching.victory translate --listappendsfrom <instruction> at <offset>to the example of an emit refusal. Under each reason it prints amade bybreakdown. Reason keys and every count are unchanged, so existing tables (#293, #1247) stay comparable.On the retail
shaders.rpfthis gives, for example:Of 3,436 emit refusals, 2,698 now carry an origin. The 738 without one are refusals whose instruction is itself the cause: 653 × "a 64-bit image atomic", LDS byte writes, conditional exports. The rest are inputs (hardware SGPRs, barycentrics) and lane-mask joins.
Measured
victory translate --validate --listover the title's files, onmain(ffe310e) and on this branch.dxil.dll1.7.2308 from Windows SDK 10.0.26100. The game was only read; nothing derived from it is in this PR.from ...suffix is stripped.Tests
emit::lower::tests:a_refusal_names_the_instruction_that_made_its_missing_valuereuses #604's timestamp program. The refusal at the branch namess_memtime at 0x0, both when the value is read directly and when it goes through two joins. Like the existing test, it tolerates timestamps lowering one day.a_refusal_for_an_input_names_no_instructionchecks that a branch on SCC at entry is refused with no origin.cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: clean.cargo test --workspace --locked: 344 passed, 0 failed, 6 ignored.cargo xtask policy: 154 files ok.git diff --check: clean.rustfmt --checkstill reports 4 hunks in these files that are already onmain, in test code this PR does not touch; I left them alone.No coordination-issue item: I found no open "Coordinating who works on what" issue. Depends on: none.
AI-assisted: written with Claude Code (Claude Opus 5.5) and reviewed by me. No game data in the diff, the tests or this description beyond shader-reason counts and instruction names.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:27:11Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/mod.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.