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

Open
github-bot wants to merge 1 commit from github-bot/gh-177 into main AGit
Owner

@⁠amine23012004 on GitHub · 2026-11-26 10:26 UTC · original
amine23012004:fix/guarded-descriptor-trace → main · +64 −11 · 1 files · 1 commits · open

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

**@⁠amine23012004** on GitHub · 2026-11-26 10:26 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/177) `amine23012004:fix/guarded-descriptor-trace` → `main` · +64 −11 · 1 files · 1 commits · open ## 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)
A descriptor or phi traced for an access inside a block only knew the
lanes that reach that block. When the access sits in a join under an
EXEC guard (lanes that skipped the arm by s_cbranch_execz reach the join
but do not run the access), the dead edge was still counted, so a
sampler built only on the live arm resolved to nothing and the shader
was rejected as unsupported.

`Tracer::at` now holds the instruction site, and `descriptor()` and
`live()` add `lanes.guards[b][i]` to the known facts next to `reach[b]`.

Ported from codec-d/cool_fox (f4b48ad, GPL-3.0), where it recovered
CS_AlphTransmissionPrefilterMip (black squares on transmissive/eye
shaders). Test `a_guarded_access_excludes_dead_lane_edges_at_a_join`
fails without the change (track() returns Unsupported).

Co-Authored-By: codec_d <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:21:48 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/177/head:github-bot/gh-177'
git switch 'github-bot/gh-177'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-177'
git switch 'github-bot/gh-177'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-177'
git switch 'github-bot/gh-177'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-177'
git switch 'main'
git merge --squash 'github-bot/gh-177'
git switch 'main'
git merge --ff-only 'github-bot/gh-177'
git switch 'main'
git merge 'github-bot/gh-177'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.