Files
AnyPS5/docs/dev/debt/changes/docs-cube-array-face-decode.md
MichonandClaude Opus 5.5 bceb8e224f fix(shader): decode out-of-range cube faces and cube indices as RDNA2 does
A DIM CUBE face coordinate z mapped to host layer (z / 8) * 6 + z % 8
through an unsigned conversion, right only for faces 0 to 5 of a cube
inside the T#. gfx1036 truncates z to a signed integer, clamps z & 7 to
5 and clamps z >> 3 to the T#'s cubes; CubeLayer now does the same,
taking the cube count from the sampled view's layers. GCN guest shaders
keep the old mapping, which is not measured on GCN hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 06:39:13 +01:00

6 lines
791 B
Markdown

# shader
## add Functional
- [Cube layers](../../../core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp) (`CubeLayer`) map a DIM CUBE face coordinate z as RDNA2 (gfx1036, AMD driver 32.0.21045.16010, [hardware oracle](../HW_ORACLE.md)) does: z is truncated to a signed integer, the face is `min(z & 7, 5)` and the cube `z >> 3` clamped to the T#'s cubes, measured with `image_sample_lz`, `sample`, `sample_l`, `sample_b` and `gather4` variants on 64x64 32_FLOAT cubes (`DEPTH` 5, 11 and 17, `BASE_ARRAY` 0 and 6). GCN guest shaders keep `(z / 8) * 6 + z % 8`, which is right only for faces 0 to 5 of a cube inside the T#; cube decode is not measured on GCN hardware. z outside the 32-bit integer range, where `OpConvertFToS` is undefined, and the PS5's gfx1013 are not measured.