feat(shader): store D16 data to SINT storage images #5899
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5899"
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 ps54all on 2026-10-14T15:05:32Z.
What
image_storewith D16 data into a storage image of a SINT format threwstores 16-bit data to an image of a SINT format. God of War Ragnarök (PPSA08330) hits it in compute shader0x1052a17900right after its MFSR setup (#5796).The throw was in two places:
ResourceMaterializer);StoreTexel).RuntimeImageModesalso left the SINT conversions out for images with 16-bit data.EmitD16StoreComponent, the function the D16 format buffer stores already use: sign-extend, then saturate to the component width the same way as for 32-bit data.docs/dev/debt/shader.mdnow says so.Tested
BUILD_TESTING=ON, on main5a6ad0ed3.agc_driver_image_store_sint:image_atomic_addon 32_SINT. It checks every texel against the model "16-bit half → sign-extend → saturate". The input edge values include 0x7fff, 0x8000, 0xffff and 0x0000.16_SINT texel (2, 0) component 0 is 0x00007fff, expected 0x0000ffff).ctest -R "agc|shader|recompiler": 536/536 pass.tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.0x1052a17900.compute shader 0x10527dd300: sampling, gathering or querying LOD of a converted unorm image is not implemented(the 11_11_10 UNORM sampling gap in the debt list).Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T19:16:28Z.
Review: COMMENTED
Run on an Apple GPU, since the PR was tested only on an RTX 3080.
GPUs tested: Apple M2 Max, MoltenVK 1.4.2 (Vulkan 1.4.357), macOS 27.2, x86-64 under Rosetta
maindoes not run the GPU tests on macOS yet, so I tested onmacos-portatb7eb6b6b(mugurc/AnyPS5) plus theImportWatchedchange from #1, with this PR's own diff (merge-base..head8c1193744) applied. Notmain. Release build, LunarG Vulkan SDK 1.4.363.0. Suite:ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30. Without the PR, 13 tests fail on this setup (7 with the #2704 build), all known macOS failures listed in #1. One hunk inResourceMaterializer.cppconflicts trivially: the branch's throw has another condition. I resolved it to the PR's side, which removes the throw.agc_driver_image_store_sintpasses. That covers the D16 stores with DMASK 0xf and 0x5 to all eight SINT formats, and the store afterimage_atomic_add.stores 16-bit data to an image of a SINT format, the refusal in the description.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-14T21:21:18Z.
Thanks for the M2 Max / MoltenVK run.
agc_driver_image_store_sintpassing there (DMASK 0xf and 0x5, all eight SINT formats, the store afterimage_atomic_add) and failing with the refusal message on the unchanged branch is exactly what the test is meant to show.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:19Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdImported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-15T19:57:17Z.
Tested on Linux x86-64 (Release build, lavapipe / llvmpipe LLVM 20.1.2), with 8c1193744 merged into main
44df21632:agc_driver_image_store_sintpasses.ShaderRecompiler::Recompile: stores 16-bit data to an image of a SINT format.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T11:25:37Z.
Measured
image_store d16to all eight SINT formats on RDNA2 (gfx1035) with DMASK 0xf, 0x7, 0x5, 0x3, 0x2, 0xa and 0x1 over edge halves (1792 rows): every row matches the sign-extend-then-saturate model, and 765 of them would differ with zero-extension. Build and the AgcDriver/Agc tests are green on RADV;agc_driver_image_store_sintfails without the change.Added on top: the
docs/dev/debt/shader.mdentry now says the D16 SINT image store rule is measured instead of "not measured". Merging.