Shaders: key immediate sampler slots by descriptor and comparison mode #1477
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!1477
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1477/head"
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?
@geiyiliyabumo on GitHub · 2026-11-24 18:18 UTC · original
geiyiliyabumo:fix/shader-static-sampler-cmp→main· +104 −8 · 2 files · 1 commits · merged 2026-11-25 00:17 UTCSummary
Fixes immediate/static sampler slot reuse when the same immediate descriptor words are used by both non-comparison (\image_sample) and comparison (\image_sample_c\ / \image_sample_c_lz) instructions in one shader (tracking issue #1242, \VIC-BT-009).
Previously, \Lower::resource_handle\ keyed \self.samplers\ only on the 4 descriptor words and set \self.s.cmp_samplers |= 1 << n\ after emitting handles. If a non-comparison sample ran first, its \dx.op.annotateHandle\ encoded \SamplerKind = 0\ (\14), while a later comparison sample flipped the slot bit so \dx.resources\ declared \SamplerKind = 1\ (\Comparison), producing invalid DXIL. It also performed an unchecked \1u64 << n\ shift.
Changes
Verification
AI-assisted; synthetic tests only, no game files.
@sinan-cmyk on GitHub · 2026-11-24 20:13 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
2286e03ontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).