fix(shader): bind 2D textures to 3D sample and load accesses as measured #2133
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2133"
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 queeeef on 2026-10-09T09:46:53Z.
What
Fixes #2023. A 3D image access bound to a 2D T# matched no runtime image mode and threw "image descriptor is incompatible with the static runtime image interface" (Sonic Origins PPSA05324).
RuntimeImageModesalready offers a 3D mode for a 2D access, but not the reverse.Semantics source: CouchRiv's hardware-oracle measurement in #2023 on RDNA2 (gfx1036):
image_sample_lzwith dim 3D on a 2D T# returns the (u,v) texel for every r.image_loadwith dim 3D returns the (x,y) texel for z = 0 and zeros otherwise.Change:
flatVolumeCompatibleimage flag, narrowed inResourceTracker::Merge, stays true only while every use of the image is one of those two measured forms: animage_sample_lzwith no other sample flags, or animage_loadwithout mip, packing or BY.RuntimeImageModesadds a 2D mode: not storage, not depth, no conversion or packed format.EmitReadOpnow returns zero when z != 0.image_load_mip) keeps throwing. Recorded in TechnicalDebt, including that gfx1013 is not measured.Tested
Linux, lavapipe (Mesa 25.2.8), main at
a7ff8852.agc_driver_image_volume_address_on_plane:image_sample_lzwith r in {0, 0.5, 1, 1.5, -0.25, 3, 0.25, 0.75} and expect the (u,v) texel.image_loadwith z in {0, 1, 2, 3, 4, -1} and expect the texel for z = 0 and zeros otherwise.image_sample_lon the 2D T# is still refused.agc_driver_image_*,runtime_imagesandbindless_imagesexecution tests,agc_shader_disk_cache(now round-trips the flag),agc_driver,agc_shader_memoryandagc_driver_graphicspass.tools/check_conventions.pyandtools/check_test_registration.pypass.Checklist
Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T12:38:43Z.
Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build pluslibs. c1b85fb9 cherry-picked onto currentmaind70b8998(applies cleanly).agc_driver_image_volume_address_on_planepasses on NVIDIA hardware, in addition to lavapipe.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-09T15:50:02Z.
Tested with Sonic Origins (PPSA05324) on Linux, R9 380 (RADV, Mesa 26.0.8, GFX8): yes, it gets past the stop.
maind70b8998+ the PRs listed in #2021), I replaced my local workaround for #2023 with this PR (c1b85fb9 cherry-picked). The shader cache started empty for the new source version, so every shader was recompiled with it.agc_driver_image_volume_address_on_planepasses on this card too, along with the other 36 image, bindless, runtime image, shader disk cache andagc_driver_graphicstests.I tested #2140 the same way; it also gets the title past this stop.
Bring-up thread: #2021
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:13:06Z.
Checked on our side:
image_sample_lzdim 3D on a 2D T# equals dim 2D on 43 rows (r from -1 to 100, ±Inf, NaN; point clamp/wrap/border, bilinear clamp/wrap), andimage_loaddim 3D returns the (x,y) texel for z = 0 and zero for z = 1..4, -1, 0x80000000 and 0x10000, also with out-of-range x/y. Same result with a non-zero DEPTH field in the 2D T#. Matches CouchRiv's gfx1036 run.Added on your branch:
constantSwizzlefields inResources.hpp,ResourceTracker.cppandShaderDiskCache.cpp; both kept).Merging once the full Linux and Windows build is green.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T06:19:35Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/shader/recompiler/Optimization/src/ResourceMaterializer.cppL630core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppL953core/shader/recompiler/Optimization/src/ResourceMaterializer.cppL630