Repository navigation
Conversation
image_sample_b with a16 was refused ("a biased image sample with 16-bit
coordinates"). With a16 the extra addresses (offset, bias, compare)
still take a whole dword each, a bias being f16 in the low half (as
LLVM's AMDGPU backend lays it out), and the packed coordinates start at
the next dword. The extras now count two 16-bit halves each with a16,
and the bias converts from f16.
This also moves the coordinates of a16 gathers with offsets (`_o`) to
the dword after the offset; they were read from the offset dword's
high half.
translate --validate on shaders.rpf: vertex/pixel 12172 -> 12208
validated (44 more emitted); the error is gone from the list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Check on Linux, not Windows: pass. Head
On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed. |
|
Tested offline against main
AI-assisted. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested aed9637 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). victory translate <title exe> --validate --pipelines gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. These 12 do not use a16 samples, so I could not reproduce the shaders.rpf figures.
- The address layout matches LLVM's AMDGPU MIMG lowering. Under a16, each extra argument (offset, bias, z-compare) still takes a whole VGPR, and a bias sits as f16 in the low half. Counting extras as 2 halves each gives the right first packed coordinate. Converting the bias with
legacyF16ToF32rather than reading it as f32 is right for that layout. - The side effect you flag looks like a fix to me, not a regression. With a16 and an offset, the old code read the first coordinate from the offset dword's high half. By the same layout rule, the coordinates start in the next dword.
- Comparison samples with a16 stay refused.
No issues found.
AI-assisted (Claude Code).
…oordinates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Measured on the full retail shader pack (26,503 containers) with
All four clear the 108 "biased image sample with 16-bit coordinates" programs identically. #73 and #318 also clear the 27 |
catminou4
left a comment
There was a problem hiding this comment.
This enables image_sample_b* (biased image sample) with 16-bit coordinates, which was previously rejected. The operand-layout reasoning in the comment is coherent: with a16, each whole-dword extra (texel offset word, the bias itself, compare value) occupies two 16-bit slots, hence first = 2 * extras, and the bias is read with to_float instead of as_float because it sits in the low half as f16.
Two things before this can be approved:
- No test coverage. The diff adds no
valu_testscase for a biased image sample with a16 coordinates — this is exactly the kind of operand-indexing change that silently reads the wrong VGPRs if the2 * extrasmath is off. A host-execution test (therun_wave_cs-style harness or an image-sample variant) would pin it. - I can't execute SM 6.6 image-sample paths on macOS (execution tests are Windows-gated), so the verification above is static only.
Test-merge with current main (ffe310e) is clean; cargo test -p victory-shader --locked (macOS arm64, rustc 1.98.1) → 96 passed / 0 failed — existing tests unaffected, but they don't touch the new path.
|
@catminou4 agreed on the missing test. The layout follows LLVM's AMDGPU MIMG lowering (bias is f16 in the low half of a whole dword under a16; offset and compare stay whole dwords), which mercuryVM checked against the same reference on RTX 5070 earlier; the gain is measured on the title's shaders (+36 VS/PS validated) but no test executes an a16 biased sample yet. A Windows-gated host-execution case with a16 coordinates and a non-zero bias would pin the |
…it-inputs Shaders: unpack 16-bit input halves and widen integer/float payloads
|
Automated triage for the maintainers. Closing because this change is already in a16 biased samples are in main's image() (extras keep a VGPR each, bias converted with legacyF16ToF32). 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. |
image_sample_bwith a16 was refused up front ("a biased image sample with 16-bit coordinates"): 108 programs in shaders.rpf, mostly mirror-reflection and ped pixel shaders.Change
legacyF16ToF32) instead of being read as f32._o) now read their coordinates from the dword after the offset. Before, they were read from the offset dword's high half.Results
victory translate --validate shaders.rpf: vertex/pixel validated 12172 → 12208 (44 more emitted). The error is gone from the list. The rest of the 108 stop at other cases further in.Testing
cargo test -p victory-shader: 69 passed. Clippy and rustfmt are clean.This is independent of #539, #554, #563 and #565.
Written with the help of Claude (AI).
🤖 Generated with Claude Code