Shaders: trace descriptors under the access's EXEC guard, not just its block #177

Open
amine23012004 wants to merge 1 commit from upstream-pr/177 into main
amine23012004 commented 2026-11-26 10:26:41 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by amine23012004 on 2026-11-26T10:26:41Z.


Trace descriptors under the access's EXEC guard, not just its block

Problem. resource::Tracer::descriptor() and Tracer::live() only add lanes.reach[b] to the known facts when they trace a descriptor (or walk phis back through joins) for an access. When the access sits in a join block under an EXEC guard — lanes that failed a v_cmp cleared EXEC and jumped to the join with s_cbranch_execz — those lanes reach the block but never run the access. The dead edge still counts, so a descriptor that is only built on the live arm (e.g. an immediate sampler s[8:11] = 0) can't be resolved and track() returns Unsupported: the shader is dropped.

Fix. Tracer::at holds the instruction site (block, inst) instead of the block; descriptor() and live() also push lanes.guards[b][i] (when present) next to reach[b]. One file, crates/victory-shader/src/resource.rs.

Test. resource::tests::a_guarded_access_excludes_dead_lane_edges_at_a_join — a guarded image_sample_lz in a join whose sampler is only written on the live arm.

  • without the change: fails (track() → Unsupported)
  • with it: passes; whole victory-shader suite 210 passed, 0 failed, 2 ignored; cargo clippy -p victory-shader --all-targets -- -D warnings clean.

Credit / origin. Ported from codec_d's cool_fox tree (commit f4b48ad, GPL-3.0, itself forked from this repo at 0a43566), where it recovered CS_AlphTransmissionPrefilterMip and removed black squares / broken blending on transmissive and eye shaders. Only the guard part is taken; the v_readlane restore changes from the same tree (which need emit/lower.rs changes) are left out. Not checked in-game on AMD by me — the shader-side analysis is vendor-neutral.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6624599981 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/177). Originally posted by [amine23012004](https://github.com/amine23012004) on 2026-11-26T10:26:41Z. --- ## Trace descriptors under the access's EXEC guard, not just its block **Problem.** `resource::Tracer::descriptor()` and `Tracer::live()` only add `lanes.reach[b]` to the known facts when they trace a descriptor (or walk phis back through joins) for an access. When the access sits in a join block under an EXEC guard — lanes that failed a `v_cmp` cleared EXEC and jumped to the join with `s_cbranch_execz` — those lanes *reach* the block but never *run* the access. The dead edge still counts, so a descriptor that is only built on the live arm (e.g. an immediate sampler `s[8:11] = 0`) can't be resolved and `track()` returns `Unsupported`: the shader is dropped. **Fix.** `Tracer::at` holds the instruction site `(block, inst)` instead of the block; `descriptor()` and `live()` also push `lanes.guards[b][i]` (when present) next to `reach[b]`. One file, `crates/victory-shader/src/resource.rs`. **Test.** `resource::tests::a_guarded_access_excludes_dead_lane_edges_at_a_join` — a guarded `image_sample_lz` in a join whose sampler is only written on the live arm. - without the change: fails (`track()` → `Unsupported`) - with it: passes; whole `victory-shader` suite 210 passed, 0 failed, 2 ignored; `cargo clippy -p victory-shader --all-targets -- -D warnings` clean. **Credit / origin.** Ported from codec_d's `cool_fox` tree (commit `f4b48ad`, GPL-3.0, itself forked from this repo at `0a43566`), where it recovered `CS_AlphTransmissionPrefilterMip` and removed black squares / broken blending on transmissive and eye shaders. Only the guard part is taken; the `v_readlane` restore changes from the same tree (which need `emit/lower.rs` changes) are left out. Not checked in-game on AMD by me — the shader-side analysis is vendor-neutral. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/177:upstream-pr/177'
git switch 'upstream-pr/177'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/177'
git switch 'upstream-pr/177'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/177'
git switch 'upstream-pr/177'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/177'
git switch 'main'
git merge --squash 'upstream-pr/177'
git switch 'main'
git merge --ff-only 'upstream-pr/177'
git switch 'main'
git merge 'upstream-pr/177'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
avatarmanz/VIctory-7900XTX!177
No description provided.