fix(agc): bind a 2D storage access to a 2D array surface as its first layer #131

Merged
oneandonlydean merged 1 commit from upstream-pr/131 into main 2026-10-01 07:40:21 +00:00
oneandonlydean commented 2026-09-29 00:33:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T00:33:13Z.


What

A compute shader that addresses an image with MIMG DIM 2D over a T# of type 2D array was refused with "guest storage texture dimension disagrees with the shader's declared image shape". That access has no slice coordinate, so the hardware reads and writes slice 0 of the resource view, which is the surface's BASE_ARRAY layer.

The storage element is now bound through a 2D view of that one layer of the surface's shared storage image. StorageTexture::FirstLayerView creates it on demand for each mip, caches it, and releases it with the image. The storage image cache key already includes BASE_ARRAY and the dimension, so the layer is always the descriptor's own. Every other shape/dimension mismatch, sampled or storage, still throws. Both messages now name the shape and the dimension.

The recorder test device now sets formatProperties, which a StorageTexture needs to pick its Vulkan format. No test on main had built one yet.

This PR and the MIN_LOD PR (feat/agc-texture-min-lod) add the same SampleLod.comp test shader, the same CMake rule and the same SampleProgram test helper. Whichever merges second hits a small conflict in tests/Recorder.cpp next to the helper, where the two test functions sit side by side.

Tested

  • Linux (CachyOS, RADV): agc_driver_recorder_tests gets firstLayerViewTests. It fills three layers of a linear 2D array surface with different values, builds its storage image with BASE_ARRAY 1, samples FirstLayerView(0) and checks it reads layer 1. It also checks the view is reused. Main has no such view, so the test doesn't build there.
  • ctest: 57/57 pass.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4670963251 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/131). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-29T00:33:13Z. --- ### What A compute shader that addresses an image with MIMG DIM 2D over a T# of type 2D array was refused with "guest storage texture dimension disagrees with the shader's declared image shape". That access has no slice coordinate, so the hardware reads and writes slice 0 of the resource view, which is the surface's BASE_ARRAY layer. The storage element is now bound through a 2D view of that one layer of the surface's shared storage image. `StorageTexture::FirstLayerView` creates it on demand for each mip, caches it, and releases it with the image. The storage image cache key already includes BASE_ARRAY and the dimension, so the layer is always the descriptor's own. Every other shape/dimension mismatch, sampled or storage, still throws. Both messages now name the shape and the dimension. The recorder test device now sets `formatProperties`, which a `StorageTexture` needs to pick its Vulkan format. No test on main had built one yet. This PR and the MIN_LOD PR (feat/agc-texture-min-lod) add the same `SampleLod.comp` test shader, the same CMake rule and the same `SampleProgram` test helper. Whichever merges second hits a small conflict in `tests/Recorder.cpp` next to the helper, where the two test functions sit side by side. ### Tested - Linux (CachyOS, RADV): `agc_driver_recorder_tests` gets `firstLayerViewTests`. It fills three layers of a linear 2D array surface with different values, builds its storage image with BASE_ARRAY 1, samples `FirstLayerView(0)` and checks it reads layer 1. It also checks the view is reused. Main has no such view, so the test doesn't build there. - `ctest`: 57/57 pass. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-09-30 16:12:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-09-30T16:12:49Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#167 core/libs/prx/libSceAgcDriver/tests/shaders/SampleLod.comp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5915143134 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/131#issuecomment-5915143134). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-09-30T16:12:49Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #167 | | | `core/libs/prx/libSceAgcDriver/tests/shaders/SampleLod.comp` |
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!131
No description provided.