Shaders: unpack a16 image coordinates and gradients after whole 32-bi… #1480
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!1480
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1480/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?
@Texbirds on GitHub · 2026-11-24 18:18 UTC · original
Texbirds:fix/shader-a16-image-address-packing→main· +29 −18 · 1 files · 1 commits · closed without merging…t address words
Problem
In
crates/victory-shader/src/emit/lower.rs,mimgindexed all address components through a single flataddr_val(k)usingregs[k / 2]whena16is set. On GFX10 (matchinggfx10/fields.rs), texel offset (_o), bias (_b), compare reference (_c), andimage_get_resinfomip level are always full 32-bit VGPRs even undera16, and explicit gradients (_d) paddhanddvto whole VGPRs separately (2 * spatial.div_ceil(2)).As a result, under
a16:image_sample_o/image_gather4_lz_otruncated the 32-bit offset word to 16 bits (breaking constant offset extraction and 3D offsets) and read the first coordinate from the upper 16 bits of the offset VGPR.image_sample_bread bias as a 16-bit half and shifted coordinates into the bias VGPR.image_sample_dwith odd spatial dimensions (1D/3D) readdvand coordinates from the wrong halves/VGPRs.Fix
whole_val(k)(full 32-bit VGPRs for_o,_b,_c, andimage_get_resinfo) andpacked_val(base, k)(2×16-bit packed components undera16starting at VGPRbase).deriv_stride = spatial.div_ceil(2)andcoords_base = first + derivs_regsto matchgfx10/fields.rsexactly.@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
b32a5d5ontomainffe310e(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 120, 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).
@Marvisak on GitHub · 2026-11-25 00:41 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.a16 address unpacking with whole VGPRs for offset, bias and compare and per-direction gradients: main already does this (lower.rs 7366-7392
extra, 7839).If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed