Shaders: decode cube-array slice and face in image lowering #1256
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1256"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T16:49:33Z.
Fixes #720.
Summary
RDNA2
MIMGcarries no separate dimension bit for cube-map arrays (dim:CUBE= 3 is shared byTextureCubeandTextureCubeArray): the compiler packs the third coordinate operand as8 * slice + faceand expects channel 2 ofimage_get_resinfoto report the view's face count (NumCubes * 6).TextureCubeArray(DXIL kind 9) when adim == 3sample orgather4builds its face operand by multiplying by8.0(covering literal, inline,omod, SGPR/VGPR constant sources, anda16half-float coordinates) or from a constant>= 8.0, whenimage_get_resinfohas a live channel-2 read, or when another cube site shares the same descriptor slot. PlainTextureCubesites remain kind 5.idx & 7with unsigned clamping of face IDs6and7to face5(-Z), and passfloat(idx >> 3)as the fourth sampling coordinate while keeping integer texel offsetsundeffor kind 9.image_get_resinfochannel 2 by 6 onTextureCubeArrayhandles so D3D12's cube count matches RDNA2's face count.Verification
dxil.dllvalidation tests acrossimage_sample*(_lz,_l,_b,_c_lz,a16),image_gather4_lz, and standalone / descriptor-linkedimage_get_resinfo.0..8including6, 7 -> 5clamping,gather4,resinfo, and plainTextureCubenon-regression) executed across:cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo xtask policypass.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T16:56:56Z.
Review: APPROVED
Tested head
18a1073(fast-forward onmainffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):cargo test -p victory-shader emit::lower: 12 passed, 0 failed (includingcube_array_encodings_and_linked_resinfo_lower)cargo clippy -p victory-shader --all-targets: 0 warningscargo xtask policy: okClean cube-array slice/face decoding in image lowering. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T17:03:19Z.
Setup: Linux, RX 9070 XT, RADV (Mesa 26.3.1), dxil-spirv master, spirv-val 1.3. Your head folded onto a base of origin/main
ffe310eplus #1017 — main's host build is broken without it (E0425 host_resourceinvictory-gpu), so the base is that pair. Ran the four-stage offline check (translate, dxil-spirv, spirv-val, RADV pipeline) over 768 programs: the 751-program world dump plus a 52-program BVH capture, 35 duplicate containers skipped.No program gained or lost and the failure table is identical to the base, reason for reason: nothing in this capture reaches the class you lower, so this is a no-regression result only (same 10 SPIR-V validation failures as the base).
Not tested: in-game.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:20:05Z.
Automated triage for the maintainers.
Merge candidate (kept). The new head (
e516804) is the same change as one commit on currentmain, and it merges cleanly. The inference now lives in its own module,emit/lower/cube_array.rs(cube_arrays).The behaviour is unchanged from the last review. A
dim == 3site becomesTextureCubeArray(kind 9) when its face operand is8 × slice + face, a constant of at least 8, or a live resinfo channel 2, or when it shares a descriptor with such a site.cube_directionsplits the operand intoidx & 7andidx >> 3, and resinfo channel 2 is scaled by 6. A plain cube still lowers as kind 5.One more thing in the new head: cube gathers with an offset are now refused (
"a cube gather with an offset"). The clamp of face ids 6 and 7 to face 5 still has no stated hardware reference. It would be welcome, but it doesn't block.CI: passing (
check). Recommending a look, not approving.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T12:37:31Z.
I combined exact #1256
e516804and #23723e624ccon main63bcca4. The integration branch is76ef8b4and preserves both heads.The two changes expose a face-operand lookup issue. After resolving the merge, a test of
cube_arrayswith 32-bit derivatives anda16coordinates found zero array sites for a face operand of 10. The inference divided the gradient prefix by two along with the coordinates. It now counts the actual gradient VGPRs first, then finds the face in the coordinate registers. The same test passes for all foura16/g16combinations.A new readback uses a two-cube array with four mip levels. All 16 WARP cases returned the expected layer, face and mip tag, including the clamped face and minimum LOD cases. All nine cube tests and the separate
a16mip query passed. Full shader suite: 327 passed, 5 failed, 3 ignored. The five are existing WARP gather, permute and edge-flag failures. Strict shader Clippy and asset policy passed. For the face 6/7 hardware reference, see the RDNA2 results in #720.If folding in the resolution or the new regressions, please retain Git attribution or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic fixtures only.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.