Preserve Z offsets in 3D texture samples #2676
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2676
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@masteraapjes on GitHub · 2026-11-29 15:52 UTC · original
masteraapjes:codex/shader-correctness→main· +274 −6 · 5 files · 1 commits · merged 2026-11-30 14:12 UTCWhat 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.
github-bot referenced this pull request2026-11-29 22:46:14 +00:00