fix(shader): accept 3D image stores on 2D-array T#s #9249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9249"
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 Pacuka on 2026-10-21T16:33:37Z.
What
A 3D
image_storebound to a 2D-array T# was refused withimage descriptor is incompatible with the static runtime image interface(descriptor dim 2D-array, prepared modes only 3D), which aborts the dispatch. The hardware addresses the layer of a 2D-array image through z, so the access is the same as a 2D-array store with (x, y, layer).This is the inverse of #5555 (2D-array loads and stores on 3D T#s):
ResourceMaterializer: a write-only 3D storage image (no read, no atomic, no dynamic mips, not packed or by elements) also gets a 2D-array runtime mode.SpirvImageEmitter: a store through that mode drops texels whose layer is past the array, with the sameVolumeSliceInRangecheck #5555 uses for the volume depth.Loads, samples and atomics are unchanged.
Tested
Linux (CachyOS, kernel 7.2.2), AMD RX 6650 XT, RADV Mesa 26.2.4.
ImageStoreVolumeThroughArray(mirror ofImageStoreArrayThroughVolume): 3D stores into a 4x4x2 2D-array T#, then a store at layer 2 that must not touch the bytes after the array. New unit caseverifyArrayVolumeStoreModeinagc_shader_memory_tests: selects the 2D-array mode for a write-only 3D store, refuses a load+store and an atomic. Both fail onmainand pass with this PR.agc_shader_memory_testspass.agc_driver_image_array_window_past_layer_limit_testsfails on this machine with and without this PR (same output onmain).maincecb540a6it aborts about a minute after start, while loading thecoreworld, on compute shader0x12b6559e00(twoimage_store ... dim:SQ_RSRC_IMG_3Dinto a format-56 2D-array T#11800100 c3800000 0003c003 d0900fac 00000000 00700000 00000000 00000000). The dumped request replays withagc_shader_replay --materializeon this PR, and the title gets past that point and starts presenting at 2560x1440 (black screen). It then stops on a separate memory problem (a 16384x16384 storage view placed in host memory), which is not part of this PR.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MaxLikesCode on 2026-10-21T19:53:20Z.
RTX 4090 (Ada) on Windows, head
adca8cfa2merged ontomain38d3c0858(clean).NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON.ctest --test-dir build -R '^agc_driver_(image_|layered_|array_layer|storage)|^agc_shader_memory$' -VwithANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1, 3 runs without and 3 withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan-ValidationLayersvulkan-sdk-1.4.363.0, implicit layers disabled). The loader log shows the layer inserted, and no log haswas not found but was requested by env var VK_INSTANCE_LAYERS.agc_driver_image_array_window_past_layer_limitis left out: it does not compile with MinGW (#8310).VUID-per validation runmainVkImageViewCreateInfo-usage-02275main+ #9249agc_driver_image_store_volume_through_array02275come fromagc_driver_image_srgb_sample_copyon both sides (anR8_SRGBview with storage usage, which this device doesn't support for that format), so nothing new.mainwith only this PR's test changes applied:agc_driver_image_store_volume_through_arrayfails withimage descriptor is incompatible with the static runtime image interface: descriptor format 20 decodes to {class 2, dim 5, ...}, andagc_shader_memorywith the same message for format 56. Both pass with the PR.tools/select_tests.pyon the merged tree: 1138 of the 1141 selected tests pass. The 3 failures areagc_driver_sample_order,_grid_referenceand_recipe_depth_locations, which fail the same way onmainon this GPU (#9313, fixed by #9056).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T21:32:29Z.
@Pacuka thanks for this. I ran PPSA03396 on main
95d17687with this PR atadca8cfa2f. It gets past the stop on main, "image descriptor is incompatible with the static runtime image interface: descriptor format 56", and now runs to about 236 s. There it stops at a different one: "buffer descriptor uses an unsupported type". That one is separate from this change.I'm assigning myself to take it through review and CI.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-21T22:34:07Z.
Review: COMMENTED
Confirmed
red→greenon two more vendors (the PR run is AMD RADV only): the newagc_driver_image_store_volume_through_arrayfails onmainand passes with this change on both an NVIDIA RTX 3070 (Linux) and lavapipe.Tested
Ubuntu 26.04, i7-8700, Release,
BUILD_TESTING=ON,ANYPS5_NO_SHADER_CACHE=1, device selected withVK_ICD_FILENAMES, run as./agc_driver_image_store_volume_through_array_tests, onmaina6dcea927(this PR applies cleanly on it).agc_driver_image_store_volume_through_arraymaina6dcea927+ new test only (recompiler reverted)To confirm the test guards the regression, I built the new
ImageStoreVolumeThroughArray.cppon top ofmainwithResourceMaterializer.cppandSpirvImageEmitter.cppreverted. It fails on both devices with:i.e. a
dim 5(3D) store reaching adim 4(2D-array) runtime interface, which is exactly what this PR accepts. With the full PR both devices pass 3 of 3.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T00:01:47Z.
Review: COMMENTED
First Apple GPU / MoltenVK run of this PR. Both the execution test and the unit case go red→green here.
Machine: Apple M2 Max, macOS 27.2, x86_64 under Rosetta 2. Vulkan loader + MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), and again against MoltenVK main + SPIRV-Cross #2704. Release,
BUILD_TESTING=ON.Base/method: PR #8658
feat/macos-port@a1fb8e3e9c(currentmaina6dcea9279plus the macOS port), notmain—maindoes not build on macOS. This PR's diff (git diff merge-base..adca8cfa2 -- . ':!docs') applied on top, clean.With this PR (
--repeat until-fail:3, both drivers):agc_driver_image_store_volume_through_arrayandagc_shader_memorypass 3/3 on each.Negative control (revert
ResourceMaterializer.cppandSpirvImageEmitter.cppto the PR's base, keep both tests): both fail with exactly the message this PR addresses:So the descriptor (
dim 5= 3D) has nodim 5runtime mode and the recompile aborts; with the PR the write-only 3D store gets adim 4(2D-array) mode and the store lands, layer-past-array bytes untouched. The behaviour is not Apple-specific, but this confirms it on MoltenVK: the test detects the regression here and the fix clears it on both drivers.Full
^agcsuite with this PR (SDK, clean rebuild): the same 15 failures as the#8658base, no new one, and the newagc_driver_image_store_volume_through_arraypasses — so the recompiler change adds nothing to the failing set on Apple.GPUs tested: Apple M2 Max (MoltenVK 1.4.2; and MoltenVK main + SPIRV-Cross #2704).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.