fix(agc): keep per-layer storage views of a 2D array in one image #10743

Open
orezraey wants to merge 17 commits from upstream-pr/10743 into main
orezraey commented 2026-10-24 20:28:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-24T20:28:05Z.


What

A compute shader that writes one layer of a 2D array at a time, through a T# with BASE_ARRAY = LAST_ARRAY = N, made a separate storage image per layer: the lookup of layer N built an image of layers 0..N (the T# names N as its last layer, not the array size). The images overlap, so every dispatch flushed the previous one's pending results and uploaded its own again (storage refresh write-backs). DEATHLOOP (PPSA01670) does this every frame on a 960x540 4-layer array.

  • StorageArraySurface (in StorageSurface): a storage view of a thin 2D array without DCC, FMASK/CMASK or MSAA is served by one image of slices 0 to the largest last slice any view of that surface has named, the way StorageSurface already widens mip chains. It falls back to the view itself when the widened geometry would move the viewed slices.
  • When a wider image is created, the narrower images of the same surface are evicted (flushed) so two pending images never hold the same slice.
  • A widened lookup refreshes only the viewed slices (RefreshLayers). The binding gets a view of those slices: StorageView, AtomicView, Atomic64View, View and FirstLayerView take a layer window, and their view caches are keyed by it. A write marks only those slices dirty (MarkSliceDirty); a write through a 2D shape marks only the window's first slice.
  • agc_driver_storage_array_layers: three rounds of per-layer image_stores into a 4-layer array. After the first round one pending image holds all four layers, later rounds reuse it, and every layer holds its own values after the flush. It then registers the same address again as a 2-layer allocation and repeats the rounds there: the pending image holds layers 0..1, not the 0..3 of the earlier array, and layers 2 and 3 stay untouched. Before that it repeats the rounds as a 2-layer array at the same address without touching the allocation (same backingSerial), with the same expectations. Last, it extends a storage mip chain (which switches StorageSurface to its locked path) and repeats the rounds on another array. On main it fails with the pending image of the 4-layer array not holding every layer; on cdfc7a986f it fails with "the pending image of the 2-layer array holds layers 0..3", and on cd720c71a4 it fails the same way in the unchanged-allocation case.
  • The largest slice is kept per surface key only while the registered guest range holding the base keeps its backing (backingSerial, renewed by a new mapping or a protection change), and a view is widened only when the wider image ends inside that range; memory in no registered range is never widened.
  • Only a view that names the largest slice creates the wider image. A view whose remembered largest slice lies past its own last slice uses a cached image of more slices if there is one, and otherwise creates an image of only slices 0 to its own last, so a new image never uploads slices the view's T# does not name.
  • Copies, resolves and color targets (CachedStorageSurface, CachedStorageLayers) are never widened: AliasCopy builds its destination with CachedStorageSurface and refuses a copy whose shapes differ, so a widened image there threw "an image copy its check allowed was refused: shape" (found by ahmadmuj). agc_driver_storage_array_layers now also stores into all four layers and then asks both for layers 0..1 at the same address; with ShaderResources.cpp at 53e11f112b it fails with "a copy destination of layers 0..1 got layers 0..3".
  • Debt entry: a shorter array the title places at the same address inside the same mapping shares the longer image only while that image is cached; a 2D T# at the address of a later slice is still a separate image.

Related: #6202 refreshes only the layers a color target covers; this PR is about storage writes and does not touch the color-target path.

Tested

  • Head 6d750b25ad (main b611e634f7 merged; the conflict was #15741's storage descriptor writes in ShaderResources.cpp, which now pick UINT storage views with ShaderRecompiler::RuntimeAbi::UintStorageImageBinding(binding.layout.binding) instead of the binding 7 to 13 range test. Both writes keep that call and pass this PR's storageLayers[index] to Atomic64View, AtomicView and StorageView). Windows, same machine as below: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^agc.*(array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer|clear_hand)" -E usb -V, 3 runs: 96 of 96 pass each time, including agc_driver_storage_array_layers, 0 VUID-, no missing-layer message. Linux (WSL Ubuntu, GCC, tree reconfigured at this head): libs and the tests build; the same ctest set, 3 runs: 94 of 94 pass each time, 92 of them skipped (exit 77, no Vulkan driver in WSL). check_conventions passes.

  • Head 72ac10a202 (main 1c8c0efc8c merged; the conflict was in cachedStorageTexture, where main (#14868) now detaches a storage image whose metadata moved and hands it to StorageTexture::PrepareCreation instead of flushing it. The merge keeps this PR's layer-narrowing lookup and widening eviction, detaches as main does, and hands over only an image detached at the key that is finally created: one detached at a wider key, or before narrower images are evicted for widening, is flushed first, as this PR did before). Windows, same machine as below: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^agc.*(array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer|clear_hand)" -E usb -V, 3 runs: 90 of 90 pass each time, including agc_driver_storage_array_layers and agc_storage_clear_hand_over, 0 VUID-, no missing-layer message. Linux (WSL Ubuntu, GCC): libs and agc_driver_storage_array_layers_tests build; the test is skipped (exit 77), no Vulkan driver in WSL. check_conventions passes.

  • Head 7d2be0318b: main was merged in, with #8887 and #12246. Texture.hpp keeps appendStoredLayers from main next to this PR's createView(..., LayerWindow layers = {}); the debt file keeps both the 1D-array entry and the storage array widening entry. The 81 focused AGC tests (^agc.*(array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer)) pass three runs in a row on Windows (MinGW, GCC 15.2) with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: no VUID- errors and the layer was found. On Linux (WSL, GCC) they build and 79 pass three runs in a row, but 77 of those skip there, so Linux exercises only 2 of them. check_conventions passes.

Head 8be6c1abe8 (main bb04a4f1ea merged; no textual conflict, but main's new RepeatStorageSurface called StorageSurface(context, viewed), which this PR gives a widenArray parameter, so the merge did not build, as the NVIDIA GPU test reported. It now passes false, as CachedStorageSurface, the lookup it repeats, does). Windows, same machine as below: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^agc" -V, 3 runs: 1151 of 1151 pass each time, no missing-layer message; each run logs 18 VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, all from agc_driver_prepared_exports and agc_driver_srgb8_color_target, and main bb04a4f1ea logs the same 18 in those two tests, so this PR adds none. Linux (WSL Ubuntu, GCC, tree reconfigured at this head): builds; ctest -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb, 3 runs: 75 of 75 pass each time, 74 of them skipped (exit 77, no Vulkan driver in WSL), including agc_driver_storage_array_layers. check_conventions passes.

Head 924af40153 (main 81267b2204 merged; the conflict was #8998's UINT storage views for bindings 7 to 13 against this PR's layer window: StorageTexture::StorageView now takes both, (mip, firstLayer, uintStorage, layers), keeps #8998's format choice, and the two storage descriptor writes in ShaderResources.cpp pass #8998's binding test and this PR's layer window). Windows, same machine as below: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb -V, 3 runs: 72 of 72 pass each time, agc_driver_storage_array_layers passes, 0 VUID-, no missing-layer message. Linux (WSL Ubuntu, GCC): builds; agc_driver_storage_array_layers is skipped (exit 77) in 3 runs, no Vulkan driver in WSL. check_conventions passes.

Head e1ee11a812 (main 9c6d153dec merged after #9961 landed; the only conflict was the libSceAgcDriver debt file, where #9961's new sampled-array-window entry is kept and this PR's storage-widening entry follows it; no code conflict). Windows, same machine as below: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb -V, 3 runs: 68 of 69 pass each time, agc_driver_storage_array_layers passes, 0 VUID-, no missing-layer message; the failure is agc_driver_depth_plane_partial_store (#10664), which fails on main too. Linux (WSL): these tests need a Vulkan device and WSL has none, so they skip (exit 77).

Head 09450f2499 (90ac083960 plus a test-only change that prints the base slice in the failure messages; agc_driver_storage_array_layers rerun 3 times at 09450f2499 on Windows with validation: passes, 0 VUID-; on Linux: skipped, exit 77). The set below ran at 90ac083960, on 53e11f112b, same machine as below. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb -V, 3 runs: 68 of 69 pass each time, 0 VUID-, no missing-layer message; the failure is again agc_driver_depth_plane_partial_store, as on main. Linux (WSL Ubuntu, GCC): builds; agc_driver_storage_array_layers, agc_driver_alias_copy_label and agc_driver_dcc_keys_first_write are skipped (exit 77) in 3 runs because WSL has no Vulkan driver. check_conventions passes.

Head 53e11f112b (main 16ff208dc3 merged after #10440 landed; in ShaderResources.cpp the storage descriptor now picks #10440's Atomic64View for 64-bit atomics and passes this PR's layer window to all three views), same machine as below. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane" -V, 3 runs: 53 of 54 pass each time, 0 VUID-, no missing-layer message; the failure is agc_driver_depth_plane_partial_store, which fails the same way on main 16ff208dc3 (1 of 53 failed there, 0 VUID-, no missing-layer message). Linux (WSL Ubuntu, GCC): builds; agc_driver_storage_array_layers is skipped (exit 77) in 3 runs, no Vulkan driver in WSL. check_conventions passes.

Head ec41941094 on main 2dc85609fc, same machine as below. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane" -V, 3 runs: 53 of 54 pass each time, 0 VUID-, no missing-layer message; the failure is again agc_driver_depth_plane_partial_store, as on main. agc_driver_storage_array_layers with only ShaderResources.cpp reverted to cd720c71a4 fails with "the pending image of the 2-layer array holds layers 0..3". Linux (WSL Ubuntu, GCC): builds; agc_driver_storage_array_layers is skipped (exit 77) in 3 runs because WSL has no Vulkan driver. check_conventions passes. The DEATHLOOP flush count below is from cdfc7a986f and was not rerun at this head.

Earlier heads:

Windows 11 Pro 26200, AMD Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver 616.64), WinLibs GCC, Release. Head cd720c71a4 on main 2dc85609fc.

  • ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane" -V, 3 runs at cd720c71a4: 53 of 54 pass each time, 0 VUID-, no missing-layer message. The failure is agc_driver_depth_plane_partial_store ("repeated lookups of the first layer of an unchanged array proved no refresh"), which fails the same way on main 2fade7ef4e on this machine. On that main the same set also fails agc_driver_storage_array_layers, and logs 0 VUID-.
  • Full ctest at cdfc7a986f (before the allocation bound): 2182 tests; failures agc_driver_depth_plane_partial_store and agc_host_import_cut_lifetime (both fail the same way on main 2fade7ef4e here) and select_tests (a temp-directory symlink error in tools/tests/test_select_tests.py).
  • tools/check_conventions.py --base origin/main: passes.
  • Linux (WSL Ubuntu, GCC, same checkout) at cd720c71a4: builds; agc_driver_storage_array_layers is skipped (exit 77) in 3 runs because WSL has no Vulkan driver, so the GPU path is covered only by the Windows runs.

DEATHLOOP (PPSA01670), same machine, behaviour count only (no speed or traffic claim). main cannot reach this scene yet, so both builds are main + #10414 + #10507 + a port of #6192, one without and one with this PR: base fa00d49312, change d26dce2835 (this PR's head cdfc7a986f cherry-picked). Same scripted input (PSN dialog and brightness calibration screens), run with APS5_TRACE_FLUSH=1: the base build logs about 1050 storage refresh flushes of each of the four overlapping images of the 0x26a7200000 array in that flush log; the change logs none for it. What remains comes from 2D T#s at the address of each slice of a 2-layer array that the title also reads as an array (in the debt entry). Alternated base/change captures showed no frame-time difference beyond run-to-run noise, so this PR makes no performance claim.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #7085, #8707, #10049, #9508, #10193, #13920, #13928, #13929, #14868, #15710, #15741 (merge order only: they edit the same lines; this PR is refreshed after them; #10440 and #9961 have merged; #13796 goes after this PR); #8887 and #12246 have merged
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 Pro 26200
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4998867077 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-24T20:28:05Z. --- ### What A compute shader that writes one layer of a 2D array at a time, through a T# with `BASE_ARRAY = LAST_ARRAY = N`, made a separate storage image per layer: the lookup of layer N built an image of layers 0..N (the T# names N as its last layer, not the array size). The images overlap, so every dispatch flushed the previous one's pending results and uploaded its own again (`storage refresh` write-backs). DEATHLOOP (PPSA01670) does this every frame on a 960x540 4-layer array. - `StorageArraySurface` (in `StorageSurface`): a storage view of a thin 2D array without DCC, FMASK/CMASK or MSAA is served by one image of slices 0 to the largest last slice any view of that surface has named, the way `StorageSurface` already widens mip chains. It falls back to the view itself when the widened geometry would move the viewed slices. - When a wider image is created, the narrower images of the same surface are evicted (flushed) so two pending images never hold the same slice. - A widened lookup refreshes only the viewed slices (`RefreshLayers`). The binding gets a view of those slices: `StorageView`, `AtomicView`, `Atomic64View`, `View` and `FirstLayerView` take a layer window, and their view caches are keyed by it. A write marks only those slices dirty (`MarkSliceDirty`); a write through a 2D shape marks only the window's first slice. - `agc_driver_storage_array_layers`: three rounds of per-layer `image_store`s into a 4-layer array. After the first round one pending image holds all four layers, later rounds reuse it, and every layer holds its own values after the flush. It then registers the same address again as a 2-layer allocation and repeats the rounds there: the pending image holds layers 0..1, not the 0..3 of the earlier array, and layers 2 and 3 stay untouched. Before that it repeats the rounds as a 2-layer array at the same address without touching the allocation (same `backingSerial`), with the same expectations. Last, it extends a storage mip chain (which switches `StorageSurface` to its locked path) and repeats the rounds on another array. On `main` it fails with the pending image of the 4-layer array not holding every layer; on `cdfc7a986f` it fails with "the pending image of the 2-layer array holds layers 0..3", and on `cd720c71a4` it fails the same way in the unchanged-allocation case. - The largest slice is kept per surface key only while the registered guest range holding the base keeps its backing (`backingSerial`, renewed by a new mapping or a protection change), and a view is widened only when the wider image ends inside that range; memory in no registered range is never widened. - Only a view that names the largest slice creates the wider image. A view whose remembered largest slice lies past its own last slice uses a cached image of more slices if there is one, and otherwise creates an image of only slices 0 to its own last, so a new image never uploads slices the view's T# does not name. - Copies, resolves and color targets (`CachedStorageSurface`, `CachedStorageLayers`) are never widened: `AliasCopy` builds its destination with `CachedStorageSurface` and refuses a copy whose shapes differ, so a widened image there threw "an image copy its check allowed was refused: shape" (found by ahmadmuj). `agc_driver_storage_array_layers` now also stores into all four layers and then asks both for layers 0..1 at the same address; with `ShaderResources.cpp` at `53e11f112b` it fails with "a copy destination of layers 0..1 got layers 0..3". - Debt entry: a shorter array the title places at the same address inside the same mapping shares the longer image only while that image is cached; a 2D T# at the address of a later slice is still a separate image. Related: #6202 refreshes only the layers a color target covers; this PR is about storage writes and does not touch the color-target path. ### Tested - Head `6d750b25ad` (`main` `b611e634f7` merged; the conflict was #15741's storage descriptor writes in `ShaderResources.cpp`, which now pick UINT storage views with `ShaderRecompiler::RuntimeAbi::UintStorageImageBinding(binding.layout.binding)` instead of the binding 7 to 13 range test. Both writes keep that call and pass this PR's `storageLayers[index]` to `Atomic64View`, `AtomicView` and `StorageView`). Windows, same machine as below: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^agc.*(array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer|clear_hand)" -E usb -V`, 3 runs: 96 of 96 pass each time, including `agc_driver_storage_array_layers`, 0 `VUID-`, no missing-layer message. Linux (WSL Ubuntu, GCC, tree reconfigured at this head): `libs` and the tests build; the same `ctest` set, 3 runs: 94 of 94 pass each time, 92 of them skipped (exit 77, no Vulkan driver in WSL). `check_conventions` passes. - Head `72ac10a202` (`main` `1c8c0efc8c` merged; the conflict was in `cachedStorageTexture`, where `main` (#14868) now detaches a storage image whose metadata moved and hands it to `StorageTexture::PrepareCreation` instead of flushing it. The merge keeps this PR's layer-narrowing lookup and widening eviction, detaches as `main` does, and hands over only an image detached at the key that is finally created: one detached at a wider key, or before narrower images are evicted for widening, is flushed first, as this PR did before). Windows, same machine as below: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^agc.*(array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer|clear_hand)" -E usb -V`, 3 runs: 90 of 90 pass each time, including `agc_driver_storage_array_layers` and `agc_storage_clear_hand_over`, 0 `VUID-`, no missing-layer message. Linux (WSL Ubuntu, GCC): `libs` and `agc_driver_storage_array_layers_tests` build; the test is skipped (exit 77), no Vulkan driver in WSL. `check_conventions` passes. - Head `7d2be0318b`: `main` was merged in, with #8887 and #12246. `Texture.hpp` keeps `appendStoredLayers` from `main` next to this PR's `createView(..., LayerWindow layers = {})`; the debt file keeps both the 1D-array entry and the storage array widening entry. The 81 focused AGC tests (`^agc.*(array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer)`) pass three runs in a row on Windows (MinGW, GCC 15.2) with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: no `VUID-` errors and the layer was found. On Linux (WSL, GCC) they build and 79 pass three runs in a row, but 77 of those skip there, so Linux exercises only 2 of them. `check_conventions` passes. Head `8be6c1abe8` (`main` `bb04a4f1ea` merged; no textual conflict, but `main`'s new `RepeatStorageSurface` called `StorageSurface(context, viewed)`, which this PR gives a `widenArray` parameter, so the merge did not build, as the NVIDIA GPU test reported. It now passes `false`, as `CachedStorageSurface`, the lookup it repeats, does). Windows, same machine as below: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^agc" -V`, 3 runs: 1151 of 1151 pass each time, no missing-layer message; each run logs 18 `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605`, all from `agc_driver_prepared_exports` and `agc_driver_srgb8_color_target`, and `main` `bb04a4f1ea` logs the same 18 in those two tests, so this PR adds none. Linux (WSL Ubuntu, GCC, tree reconfigured at this head): builds; `ctest -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb`, 3 runs: 75 of 75 pass each time, 74 of them skipped (exit 77, no Vulkan driver in WSL), including `agc_driver_storage_array_layers`. `check_conventions` passes. Head `924af40153` (`main` `81267b2204` merged; the conflict was #8998's UINT storage views for bindings 7 to 13 against this PR's layer window: `StorageTexture::StorageView` now takes both, `(mip, firstLayer, uintStorage, layers)`, keeps #8998's format choice, and the two storage descriptor writes in `ShaderResources.cpp` pass #8998's binding test and this PR's layer window). Windows, same machine as below: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb -V`, 3 runs: 72 of 72 pass each time, `agc_driver_storage_array_layers` passes, 0 `VUID-`, no missing-layer message. Linux (WSL Ubuntu, GCC): builds; `agc_driver_storage_array_layers` is skipped (exit 77) in 3 runs, no Vulkan driver in WSL. `check_conventions` passes. Head `e1ee11a812` (`main` `9c6d153dec` merged after #9961 landed; the only conflict was the libSceAgcDriver debt file, where #9961's new sampled-array-window entry is kept and this PR's storage-widening entry follows it; no code conflict). Windows, same machine as below: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb -V`, 3 runs: 68 of 69 pass each time, `agc_driver_storage_array_layers` passes, 0 `VUID-`, no missing-layer message; the failure is `agc_driver_depth_plane_partial_store` (#10664), which fails on `main` too. Linux (WSL): these tests need a Vulkan device and WSL has none, so they skip (exit 77). Head `09450f2499` (`90ac083960` plus a test-only change that prints the base slice in the failure messages; `agc_driver_storage_array_layers` rerun 3 times at `09450f2499` on Windows with validation: passes, 0 `VUID-`; on Linux: skipped, exit 77). The set below ran at `90ac083960`, on `53e11f112b`, same machine as below. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer" -E usb -V`, 3 runs: 68 of 69 pass each time, 0 `VUID-`, no missing-layer message; the failure is again `agc_driver_depth_plane_partial_store`, as on `main`. Linux (WSL Ubuntu, GCC): builds; `agc_driver_storage_array_layers`, `agc_driver_alias_copy_label` and `agc_driver_dcc_keys_first_write` are skipped (exit 77) in 3 runs because WSL has no Vulkan driver. `check_conventions` passes. Head `53e11f112b` (`main` `16ff208dc3` merged after #10440 landed; in `ShaderResources.cpp` the storage descriptor now picks #10440's `Atomic64View` for 64-bit atomics and passes this PR's layer window to all three views), same machine as below. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane" -V`, 3 runs: 53 of 54 pass each time, 0 `VUID-`, no missing-layer message; the failure is `agc_driver_depth_plane_partial_store`, which fails the same way on `main` `16ff208dc3` (1 of 53 failed there, 0 `VUID-`, no missing-layer message). Linux (WSL Ubuntu, GCC): builds; `agc_driver_storage_array_layers` is skipped (exit 77) in 3 runs, no Vulkan driver in WSL. `check_conventions` passes. Head `ec41941094` on `main` `2dc85609fc`, same machine as below. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane" -V`, 3 runs: 53 of 54 pass each time, 0 `VUID-`, no missing-layer message; the failure is again `agc_driver_depth_plane_partial_store`, as on `main`. `agc_driver_storage_array_layers` with only `ShaderResources.cpp` reverted to `cd720c71a4` fails with "the pending image of the 2-layer array holds layers 0..3". Linux (WSL Ubuntu, GCC): builds; `agc_driver_storage_array_layers` is skipped (exit 77) in 3 runs because WSL has no Vulkan driver. `check_conventions` passes. The DEATHLOOP flush count below is from `cdfc7a986f` and was not rerun at this head. Earlier heads: Windows 11 Pro 26200, AMD Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver 616.64), WinLibs GCC, Release. Head `cd720c71a4` on `main` `2dc85609fc`. - `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "array_layer|image_store|storage|depth_plane" -V`, 3 runs at `cd720c71a4`: 53 of 54 pass each time, 0 `VUID-`, no missing-layer message. The failure is `agc_driver_depth_plane_partial_store` ("repeated lookups of the first layer of an unchanged array proved no refresh"), which fails the same way on `main` `2fade7ef4e` on this machine. On that `main` the same set also fails `agc_driver_storage_array_layers`, and logs 0 `VUID-`. - Full `ctest` at `cdfc7a986f` (before the allocation bound): 2182 tests; failures `agc_driver_depth_plane_partial_store` and `agc_host_import_cut_lifetime` (both fail the same way on `main` `2fade7ef4e` here) and `select_tests` (a temp-directory symlink error in `tools/tests/test_select_tests.py`). - `tools/check_conventions.py --base origin/main`: passes. - Linux (WSL Ubuntu, GCC, same checkout) at `cd720c71a4`: builds; `agc_driver_storage_array_layers` is skipped (exit 77) in 3 runs because WSL has no Vulkan driver, so the GPU path is covered only by the Windows runs. **DEATHLOOP (PPSA01670)**, same machine, behaviour count only (no speed or traffic claim). `main` cannot reach this scene yet, so both builds are `main` + #10414 + #10507 + a port of #6192, one without and one with this PR: base `fa00d49312`, change `d26dce2835` (this PR's head `cdfc7a986f` cherry-picked). Same scripted input (PSN dialog and brightness calibration screens), run with `APS5_TRACE_FLUSH=1`: the base build logs about 1050 `storage refresh` flushes of each of the four overlapping images of the 0x26a7200000 array in that flush log; the change logs none for it. What remains comes from 2D T#s at the address of each slice of a 2-layer array that the title also reads as an array (in the debt entry). Alternated base/change captures showed no frame-time difference beyond run-to-run noise, so this PR makes no performance claim. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #7085, #8707, #10049, #9508, #10193, #13920, #13928, #13929, #14868, #15710, #15741 (merge order only: they edit the same lines; this PR is refreshed after them; #10440 and #9961 have merged; #13796 goes after this PR); #8887 and #12246 have merged - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 Pro 26200 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-24 20:30:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T20:30:06Z.

Review: CHANGES_REQUESTED


Reviewed exact head 636ef21f8a724030a06c91473ed926508b5656ce. I found a deadlock when this feature is combined with the existing extended-mip tracking. StorageSurface takes surfaces.mutex at the std::lock_guard below the surfaces.any fast path, then its final return calls StorageArraySurface; for a 2D-array resource, StorageArraySurface takes the same non-recursive AgcDriver::Mutex again to update lastLayers. This occurs immediately for an extended 2D-array request, and for any array request after surfaces.any becomes true, so a game that uses extended mip chains before storage arrays can hang on its next array lookup. Please release the outer lock before calling StorageArraySurface (or refactor the state update so it takes the lock only once) and add a regression that first establishes an extended mip chain, then resolves a 2D-array storage view. Separately, the performance captures are not attached; CONTRIBUTING.md requires the traces alongside the summaries. I cannot approve until the deadlock is fixed and the documented performance-evidence requirement is met or the speed claim/perf classification is removed. Hosted policy checks pass; product jobs were skipped, so I have not independently run the GPU tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5639840373 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5639840373). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T20:30:06Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `636ef21f8a724030a06c91473ed926508b5656ce`. I found a deadlock when this feature is combined with the existing extended-mip tracking. `StorageSurface` takes `surfaces.mutex` at the `std::lock_guard` below the `surfaces.any` fast path, then its final return calls `StorageArraySurface`; for a 2D-array resource, `StorageArraySurface` takes the same non-recursive `AgcDriver::Mutex` again to update `lastLayers`. This occurs immediately for an extended 2D-array request, and for any array request after `surfaces.any` becomes true, so a game that uses extended mip chains before storage arrays can hang on its next array lookup. Please release the outer lock before calling `StorageArraySurface` (or refactor the state update so it takes the lock only once) and add a regression that first establishes an extended mip chain, then resolves a 2D-array storage view. Separately, the performance captures are not attached; CONTRIBUTING.md requires the traces alongside the summaries. I cannot approve until the deadlock is fixed and the documented performance-evidence requirement is met or the speed claim/perf classification is removed. Hosted policy checks pass; product jobs were skipped, so I have not independently run the GPU tests.
MarcZX10 commented 2026-10-24 20:45:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T20:45:47Z.

Review: CHANGES_REQUESTED


The new lock scope fixes the recursive acquisition I reported, and the regression now establishes an extended mip chain before looking up an array storage view. Thanks for addressing that path.

I found a separate lifetime/bounds issue in lastLayers. Its key is computed after setting baseArray and depthOrLastArray to zero, and the map is never invalidated. If guest memory is later reused at the same address for a shorter array with otherwise matching surface properties, this entry widens the new descriptor back to the largest layer seen in the earlier allocation. cachedStorageTexture then discards the caller's guestBytes for a widened resource and derives the larger byte range from DescribeSurface, so the stale layer count is used for image creation and memory access. The new debt entry describes this as reading past the new array.

Please bound widening to the currently valid guest allocation or track/invalidate the state with the allocation lifetime, and add a regression that reuses an address for a shorter array after a larger array. I cannot approve a path that knowingly expands a later storage view beyond its current allocation.

The PR still has the perf label, and the performance traces are not attached (Tested says they can be shared on request). Please attach the six traces required by the performance report rule, or remove the perf classification and the unverified title-performance claim if those measurements are not part of this PR's evidence. I did not run the Vulkan tests locally; the Windows GPU results in Tested are author-reported, and hosted product jobs were skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5639933011 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5639933011). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T20:45:47Z. **Review:** CHANGES_REQUESTED --- The new lock scope fixes the recursive acquisition I reported, and the regression now establishes an extended mip chain before looking up an array storage view. Thanks for addressing that path. I found a separate lifetime/bounds issue in `lastLayers`. Its key is computed after setting `baseArray` and `depthOrLastArray` to zero, and the map is never invalidated. If guest memory is later reused at the same address for a shorter array with otherwise matching surface properties, this entry widens the new descriptor back to the largest layer seen in the earlier allocation. `cachedStorageTexture` then discards the caller's `guestBytes` for a widened resource and derives the larger byte range from `DescribeSurface`, so the stale layer count is used for image creation and memory access. The new debt entry describes this as reading past the new array. Please bound widening to the currently valid guest allocation or track/invalidate the state with the allocation lifetime, and add a regression that reuses an address for a shorter array after a larger array. I cannot approve a path that knowingly expands a later storage view beyond its current allocation. The PR still has the `perf` label, and the performance traces are not attached (`Tested` says they can be shared on request). Please attach the six traces required by the performance report rule, or remove the `perf` classification and the unverified title-performance claim if those measurements are not part of this PR's evidence. I did not run the Vulkan tests locally; the Windows GPU results in `Tested` are author-reported, and hosted product jobs were skipped.
MarcZX10 commented 2026-10-24 22:54:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T22:54:31Z.

Review: CHANGES_REQUESTED


Reviewed the updated exact head cd720c71a4b4e709b11e6dcd55885ccec0d8fd39. Tying lastLayers to backingSerial and checking the mapped range are useful: the new re-registration case changes the backing serial and correctly resets the remembered layer count. One stale-resource case remains untested and still crosses the logical surface extent:

  • GuestAllocations::Range::backingSerial identifies a registered backing range, not a texture's logical lifetime. The debt entry now explicitly records that a shorter array placed at the same address inside the same mapping still widens to the prior maximum. In that case the remembered lastLayers survives because backingSerial is unchanged.
  • This affects actual guest reads: cachedStorageTexture clears guestBytes when the resource is widened, and StorageTexture::Create calls upload() for the full widened descriptor. So a 2-layer descriptor can upload 4 layers of bytes from the same backing range after a prior 4-layer descriptor, even though only the first two belong to the current texture. The new regression removes and re-adds the allocation, which assigns a new backing serial; it does not cover reuse within the same range.

Please invalidate or constrain the remembered width when a logical surface is reused within an unchanged backing range, and add a regression that preserves the backing serial while changing the same-address surface from four layers to two. If the emulator cannot observe that logical lifetime, please avoid widening in that ambiguous case so the upload stays within the requested descriptor's extent. The separate performance-evidence requirement also remains: the PR is titled perf(...), but the six referenced traces are not attached. CONTRIBUTING requires attaching the captures; please attach them and the trace_digest.py output, or remove the perf title/classification and the storage-traffic performance claim. I did not run the GPU test locally; current PR product jobs are skipped by policy, so the posted hardware results are author-reported.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640434986 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5640434986). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T22:54:31Z. **Review:** CHANGES_REQUESTED --- Reviewed the updated exact head `cd720c71a4b4e709b11e6dcd55885ccec0d8fd39`. Tying `lastLayers` to `backingSerial` and checking the mapped range are useful: the new re-registration case changes the backing serial and correctly resets the remembered layer count. One stale-resource case remains untested and still crosses the logical surface extent: - `GuestAllocations::Range::backingSerial` identifies a registered backing range, not a texture's logical lifetime. The debt entry now explicitly records that a shorter array placed at the same address inside the same mapping still widens to the prior maximum. In that case the remembered `lastLayers` survives because `backingSerial` is unchanged. - This affects actual guest reads: `cachedStorageTexture` clears `guestBytes` when the resource is widened, and `StorageTexture::Create` calls `upload()` for the full widened descriptor. So a 2-layer descriptor can upload 4 layers of bytes from the same backing range after a prior 4-layer descriptor, even though only the first two belong to the current texture. The new regression removes and re-adds the allocation, which assigns a new backing serial; it does not cover reuse within the same range. Please invalidate or constrain the remembered width when a logical surface is reused within an unchanged backing range, and add a regression that preserves the backing serial while changing the same-address surface from four layers to two. If the emulator cannot observe that logical lifetime, please avoid widening in that ambiguous case so the upload stays within the requested descriptor's extent. The separate performance-evidence requirement also remains: the PR is titled `perf(...)`, but the six referenced traces are not attached. CONTRIBUTING requires attaching the captures; please attach them and the `trace_digest.py` output, or remove the `perf` title/classification and the storage-traffic performance claim. I did not run the GPU test locally; current PR product jobs are skipped by policy, so the posted hardware results are author-reported.
MarcZX10 commented 2026-10-25 04:19:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T04:19:18Z.

Review: APPROVED


Reviewed exact head ec4194109429e476dfe29412a9658e6fb6501118. The latest change fixes the remaining same-mapping shorter-array case: a shorter view now reuses a larger cached image only when one already exists, and does not create a widened image from that shorter view. The regression repeats the two-layer case at the same address and backing serial after a four-layer case, asserting layers 2–3 remain untouched; the author reports that reverting the relevant lookup change reproduces the failure. The earlier extended-mip lock ordering and re-registration checks remain in the test sequence. The PR removed its perf classification and time-improvement claim because its captures showed no measurable frame-time difference. I ran tools/check_conventions.py --base upstream/main --head HEAD and git diff upstream/main...HEAD --check; both pass. Product GPU tests are skipped by hosted PR workflow policy, and I could not run them locally because the checkout has no populated third-party submodules. The remaining behavior and coverage limits are documented in the debt entry.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641469497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5641469497). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T04:19:18Z. **Review:** APPROVED --- Reviewed exact head `ec4194109429e476dfe29412a9658e6fb6501118`. The latest change fixes the remaining same-mapping shorter-array case: a shorter view now reuses a larger cached image only when one already exists, and does not create a widened image from that shorter view. The regression repeats the two-layer case at the same address and backing serial after a four-layer case, asserting layers 2–3 remain untouched; the author reports that reverting the relevant lookup change reproduces the failure. The earlier extended-mip lock ordering and re-registration checks remain in the test sequence. The PR removed its `perf` classification and time-improvement claim because its captures showed no measurable frame-time difference. I ran `tools/check_conventions.py --base upstream/main --head HEAD` and `git diff upstream/main...HEAD --check`; both pass. Product GPU tests are skipped by hosted PR workflow policy, and I could not run them locally because the checkout has no populated third-party submodules. The remaining behavior and coverage limits are documented in the debt entry.
ahmadmuj commented 2026-10-25 16:23:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T16:23:03Z.

Review: COMMENTED


Reviewed head 53e11f112b1d, merged locally onto current main 0119103fa9ed (clean). Linux, lavapipe, GCC Release, targeted build.

What I ran:

  • array_layer|image_store|storage|depth_plane|image_atomic|image_table with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: merge 63/63 pass, main 62/62 pass. Same skip on both (agc_storage_clear_hand_over). The only VUID on either side is VUID-VkDeviceCreateInfo-pNext-pNext from my older local layer.
  • agc_driver_storage_array_layers runs on lavapipe (no skip) and passes. Dropped onto main's code it fails with "the pending image of the 4-layer array holds layers 0..3" (base slice is 3 there, so the message reads a bit off, but the red is real).
  • The buildComplete merge resolution: both sites pass storageLayers[index] to Atomic64View, AtomicView and StorageView, storageLayers is pushed in step at all three push sites, and atomicViews is keyed by format now. Looks right to me. agc_driver_image_atomics64 passes, but it uses a Type2D image, so nothing runs a 64-bit atomic through a widened window yet.

CachedStorageSurface can now return an image with more slices than asked for, and AliasCopy throws on that.

AliasCopy (VulkanDevice.cpp:2799) creates the destination image with CachedStorageSurface(from->Descriptor() at destination), then calls CopyFrom. If SameSurfaceShape fails there, it throws "an image copy its check allowed was refused: shape" (:2803). With this PR, CachedStorageSurface goes through StorageArraySurface. So if a storage view at the destination already named a later slice (same backingSerial), the lookup widens, and the step-down loop (ShaderResources.cpp:1286) returns the cached wider image.

Example, a local probe built from your test's helpers (not for this PR): StoreLayer into all 4 layers of the 128x128 R32_UINT array at A, then a 2-layer array image at B, then CachedStorageSurface with B's descriptor moved to A:

  • this PR: returns the 0..3 image, SameSurfaceShape false, CopyRefusal = shape
  • main: returns a 0..1 image, SameSurfaceShape true, CopyRefusal = none

PlanAlias doesn't catch it, because FindLive(destination, bytes) matches on guestBytes and the 0..3 image is bigger. So the plan passes and the throw comes from CopyFrom. I didn't drive a full DMA copy through AliasCopy, so the throw itself is from reading. The layout is the one your debt entry describes (a shorter array at the same address inside the same mapping).

One way out: keep CachedStorageSurface exact (no array widening for it). Another: have AliasCopy treat a shape mismatch after the lookup like copyAliasShape and take the transfer path. The Draw.cpp callers of CachedStorageSurface may also expect the exact shape; I didn't check those.

Limits: lavapipe only, synthetic tests, no DEATHLOOP dump.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644114154 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5644114154). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T16:23:03Z. **Review:** COMMENTED --- Reviewed head `53e11f112b1d`, merged locally onto current main `0119103fa9ed` (clean). Linux, lavapipe, GCC Release, targeted build. What I ran: - `array_layer|image_store|storage|depth_plane|image_atomic|image_table` with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: merge 63/63 pass, main 62/62 pass. Same skip on both (`agc_storage_clear_hand_over`). The only VUID on either side is `VUID-VkDeviceCreateInfo-pNext-pNext` from my older local layer. - `agc_driver_storage_array_layers` runs on lavapipe (no skip) and passes. Dropped onto main's code it fails with "the pending image of the 4-layer array holds layers 0..3" (base slice is 3 there, so the message reads a bit off, but the red is real). - The `buildComplete` merge resolution: both sites pass `storageLayers[index]` to `Atomic64View`, `AtomicView` and `StorageView`, `storageLayers` is pushed in step at all three push sites, and `atomicViews` is keyed by format now. Looks right to me. `agc_driver_image_atomics64` passes, but it uses a Type2D image, so nothing runs a 64-bit atomic through a widened window yet. **`CachedStorageSurface` can now return an image with more slices than asked for, and `AliasCopy` throws on that.** `AliasCopy` (`VulkanDevice.cpp:2799`) creates the destination image with `CachedStorageSurface(from->Descriptor() at destination)`, then calls `CopyFrom`. If `SameSurfaceShape` fails there, it throws "an image copy its check allowed was refused: shape" (`:2803`). With this PR, `CachedStorageSurface` goes through `StorageArraySurface`. So if a storage view at the destination already named a later slice (same `backingSerial`), the lookup widens, and the step-down loop (`ShaderResources.cpp:1286`) returns the cached wider image. Example, a local probe built from your test's helpers (not for this PR): `StoreLayer` into all 4 layers of the 128x128 R32_UINT array at A, then a 2-layer array image at B, then `CachedStorageSurface` with B's descriptor moved to A: - this PR: returns the 0..3 image, `SameSurfaceShape` false, `CopyRefusal` = `shape` - main: returns a 0..1 image, `SameSurfaceShape` true, `CopyRefusal` = none `PlanAlias` doesn't catch it, because `FindLive(destination, bytes)` matches on `guestBytes` and the 0..3 image is bigger. So the plan passes and the throw comes from `CopyFrom`. I didn't drive a full DMA copy through `AliasCopy`, so the throw itself is from reading. The layout is the one your debt entry describes (a shorter array at the same address inside the same mapping). One way out: keep `CachedStorageSurface` exact (no array widening for it). Another: have `AliasCopy` treat a shape mismatch after the lookup like `copyAliasShape` and take the transfer path. The `Draw.cpp` callers of `CachedStorageSurface` may also expect the exact shape; I didn't check those. Limits: lavapipe only, synthetic tests, no DEATHLOOP dump.
ahmadmuj commented 2026-10-25 17:37:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T17:37:17Z.

Review: APPROVED


Re-checked head 09450f2499a5, merged locally onto current main 2e1c72239b23 (clean). Linux, lavapipe, GCC Release, targeted build.

  • My probe from the last review, rerun: after the per-layer stores leave a 0..3 image at A, CachedStorageSurface for a 2-layer array at A now returns a 0..1 image. SameSurfaceShape is true and CopyRefusal is none, same as main. The per-layer stores still share the one 0..3 image.
  • Red/green: with only 90ac0839's ShaderResources.cpp hunks reverted, agc_driver_storage_array_layers fails with "a copy destination of layers 0..1 got layers 0..3". Restored, it passes.
  • array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: merge 69/69 plus my probe, main 68/68. Same single skip on both (agc_storage_clear_hand_over). alias_copy_label, dcc_keys_first_write and the copied_writer tests run on lavapipe, no skip. The only VUID on either side is VUID-VkDeviceCreateInfo-pNext-pNext from my older local layer.
  • Reading the change: with widenArray=false, StorageSurface keeps the array fields, so the step-down loop never runs and the narrower eviction is skipped. The exact lookups behave like main.

Approving on that evidence. Limits: lavapipe only, synthetic tests, no DEATHLOOP dump, and no full DMA copy through AliasCopy.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644376313 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5644376313). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T17:37:17Z. **Review:** APPROVED --- Re-checked head `09450f2499a5`, merged locally onto current main `2e1c72239b23` (clean). Linux, lavapipe, GCC Release, targeted build. - My probe from the last review, rerun: after the per-layer stores leave a 0..3 image at A, `CachedStorageSurface` for a 2-layer array at A now returns a 0..1 image. `SameSurfaceShape` is true and `CopyRefusal` is none, same as main. The per-layer stores still share the one 0..3 image. - Red/green: with only 90ac0839's `ShaderResources.cpp` hunks reverted, `agc_driver_storage_array_layers` fails with "a copy destination of layers 0..1 got layers 0..3". Restored, it passes. - `array_layer|image_store|storage|depth_plane|image_atomic|image_table|alias_copy|dcc_keys_first_write|copied_writer` with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: merge 69/69 plus my probe, main 68/68. Same single skip on both (`agc_storage_clear_hand_over`). `alias_copy_label`, `dcc_keys_first_write` and the `copied_writer` tests run on lavapipe, no skip. The only VUID on either side is `VUID-VkDeviceCreateInfo-pNext-pNext` from my older local layer. - Reading the change: with `widenArray=false`, `StorageSurface` keeps the array fields, so the step-down loop never runs and the narrower eviction is skipped. The exact lookups behave like main. Approving on that evidence. Limits: lavapipe only, synthetic tests, no DEATHLOOP dump, and no full DMA copy through `AliasCopy`.
MarcZX10 commented 2026-11-20 10:06:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T10:06:26Z.

Review: COMMENTED


Reviewed — no blocking findings

The storage array widening and per-view layer tracking are consistent with the stated goal; no verified blocking defect was found in the inspected changes.

What I ran

Reviewed head 169535353891ac73274c805a00543458f026ef2a. I inspected the prepared description, commit list, manifest and diff, then read the changed lines and targeted storage cache, binding, image view, refresh and dirty tracking code with repo_read.py. I did not run build or test commands.

Results

Check Result Note
Diff and targeted source review passed Changed paths and core behavior inspected
Build and tests not run Author-reported results are not independently verified

Findings

Blocking

None verified.

Non-blocking

None.

Sources

The reviewed changes are in core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp, core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp, core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp, core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp, core/libs/prx/libSceAgcDriver/tests/execution/StorageArrayLayers.cpp, and docs/dev/debt/libSceAgcDriver.md.

Not verified

Builds, tests, Vulkan validation, and runtime behavior were not independently run. The full text of ShaderResources.cpp and Texture.cpp was excluded from the prepared folder; only targeted ranges and changed hunks were read. No files were omitted from the manifest’s reviewed list.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990922219 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10743#pullrequestreview-5990922219). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T10:06:26Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The storage array widening and per-view layer tracking are consistent with the stated goal; no verified blocking defect was found in the inspected changes. ## What I ran Reviewed head `169535353891ac73274c805a00543458f026ef2a`. I inspected the prepared description, commit list, manifest and diff, then read the changed lines and targeted storage cache, binding, image view, refresh and dirty tracking code with `repo_read.py`. I did not run build or test commands. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Changed paths and core behavior inspected | | Build and tests | not run | Author-reported results are not independently verified | ## Findings ### Blocking None verified. ### Non-blocking None. ## Sources The reviewed changes are in `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`, `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`, `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`, `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`, `core/libs/prx/libSceAgcDriver/tests/execution/StorageArrayLayers.cpp`, and `docs/dev/debt/libSceAgcDriver.md`. ## Not verified Builds, tests, Vulkan validation, and runtime behavior were not independently run. The full text of `ShaderResources.cpp` and `Texture.cpp` was excluded from the prepared folder; only targeted ranges and changed hunks were read. No files were omitted from the manifest’s `reviewed` list. ## To get this to a good state Nothing is required.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/10743:upstream-pr/10743'
git switch 'upstream-pr/10743'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/10743'
git switch 'upstream-pr/10743'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/10743'
git switch 'upstream-pr/10743'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/10743'
git switch 'main'
git merge --squash 'upstream-pr/10743'
git switch 'main'
git merge --ff-only 'upstream-pr/10743'
git switch 'main'
git merge 'upstream-pr/10743'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10743
No description provided.