Repository navigation
Conversation
With a16 the address VGPRs were read as one run of 16-bit pairs. The
hardware (and image_addr_dwords, which counts them) gives each extra word
(texel offsets, bias, comparison value) a whole VGPR, pads each direction
of an odd number of gradients to whole VGPRs and begins the coordinates
in a new VGPR. image_address_place now places each address that way, so
a16 biased samples translate (the bias is the f16 in its word's low half)
and a16 gathers with an offset word read their coordinates from the right
VGPR.
image_sample_d_cl lowers to sampleGrad with the clamp that follows the
coordinates.
In a census of the title's shaders these stopped 108 ("a biased image
sample with 16-bit coordinates") and 27 (image_sample_d_cl) programs.
09789c2 to
1d7bf9b
Compare
|
Review note on the address layout. This PR reads the a16 bias as an f16 in the low half of its dword, which matches LLVM. But i.e. four 32-bit derivatives, then one dword of packed coordinates (and clamp). With the packing here the coordinates are read from dword 2 instead of dword 4. I made the same mistake in #160 and fixed it there (
From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware. |
|
Tested Offline,
The totals balance with none of the 27 In the world, #293's top pixel shader AI-assisted (Claude Code, Claude Opus 5.5); no game data. |
…pute gradient lowering too
…pute gradient lowering too
|
@nullmarsh thank you for running it. On EduAzevedo looked at the #160 has that cube rule since What I do not know is whether From the documents, synthetic tests and the linked testers' measurements; nothing was run on the title here. AI-assisted. |
|
@r4tedx It is one of them. In game on AMD RDNA4 (RX 9060 XT, Windows 11):
No visible change: in both arms 3–4 of the 12 frames show the title card and the rest are black. No device loss in these four runs (each stopped after its 12 frames). AI-assisted (Claude Code, Claude Opus 5.5); no game data. |
|
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 |
|
A data point on the gradient layout under a16, from LLVM's GFX10 assembler
All four match "a16 packs coordinates and LOD/clamp only; gradients stay A branch with this layout and unit tests for |
What
a16 address layout. With
a16,image()read the address VGPRs as one continuous run of 16-bit pairs (k / 2). The hardware packs them differently, andimage_addr_dwordsingfx10/fields.rsalready counts them that way:The new
image_address_placeplaces each address by that layout. Effects:legacyF16ToF32like the coordinates,(k, None)).image_sample_d_cllowers tosampleGradlikeimage_sample_d, passing the clamp that follows the coordinates instead of undef.Why
In a
translate --validatecensus of the title's shaders, these were the reasons for 108 programs (biased a16) and 27 programs (image_sample_d_cl, e.g.PS_DeferredTextured_AlphaClipNC).Testing
cargo test -p victory-shader: all pass, plus a new testa16_image_addresses_pack_as_the_hardware_doescovering biased/offset, 2D-gradient (+ clamp) and 3D-gradient layouts.cargo clippy -p victory-shader: clean.