fix(agc): write a single-slice 1D-array T# through a DIM 1D storage binding #25151

Merged
birdmarty merged 1 commit from upstream-pr/25151 into main 2026-11-23 06:00:32 +00:00
birdmarty commented 2026-11-21 17:54:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by birdmarty on 2026-11-21T17:54:06Z.


What

Allow a DIM 1D storage image binding over a single-slice 1D-array T# (BASE_ARRAY == lastArraySlice) by binding a 1D first-layer view of that slice.

Previously, ShaderResources::resolveImageBinding narrowed only a 2D storage binding over a 2D array to its base slice, so a DIM 1D storage binding over a 1D-array T# threw guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5). #23688 handles DIM 1D sampled reads and loads of 1D arrays (measured on gfx1036 to read slice BASE_ARRAY), while stores were not measured. When a 1D array has only one slice (baseArray == depthOrLastArray), a DIM 1D store can only address that slice, so narrowing it to a 1D first-layer view is unambiguous without a multi-slice hardware measurement. A 1D array with more than one slice still throws.

Changes

  • core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp: extend the storage binding's firstLayer check in ShaderResources::resolveImageBinding to accept DescriptorImageShape::Image1D over TextureDimension::k1DArray when resource.baseArray == resource.depthOrLastArray.
  • core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp: allow StorageTexture::createView to create a VK_IMAGE_VIEW_TYPE_1D first-layer view over a k1DArray surface.
  • core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreLineThroughLineArraySlice.cpp: add agc_driver_image_store_line_through_line_array_slice, checking that a DIM 1D image_store through a single-slice 1D-array T# (32_SINT and 32_32_32_32_SINT) writes every texel and leaves trailing bytes untouched, and that the same store through a two-slice 1D array is still refused.
  • docs/dev/debt/changes/fix-agc-1d-array-single-slice-storage.md: document 1D stores to single-slice 1D arrays and that multi-slice 1D arrays remain refused pending hardware measurement.

Tested

Windows 11 Pro (build 26300), Intel Core i9-9900K, MinGW-w64 GCC 15.3.0, Release build with tests, AMD Radeon RX 6800 (vendor 0x1002, device 0x73bf, AMD proprietary driver 26.10.1 / Windows driver 32.0.21045.16010, Vulkan 1.4.315), based on origin/main e60b2f74ad.

Focused AGC image and shader memory tests (^agc_driver_image|^agc_shader_memory$) on main e60b2f74ad and on this branch (1fbeda1ffd), same machine and GPU, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0) and VK_LOADER_DEBUG=layer:

main e60b2f74ad this change (1fbeda1ffd)
Passed / skipped / failed 113 / 2 / 0 (115 total) 114 / 2 / 0 (116 total, adds agc_driver_image_store_line_through_line_array_slice)
Skipped (both) agc_driver_image_array_rows_past_layer_limit, agc_driver_image_array_window_past_layer_limit the same
Insert instance layer "VK_LAYER_KHRONOS_validation" 113 114
Missing validation layer errors 0 0
VUID- lines 0 0
  • Without the fix (main's ShaderResources.cpp and Texture.cpp built with this branch's test): agc_driver_image_store_line_through_line_array_slice fails with AGC graphics: guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5).
  • py -3 tools/check_conventions.py --base origin/main and py -3 tools/debt_fold.py --check: both passed.
  • py -3 tools/pr_overlap.py --branch fix/agc-1d-array-single-slice-storage (2,238 open PRs): 116 share files; among mergeable PRs, only #14871 (feat(shader): flatten oversized 1D image arrays to 2D) touches neighbouring context around firstLayer in ShaderResources.cpp (unrelated). The 49 conflicted PRs could not be compared automatically and were checked by title, with the 11 array/storage/view PRs (#1368, #4448, #6197, #7085, #10743, #13251, #13796, #13809, #13920, #14871, #22018) diff-checked; none implements DIM 1D storage bindings over a single-slice 1D array. (#23688 covers DIM 1D reads only and touches independent code.)

Title test: Forza Horizon 5 (PPSA22327 v01.685.672, same machine): compute shader 0x7f5d100 writes a single-slice 1D-array T# (width 8, format 20, linear, slices 0..0, 1 mip) through a DIM 1D storage binding:

  • Without this change (main e60b2f74ad + #23688 + open PRs): stopped with compute shader 0x7f5d100: AGC graphics: guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5).
  • With this change: 0 storage dimension errors in 110 of 110 runs. The first 5 on this exact commit (1fbeda1ffd, without diagnostics, on main e60b2f74ad + #23688 + #24960 + #24993 + #24994 + #23545 / 4x FMASK) ran 68.5–75.0 s (~909–1,002 frames presented) to a later unrelated stop; the later runs added more open PRs on top, and the first 7 runs used an earlier commit with the same source change.

Not tested: multi-slice 1D arrays (still refused), other GPUs, Linux/macOS host builds, console hardware.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • Fixes: none
  • Unblocks: PPSA22327 #25152
  • GPUs tested: AMD Radeon RX 6800 (vendor=0x1002, device=0x73bf), AMD proprietary driver 26.10.1 (Windows driver 32.0.21045.16010, Vulkan 1.4.315), Windows 11 Pro (build 26300); Khronos validation layer 1.4.363.0 on main and this change, 0 VUIDs
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5430773470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25151). Originally posted by [birdmarty](https://github.com/birdmarty) on 2026-11-21T17:54:06Z. --- ### What Allow a DIM 1D storage image binding over a single-slice 1D-array `T#` (`BASE_ARRAY == lastArraySlice`) by binding a 1D first-layer view of that slice. Previously, `ShaderResources::resolveImageBinding` narrowed only a 2D storage binding over a 2D array to its base slice, so a DIM 1D storage binding over a 1D-array `T#` threw `guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5)`. #23688 handles DIM 1D sampled reads and loads of 1D arrays (measured on gfx1036 to read slice `BASE_ARRAY`), while stores were not measured. When a 1D array has only one slice (`baseArray == depthOrLastArray`), a DIM 1D store can only address that slice, so narrowing it to a 1D first-layer view is unambiguous without a multi-slice hardware measurement. A 1D array with more than one slice still throws. #### Changes - `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`: extend the storage binding's `firstLayer` check in `ShaderResources::resolveImageBinding` to accept `DescriptorImageShape::Image1D` over `TextureDimension::k1DArray` when `resource.baseArray == resource.depthOrLastArray`. - `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`: allow `StorageTexture::createView` to create a `VK_IMAGE_VIEW_TYPE_1D` first-layer view over a `k1DArray` surface. - `core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreLineThroughLineArraySlice.cpp`: add `agc_driver_image_store_line_through_line_array_slice`, checking that a DIM 1D `image_store` through a single-slice 1D-array `T#` (`32_SINT` and `32_32_32_32_SINT`) writes every texel and leaves trailing bytes untouched, and that the same store through a two-slice 1D array is still refused. - `docs/dev/debt/changes/fix-agc-1d-array-single-slice-storage.md`: document `1D stores to single-slice 1D arrays` and that multi-slice 1D arrays remain refused pending hardware measurement. ### Tested Windows 11 Pro (build 26300), Intel Core i9-9900K, MinGW-w64 GCC 15.3.0, Release build with tests, AMD Radeon RX 6800 (vendor `0x1002`, device `0x73bf`, AMD proprietary driver 26.10.1 / Windows driver 32.0.21045.16010, Vulkan 1.4.315), based on `origin/main` e60b2f74ad. Focused AGC image and shader memory tests (`^agc_driver_image|^agc_shader_memory$`) on `main` e60b2f74ad and on this branch (1fbeda1ffd), same machine and GPU, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363.0) and `VK_LOADER_DEBUG=layer`: | | `main` e60b2f74ad | this change (1fbeda1ffd) | |---|---|---| | Passed / skipped / failed | 113 / 2 / 0 (115 total) | 114 / 2 / 0 (116 total, adds `agc_driver_image_store_line_through_line_array_slice`) | | Skipped (both) | `agc_driver_image_array_rows_past_layer_limit`, `agc_driver_image_array_window_past_layer_limit` | the same | | `Insert instance layer "VK_LAYER_KHRONOS_validation"` | 113 | 114 | | Missing validation layer errors | 0 | 0 | | `VUID-` lines | 0 | 0 | - Without the fix (`main`'s `ShaderResources.cpp` and `Texture.cpp` built with this branch's test): `agc_driver_image_store_line_through_line_array_slice` fails with `AGC graphics: guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5)`. - `py -3 tools/check_conventions.py --base origin/main` and `py -3 tools/debt_fold.py --check`: both passed. - `py -3 tools/pr_overlap.py --branch fix/agc-1d-array-single-slice-storage` (2,238 open PRs): 116 share files; among mergeable PRs, only #14871 (`feat(shader): flatten oversized 1D image arrays to 2D`) touches neighbouring context around `firstLayer` in `ShaderResources.cpp` (unrelated). The 49 conflicted PRs could not be compared automatically and were checked by title, with the 11 array/storage/view PRs (#1368, #4448, #6197, #7085, #10743, #13251, #13796, #13809, #13920, #14871, #22018) diff-checked; none implements DIM 1D storage bindings over a single-slice 1D array. (#23688 covers DIM 1D reads only and touches independent code.) Title test: Forza Horizon 5 (PPSA22327 v01.685.672, same machine): compute shader `0x7f5d100` writes a single-slice 1D-array `T#` (width 8, format 20, linear, slices 0..0, 1 mip) through a DIM 1D storage binding: - Without this change (`main` e60b2f74ad + #23688 + open PRs): stopped with `compute shader 0x7f5d100: AGC graphics: guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5)`. - With this change: 0 storage dimension errors in 110 of 110 runs. The first 5 on this exact commit (1fbeda1ffd, without diagnostics, on `main` e60b2f74ad + #23688 + #24960 + #24993 + #24994 + #23545 / 4x FMASK) ran 68.5–75.0 s (~909–1,002 frames presented) to a later unrelated stop; the later runs added more open PRs on top, and the first 7 runs used an earlier commit with the same source change. Not tested: multi-slice 1D arrays (still refused), other GPUs, Linux/macOS host builds, console hardware. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: none - [x] Unblocks: PPSA22327 #25152 - [x] GPUs tested: AMD Radeon RX 6800 (vendor=0x1002, device=0x73bf), AMD proprietary driver 26.10.1 (Windows driver 32.0.21045.16010, Vulkan 1.4.315), Windows 11 Pro (build 26300); Khronos validation layer 1.4.363.0 on `main` and this change, 0 VUIDs - [x] AI-assisted: yes
MarcZX10 commented 2026-11-22 07:24:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:24:20Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 1fbeda1ffd8be8c4e5eda298a8a8e7e12877dbb7. I did not run commands or tests; the test results below are author-reported. I read the changed lines in ShaderResources.cpp, Texture.cpp, ImageStoreLineThroughLineArraySlice.cpp, and fix-agc-1d-array-single-slice-storage.md, plus the storage-view call sites in ShaderResources.cpp and Texture.cpp.

Results

Check Result Note
Source review passed No concrete defect found in the reviewed changes.
Focused tests not run The reported RX 6800 results were not independently verified.
Console behavior not run The reported Forza Horizon 5 runs were not independently verified.

Negative control

Not run by me. The description reports that the new test failed against the unmodified implementation with a dimension mismatch.

Findings

Blocking

None.

Non-blocking

None.

Sources

The change permits first-layer storage views for a 1D array only when its base and last slices are equal, and selects a 1D Vulkan view for that case. The storage binding path carries this flag into view selection. ShaderResources.cpp at the reviewed head · Texture.cpp at the reviewed head

Not verified

I did not independently run the build, focused tests, convention checks, debt check, or title test. Other GPUs, host operating systems, console hardware, and multi-slice DIM 1D stores were not verified. All four changed files were reviewed; ShaderResources.cpp and Texture.cpp were read through the pinned repository reader because their full text was excluded from the review folder. No changed files were excluded from review.

To get this to a good state

Nothing is required. Optional: independently run the focused tests and confirm the reported hardware behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011038228 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25151#pullrequestreview-6011038228). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T07:24:20Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Reviewed head `1fbeda1ffd8be8c4e5eda298a8a8e7e12877dbb7`. I did not run commands or tests; the test results below are author-reported. I read the changed lines in `ShaderResources.cpp`, `Texture.cpp`, `ImageStoreLineThroughLineArraySlice.cpp`, and `fix-agc-1d-array-single-slice-storage.md`, plus the storage-view call sites in `ShaderResources.cpp` and `Texture.cpp`. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | No concrete defect found in the reviewed changes. | | Focused tests | not run | The reported RX 6800 results were not independently verified. | | Console behavior | not run | The reported Forza Horizon 5 runs were not independently verified. | ## Negative control Not run by me. The description reports that the new test failed against the unmodified implementation with a dimension mismatch. ## Findings ### Blocking None. ### Non-blocking None. ## Sources The change permits first-layer storage views for a 1D array only when its base and last slices are equal, and selects a 1D Vulkan view for that case. The storage binding path carries this flag into view selection. [ShaderResources.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/1fbeda1ffd8be8c4e5eda298a8a8e7e12877dbb7/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L6099-L6100) · [Texture.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/1fbeda1ffd8be8c4e5eda298a8a8e7e12877dbb7/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L2275-L2289) ## Not verified I did not independently run the build, focused tests, convention checks, debt check, or title test. Other GPUs, host operating systems, console hardware, and multi-slice DIM 1D stores were not verified. All four changed files were reviewed; `ShaderResources.cpp` and `Texture.cpp` were read through the pinned repository reader because their full text was excluded from the review folder. No changed files were excluded from review. ## To get this to a good state Nothing is required. Optional: independently run the focused tests and confirm the reported hardware behavior.
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!25151
No description provided.