fix(shader): decode forced degamma on biased RGBA8_UINT samples #5472
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5472"
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 boykopovar/AnyPS5. Originally posted by eljackjoestar-cmd on 2026-10-13T20:39:21Z.
What
After #5461, Lost Soul Aside (PPSA26358) reaches a rejection of FORCE_DEGAMMA on guest format 60, RGBA8_UINT. Hardware does not leave these samples as integers: setting the sampler bit makes the same bytes return decoded floating-point sRGB values.
For the measured direct, plain biased pixel-sampling case, materialize the image descriptor as RGBA8_SRGB before selecting the runtime image mode and descriptor heap. This changes both the shader's numeric mode and the sampled image view. The underlying guest descriptor/user-data bytes remain unchanged. Only a one-slice 3D image at mip zero is accepted, and every sampler paired with it must force degamma. The #5461 sampler proof still requires normalized point filtering. Mixed sampler states, other access forms, indirect images and other shapes remain refused.
This depends on #5461's bias-use proof, restricted 3D runtime mode and regression fixture. Its prerequisite commit is included until that PR merges; the new change is the final commit.
Semantics measurement
Direct native RDNA2 measurement on AMD integrated gfx1036 (Ryzen 7 7800X3D), AMD driver 32.0.21036.18, Windows 11. An OpenCL-loaded native kernel executes
image_sample_bDIM 2D (f0940f08 00400000) against a 16×16×1 RGBA8_UINT 3D image at mip zero. The script below verifies the compiled instruction/register layout, removes coordinate preprocessing and patches the opcode/DIM and sampler flag before loading the native binary. No emulator shaders run in this measurement.Controls: wave32; IEEE off; DX10 clamp on; f32/f16 denormals preserved; round to nearest even; FP16 overflow off. Twenty rows combine biases -16/-0.5/0/0.5/16 and four UV pairs, including wrapped coordinates. The RGBA8_UINT texel bytes are 64,128,32,255:
64,128,32,255.3d520000,3e5d0000,3c6d0000,3f800000, bit-identical to the same RGBA8_UNORM bytes sampled with FORCE_DEGAMMA.20175700 03800000 00000000 a0500f2e): 140 RGBA8_UINT rows checked.Wave64 and PS5 gfx1013 are not measured; the scope and gaps are recorded in shader debt. The Vulkan pixel readback compares decoded channels with a scalar sRGB oracle within one output UNORM code, retaining exact checks for the original non-degamma cases.
Tested
Rebased onto main
84b01f9cd042e1d2e9e112f8783aa5a9d26399eeon 2026-10-14; PR head613bb8e90fd7ebe74d35c014016949de719e48c6. Standalone branch verification (#5461 plus this PR), Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, Release, SPIRV-Tools OFF: runtime and selected native test targets built successfully. All 7 focused tests passed without skips in 3.03 s. Conventions and whitespace checks passed. The #5461 prerequisite is rebased onto the same main; it remains the only dependency. The cache format is 32, inherited from #5461. The Vulkan checks above used NVIDIA RTX 5070 / driver 617.14. Three image regressions also passed on AMD integrated gfx1036 / 32.0.21036.18 in 0.53 s, including the existing array-to-volume store regression. No new title/gameplay run, Linux, full-suite or CI result is claimed.Earlier validation, on the bases stated below:
a0f5916a2+ #5461 + this change alone, WinLibs GCC 15.2.0x2017590000is now bound as guest format 130 through a sampled sRGB view (vk=43). No renderer rejection occurs before the memory guard stops loading with 1,580 MiB free commit headroom (process private memory 16,943 MiB). Gameplay is still unverified. This integration includes #4551, #4806, #5049, #5198, point-size and depth-storage prerequisites plus the occlusion workaround; those are not new changes in this PR.Checklist
main; no other open PR implements this UINT numeric-mode conversionRaw native measurements
Reproduction script (Windows OpenCL, gfx1036)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T21:33:38Z.
Measured on RDNA2 (gfx1035, wave32, IEEE=0):
image_sample_bDIM 2D over all 256 codes per channel, on 2D and one-slice 3D T#s, biases -16/0/16, clamp/wrap/min/max and the title's S#: RGBA8_UINT with FORCE_DEGAMMA returns the RGBA8_SRGB result bit for bit (0 differing rows), integers without the bit. The new readback passes on RADV and CI's lavapipe and fails without the change.#5461 is merged, so I rebased the final commit alone onto main: the debt line now sits next to #5461's,
materializeTableslost itstablesargument, andindirectRoot != ImageResource::NoIndirectImagebecametable != NoTable(main renamed it, as in the merged #5461). Merging once the full build is green.