fix(agc): sample a 2D instruction over a 2D array texture through its first layer #181

Merged
oneandonlydean merged 1 commit from upstream-pr/181 into main 2026-10-01 08:28:42 +00:00
oneandonlydean commented 2026-09-30 11:47:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-30T11:47:46Z.


What

Follow-up to #131 (merged); rebased onto current main, so this branch is now the one commit on top of it.

#131 binds a 2D storage access to a 2D array surface as the surface's first layer. The sampled path had the same gap: a shader sampling with MIMG DIM 2D over a T# of type 2D array was refused with "guest texture dimension disagrees with the shader's declared image shape (shape 1, dimension 2)". The access carries no slice coordinate, so the hardware samples slice 0 of the resource view, the BASE_ARRAY layer.

A 2D array Texture now also makes a 2D view of that layer (Texture::FirstLayerView), both for a texture that holds its own snapshot and for one that views the surface's storage image. The view is created with the full view and released with it. resolveImageBinding accepts exactly this case (2D shape over a 2D array dimension) and binds the first-layer view; every other shape/dimension mismatch still throws.

In PPSA21564 a compute shader samples a 2D array texture this way from the intro's warp effect on; the dispatch was skipped every time.

If #130 (MIN_LOD) merges first, the first-layer view picks up its VkImageViewMinLodCreateInfoEXT through the copied create info, since it is created while the full view's chain is still alive.

Tested

  • Linux (CachyOS, RTX 4090): firstLayerViewTests in agc_driver_recorder_tests (from #131) now also samples a 2D array snapshot texture and a sampled view of a 2D array storage image through FirstLayerView() and checks both read the BASE_ARRAY layer, and checks that a 2D texture has no first-layer view. Without the view creation the test fails with "a sampled 2D array texture has no first-layer view"; on #131 alone it does not build (no Texture::FirstLayerView).
  • Exercised in PPSA21564 on our integration branch: the warp's sampling dispatch runs.
  • ctest: 85/85 pass on current main with this branch. agc_driver_recorder_tests and agc_driver_graphics_tests 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 (#131 is merged)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4690038398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/181). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-30T11:47:46Z. --- ### What Follow-up to #131 (merged); rebased onto current `main`, so this branch is now the one commit on top of it. #131 binds a 2D storage access to a 2D array surface as the surface's first layer. The sampled path had the same gap: a shader sampling with MIMG DIM 2D over a T# of type 2D array was refused with "guest texture dimension disagrees with the shader's declared image shape (shape 1, dimension 2)". The access carries no slice coordinate, so the hardware samples slice 0 of the resource view, the BASE_ARRAY layer. A 2D array `Texture` now also makes a 2D view of that layer (`Texture::FirstLayerView`), both for a texture that holds its own snapshot and for one that views the surface's storage image. The view is created with the full view and released with it. `resolveImageBinding` accepts exactly this case (2D shape over a 2D array dimension) and binds the first-layer view; every other shape/dimension mismatch still throws. In PPSA21564 a compute shader samples a 2D array texture this way from the intro's warp effect on; the dispatch was skipped every time. If #130 (MIN_LOD) merges first, the first-layer view picks up its `VkImageViewMinLodCreateInfoEXT` through the copied create info, since it is created while the full view's chain is still alive. ### Tested - Linux (CachyOS, RTX 4090): `firstLayerViewTests` in `agc_driver_recorder_tests` (from #131) now also samples a 2D array snapshot texture and a sampled view of a 2D array storage image through `FirstLayerView()` and checks both read the BASE_ARRAY layer, and checks that a 2D texture has no first-layer view. Without the view creation the test fails with "a sampled 2D array texture has no first-layer view"; on #131 alone it does not build (no `Texture::FirstLayerView`). - Exercised in PPSA21564 on our integration branch: the warp's sampling dispatch runs. - `ctest`: 85/85 pass on current main with this branch. `agc_driver_recorder_tests` and `agc_driver_graphics_tests` 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 (#131 is merged) - [x] AI-assisted: yes
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!181
No description provided.