feat(agc): render layered draws into 3D color targets #1077

Closed
alfalfa-star wants to merge 8 commits from upstream-pr/1077 into main
alfalfa-star commented 2026-10-07 09:21:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-07T09:21:27Z.


What

Layered draws into 3D color targets render, where they were rejected with color views of several array slices are unsupported. Titles fill a volume with one instanced draw: CB_COLOR_VIEW covers several depth slices, and the vertex stage picks each primitive's slice through the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA).

Builds on #423, which carries PA_CL_VS_OUT_CNTL to the recompiler. Until it merges, the bottom of this branch carries #423 at 577b8d57 squashed into one commit (author kept), with PA_CL_VS_OUT_CNTL read from request version 17 because main now writes 16, followed by @johnmaia's b599cfc1 (prepare vertex programs with the position export layout), which #423 is taking in. This PR is feat(agc): render layered draws into 3D color targets plus two test commits for main's changes (the legacy vertex info test reads version 16; the layered test passes the new GPU flag to Mutation::Add).

  • Decode: DecodeColorBuffer takes the slice range of a 3D target into ColorTarget::layers, clamped to the surface's last slice. It allows DCC on 3D targets and sizes a tiled 3D target by its whole surface (SurfaceForTarget moves to State.cpp). DecodeState sets State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (State::layerExports). Targets of different slice counts and layered draws with a depth target throw.
  • Recompiler input: the driver ORs State::layerExports into the PA_CL_VS_OUT_CNTL bits that #423 passes. #423 already passes VS_OUT_MISC_VEC_ENA, so only the render target index is added, and only for layered draws. Elsewhere the layer export stays ignored, as before.
  • SPIR-V: a vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT and SPV_EXT_shader_viewport_index_layer when the device offers them, instead of SPIR-V 1.5 ShaderLayer, which the driver's Vulkan 1.1 target cannot take. The device enables VK_EXT_shader_viewport_index_layer when present. Graphics validation accepts the capability, the extension and a vertex Layer output when it is enabled, and a per-primitive Layer output of a mesh stage.
  • Attachments: the resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers.
  • A TechnicalDebt line records what is not modeled.

Tested

Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT.

  • New execution test agc_driver_layered_volume_draw. It draws into a 4-slice, 64 KiB-tiled RGBA8 volume through a view of slices 1..3, three bands with one per layer (the layer comes from the misc export), and reads every slice back with the R_X swizzle equation (its slice input included). Slice 0 stays untouched and slice 1 + L holds only band L. With paClVsOutCntl left at 0, it fails as expected (layer 1's band lands in slice 1). It skips without VK_EXT_shader_viewport_index_layer, which lavapipe has.
    • Mesh case: it recompiles a mesh program with the layer export (Mesh.cpp's geometry program plus an exp pos1), checks that it declares a Layer output, and validates it against the layered state. Without the mesh Layer rule in the validator, this case fails. It does not draw, because lavapipe's LLVM backend aborts while compiling that mesh pipeline (Cannot emit physreg copy instruction), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices.
  • agc_vertex_layer_export recompiles a vertex shader with a misc layer export. It declares the extension's capability under SPIR-V 1.3 when it is offered, ShaderLayer with SPIR-V 1.5 when it is not, and no gl_Layer without USE_VTX_RENDER_TARGET_INDX.
  • agc_driver_graphics covers the slice-range decode (layers, clamping, refusals, a DCC 3D target, the export bit) and the validation of a vertex Layer output with and without the extension.
  • PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes this way: two DCC targets, 64 instances, a mesh (NGG) vertex stage. About 270 such draws per 150 s were rejected. With this PR the slice range decodes and the draws record. Their pixel shaders also read the layer from the packed pixel ancillary (#295, merged, and #375 through #423). About half of the draws then stop at a separate limit (writable guest memory overlaps an immutable snapshot), which is not part of this PR.
  • ctest on #423 + this PR: 397 of 397 pass; 468 of 468 after the rebase onto #423's current head.
  • Rebased onto main 90c152e8 (2026-10-11): full ctest 818/818 pass (4 video_out_flip_* skipped), RX 9070 XT, RADV. agc_driver_layered_volume_draw draws (not skipped). tools/check_conventions.py passes.
  • PPSA14632 on that main (with scripted pad input only): plain main aborts after about 35 s at color views of several array slices are unsupported on its 64x64x64 lighting volumes. With this branch it records those draws and next stops after about 38 s at #1409 (storage image access to depth/stencil surface ... is not implemented).

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 (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #423; its commits are included here until it merges
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4770589272 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-07T09:21:27Z. --- ### What Layered draws into 3D color targets render, where they were rejected with `color views of several array slices are unsupported`. Titles fill a volume with one instanced draw: `CB_COLOR_VIEW` covers several depth slices, and the vertex stage picks each primitive's slice through the misc position export (`PA_CL_VS_OUT_CNTL` USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA). Builds on #423, which carries `PA_CL_VS_OUT_CNTL` to the recompiler. Until it merges, the bottom of this branch carries #423 at 577b8d57 squashed into one commit (author kept), with `PA_CL_VS_OUT_CNTL` read from request version 17 because `main` now writes 16, followed by @johnmaia's b599cfc1 (prepare vertex programs with the position export layout), which #423 is taking in. This PR is `feat(agc): render layered draws into 3D color targets` plus two test commits for `main`'s changes (the legacy vertex info test reads version 16; the layered test passes the new GPU flag to `Mutation::Add`). - **Decode:** `DecodeColorBuffer` takes the slice range of a 3D target into `ColorTarget::layers`, clamped to the surface's last slice. It allows DCC on 3D targets and sizes a tiled 3D target by its whole surface (`SurfaceForTarget` moves to `State.cpp`). `DecodeState` sets `State::renderLayers` and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (`State::layerExports`). Targets of different slice counts and layered draws with a depth target throw. - **Recompiler input:** the driver ORs `State::layerExports` into the `PA_CL_VS_OUT_CNTL` bits that #423 passes. #423 already passes VS_OUT_MISC_VEC_ENA, so only the render target index is added, and only for layered draws. Elsewhere the layer export stays ignored, as before. - **SPIR-V:** a vertex stage writing `gl_Layer` declares `ShaderViewportIndexLayerEXT` and `SPV_EXT_shader_viewport_index_layer` when the device offers them, instead of SPIR-V 1.5 `ShaderLayer`, which the driver's Vulkan 1.1 target cannot take. The device enables `VK_EXT_shader_viewport_index_layer` when present. Graphics validation accepts the capability, the extension and a vertex `Layer` output when it is enabled, and a per-primitive `Layer` output of a mesh stage. - **Attachments:** the resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers. - A TechnicalDebt line records what is not modeled. ### Tested Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT. - New execution test `agc_driver_layered_volume_draw`. It draws into a 4-slice, 64 KiB-tiled RGBA8 volume through a view of slices 1..3, three bands with one per layer (the layer comes from the misc export), and reads every slice back with the R_X swizzle equation (its slice input included). Slice 0 stays untouched and slice 1 + L holds only band L. With `paClVsOutCntl` left at 0, it fails as expected (layer 1's band lands in slice 1). It skips without `VK_EXT_shader_viewport_index_layer`, which lavapipe has. - Mesh case: it recompiles a mesh program with the layer export (Mesh.cpp's geometry program plus an `exp pos1`), checks that it declares a `Layer` output, and validates it against the layered state. Without the mesh `Layer` rule in the validator, this case fails. It does not draw, because lavapipe's LLVM backend aborts while compiling that mesh pipeline (`Cannot emit physreg copy instruction`), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices. - `agc_vertex_layer_export` recompiles a vertex shader with a misc layer export. It declares the extension's capability under SPIR-V 1.3 when it is offered, `ShaderLayer` with SPIR-V 1.5 when it is not, and no `gl_Layer` without USE_VTX_RENDER_TARGET_INDX. - `agc_driver_graphics` covers the slice-range decode (layers, clamping, refusals, a DCC 3D target, the export bit) and the validation of a vertex `Layer` output with and without the extension. - PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes this way: two DCC targets, 64 instances, a mesh (NGG) vertex stage. About 270 such draws per 150 s were rejected. With this PR the slice range decodes and the draws record. Their pixel shaders also read the layer from the packed pixel ancillary (#295, merged, and #375 through #423). About half of the draws then stop at a separate limit (`writable guest memory overlaps an immutable snapshot`), which is not part of this PR. - `ctest` on #423 + this PR: 397 of 397 pass; 468 of 468 after the rebase onto #423's current head. - Rebased onto `main` 90c152e8 (2026-10-11): full `ctest` 818/818 pass (4 `video_out_flip_*` skipped), RX 9070 XT, RADV. `agc_driver_layered_volume_draw` draws (not skipped). `tools/check_conventions.py` passes. - PPSA14632 on that `main` (with scripted pad input only): plain `main` aborts after about 35 s at `color views of several array slices are unsupported` on its 64x64x64 lighting volumes. With this branch it records those draws and next stops after about 38 s at #1409 (`storage image access to depth/stencil surface ... is not implemented`). ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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: #423; its commits are included here until it merges - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
adriadam10 commented 2026-10-07 12:31:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T12:31:36Z.

Review: CHANGES_REQUESTED


Thanks. Build and ctest are green merged onto current main (396/396). Before this can go in, part of it needs to come out and a test needs to go in:

  • Overlap with #423: please drop that part. #423 (open since 2026-10-02) already adds ShaderVertexStageInfo::paClVsOutCntl and plumbs it through Recompiler.hpp, CacheKey.hpp, RequestSerializer.cpp (version 9), DrawLookup.cpp, sameVertexInfo and ShaderInputInfoBuilder.cpp, with its round-trip test in ShaderMemory.cpp. This PR adds the same plumbing again. CONTRIBUTING asks that no two open PRs implement the same thing. The Draw.cpp:139 assignment also collides: #423 stores the clip/cull bits in that field and this PR stores graphics.layerExports, so whichever lands second drops the other's bits. Please remove the duplicated plumbing, list #423 under Depends on, and add the layer bits (USE_VTX_RENDER_TARGET_INDX, VS_OUT_MISC_VEC_ENA) to #423's mask for layered draws. The rest of the PR stays as it is: the CB_COLOR_VIEW slice range, the 2D-array attachment views, the framebuffer layers, the VK_EXT_shader_viewport_index_layer path and the validation.
  • No test of the layered draw itself. The new tests cover the register decode, the serializer and which capability the SPIR-V declares, but nothing renders. The 2D-array attachment view of a 3D image (Texture.cpp:998-1001), the framebuffer layer count (Pipeline.cpp:73-74) and gl_Layer selecting the slice relative to SLICE_START are never run. An execution test that draws into a 4-slice 3D target with a view of slices 1..3 (one primitive per layer via the misc export), then reads every slice back, would pin it. Slice 0 should stay untouched and slices 1-3 should hold their primitive's value. lavapipe exposes VK_EXT_shader_viewport_index_layer, so it runs on CI. tests/Mesh.cpp and tests/execution/Pixel*.cpp already have the draw harness.
  • Minor: ShaderValidation.cpp:112 now accepts a per-primitive Layer output in mesh stages, but validationTests only covers the vertex case. A mesh case would cover it.

We couldn't check the slice mapping on hardware: our oracle only runs compute, not draws. The TechnicalDebt line covering that is fine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5442296571 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#pullrequestreview-5442296571). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T12:31:36Z. **Review:** CHANGES_REQUESTED --- Thanks. Build and ctest are green merged onto current `main` (396/396). Before this can go in, part of it needs to come out and a test needs to go in: - **Overlap with #423: please drop that part.** #423 (open since 2026-10-02) already adds `ShaderVertexStageInfo::paClVsOutCntl` and plumbs it through `Recompiler.hpp`, `CacheKey.hpp`, `RequestSerializer.cpp` (version 9), `DrawLookup.cpp`, `sameVertexInfo` and `ShaderInputInfoBuilder.cpp`, with its round-trip test in `ShaderMemory.cpp`. This PR adds the same plumbing again. CONTRIBUTING asks that no two open PRs implement the same thing. The `Draw.cpp:139` assignment also collides: #423 stores the clip/cull bits in that field and this PR stores `graphics.layerExports`, so whichever lands second drops the other's bits. Please remove the duplicated plumbing, list #423 under **Depends on**, and add the layer bits (USE_VTX_RENDER_TARGET_INDX, VS_OUT_MISC_VEC_ENA) to #423's mask for layered draws. The rest of the PR stays as it is: the `CB_COLOR_VIEW` slice range, the 2D-array attachment views, the framebuffer layers, the `VK_EXT_shader_viewport_index_layer` path and the validation. - **No test of the layered draw itself.** The new tests cover the register decode, the serializer and which capability the SPIR-V declares, but nothing renders. The 2D-array attachment view of a 3D image (`Texture.cpp:998-1001`), the framebuffer layer count (`Pipeline.cpp:73-74`) and gl_Layer selecting the slice relative to `SLICE_START` are never run. An execution test that draws into a 4-slice 3D target with a view of slices 1..3 (one primitive per layer via the misc export), then reads every slice back, would pin it. Slice 0 should stay untouched and slices 1-3 should hold their primitive's value. lavapipe exposes `VK_EXT_shader_viewport_index_layer`, so it runs on CI. `tests/Mesh.cpp` and `tests/execution/Pixel*.cpp` already have the draw harness. - Minor: `ShaderValidation.cpp:112` now accepts a per-primitive `Layer` output in mesh stages, but `validationTests` only covers the vertex case. A mesh case would cover it. We couldn't check the slice mapping on hardware: our oracle only runs compute, not draws. The TechnicalDebt line covering that is fine.
alfalfa-star commented 2026-10-07 13:02:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-07T13:02:02Z.


@adriadam10 Thanks. All three points are done in 6017bd9a, and the branch is now stacked on #423.

  • #423 overlap: the duplicated plumbing is gone: the paClVsOutCntl field, the version 9 serializer, the cache key, the draw lookup hash, sameVertexInfo, ShaderInputInfoBuilder and the ShaderMemory round trip. #423's commits sit under this one (rebased onto current main) and are listed under Depends on. At Draw.cpp:139 the line is now #423's mask, OR'd with graphics.layerExports, so neither PR drops the other's bits. #423's mask already includes VS_OUT_MISC_VEC_ENA (bit 21), which also shifts the clip/cull vectors, so layerExports only adds USE_VTX_RENDER_TARGET_INDX (bit 18), and only when the color view covers several slices.
    • The rebase of #423 needed one manual step, plus one I'd flag for @MichonGoddijn231849. main added imageInt64Atomics to ValidateShaders/Inspect, in the spot where #375 adds geometryShader/sampleRateShading. I kept main's flag first, so #375's positional test calls in Graphics.cpp (the false, false, true, true ones) gain one false.
  • Layered draw test: new agc_driver_layered_volume_draw, as you described. It renders into a 4-slice 64 KiB-tiled RGBA8 volume through a view of slices 1..3. Each primitive's layer comes from the misc export (one band per layer). Every slice is read back through the R_X swizzle equation with its slice input, which matters: the XOR pattern differs per slice, so a 2D detile reads the wrong texels. Slice 0 must stay untouched and slice 1 + L must hold only band L. With paClVsOutCntl forced to 0 it fails (layer 1's band lands in slice 1). It skips without VK_EXT_shader_viewport_index_layer, which lavapipe has.
  • Mesh case: the same test also draws through the mesh path. It uses Mesh.cpp's geometry program with one exp pos1 added for the layer, so the per-primitive Layer output goes through ValidateShaders in the draw and onto the target. It also fails with the export off. I covered it there rather than in validationTests, because a mesh module that passes the rest of the mesh validation (modes, push block, output arrays, primitive indices) by hand would mostly test the hand-built module.

ctest: 397/397 on Linux (RADV, RX 9070 XT).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6038473400 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6038473400). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-07T13:02:02Z. --- @adriadam10 Thanks. All three points are done in 6017bd9a, and the branch is now stacked on #423. - **#423 overlap:** the duplicated plumbing is gone: the `paClVsOutCntl` field, the version 9 serializer, the cache key, the draw lookup hash, `sameVertexInfo`, `ShaderInputInfoBuilder` and the `ShaderMemory` round trip. #423's commits sit under this one (rebased onto current `main`) and are listed under **Depends on**. At `Draw.cpp:139` the line is now #423's mask, OR'd with `graphics.layerExports`, so neither PR drops the other's bits. #423's mask already includes VS_OUT_MISC_VEC_ENA (bit 21), which also shifts the clip/cull vectors, so `layerExports` only adds USE_VTX_RENDER_TARGET_INDX (bit 18), and only when the color view covers several slices. - The rebase of #423 needed one manual step, plus one I'd flag for @MichonGoddijn231849. `main` added `imageInt64Atomics` to `ValidateShaders`/`Inspect`, in the spot where #375 adds `geometryShader`/`sampleRateShading`. I kept main's flag first, so #375's positional test calls in `Graphics.cpp` (the `false, false, true, true` ones) gain one `false`. - **Layered draw test:** new `agc_driver_layered_volume_draw`, as you described. It renders into a 4-slice 64 KiB-tiled RGBA8 volume through a view of slices 1..3. Each primitive's layer comes from the misc export (one band per layer). Every slice is read back through the R_X swizzle equation with its slice input, which matters: the XOR pattern differs per slice, so a 2D detile reads the wrong texels. Slice 0 must stay untouched and slice 1 + L must hold only band L. With `paClVsOutCntl` forced to 0 it fails (layer 1's band lands in slice 1). It skips without `VK_EXT_shader_viewport_index_layer`, which lavapipe has. - **Mesh case:** the same test also draws through the mesh path. It uses Mesh.cpp's geometry program with one `exp pos1` added for the layer, so the per-primitive `Layer` output goes through `ValidateShaders` in the draw and onto the target. It also fails with the export off. I covered it there rather than in `validationTests`, because a mesh module that passes the rest of the mesh validation (modes, push block, output arrays, primitive indices) by hand would mostly test the hand-built module. `ctest`: 397/397 on Linux (RADV, RX 9070 XT).
alfalfa-star commented 2026-10-07 13:25:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-07T13:25:46Z.


CI fix in d86365c7. The Windows build lacked std::aligned_alloc; the test now allocates the volume like the other execution tests (VirtualAlloc on Windows). On lavapipe, the mesh case aborted inside LLVM while compiling the mesh pipeline (Cannot emit physreg copy instruction), so it now recompiles and validates the layered mesh program without drawing it. The description has the details.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6038919092 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6038919092). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-07T13:25:46Z. --- CI fix in d86365c7. The Windows build lacked `std::aligned_alloc`; the test now allocates the volume like the other execution tests (`VirtualAlloc` on Windows). On lavapipe, the mesh case aborted inside LLVM while compiling the mesh pipeline (`Cannot emit physreg copy instruction`), so it now recompiles and validates the layered mesh program without drawing it. The description has the details.
alfalfa-star commented 2026-10-08 16:54:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T16:54:00Z.


Rebased onto #423's current head (577b8d57, now on main), aed33bf7. Conflicts resolved with main's 8_SRGB attachment proxy (layered targets are 3D, so they never take the proxy path, which is 2D only) and the CMASK changes. SurfaceForTarget moved to State.cpp with main's body (dccPipeAligned included). viewportIndexLayer now comes after #423's clipDistance/cullDistance. ctest: 468/468, and agc_driver_layered_volume_draw draws on RADV.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064834279 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6064834279). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-08T16:54:00Z. --- Rebased onto #423's current head (577b8d57, now on `main`), aed33bf7. Conflicts resolved with main's 8_SRGB attachment proxy (layered targets are 3D, so they never take the proxy path, which is 2D only) and the CMASK changes. `SurfaceForTarget` moved to State.cpp with main's body (`dccPipeAligned` included). `viewportIndexLayer` now comes after #423's `clipDistance`/`cullDistance`. `ctest`: 468/468, and `agc_driver_layered_volume_draw` draws on RADV.
alfalfa-star commented 2026-10-08 17:28:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T17:28:40Z.


CI fix in f402eab0. agc_vertex_layer_export asked for a SPIR-V 1.3 target in its no-extension case but expected a 1.5 module (ShaderLayer), which SPIRV-Tools refuses ("module version exceeds requested SPIR-V target"). That case now targets Vulkan 1.2 / SPIR-V 1.5, as a device without VK_EXT_shader_viewport_index_layer would need for ShaderLayer. 471/471 pass with ANYPS5_ENABLE_SPIRV_TOOLS=ON. The Windows timeouts in agc_driver_vertex_clip_cull_draw and _no_key come from #423: its own head times out on the same two tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6065431353 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6065431353). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-08T17:28:40Z. --- CI fix in f402eab0. `agc_vertex_layer_export` asked for a SPIR-V 1.3 target in its no-extension case but expected a 1.5 module (`ShaderLayer`), which SPIRV-Tools refuses ("module version exceeds requested SPIR-V target"). That case now targets Vulkan 1.2 / SPIR-V 1.5, as a device without `VK_EXT_shader_viewport_index_layer` would need for `ShaderLayer`. 471/471 pass with `ANYPS5_ENABLE_SPIRV_TOOLS=ON`. The Windows timeouts in `agc_driver_vertex_clip_cull_draw` and `_no_key` come from #423: its own head times out on the same two tests.
alfalfa-star commented 2026-10-10 08:04:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-10T08:04:35Z.


Status: the conflicts with main are in the five #423 commits this PR is stacked on (#423 is in draft and conflicts with main itself). @MichonGoddijn231849 is reworking it so prepared vertex artifacts take PA_CL_VS_OUT_CNTL into account. Once #423 is updated, I'll rebase onto its new head, so the layer bits go into the mask it ends up preparing with. The #448 row from the overlap bot is #423's two test files (VertexClipCullDistances.cpp, VertexClipCullDraw.cpp), not this PR's own change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095491839 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6095491839). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-10T08:04:35Z. --- Status: the conflicts with `main` are in the five #423 commits this PR is stacked on (#423 is in draft and conflicts with `main` itself). @MichonGoddijn231849 is reworking it so prepared vertex artifacts take `PA_CL_VS_OUT_CNTL` into account. Once #423 is updated, I'll rebase onto its new head, so the layer bits go into the mask it ends up preparing with. The #448 row from the overlap bot is #423's two test files (`VertexClipCullDistances.cpp`, `VertexClipCullDraw.cpp`), not this PR's own change.
alfalfa-star commented 2026-10-11 09:51:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T09:51:18Z.


Rebased onto main 90c152e8, since it conflicted in seven files and testers on #2783 and #2102 asked for a testable head.

  • #423 is carried as one squashed commit at 577b8d57 (Michon kept as author). Its PA_CL_VS_OUT_CNTL field moves to request version 17, because main now writes 16. @johnmaia's b599cfc1 follows it under their name. @MichonGoddijn231849, once #423's runtime-enable rework is up, I'll rebase onto it and drop these two commits.
  • Title evidence, LEGO Horizon Adventures (PPSA14632) on that main: plain main aborts after about 35 s at color views of several array slices are unsupported on its 64x64x64 lighting volumes. With this branch it records them and next stops at #1409.
  • Full ctest 818/818 (RX 9070 XT, RADV); tools/check_conventions.py passes.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107757659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6107757659). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-11T09:51:18Z. --- Rebased onto `main` 90c152e8, since it conflicted in seven files and testers on #2783 and #2102 asked for a testable head. - #423 is carried as one squashed commit at 577b8d57 (Michon kept as author). Its `PA_CL_VS_OUT_CNTL` field moves to request version 17, because `main` now writes 16. @johnmaia's b599cfc1 follows it under their name. @MichonGoddijn231849, once #423's runtime-enable rework is up, I'll rebase onto it and drop these two commits. - Title evidence, LEGO Horizon Adventures (PPSA14632) on that `main`: plain `main` aborts after about 35 s at `color views of several array slices are unsupported` on its 64x64x64 lighting volumes. With this branch it records them and next stops at #1409. - Full `ctest` 818/818 (RX 9070 XT, RADV); `tools/check_conventions.py` passes. AI-assisted: yes (Claude Code)
alfalfa-star commented 2026-10-11 09:58:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T09:58:23Z.


@adriadam10 Would you be able to check this since this has been rebased a couple of times.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107811607 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6107811607). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-11T09:58:23Z. --- @adriadam10 Would you be able to check this since this has been rebased a couple of times.
adriadam10 commented 2026-10-11 10:08:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:08:47Z.

Review: CHANGES_REQUESTED


Thanks for the rebase. Build and the PR's tests pass merged onto current main (RADV; agc_driver_layered_volume_draw draws, it doesn't skip). One thing blocks this:

  • The driver wiring isn't pinned by any test. LayeredVolumeDraw.cpp:150 and :193 set paClVsOutCntl and state.layerExports by hand and call device.Draw, so Driver::draw never runs. Removing | graphics.layerExports at Draw/Draw.cpp:148 leaves every test green, and so would dropping the 0x207 bit-18 read in DecodeState combined with the registry path. Please add a case that goes through the real path: register 0x207 with USE_VTX_RENDER_TARGET_INDX set in the queue context, a shader registered before the draw (ShaderRegistry.cpp:607 and :796 mask that bit out when preparing, so this is the path the "prepared at registration, layered variant at draw" log line in ReportPreparedAtUse describes), and the same band/slice readback. It must fail when the | graphics.layerExports is removed.
  • DCC on a 3D target is only decoded. The agc_driver_graphics rows cover the decode, but the draw test uses RGBA8 without DCC, and PPSA14632's volumes are DCC. Either draw one with DCC, or throw on DCC until it is covered.
  • Depends on #423, which is a draft being reworked. Once its runtime-enable rework lands this needs a rebase onto it, and the squashed commits should drop out.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5482875954 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#pullrequestreview-5482875954). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T10:08:47Z. **Review:** CHANGES_REQUESTED --- Thanks for the rebase. Build and the PR's tests pass merged onto current `main` (RADV; `agc_driver_layered_volume_draw` draws, it doesn't skip). One thing blocks this: - **The driver wiring isn't pinned by any test.** `LayeredVolumeDraw.cpp:150` and `:193` set `paClVsOutCntl` and `state.layerExports` by hand and call `device.Draw`, so `Driver::draw` never runs. Removing `| graphics.layerExports` at `Draw/Draw.cpp:148` leaves every test green, and so would dropping the `0x207` bit-18 read in `DecodeState` combined with the registry path. Please add a case that goes through the real path: register `0x207` with USE_VTX_RENDER_TARGET_INDX set in the queue context, a shader registered before the draw (`ShaderRegistry.cpp:607` and `:796` mask that bit out when preparing, so this is the path the "prepared at registration, layered variant at draw" log line in `ReportPreparedAtUse` describes), and the same band/slice readback. It must fail when the `| graphics.layerExports` is removed. - **DCC on a 3D target is only decoded.** The `agc_driver_graphics` rows cover the decode, but the draw test uses RGBA8 without DCC, and PPSA14632's volumes are DCC. Either draw one with DCC, or throw on DCC until it is covered. - **Depends on #423**, which is a draft being reworked. Once its runtime-enable rework lands this needs a rebase onto it, and the squashed commits should drop out.
orishamir commented 2026-10-11 10:08:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T10:08:48Z.


Windows + NVIDIA run of 5e14fe0d merged onto main 5c4bc7d6 (clean), since the PR's runs are RADV: Windows 11 Pro 26300, RTX 4080 driver 616.56, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, the CI windows job's configure flags. The build is clean.

  • agc_descriptor_pool_reset_failure, agc_driver_pm4_failure, agc_vertex_layer_export, agc_position_invariance: pass 5/5.
  • agc_driver_layered_volume_draw fails at once, every run:
    AGC graphics: vertex draw: slice 1 texel (16, 0) channel 0 is 255, expected 64 (another layer's band)
    
    so on this GPU the layer from the misc export does not route the second band to its slice; slice 1 holds band 1's value where band 0's is expected (the mesh case is not reached).
  • agc_driver_vertex_clip_cull_draw and agc_driver_vertex_clip_cull_draw_no_key (the #423 commit): each prints its final vertex clip and cull distance draws passed line and then hangs until ctest's 120 s timeout, in the named run and again in the full suite, so the process does not exit after the checks.
  • Full suite 826/830: those three plus windows_exceptions, which fails on main itself since #1423 (reported there).

No revert-pin this time (my script passed the file list wrong); the failures above are the point.

AI-assisted: yes (Claude Code Fable 5.1 xhigh)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107915458 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6107915458). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-11T10:08:48Z. --- Windows + NVIDIA run of 5e14fe0d merged onto `main` 5c4bc7d6 (clean), since the PR's runs are RADV: Windows 11 Pro 26300, RTX 4080 driver 616.56, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, the CI `windows` job's configure flags. The build is clean. - `agc_descriptor_pool_reset_failure`, `agc_driver_pm4_failure`, `agc_vertex_layer_export`, `agc_position_invariance`: pass 5/5. - `agc_driver_layered_volume_draw` fails at once, every run: ``` AGC graphics: vertex draw: slice 1 texel (16, 0) channel 0 is 255, expected 64 (another layer's band) ``` so on this GPU the layer from the misc export does not route the second band to its slice; slice 1 holds band 1's value where band 0's is expected (the mesh case is not reached). - `agc_driver_vertex_clip_cull_draw` and `agc_driver_vertex_clip_cull_draw_no_key` (the #423 commit): each prints its final `vertex clip and cull distance draws passed` line and then hangs until ctest's 120 s timeout, in the named run and again in the full suite, so the process does not exit after the checks. - Full suite 826/830: those three plus `windows_exceptions`, which fails on `main` itself since #1423 (reported there). No revert-pin this time (my script passed the file list wrong); the failures above are the point. AI-assisted: yes (Claude Code Fable 5.1 xhigh)
alfalfa-star commented 2026-10-11 11:22:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T11:22:12Z.


@adriadam10 thanks, all three addressed in three new commits on top (head 95d7536c, no force push):

Driver wiring (c6c1cc5f). New agc_driver_layered_volume_submit goes through the real path:

  • a DCB whose context registers alone describe the target (CB_COLOR_ATTRIB3 resource type 3D with 64 KiB R_X tiling, CB_COLOR_VIEW slices 1-3);
  • 0x207 with USE_VTX_RENDER_TARGET_INDX and the misc vector set;
  • both shaders registered before the draw (AgcDriverRegisterShader), then sceAgcDriverSubmitDcb;
  • the same band/slice readback as agc_driver_layered_volume_draw.

Negative checks, each with ANYPS5_NO_SHADER_CACHE=1:

  • removing | graphics.layerExports in Driver::draw fails it: slice 1 texel (16, 0) channel 0 is 255, expected 64 (another layer's band);
  • replacing DecodeState's bit-18 read with 0 fails it the same way.

DCC on a 3D target (same test). It draws the volume twice more under DCC (CB_COLOR_INFO DCC_ENABLE, keys at CB_COLOR_DCC_BASE):

  • with uncompressed keys, the texels are as without DCC and the keys stay 0xff;
  • with 0000 fast-clear keys, every texel the draw doesn't write reads as the clear color after the write-back, including slice 0 outside the view, and all keys end uncompressed.

Making DecodeColorBuffer drop DCC for volumes fails the fast-clear case (slice 0 texel (0, 0) ... is 64, expected 0), so the decode is now pinned too. Only uniform keys are interpreted, as for 2D targets. The key extent (one key per 256 bytes over every slice) is an assumption about the console's 3D layout, now in the TechnicalDebt entry (95d7536c).

Also (b70f6acd). The [gpu] layer/viewport index vertex exports are ignored line was still printed for layered draws that route the index. It is now reported only for bits a draw doesn't route, and the comment saying layer exports are never routed is removed.

#423. Understood. Once its runtime-enable rework lands I'll rebase onto it and drop the two squashed commits.

Full ctest 819/819 (RADV, RX 9070 XT); conventions pass.

@orishamir thanks for the NVIDIA run. Your agc_driver_layered_volume_draw failure is byte for byte what the new test prints when the layer export is removed from the vertex stage. So on your GPU the render target index never reaches Layer, while the attachment side (2D-array view of the 2D_ARRAY_COMPATIBLE 3D image, framebuffer layers) works. Could you run that test once more with:

  • ANYPS5_NO_SHADER_CACHE=1, to rule out a cached artifact;
  • the Khronos validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation);
  • and, if possible, a dump of the vertex program's SPIR-V, to check whether it declares and writes BuiltIn Layer?

I don't have NVIDIA hardware. The agc_driver_vertex_clip_cull_draw* hang after the final line comes from #423's commit. I'll pass it to @MichonGoddijn231849 with that rework.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108492111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6108492111). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-11T11:22:12Z. --- @adriadam10 thanks, all three addressed in three new commits on top (head 95d7536c, no force push): **Driver wiring (c6c1cc5f).** New `agc_driver_layered_volume_submit` goes through the real path: - a DCB whose context registers alone describe the target (`CB_COLOR_ATTRIB3` resource type 3D with 64 KiB R_X tiling, `CB_COLOR_VIEW` slices 1-3); - `0x207` with USE_VTX_RENDER_TARGET_INDX and the misc vector set; - both shaders registered before the draw (`AgcDriverRegisterShader`), then `sceAgcDriverSubmitDcb`; - the same band/slice readback as `agc_driver_layered_volume_draw`. Negative checks, each with `ANYPS5_NO_SHADER_CACHE=1`: - removing `| graphics.layerExports` in `Driver::draw` fails it: `slice 1 texel (16, 0) channel 0 is 255, expected 64 (another layer's band)`; - replacing `DecodeState`'s bit-18 read with 0 fails it the same way. **DCC on a 3D target (same test).** It draws the volume twice more under DCC (`CB_COLOR_INFO` DCC_ENABLE, keys at `CB_COLOR_DCC_BASE`): - with uncompressed keys, the texels are as without DCC and the keys stay `0xff`; - with `0000` fast-clear keys, every texel the draw doesn't write reads as the clear color after the write-back, including slice 0 outside the view, and all keys end uncompressed. Making `DecodeColorBuffer` drop DCC for volumes fails the fast-clear case (`slice 0 texel (0, 0) ... is 64, expected 0`), so the decode is now pinned too. Only uniform keys are interpreted, as for 2D targets. The key extent (one key per 256 bytes over every slice) is an assumption about the console's 3D layout, now in the TechnicalDebt entry (95d7536c). **Also (b70f6acd).** The `[gpu] layer/viewport index vertex exports are ignored` line was still printed for layered draws that route the index. It is now reported only for bits a draw doesn't route, and the comment saying layer exports are never routed is removed. **#423.** Understood. Once its runtime-enable rework lands I'll rebase onto it and drop the two squashed commits. Full `ctest` 819/819 (RADV, RX 9070 XT); conventions pass. @orishamir thanks for the NVIDIA run. Your `agc_driver_layered_volume_draw` failure is byte for byte what the new test prints when the layer export is removed from the vertex stage. So on your GPU the render target index never reaches `Layer`, while the attachment side (2D-array view of the `2D_ARRAY_COMPATIBLE` 3D image, framebuffer `layers`) works. Could you run that test once more with: - `ANYPS5_NO_SHADER_CACHE=1`, to rule out a cached artifact; - the Khronos validation layer (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`); - and, if possible, a dump of the vertex program's SPIR-V, to check whether it declares and writes `BuiltIn Layer`? I don't have NVIDIA hardware. The `agc_driver_vertex_clip_cull_draw*` hang after the final line comes from #423's commit. I'll pass it to @MichonGoddijn231849 with that rework. AI-assisted: yes (Claude Code)
adriadam10 commented 2026-10-11 11:41:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:41:09Z.

Review: CHANGES_REQUESTED


Thanks for the extra driver-level test and the DCC coverage. Build and the PR's tests pass here merged onto current main (RADV; agc_driver_layered_volume_draw and _submit draw, they don't skip). One thing blocks this:

  • Layer routing fails on NVIDIA. @orishamir's Windows + RTX 4080 run reports agc_driver_layered_volume_draw failing on every run (slice 1 texel (16, 0) channel 0 is 255, expected 64), i.e. the render target index from the misc export never reaches Layer on that driver. We can't reproduce it without NVIDIA, and the NVIDIA run is part of how AGC/recompiler PRs are checked before merging. Please follow up on the data requested above (ANYPS5_NO_SHADER_CACHE=1, validation layer, SPIR-V dump of the vertex stage) together with @orishamir; a likely area to look at is how ShaderViewportIndexLayerEXT / SPV_EXT_shader_viewport_index_layer is declared for a vertex stage on that driver (capability, extension and Layer output vs. the device features enabled). Once the test passes on NVIDIA this is ready from our side.
  • Stack on #423. agc_driver_vertex_clip_cull_draw and _no_key (the #423 commits) hang after their final line on Windows. That is #423's, but this PR can't land before it, so it stays blocked until #423 is out of draft and rebased.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483163001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#pullrequestreview-5483163001). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:41:09Z. **Review:** CHANGES_REQUESTED --- Thanks for the extra driver-level test and the DCC coverage. Build and the PR's tests pass here merged onto current `main` (RADV; `agc_driver_layered_volume_draw` and `_submit` draw, they don't skip). One thing blocks this: - **Layer routing fails on NVIDIA.** @orishamir's Windows + RTX 4080 run reports `agc_driver_layered_volume_draw` failing on every run (`slice 1 texel (16, 0) channel 0 is 255, expected 64`), i.e. the render target index from the misc export never reaches `Layer` on that driver. We can't reproduce it without NVIDIA, and the NVIDIA run is part of how AGC/recompiler PRs are checked before merging. Please follow up on the data requested above (`ANYPS5_NO_SHADER_CACHE=1`, validation layer, SPIR-V dump of the vertex stage) together with @orishamir; a likely area to look at is how `ShaderViewportIndexLayerEXT` / `SPV_EXT_shader_viewport_index_layer` is declared for a vertex stage on that driver (capability, extension and `Layer` output vs. the device features enabled). Once the test passes on NVIDIA this is ready from our side. - **Stack on #423.** `agc_driver_vertex_clip_cull_draw` and `_no_key` (the #423 commits) hang after their final line on Windows. That is #423's, but this PR can't land before it, so it stays blocked until #423 is out of draft and rebased.
orishamir commented 2026-10-11 11:54:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T11:54:32Z.


@alfalfa-star, the three checks on Windows 11 + RTX 4080 (driver 616.56), 95d7536c merged onto main 0f863c10:

  1. Shader cache. The ctest entry of agc_driver_layered_volume_draw already sets ANYPS5_NO_SHADER_CACHE=1 and the test compiles with useCache = false, so my first run had no cache either. With the variable set again: the same line, 3/3. agc_driver_layered_volume_submit fails with the same slice-1 line, 3/3.
  2. Validation layer (Khronos, SDK 1.4.363): no errors. The only message is WARNING-VkImageSubresourceRange-layerCount-compatibility, 4 times (barriers with layerCount 1 on the 3D image).
  3. SPIR-V of the vertex program (a copy of the test that writes geometryResult.spirv): OpCapability ShaderViewportIndexLayerEXT, OpExtension "SPV_EXT_shader_viewport_index_layer", OpDecorate %gl_Layer BuiltIn Layer on an output in the entry point's interface, and one OpStore %gl_Layer of the vertex buffer's layer dword & 2047. spirv-val --target-env vulkan1.2 and vulkan1.3 pass.

Reading back all four slices shows where the bands go: all three land in slice 1. They still all land in slice 1 when the store is patched to a constant 1 or 2. So the Layer write is not applied at all, whatever its value.

Cause: this device reports pipelineLibrary=1, so Pipeline::Begin takes the dynamic-rendering path. That path sets rendering.layerCount = 1 (Pipeline.cpp:546 here, 544 on main). The render-pass path gives the framebuffer state.renderLayers instead. Writing a Layer at or past layerCount is undefined, and the validation layer does not flag it. Your RADV runs pass, so RADV either routes it anyway or takes the render-pass path; NVIDIA puts everything in layer 0.

With that line changed locally to rendering.layerCount = state.renderLayers != 0 ? state.renderLayers : 1u;:

  • The slices hold bands 0/1/2 in slices 1/2/3. With a constant 1 every band lands in slice 2, and with a constant 2 in slice 3.
  • agc_driver_layered_volume_submit passes its checks (layered volume draws through the driver passed). It then segfaults on exit, as it also does after the failure without the change.
  • agc_driver_layered_volume_draw passes the vertex case and stops in the mesh case with missing or incompatible shader execution mode. The mesh program built for this device has LocalSize 32 1 1, but the test passes subgroupSize = 64 to ValidateShaders, so the check expects 64. With the device's 32 it accepts the program.
  • agc_driver_graphics, agc_pipeline_library, agc_pipeline_library_fast_only, agc_driver_prepared_graphics and agc_vertex_layer_export pass.

Not checked: the change on RADV, a full suite with it, or the exit segfault. Without the change the full suite is 833/839 here: the two layered tests, the clip/cull pair, windows_exceptions (from main), and one agc_driver heap-corruption abort that passed 10/10 when run alone.

AI-assisted: yes (Claude Code Opus 5.5 xhigh)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108747860 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6108747860). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-11T11:54:32Z. --- @alfalfa-star, the three checks on Windows 11 + RTX 4080 (driver 616.56), 95d7536c merged onto `main` 0f863c10: 1. **Shader cache.** The ctest entry of `agc_driver_layered_volume_draw` already sets `ANYPS5_NO_SHADER_CACHE=1` and the test compiles with `useCache = false`, so my first run had no cache either. With the variable set again: the same line, 3/3. `agc_driver_layered_volume_submit` fails with the same slice-1 line, 3/3. 2. **Validation layer** (Khronos, SDK 1.4.363): no errors. The only message is `WARNING-VkImageSubresourceRange-layerCount-compatibility`, 4 times (barriers with `layerCount` 1 on the 3D image). 3. **SPIR-V of the vertex program** (a copy of the test that writes `geometryResult.spirv`): `OpCapability ShaderViewportIndexLayerEXT`, `OpExtension "SPV_EXT_shader_viewport_index_layer"`, `OpDecorate %gl_Layer BuiltIn Layer` on an output in the entry point's interface, and one `OpStore %gl_Layer` of the vertex buffer's layer dword `& 2047`. `spirv-val --target-env vulkan1.2` and `vulkan1.3` pass. Reading back all four slices shows where the bands go: all three land in slice 1. They still all land in slice 1 when the store is patched to a constant 1 or 2. So the `Layer` write is not applied at all, whatever its value. **Cause:** this device reports `pipelineLibrary=1`, so `Pipeline::Begin` takes the dynamic-rendering path. That path sets `rendering.layerCount = 1` (`Pipeline.cpp:546` here, 544 on `main`). The render-pass path gives the framebuffer `state.renderLayers` instead. Writing a `Layer` at or past `layerCount` is undefined, and the validation layer does not flag it. Your RADV runs pass, so RADV either routes it anyway or takes the render-pass path; NVIDIA puts everything in layer 0. With that line changed locally to `rendering.layerCount = state.renderLayers != 0 ? state.renderLayers : 1u;`: - The slices hold bands 0/1/2 in slices 1/2/3. With a constant 1 every band lands in slice 2, and with a constant 2 in slice 3. - `agc_driver_layered_volume_submit` passes its checks (`layered volume draws through the driver passed`). It then segfaults on exit, as it also does after the failure without the change. - `agc_driver_layered_volume_draw` passes the vertex case and stops in the mesh case with `missing or incompatible shader execution mode`. The mesh program built for this device has `LocalSize 32 1 1`, but the test passes `subgroupSize = 64` to `ValidateShaders`, so the check expects 64. With the device's 32 it accepts the program. - `agc_driver_graphics`, `agc_pipeline_library`, `agc_pipeline_library_fast_only`, `agc_driver_prepared_graphics` and `agc_vertex_layer_export` pass. Not checked: the change on RADV, a full suite with it, or the exit segfault. Without the change the full suite is 833/839 here: the two layered tests, the clip/cull pair, `windows_exceptions` (from `main`), and one `agc_driver` heap-corruption abort that passed 10/10 when run alone. AI-assisted: yes (Claude Code Opus 5.5 xhigh)
ThatsLeo commented 2026-10-11 12:01:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T12:01:10Z.


Stray (PPSA02101 v01.002, UE4) needs this. It renders into a 3D color target with one view over 65 slices (CB_COLOR_VIEW 0x80000, slices 0-64, CB_COLOR_ATTRIB3 type 2), and without this PR it stops with color views of several array slices are unsupported, as in #2102.

I merged f402eab0 (this PR's head then; I have not retested 95d7536c) onto main f1ae427b for Stray. The conflicts were all additions on both sides:

  • ValidateShaders and Inspect arguments;
  • the Context flags;
  • SurfaceForTarget moving to State.cpp;
  • AttachmentView;
  • the request serialization version (bumped to 16);
  • the tests in Graphics.cpp and ShaderMemory.cpp;
  • LayeredVolumeDraw needed main's Mutation::Add gpu flag.

With it, Stray gets past those draws and renders its first screens (#2749). Intel Arc (Meteor Lake), Mesa 26.2.3 ANV, which has VK_EXT_shader_viewport_index_layer.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108800398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6108800398). Originally posted by [ThatsLeo](https://github.com/ThatsLeo) on 2026-10-11T12:01:10Z. --- Stray (PPSA02101 v01.002, UE4) needs this. It renders into a 3D color target with one view over 65 slices (`CB_COLOR_VIEW` 0x80000, slices 0-64, `CB_COLOR_ATTRIB3` type 2), and without this PR it stops with `color views of several array slices are unsupported`, as in #2102. I merged `f402eab0` (this PR's head then; I have not retested `95d7536c`) onto `main` `f1ae427b` for Stray. The conflicts were all additions on both sides: - `ValidateShaders` and `Inspect` arguments; - the `Context` flags; - `SurfaceForTarget` moving to `State.cpp`; - `AttachmentView`; - the request serialization version (bumped to 16); - the tests in `Graphics.cpp` and `ShaderMemory.cpp`; - `LayeredVolumeDraw` needed `main`'s `Mutation::Add` gpu flag. With it, Stray gets past those draws and renders its first screens (#2749). Intel Arc (Meteor Lake), Mesa 26.2.3 ANV, which has `VK_EXT_shader_viewport_index_layer`. AI-assisted: yes.
alfalfa-star commented 2026-10-12 17:33:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-12T17:33:51Z.


Status update.

NVIDIA routing (@adriadam10's review): @orishamir found the cause: the dynamic-rendering path that devices with pipeline libraries take sets VkRenderingInfo::layerCount = 1, so every layer lands in the first slice. @AlxcBTW's bdd55e037 passes the framebuffer's layer count there and fixes the layered tests for NVIDIA (subgroup size in the mesh case, clean shutdown). I'll take that commit, with authorship kept.

Waiting on #423: this PR needs #423's PA_CL_VS_OUT_CNTL plumbing and carries a squashed copy of it until #423 merges. #423 was rebuilt on main today. Rather than rebase this branch onto every new #423 head, I'll rebase once #423 lands. Then this PR is only its own commits plus the fix above.

Testing it now: #3763 (@eljackjoestar-cmd) carries this PR rebased onto a recent main, with the same layerCount fix, so that's the easiest branch to test titles on until then.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129343031 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6129343031). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-12T17:33:51Z. --- Status update. **NVIDIA routing (@adriadam10's review):** @orishamir found the cause: the dynamic-rendering path that devices with pipeline libraries take sets `VkRenderingInfo::layerCount = 1`, so every layer lands in the first slice. @AlxcBTW's bdd55e037 passes the framebuffer's layer count there and fixes the layered tests for NVIDIA (subgroup size in the mesh case, clean shutdown). I'll take that commit, with authorship kept. **Waiting on #423:** this PR needs #423's `PA_CL_VS_OUT_CNTL` plumbing and carries a squashed copy of it until #423 merges. #423 was rebuilt on `main` today. Rather than rebase this branch onto every new #423 head, I'll rebase once #423 lands. Then this PR is only its own commits plus the fix above. **Testing it now:** #3763 (@eljackjoestar-cmd) carries this PR rebased onto a recent `main`, with the same `layerCount` fix, so that's the easiest branch to test titles on until then. AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-13 08:50:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T08:50:20Z.


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
#448 core/libs/prx/libSceAgcDriver/tests/execution/VertexClipCullDistances.cpp
core/libs/prx/libSceAgcDriver/tests/execution/VertexClipCullDraw.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141882877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6141882877). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T08:50:20Z. --- <!-- 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 | |---|---|---|---| | #448 | | | `core/libs/prx/libSceAgcDriver/tests/execution/VertexClipCullDistances.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/execution/VertexClipCullDraw.cpp` |
fma-rc commented 2026-10-13 10:07:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-13T10:07:05Z.


Kena (PPSA01746) needs the DCC part of this. On main 2a2a3dc65 (with #423 merged) it runs to 101 s and stops with AGC graphics: mipmapped or DCC 3D color targets are unsupported.

I printed the decoded target in front of that check: slot 0, 64 slices, max mip 0, DCC enabled (CB_COLOR_ATTRIB3 0x4ec6c03f, info word 0x10040730). That is the DCC case this PR lifts; the surface has no mips.

I could not run the title on this branch, it conflicts with main since #423 merged. I will run it after a rebase and report where it gets to.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143181743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6143181743). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-13T10:07:05Z. --- Kena (PPSA01746) needs the DCC part of this. On `main` 2a2a3dc65 (with #423 merged) it runs to 101 s and stops with `AGC graphics: mipmapped or DCC 3D color targets are unsupported`. I printed the decoded target in front of that check: slot 0, 64 slices, max mip 0, DCC enabled (`CB_COLOR_ATTRIB3` 0x4ec6c03f, info word 0x10040730). That is the DCC case this PR lifts; the surface has no mips. I could not run the title on this branch, it conflicts with `main` since #423 merged. I will run it after a rebase and report where it gets to.
oneandonlydean commented 2026-10-13 10:36:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T10:36:20Z.


Closing as merged through #3763: your commits are on main with your authorship (1055617751c render layered draws into 3D color targets, the layered volume tests, the layer-export reporting fix and the DCC key extent note), with the dynamic-rendering layer count on top. Thanks for the work on this.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143670075 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6143670075). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T10:36:20Z. --- Closing as merged through #3763: your commits are on main with your authorship (`1055617751c` render layered draws into 3D color targets, the layered volume tests, the layer-export reporting fix and the DCC key extent note), with the dynamic-rendering layer count on top. Thanks for the work on this.
oneandonlydean commented 2026-10-13 10:37:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T10:37:22Z.


@fma-rc #3763 is merged with these commits, and mipmapped or DCC 3D color targets are unsupported is gone from main. Does PPSA01746 get past 101 s on current main now? If it stops again, the next log line would help.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143686767 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6143686767). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T10:37:22Z. --- @fma-rc #3763 is merged with these commits, and `mipmapped or DCC 3D color targets are unsupported` is gone from main. Does PPSA01746 get past 101 s on current main now? If it stops again, the next log line would help.
fma-rc commented 2026-10-13 11:26:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-13T11:26:02Z.


Yes, it gets past that check. On main b1328fc0f PPSA01746 creates the two 200x113 targets with 64 slices and no longer throws on them. Two runs then stop a little later in the same place (77 s and 86 s into the run, the difference is shader cache warm-up):

[gpu] layer/viewport index vertex exports are ignored (PA_CL_VS_OUT_CNTL=0x01240000)
terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC driver: guest memory is not readable at 0xdfac00000008 (range 0xdfac00000008+0x4)

The layer/viewport index line is printed once per run, right before the stop. I have not looked at which read hits 0xdfac00000008 yet, so I can't say whether the two lines are related. I'll get a backtrace for it and open an issue with that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6144485948 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6144485948). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-13T11:26:02Z. --- Yes, it gets past that check. On `main` b1328fc0f PPSA01746 creates the two 200x113 targets with 64 slices and no longer throws on them. Two runs then stop a little later in the same place (77 s and 86 s into the run, the difference is shader cache warm-up): ``` [gpu] layer/viewport index vertex exports are ignored (PA_CL_VS_OUT_CNTL=0x01240000) terminate called after throwing an instance of 'std::runtime_error' what(): AGC driver: guest memory is not readable at 0xdfac00000008 (range 0xdfac00000008+0x4) ``` The `layer/viewport index` line is printed once per run, right before the stop. I have not looked at which read hits 0xdfac00000008 yet, so I can't say whether the two lines are related. I'll get a backtrace for it and open an issue with that.
alfalfa-star commented 2026-10-13 16:19:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-13T16:19:26Z.


@fma-rc I hit the same 0xdfac00000008 stop with Kena on PPSA01802, so here is what I found, in case it saves you the backtrace.

  • What it is: the address is not a real pointer. It is words 2-3 of a buffer descriptor (V#) read as a 64-bit address: word 2 (NUM_RECORDS, here 8) in the low half and word 3 in the high half, cut to 48 bits. Kena's V# word 3 looks like 0x0004dfac, which gives 0xdfac00000008 (I also saw 0x9fac...). The SRT walker follows that "pointer" while evaluating a shader's descriptor sources, and CheckRange throws on the unreadable range.
  • #3952 alone doesn't cover it: your main b1328fc0f already has #3952 (branch-decided descriptor sources) and still stops, which matches what I saw.
  • What got Kena past it locally: outside flat SRTs, an inaccessible read in EvaluateRuntimeSourcesImpl (SrtDescriptorEvaluation.cpp) is reported the same way the flat-SRT path already does it (ReportInaccessibleReads), so that descriptor becomes a null descriptor instead of ending the title. That stand-in was part of the local stack on which Kena reached gameplay. I haven't proposed it as a PR yet, because it hides the read instead of explaining why the shader's source resolves to V# words. A backtrace from your side (APS5_TRACE_UNREADABLE=1 prints the caller's offset) would show whether it's the same walker path.

The [gpu] layer/viewport index vertex exports are ignored (PA_CL_VS_OUT_CNTL=0x01240000) line is most likely unrelated. It is printed because bit 24 is outside layerExports even though the layered draw is routed (@queeeef noted the same on #2102).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6150060568 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1077#issuecomment-6150060568). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-13T16:19:26Z. --- @fma-rc I hit the same `0xdfac00000008` stop with Kena on PPSA01802, so here is what I found, in case it saves you the backtrace. - **What it is:** the address is not a real pointer. It is words 2-3 of a buffer descriptor (V#) read as a 64-bit address: word 2 (`NUM_RECORDS`, here 8) in the low half and word 3 in the high half, cut to 48 bits. Kena's V# word 3 looks like `0x0004dfac`, which gives `0xdfac00000008` (I also saw `0x9fac...`). The SRT walker follows that "pointer" while evaluating a shader's descriptor sources, and `CheckRange` throws on the unreadable range. - **#3952 alone doesn't cover it:** your `main` b1328fc0f already has #3952 (branch-decided descriptor sources) and still stops, which matches what I saw. - **What got Kena past it locally:** outside flat SRTs, an inaccessible read in `EvaluateRuntimeSourcesImpl` (`SrtDescriptorEvaluation.cpp`) is reported the same way the flat-SRT path already does it (`ReportInaccessibleReads`), so that descriptor becomes a null descriptor instead of ending the title. That stand-in was part of the local stack on which Kena reached gameplay. I haven't proposed it as a PR yet, because it hides the read instead of explaining why the shader's source resolves to V# words. A backtrace from your side (`APS5_TRACE_UNREADABLE=1` prints the caller's offset) would show whether it's the same walker path. The `[gpu] layer/viewport index vertex exports are ignored (PA_CL_VS_OUT_CNTL=0x01240000)` line is most likely unrelated. It is printed because bit 24 is outside `layerExports` even though the layered draw is routed (@queeeef noted the same on #2102). AI-assisted: yes (Claude Code)

Pull request closed

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!1077
No description provided.