Skip to content

feat(agc): render layered draws into 2D array color views - #7254

Merged
adriadam10 merged 4 commits into
boykopovar:mainfrom
gjonn:feat/agc-layered-2d-array-color-views
Oct 19, 2026
Merged

adriadam10 merged 4 commits into
boykopovar:mainfrom
gjonn:feat/agc-layered-2d-array-color-views

Conversation

@gjonn

@gjonn gjonn commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What

PPSA01317 on main aborts in a 512x512 cube map pass with layered draws into a color view of several array slices are unsupported. The draw's vertex shader exports the render target array index (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX) into a CB_COLOR_VIEW of slices 0 to 5. Only 3D color targets rendered several slices; a layered draw into any other slice range threw.

Two commits:

  • 2D array color views. A layered draw into a view of several slices of a 2D array target renders lastSlice - slice + 1 layers through a 2D array attachment view of the array's resident image, starting at the view's first slice. The draw marks every rendered slice dirty (MarkSliceDirty takes a slice count). A layered draw into an array without its resident image throws.
  • One-slice surface viewed as several slices. In this pass CB_COLOR_ATTRIB3 declares one slice while the view covers slices 0 to 5, which then threw ... of several slices of a surface that is not a 2D array are unsupported. The CB clamps the layer to the view's SLICE_MAX, not to the surface's slice count, so each layer is written one slice pitch further on. Such a view now renders as a 2D array of the view's last slice + 1 slices. The "Layered color targets" debt entry is updated to match.

Single-slice views and views without the layer export behave as before (the first slice of the range). A layered draw with a depth target still throws; #7256 handles that. #6959 also touches layered rendering (mesh layer windows) and keeps the refusals this PR removes; the two do not overlap.

Tested

Windows 11, NVIDIA GeForce RTX 5090 Laptop GPU, driver 616.92. Ninja/MinGW Release with BUILD_TESTING=ON, rebased on main 922dc89.

  • agc_driver_graphics_tests: the two decode cases that expected the refusal now require two layers (a 2D array view of slices 0 to 1 and a one-slice surface viewed as slices 0 to 1).
  • GPU tests agc_driver_array_layer_target, agc_driver_depth_plane_guest_layers, agc_driver_layered_volume_draw, agc_driver_layered_volume_submit, agc_driver_layered_volume_vertex, agc_driver_layered_volume_vertex_no_gpl, agc_vertex_layer_export and the decode state tests (agc_driver_msaa_dcc_state, the alpha-to-coverage state tests): 11/11 pass.
  • tools/check_conventions.py --base origin/main and tools/check_test_registration.py pass.
  • PPSA01317 gets past both aborts on main (checked in boots). It then stops at layered rendering with a depth target is unsupported on the same pass, which feat(agc): render layered draws into a depth view of several slices #7256 handles.

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: none
  • Fixes: none
  • Unblocks: PPSA01317 Gran Turismo 7 (PPSA01317) #4697
  • GPUs tested: NVIDIA GeForce RTX 5090 Laptop GPU, driver 616.92, Windows 11
  • AI-assisted: yes

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, this unblocks the first two PPSA01317 aborts nicely. We read through it: the change is confined to paths that threw on main (a layer export over a slice range), the dirty range from MarkSliceDirty(slice, count) is exact, and volume targets are unchanged.

One ask before it can merge, a test that runs the new path. The tests added here are decode-only (they check layers, renderLayers and arrayLastSlice after DecodeState). agc_driver_array_layer_target uses single-slice views, and the agc_driver_layered_volume_* tests are 3D only. Nothing renders a layered draw into a 2D array yet, and the title stops at the next abort, so a wrong base layer, layer count or write-back range would go unnoticed, where main at least threw.

Could you add an execution test modelled on LayeredVolumeDraw that draws with a layer-exporting VS into:

  • (a) a CB_COLOR_VIEW of slices 1..3 of a 4-slice 2D array, and
  • (b) a one-slice surface viewed as slices 0..2,

with a distinct colour per layer, then checks guest memory per slice after write-back, including that slice 0 is untouched in case (a)? It needs to run on Linux llvmpipe (no early skip other than "no device"), since that's the only CI lane with a Vulkan device. It would also cover the colour side of #7256.

Two small optional points:

  • AttachmentView's second Require now accepts any layer for a volume (|| volume), where main required layer == 0. It's unreachable today, but (volume && layer == 0) would keep the guard.
  • With slice == 0 the pitch check in the resident path in Draw.cpp is trivially true, so nothing compares the synthesized array's layerBytes with the per-slice size State.cpp uses for slice offsets. Comparing them for every slice would be cheap hardening.

Heads-up on merge order: this conflicts textually in Draw.cpp with the native-multisample series (#6973, #6987, #6989, #6995, #7002); whichever lands second will need a rebase. #7256 builds on this one, so this merges first.

@github-actions

github-actions Bot commented Oct 17, 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
PR 7310 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2219
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L1825-1826
PR 7369 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2857-2858

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5431 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 5500 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6146 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6187 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6252 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6557 docs/dev/debt/libSceAgcDriver.md
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6661 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6682 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6718 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6727 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6772 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6820 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 docs/dev/debt/libSceAgcDriver.md
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6960 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6970 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6971 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6972 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7048 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7154 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7332 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7427 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7446 docs/dev/debt/libSceAgcDriver.md
PR 7449 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
docs/dev/debt/libSceAgcDriver.md
PR 7505 docs/dev/debt/libSceAgcDriver.md
PR 7514 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7579 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7604 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7746 docs/dev/debt/libSceAgcDriver.md
PR 7800 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7927 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7978 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 17, 2026
@gjonn

gjonn commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed two follow-up commits:

Test: agc_driver_layered_array_color_draw (tests/execution/LayeredArrayColorDraw.cpp, modelled on LayeredVolumeDraw). A VS exporting the render target index draws one full-screen quad per layer. The PS writes 1 + layer / 2 from the ancillary RT-index field, so each layer gets its own value. The colour view comes from DecodeColorBuffer with the layer export set in PA_CL_VS_OUT_CNTL:

  • (a) a CB_COLOR_VIEW of slices 1..3 of a four-slice 2D array (R32_FLOAT, 64 KiB R_X, one 64 KiB block per slice).
  • (b) a one-slice surface viewed as slices 0..2.

After FlushPending over the surface it checks every word of all four slices in guest memory:

  • each drawn slice holds its layer's value;
  • slice 0 in (a) and slice 3 in (b) still hold their initial bytes.

It only skips with no device. The VK_EXT_shader_viewport_index_layer check is the same one LayeredVolumeDraw makes, and lavapipe exposes that extension. I ran it on llvmpipe (LLVM 21.1.8) under WSL Ubuntu and it passes there, not skipped. It also passes on Windows.

Mutation check (one change at a time; each should make the test fail):

mutation result
attachment view base layer ignores the view's first slice fails: slice 1 holds layer 1's value
decoded layer count one short (lastSlice - slice) fails at the decode check
MarkSliceDirty covers one slice (in Texture.cpp) fails: slice 2 never written back
Draw.cpp passes a dirty count of 1 at every site fails: slice 2 never written back

One mutation didn't fail: shrinking only the attachment view's layerCount, with the framebuffer still at 3 layers. That is undefined behaviour in Vulkan, and the NVIDIA driver still wrote the third layer, so I left it out of the table.

Optional points, both done (fix(agc): ... commit):

  • AttachmentView's second Require now uses (volume && layer == 0), so volumes keep main's guard.
  • In the resident path, every slice of the synthesized array image is now compared with the slice size DecodeColorBuffer offsets slices by (ComputeSurfaceSize of the surface's mip chain, one layer), not just slice 0. A mismatch throws. The view's own surfaceAddress check uses that same size.

#7256 is rebased onto the new tip. Its tests, including LayeredDepthTarget, pass again.

On merge order: understood that this conflicts in Draw.cpp with #6973, #6987, #6989, #6995 and #7002. If any of them lands first I'll rebase this one and #7256 on top.

AI-assisted: yes

@gjonn
gjonn force-pushed the feat/agc-layered-2d-array-color-views branch from 06fcd74 to ebe289b Compare October 17, 2026 21:21
@gjonn

gjonn commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 5f8d2a2 (force-push, head ebe289b). No conflicts; main's Draw.cpp/DepthSurface.cpp changes since the previous base (depth plane fill, 5_6_5 and unclamped normalized color targets) merged cleanly. Rebuilt; all 666 agc_* tests pass, including agc_driver_graphics, agc_driver_layered_array_color_draw, agc_driver_array_layer_target, agc_driver_layered_volume_, and the new agc_driver_color565_target, agc_driver_depth_plane_fill, agc_driver_native_depth_bda_clear and agc_pipeline_queue_failure_. check_conventions.py --base origin/main and check_test_registration.py are clean.

AI-assisted: yes

alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
@frankea

frankea commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

RTX 4090 data point on PPSA01317, continuing the chain from my #7243, #7238 and #7240 runs tonight, where the title stopped on layered draws into a color view of several array slices are unsupported in its cube map pass. Short version: with this PR the pass gets through its colour side on this GPU too, 3 of 3 runs, and the title stops on the depth side (layered rendering with a depth target is unsupported), exactly as the description of #7256 says.

Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release libs target only (no tests built). app.exe is the relink from main 31cbb55 (--windows --registry --module-dir .); only libs/ is swapped between runs. Tree: the stack from the earlier runs (main e1041f6 + #7137 2aa6bfc + #7207 ec28b6b + #7175 555b7e8 + #5958 87a9b8d + #7243 da158d6 + #7238 4aaf276 + #7240 7c19c66, ac5e28d17) merged with this PR's head ebe289b (9ea37b61b). The merge brings the PR's base, main 5f8d2a2, with it (115 main commits, none of them libSceHmd2, so the #7323 abort from the #7243 comment does not apply here). One conflict, in Graphics/src/State.cpp: the COMP_SWAP > 1 format list, where the stack's pr7207-branch line and the PR's pre-#7207 main line differ; resolved to current main's line (format != 7 ... && format != 16). With the PR's side taken instead, the title aborts on unsupported color format 7 number type 7 component swap 2 28 s in (3 runs), which is just #7207 missing again, not this PR. The libSceSsl.prx is the one from #7319 (1f26755). No controller, no input, nobody at the keyboard; one-shot interactive task per run, 600 s cap, box otherwise idle.

Result. All three runs get past the layered colour draw: splash, the black loading screen with the GT spinner (title-bar counter 27 FPS, 1,134 frames at the last capture of run 3), save data mounted, three sceNetResolverStartNtoa -> host DNS lookup failed, 392 further shaders registered, and then, identically every time:

[gpu] driver failure: AGC graphics: layered rendering with a depth target is unsupported
[videoout] presentation failed: AGC graphics: layered rendering with a depth target is unsupported
terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC graphics: layered rendering with a depth target is unsupported
FATAL: abort() (SIGABRT) on thread 17748

No several slices of a surface that is not a 2D array refusal, no layered draw into an array without its resident image, no device loss. With #7256 on top the depth stop goes away as well; that result is on #7256.

run shader cache exit after stop
stack without #7254 (earlier tonight, 3 runs) cold / warm 34 to 40 s layered draws into a color view of several array slices are unsupported
1 warm 42 s layered rendering with a depth target is unsupported
2 warm 35 s same
3 warm 35 s same
stderr of run 3 (warm, box idle) from the second 10 s summary to the abort, the 392 per-shader ShaderRegistry lines removed
[log] 10.5 s: 191 lines (19 stdout, 172 stderr), 26.7 KiB written, 0 repeats coalesced; callers spent 0.32 ms queueing and formatting (0.003% of one thread), logger thread 88.26 ms, queue peak 5.5 KiB
[SAVEDATA:native] mount3 user=268435456 dir=DRFILEIV mode=0x1 blocks=673 -> 0x809f0008 point= status=0
[SAVEDATA:native] getMemory2 user=268435456 slot=0 -> 0x00000000
[shader-disk-cache] (10 s): 118 hits, 0 misses, 0 writes (0.0 MiB), 0 load failures, 0 write failures; resource plans: 112 hits, 0 misses, 0 writes, 0 load failures; 12.6 MiB read in 25.8 ms (totals: 1792 hits, 0 misses, 0 writes; plans 1760 hits, 0 misses)
[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failed
[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failed
[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failed
[gpu] driver failure: AGC graphics: layered rendering with a depth target is unsupported
[videoout] presentation failed: AGC graphics: layered rendering with a depth target is unsupported
terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC graphics: layered rendering with a depth target is unsupported
FATAL: abort() (SIGABRT) on thread 17748
terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC graphics: layered rendering with a depth target is unsupported

AI-assisted: yes (Claude Code)

alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 18, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apple GPU / MoltenVK run. agc_driver_layered_array_color_draw runs on Metal (no skip) and passes, fails without the fix with the original refusal, and the full ^agc suite is unchanged.

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head ebe289b. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main + SPIRV-Cross #2704.

Tested: the tree is main a373e85 + mugurc's macOS series (ci/macos-series-2) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plain main (it doesn't build on macOS yet). One textual conflict in Draw.cpp, in the DrawRecord declaration: that tree's main already has multisampleTargets, and this PR changes targetSlices to a slice/count pair. I kept both. #7671 was applied in the same build (disjoint files: recompiler vs driver). Base on that tree: 40 ^agc failures with MoltenVK 1.4.2 and 26 with MoltenVK main + #2704, the same known failures in every run below.

  • MoltenVK exposes VK_EXT_shader_viewport_index_layer, so the test takes the layered path here. agc_driver_layered_array_color_draw, agc_driver_graphics, agc_driver_array_layer_target, the four agc_driver_layered_volume_* tests and agc_vertex_layer_export pass 3 of 3 on MoltenVK 1.4.2; the new test and agc_driver_graphics also pass 3 of 3 on MoltenVK main + #2704.
  • Without the fix (the four driver files back to the base, tests kept), agc_driver_layered_array_color_draw fails on both drivers with layered draws into a color view of several array slices are unsupported, and agc_driver_graphics fails on the changed decode cases.
  • Full ^agc suite with the PR: 40 of 729 fail on MoltenVK 1.4.2 and 26 of 729 on MoltenVK main + #2704, the same tests as the base on each driver.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
alex73630 added a commit to alex73630/AnyPS5 that referenced this pull request Oct 19, 2026
Integrate the remaining array handling from Gjonn PR boykopovar#7254: validate every slice pitch, track the written layer range and exercise layered array draws. Preserve the existing full-array hazards and shared depth storage.

Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
gjonn added 4 commits October 19, 2026 15:52
A draw whose vertex shader exports the render target array index into a
color view of several slices of a 2D array target was refused. The view
now renders layers lastSlice - slice + 1 through a 2D array attachment
view of the array's resident image starting at its first slice, and the
draw marks every rendered slice dirty. A view of several slices of a
surface that is not a 2D array is still refused, as is a layered draw
without the array's resident image.

AI-assisted: yes
…of its view's slices

A layered draw into a color view of slices 0 to 5 of a 2D surface whose
CB_COLOR_ATTRIB3 declares one slice was refused. The CB clamps the
render target array index to the view's SLICE_MAX, not to the surface's
slice count, so each layer is written one slice pitch further on.
PPSA01317 renders a 512x512 cube map this way. Such a view now renders as
a 2D array of the view's last slice + 1 slices.

AI-assisted: yes
…the volume layer guard

The resident image of a 2D array color view only compared the view's own
slice offset with the image's layer pitch, which is trivially equal for
slice 0. Every slice of the array image is now checked against the slice
size DecodeColorBuffer offsets the view by. AttachmentView again requires
layer 0 for a 3D target, as it did before layered 2D array views.

AI-assisted: yes
A vertex shader exporting the render target index draws one value per
layer into a CB_COLOR_VIEW of slices 1 to 3 of a four-slice 2D array and
into slices 0 to 2 of a surface of one slice. After the write-back every
slice of guest memory must hold its layer's value, and the slices
outside the view (slice 0, and slice 3 of the one-slice surface) their
initial bytes.

AI-assisted: yes
@adriadam10
adriadam10 force-pushed the feat/agc-layered-2d-array-color-views branch from ebe289b to deb0ba3 Compare October 19, 2026 14:32
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@adriadam10
adriadam10 merged commit cde1ffd into boykopovar:main Oct 19, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main (one adjacency conflict in Draw.cpp: targetSlices next to the new multisampleTargets). Checked that every changed path threw on main, the per-slice pitch validation, the dirty-slice range from MarkSliceDirty(slice, count), that multisampled targets still reject layers > 1, the debt entry, and that agc_driver_layered_array_color_draw checks each layer's value and the untouched slices. Thanks @oneandonlydean, @frankea and @jotitadev for the runs; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants