Skip to content

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

Merged
boykopovar merged 1 commit into
boykopovar:mainfrom
oneandonlydean:fix/agc-2d-over-array-storage
Oct 1, 2026
Merged

boykopovar merged 1 commit into
boykopovar:mainfrom
oneandonlydean:fix/agc-2d-over-array-storage

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean
oneandonlydean force-pushed the fix/agc-2d-over-array-storage branch from 443309e to fbe9ad0 Compare September 30, 2026 19:48
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Sep 30, 2026
… layer

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

The storage element is now bound through a 2D view of that layer of the
surface's shared storage image (StorageTexture::FirstLayerView, created on
demand per mip and released with the image). Every other shape/dimension
mismatch still throws, and both mismatch messages now name the shape and
the dimension.

The recorder test device sets formatProperties, which storage images need
to pick their Vulkan format.
@boykopovar
boykopovar force-pushed the fix/agc-2d-over-array-storage branch from fbe9ad0 to edb1358 Compare October 1, 2026 07:36
@boykopovar
boykopovar merged commit 00a18dc into boykopovar:main Oct 1, 2026
3 checks passed
@oneandonlydean
oneandonlydean deleted the fix/agc-2d-over-array-storage branch October 1, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants