Shaders: a refusal names the instruction that made its missing value #1425
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1425
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@ThomasSAMP on GitHub · 2026-11-24 17:57 UTC · original
ThomasSAMP:shader/missing-value-origin→main· +241 −41 · 4 files · 1 commits · openWhat
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
@Marvisak on GitHub · 2026-11-25 01:27 UTC · original
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
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.