Preserve Z offsets in 3D texture samples #2676
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2676"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by masteraapjes on 2026-11-29T15:52:58Z.
What it changes
image_sample_*_oextracts only X/Y from the packed texel-offset word. For3D textures it silently samples at Z offset zero. With A16 coordinates, the
offset word is also incorrectly unpacked as a half coordinate, losing its
upper bits. The pixel immediate-offset path likewise stops after two axes.
Read the offset as a whole 32-bit VGPR, decode all three signed six-bit fields,
and include Z when making pixel offsets immediate. The axis count still
excludes array slices and gives cube samples no offsets. Translator source
fingerprinting automatically invalidates the affected shader-cache keys.
The bit layout follows AMD RDNA 2 ISA section 8.2.5 (page 73).
How it was tested
wave32 compute shaders, plus pixel-shader lowering checks. No game files.
[8,8,8,1] instead of [8,8,9,1].
coordinates, WARP/hardware). Covers zero, signed Z, mixed XYZ and reserved
bits, using a generated 3D texture whose RGB records its texel coordinates.
offsets with A16, 1D/2D array dimensions, and all three pixel immediates.
cargo test --locked -p victory-shader --features diagnostics --lib: 466 passed, 0 failed, 9 ignored.cargo test --locked -p victory-shader --features diagnostics sample_offsets -- --nocapture: all four regressions passed.git diff --checkpassed.too-many-arguments lints are allowed on the command line; no lint settings
were changed in the source or CI.
condition in lower/analysis.rs, and native.rs's eight-argument test helper.
GPU regressions use the existing SM 6.6 immediate range [-8,7]. IR tests check
six-bit decoding; this does not add host legalization for wider or dynamic
sample offsets. In-game appearance has not been measured.
Checked for overlap
Related: #2522 handles cube-array sampling; #2387 handles array LOD
coordinates. Neither corrects packed XYZ offset decoding.