feat(agc): vertex clip and cull distances #423

Merged
MichonGoddijn231849 merged 2 commits from upstream-pr/423 into main 2026-10-13 08:47:44 +00:00
MichonGoddijn231849 commented 2026-10-02 23:31:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-02T23:31:00Z.


What

Draws whose vertex stage exports clip or cull distances (PA_CL_VS_OUT_CNTL clip/cull enables and VS_OUT_CCDIST) were refused with clip distances, layer, viewport or auxiliary vertex exports. The recompiler already turns the misc and clip/cull position exports into ClipDistance/CullDistance outputs from ShaderVertexStageInfo::paClVsOutCntl, but the driver never passed the register, so the field was always 0.

  • Driver: decodeVertexInfo passes PA_CL_VS_OUT_CNTL's clip/cull enables and VS_OUT_MISC/CCDIST bits. They are part of the draw lookup key and the vertex-info comparison, the recompile cache key, and the serialized request (version 18; main is at 17).
  • Preparation (with @johnmaia's b599cfc1): registration (from the registered state's PA_CL_VS_OUT_CNTL) and draw-time preparation set the bits the same way the draw does, so a draw whose register matches finds the artifact prepared ahead instead of preparing one at use. A program whose code has no pos1..pos3 export gets no bits at all (PositionExportLayout, cached per snapshot), so its artifact does not depend on PA_CL_VS_OUT_CNTL. That also covers johnmaia's 0x01240000 case, where only the misc-vector bit was set.
  • State: up to eight clip and cull distances are accepted; more are refused by the decode and the precheck. State::paClVsOutCntl keeps the value for the validator's messages and its cache key.
  • Validator: vertex ClipDistance outputs of f32[1..8] (they share one array with main's all-zero clip position distance from 9db923e90, which takes the index after the guest's) and vertex CullDistance outputs of f32[1..8], at most eight together. A clip or cull capability on a device without shaderClipDistance/shaderCullDistance is refused with the PA_CL_VS_OUT_CNTL value in the message.
  • Device: shaderCullDistance is enabled when available, next to main's shaderClipDistance, and CullDistance joins the device capabilities.

In GTA V the reflections in glass and some glass textures were missing: their draws clip against a plane. tibzejoker's Story mode stop (register 0x207 = 0x00400001, one clip distance) is this path.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

  • New execution tests:
    • agc_driver_vertex_clip_cull_distances: device draws for each enable pattern (no bits, clip planes 0, 1 and 0x5, cull plane 0 with every vertex negative and with one not, sparse cull plane 0x4), checking which pixels are written.
    • agc_driver_vertex_clip_cull_draw and ..._no_key: the position export layout of a pos0-only program (no bits), a pos1 program (only the layout bits), cached and at a code offset; then the same draws through PM4 submission, with the draw key on and off (the cache then keys on the decoded vertex stage, which must include PA_CL_VS_OUT_CNTL). Both shut the driver down at exit (thanks @Scramblrrrr for the teardown crash).
  • Unit tests: four clip and four cull distances pass the validator, nine are refused; a device without the clip or without the cull feature refuses that capability only; four distances pass the decode and the precheck, nine are refused by both; the field survives serialization, changes the recompile cache key, and a version 17 request reads without it; position components decode to the right clip and cull indices.
  • Main's agc_driver_zero_position_vertex and agc_position_invariance still pass.
  • GTA V (PPSA04264), Prologue, on the earlier head: the reflections and glass textures render.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4722547077 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-02T23:31:00Z. --- ### What Draws whose vertex stage exports clip or cull distances (PA_CL_VS_OUT_CNTL clip/cull enables and VS_OUT_CCDIST) were refused with `clip distances, layer, viewport or auxiliary vertex exports`. The recompiler already turns the misc and clip/cull position exports into `ClipDistance`/`CullDistance` outputs from `ShaderVertexStageInfo::paClVsOutCntl`, but the driver never passed the register, so the field was always 0. - **Driver:** `decodeVertexInfo` passes PA_CL_VS_OUT_CNTL's clip/cull enables and VS_OUT_MISC/CCDIST bits. They are part of the draw lookup key and the vertex-info comparison, the recompile cache key, and the serialized request (version 18; main is at 17). - **Preparation** (with @johnmaia's b599cfc1): registration (from the registered state's PA_CL_VS_OUT_CNTL) and draw-time preparation set the bits the same way the draw does, so a draw whose register matches finds the artifact prepared ahead instead of preparing one at use. A program whose code has no `pos1`..`pos3` export gets no bits at all (`PositionExportLayout`, cached per snapshot), so its artifact does not depend on PA_CL_VS_OUT_CNTL. That also covers johnmaia's `0x01240000` case, where only the misc-vector bit was set. - **State:** up to eight clip and cull distances are accepted; more are refused by the decode and the precheck. `State::paClVsOutCntl` keeps the value for the validator's messages and its cache key. - **Validator:** vertex `ClipDistance` outputs of `f32[1..8]` (they share one array with main's all-zero clip position distance from 9db923e90, which takes the index after the guest's) and vertex `CullDistance` outputs of `f32[1..8]`, at most eight together. A clip or cull capability on a device without `shaderClipDistance`/`shaderCullDistance` is refused with the PA_CL_VS_OUT_CNTL value in the message. - **Device:** `shaderCullDistance` is enabled when available, next to main's `shaderClipDistance`, and `CullDistance` joins the device capabilities. In GTA V the reflections in glass and some glass textures were missing: their draws clip against a plane. tibzejoker's Story mode stop (`register 0x207 = 0x00400001`, one clip distance) is this path. ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0. - New execution tests: - `agc_driver_vertex_clip_cull_distances`: device draws for each enable pattern (no bits, clip planes 0, 1 and 0x5, cull plane 0 with every vertex negative and with one not, sparse cull plane 0x4), checking which pixels are written. - `agc_driver_vertex_clip_cull_draw` and `..._no_key`: the position export layout of a pos0-only program (no bits), a pos1 program (only the layout bits), cached and at a code offset; then the same draws through PM4 submission, with the draw key on and off (the cache then keys on the decoded vertex stage, which must include PA_CL_VS_OUT_CNTL). Both shut the driver down at exit (thanks @Scramblrrrr for the teardown crash). - Unit tests: four clip and four cull distances pass the validator, nine are refused; a device without the clip or without the cull feature refuses that capability only; four distances pass the decode and the precheck, nine are refused by both; the field survives serialization, changes the recompile cache key, and a version 17 request reads without it; position components decode to the right clip and cull indices. - Main's `agc_driver_zero_position_vertex` and `agc_position_invariance` still pass. - GTA V (PPSA04264), Prologue, on the earlier head: the reflections and glass textures render. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-03 06:28:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T06:28:33Z.


Heads-up on the request serialization: #303 (mine) also moves it from version 5 to 6, for nonConstantImageOffsets. Git merges the two cleanly because the version lines are identical, but then a version 6 request written by a build with only one of them is misread by a build with both. Whichever of the two lands second should move to version 7. #426 currently has both fields under version 6.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5966362598 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-5966362598). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-03T06:28:33Z. --- Heads-up on the request serialization: #303 (mine) also moves it from version 5 to 6, for `nonConstantImageOffsets`. Git merges the two cleanly because the version lines are identical, but then a version 6 request written by a build with only one of them is misread by a build with both. Whichever of the two lands second should move to version 7. #426 currently has both fields under version 6.
MichonGoddijn231849 commented 2026-10-03 08:35:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-03T08:35:26Z.


Thanks, good catch. #303 landed first, so this one moved to version 7: it writes 7, reads paClVsOutCntl only from version 7, and still reads #303's field from version 6. Rebased onto main with a round-trip test for the field.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5967233925 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-5967233925). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-03T08:35:26Z. --- Thanks, good catch. #303 landed first, so this one moved to version 7: it writes 7, reads `paClVsOutCntl` only from version 7, and still reads #303's field from version 6. Rebased onto `main` with a round-trip test for the field.
MichonGoddijn231849 commented 2026-10-06 15:39:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-06T15:39:16Z.


Rebased onto current main and the rebased #375 (now 7aa98bf2). One more fix on top: #752 took recompile request version 7 for the conservative Z export, which is the version this PR used for PA_CL_VS_OUT_CNTL. A version 7 request written by main would have been misread, so this PR now writes version 8 and reads paClVsOutCntl only from version 8. The round-trip test still covers the field. Builds; the driver tests pass apart from agc_driver_scalar_sop1, which fails without this PR too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6019835481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6019835481). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-06T15:39:16Z. --- Rebased onto current `main` and the rebased #375 (now 7aa98bf2). One more fix on top: #752 took recompile request version 7 for the conservative Z export, which is the version this PR used for `PA_CL_VS_OUT_CNTL`. A version 7 request written by `main` would have been misread, so this PR now writes version 8 and reads `paClVsOutCntl` only from version 8. The round-trip test still covers the field. Builds; the driver tests pass apart from `agc_driver_scalar_sop1`, which fails without this PR too.
MichonGoddijn231849 commented 2026-10-07 08:41:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T08:41:32Z.


Rebased onto current main (now e6210b87). main took request version 8 for the target export mapping in the meantime, which is the version this PR used for PA_CL_VS_OUT_CNTL. It merged without a textual conflict, but a version 8 request written by main would have been read as having the field, so this PR now writes version 9 and reads paClVsOutCntl only from version 9; the serializer test checks the version 9 prefix and refuses 10. #375 and #295's commits are still included below it. Builds; the driver tests pass apart from agc_driver_scalar_sop1 (fixed by #928).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6034274125 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6034274125). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-07T08:41:32Z. --- Rebased onto current `main` (now e6210b87). `main` took request version 8 for the target export mapping in the meantime, which is the version this PR used for `PA_CL_VS_OUT_CNTL`. It merged without a textual conflict, but a version 8 request written by `main` would have been read as having the field, so this PR now writes version 9 and reads `paClVsOutCntl` only from version 9; the serializer test checks the version 9 prefix and refuses 10. #375 and #295's commits are still included below it. Builds; the driver tests pass apart from `agc_driver_scalar_sop1` (fixed by #928).
MichonGoddijn231849 commented 2026-10-07 17:31:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T17:31:05Z.


Rebased onto current main and the rebased #375 (now 5c5b106d). main now uses request version 9 for the sRGB decode formats, which is the version this PR used for PA_CL_VS_OUT_CNTL. A new commit moves it to version 10, and the serialization test expects 10 for new requests and refuses 11. Note: #1182 (compute scratch) also takes version 10; whichever lands second moves to 11. Build and ctest pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6043246895 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6043246895). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-07T17:31:05Z. --- Rebased onto current `main` and the rebased #375 (now 5c5b106d). `main` now uses request version 9 for the sRGB decode formats, which is the version this PR used for `PA_CL_VS_OUT_CNTL`. A new commit moves it to version 10, and the serialization test expects 10 for new requests and refuses 11. Note: #1182 (compute scratch) also takes version 10; whichever lands second moves to 11. Build and ctest pass.
adriadam10 commented 2026-10-07 20:14:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T20:14:58Z.

Review: DISMISSED


Built this merged onto current main: ctest passes (400/400). I also reverted each source file by itself to see which ones the new tests cover. The validator, state, serializer and cache-key changes are covered. The path that makes the feature work isn't: reverting Draw.cpp:139, DrawLookup.cpp:51, DrawRegisterKey.cpp:43, ShaderInputInfoBuilder.cpp:160 or VulkanDevice.cpp:930 still passes every test.

  • No test draws with clip or cull distances. The recompiler's mapping from position exports to ClipDistance/CullDistance (DecodePositionExportComponent) has never run in a test on main, and this PR is what turns it on. Could you add an execution test along the lines of tests/execution/PixelHelperLanes.cpp? A vertex shader that exports pos0 plus pos1, with VS_OUT_CCDIST0_VEC_ENA set and some clip and cull enables, would do. Use a triangle whose distances go negative across it, and check which pixels get written: one row for clip, one for cull, and one with a sparse mask like CLIP_DIST_ENA = 0x5, so the compacted indexing is pinned too. Lavapipe supports shaderClipDistance/shaderCullDistance, so this runs on Linux CI. Right now the GTA V result is the only evidence for the main change, and we can't reproduce it.
  • ShaderValidation.cpp:222 accepts the ClipDistance/CullDistance capabilities unconditionally. VulkanDevice.cpp:929-930 only enables the features when they're available. On a device without them, the draw would build an invalid pipeline instead of being refused. Gate them the way geometryShader/sampleRateShading are gated for fragment stages, or push the capabilities into state->capabilities when they're enabled.
  • Serializer: reading paClVsOutCntl from version 9 (RequestSerializer.cpp:401, >= 9u) still passes the tests, so the version gate isn't pinned. A case that deserializes a version 9 vertex request (the field stays 0 and the fields after it are intact) would cover it.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5447801987 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#pullrequestreview-5447801987). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T20:14:58Z. **Review:** DISMISSED --- Built this merged onto current `main`: ctest passes (400/400). I also reverted each source file by itself to see which ones the new tests cover. The validator, state, serializer and cache-key changes are covered. The path that makes the feature work isn't: reverting `Draw.cpp:139`, `DrawLookup.cpp:51`, `DrawRegisterKey.cpp:43`, `ShaderInputInfoBuilder.cpp:160` or `VulkanDevice.cpp:930` still passes every test. - **No test draws with clip or cull distances.** The recompiler's mapping from position exports to `ClipDistance`/`CullDistance` (`DecodePositionExportComponent`) has never run in a test on `main`, and this PR is what turns it on. Could you add an execution test along the lines of `tests/execution/PixelHelperLanes.cpp`? A vertex shader that exports `pos0` plus `pos1`, with `VS_OUT_CCDIST0_VEC_ENA` set and some clip and cull enables, would do. Use a triangle whose distances go negative across it, and check which pixels get written: one row for clip, one for cull, and one with a sparse mask like `CLIP_DIST_ENA = 0x5`, so the compacted indexing is pinned too. Lavapipe supports `shaderClipDistance`/`shaderCullDistance`, so this runs on Linux CI. Right now the GTA V result is the only evidence for the main change, and we can't reproduce it. - **`ShaderValidation.cpp:222` accepts the `ClipDistance`/`CullDistance` capabilities unconditionally.** `VulkanDevice.cpp:929-930` only enables the features when they're available. On a device without them, the draw would build an invalid pipeline instead of being refused. Gate them the way `geometryShader`/`sampleRateShading` are gated for fragment stages, or push the capabilities into `state->capabilities` when they're enabled. - **Serializer:** reading `paClVsOutCntl` from version 9 (`RequestSerializer.cpp:401`, `>= 9u`) still passes the tests, so the version gate isn't pinned. A case that deserializes a version 9 vertex request (the field stays 0 and the fields after it are intact) would cover it.
MichonGoddijn231849 commented 2026-10-08 16:13:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-08T16:13:29Z.


Thanks. Rebased onto main (the vertex field now reads from request version 13, since main is at 12) and addressed the points:

  1. Draws with clip and cull distances: agc_driver_vertex_clip_cull_distances hand-encodes a vertex shader that exports pos0 and pos1 with VS_OUT_CCDIST0_VEC_ENA and drives the device directly: no enables, clip plane 0, clip plane 1 alone, CLIP_DIST_ENA = 0x5 (the compacted indexing), and two cull cases, checking which pixels are written. agc_driver_vertex_clip_cull_draw (and _no_key, with APS5_NO_DRAW_KEY=1) submit the same through PM4, changing only PA_CL_VS_OUT_CNTL and the distances, so the draw decode and the draw cache are covered. I reverted each line you listed in turn: Draw.cpp, ShaderInputInfoBuilder.cpp and the cull enable in VulkanDevice.cpp fail the tests; DrawLookup.cpp fails the _no_key run (the register key already covers it otherwise). The sameVertexInfo comparison in DrawRegisterKey.cpp is not reachable by a test, since the register key already includes PA_CL_VS_OUT_CNTL; I kept it as a guard, but can drop it if you prefer.
  2. ShaderValidation accepts the ClipDistance/CullDistance capabilities only when the device enabled the features, and the refusal names PA_CL_VS_OUT_CNTL with its value.
  3. A version-12 vertex request test checks the field reads as 0 and the following bytes are unchanged.
    The bit-to-component mapping (enable bit s selects component s, the Vulkan index counted by the enabled bits below) follows the recompiler's existing position-export mapping, not hardware or documentation; it is listed under Unknown function info in TechnicalDebt.md.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064132370 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6064132370). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-08T16:13:29Z. --- Thanks. Rebased onto main (the vertex field now reads from request version 13, since main is at 12) and addressed the points: 1. Draws with clip and cull distances: `agc_driver_vertex_clip_cull_distances` hand-encodes a vertex shader that exports pos0 and pos1 with `VS_OUT_CCDIST0_VEC_ENA` and drives the device directly: no enables, clip plane 0, clip plane 1 alone, `CLIP_DIST_ENA = 0x5` (the compacted indexing), and two cull cases, checking which pixels are written. `agc_driver_vertex_clip_cull_draw` (and `_no_key`, with `APS5_NO_DRAW_KEY=1`) submit the same through PM4, changing only `PA_CL_VS_OUT_CNTL` and the distances, so the draw decode and the draw cache are covered. I reverted each line you listed in turn: `Draw.cpp`, `ShaderInputInfoBuilder.cpp` and the cull enable in `VulkanDevice.cpp` fail the tests; `DrawLookup.cpp` fails the `_no_key` run (the register key already covers it otherwise). The `sameVertexInfo` comparison in `DrawRegisterKey.cpp` is not reachable by a test, since the register key already includes `PA_CL_VS_OUT_CNTL`; I kept it as a guard, but can drop it if you prefer. 2. `ShaderValidation` accepts the `ClipDistance`/`CullDistance` capabilities only when the device enabled the features, and the refusal names `PA_CL_VS_OUT_CNTL` with its value. 3. A version-12 vertex request test checks the field reads as 0 and the following bytes are unchanged. The bit-to-component mapping (enable bit s selects component s, the Vulkan index counted by the enabled bits below) follows the recompiler's existing position-export mapping, not hardware or documentation; it is listed under Unknown function info in TechnicalDebt.md.
alfalfa-star commented 2026-10-08 17:51:40 +00:00 (Migrated from github.com)

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


@MichonGoddijn231849 The Windows job times out in agc_driver_vertex_clip_cull_draw and agc_driver_vertex_clip_cull_draw_no_key (120 s each). Windows CI has no Vulkan device, so the other execution tests skip there in about 0.05 s. This one submits through the driver without checking for a device. With VK_ICD_FILENAMES=/nonexistent.json on Linux it fails instead of skipping ("pixel (0, 0) is clear, expected written"), and on Windows it hangs.

Probing the device the way the other execution tests do fixes both cases:

 #include "prx/libSceAgcDriver/Submit/include/Dcb.hpp"
+#include "VulkanTestDevice.hpp"
@@ int main(int argc, char** argv) {
         if (noKey) Require(std::getenv("APS5_NO_DRAW_KEY") != nullptr, "the no-key run must start with APS5_NO_DRAW_KEY set");
+        if (!OpenVulkanTestDevice()) return VulkanTestSkipped;

Locally, with no device both variants exit 77 (skipped). On RADV (RX 9070 XT) both still pass. #1077 is stacked on this PR and fails Windows for the same reason.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6065820626 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6065820626). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-08T17:51:40Z. --- @MichonGoddijn231849 The Windows job times out in `agc_driver_vertex_clip_cull_draw` and `agc_driver_vertex_clip_cull_draw_no_key` (120 s each). Windows CI has no Vulkan device, so the other execution tests skip there in about 0.05 s. This one submits through the driver without checking for a device. With `VK_ICD_FILENAMES=/nonexistent.json` on Linux it fails instead of skipping ("pixel (0, 0) is clear, expected written"), and on Windows it hangs. Probing the device the way the other execution tests do fixes both cases: ```diff #include "prx/libSceAgcDriver/Submit/include/Dcb.hpp" +#include "VulkanTestDevice.hpp" @@ int main(int argc, char** argv) { if (noKey) Require(std::getenv("APS5_NO_DRAW_KEY") != nullptr, "the no-key run must start with APS5_NO_DRAW_KEY set"); + if (!OpenVulkanTestDevice()) return VulkanTestSkipped; ``` Locally, with no device both variants exit 77 (skipped). On RADV (RX 9070 XT) both still pass. #1077 is stacked on this PR and fails Windows for the same reason.
alfalfa-star commented 2026-10-08 18:44:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T18:44:29Z.


@MichonGoddijn231849 I rebased this PR onto main 6b56175a locally (as the base for #1077). The conflicts with #639 are small, but on Linux (RADV) both clip/cull draw tests fail in two separate ways. This comes on top of the missing device check I posted above.

1. Registration: easy to fix in the test. Since #639, AgcDriverRegisterShader prepares the shader from the static registers in its header, so the test fails with missing static shader ABI register 201 (0xc9, the vertex program address). With the program, resource and stage registers in the header, as tests/Submit.cpp does now, registration succeeds:

@@ -100,2 +100,4 @@ struct RegisteredShader {
     ShaderUserData userData;
+    std::array<ShaderRegister, 3> shRegisters;
+    std::array<ShaderRegister, 1> cxRegisters;
 };
@@ -119,3 +121,10 @@ const std::vector<std::pair<std::uint32_t, std::uint32_t>> ContextBaseline{
 
-void Register(RegisteredShader& registered, const void* code, std::uint32_t bytes, std::uint8_t type) {
+void Register(RegisteredShader& registered, const void* code, std::uint32_t bytes, std::uint8_t type, std::uint32_t programRegister, std::uint32_t resourceRegister, std::uint32_t resources, ShaderRegister context) {
+    const auto address = reinterpret_cast<std::uintptr_t>(code);
+    registered.shRegisters = {{{programRegister, static_cast<std::uint32_t>(address >> 8u)}, {programRegister + 1u, static_cast<std::uint32_t>(address >> 40u)}, {resourceRegister, resources}}};
+    registered.cxRegisters = {context};
+    registered.shader.sh_registers = registered.shRegisters.data();
+    registered.shader.num_sh_registers = registered.shRegisters.size();
+    registered.shader.cx_registers = registered.cxRegisters.data();
+    registered.shader.num_cx_registers = registered.cxRegisters.size();
     registered.shader.file_header = 0x34333231u;
@@ -195,4 +204,4 @@ int main(int argc, char** argv) {
         ColorMemory = AllocateWatched(2 * Block);
-        Register(VertexShader, VertexCode.data(), sizeof(VertexCode), 2);
-        Register(PixelShader, PixelCode.data(), sizeof(PixelCode), 1);
+        Register(VertexShader, VertexCode.data(), sizeof(VertexCode), 2, 0x0c8, 0x08b, 4u << 1u, {0x2d5, 0x2000});
+        Register(PixelShader, PixelCode.data(), sizeof(PixelCode), 1, 0x008, 0x00b, 0u, {0x1b6, 0});
         for (const auto& step : Steps) {

2. Draw: the prepared artifact misses. This one is a design question, not a test fix. With registration fixed, the first draw fails with:

AGC driver: prepared shader artifact is missing for the requested static ABI: ... stage=1 wave=64 pushOffset=0 pushCapacity=128 preparedLayouts= [0,128]

The layout matches, so the miss comes from the static key. The driver sets paClVsOutCntl from 0x207 at draw time (Execution/src/Driver/Draw/Draw.cpp). RecompileCacheKey::BuildInterface includes it (CacheKey.hpp, append(key, value.paClVsOutCntl)), and BuildPreparedShaderKey builds on that. Registration never sets it, so its artifact is keyed with 0, and every draw that sets the clip/cull bits misses. Even the test's first step has DistanceVector (bit 22) set. Also, one registered shader is drawn with four different PA_CL_VS_OUT_CNTL values, so a single value read at registration wouldn't cover it either.

#639 had the same problem with export component order, and moved it to runtime (2a117a6e, fix(shader): apply fragment export mappings at runtime). The clip/cull enables probably need the same treatment, as a runtime input or a prepared variant per value, but that's your design call (and perhaps the maintainers'). #1077 adds the layer export to the same field, so it has the same problem and will follow whatever you choose here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6066707627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6066707627). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-08T18:44:29Z. --- @MichonGoddijn231849 I rebased this PR onto `main` 6b56175a locally (as the base for #1077). The conflicts with #639 are small, but on Linux (RADV) both clip/cull draw tests fail in two separate ways. This comes on top of the missing device check I posted above. **1. Registration: easy to fix in the test.** Since #639, `AgcDriverRegisterShader` prepares the shader from the static registers in its header, so the test fails with `missing static shader ABI register 201` (`0xc9`, the vertex program address). With the program, resource and stage registers in the header, as `tests/Submit.cpp` does now, registration succeeds: ```diff @@ -100,2 +100,4 @@ struct RegisteredShader { ShaderUserData userData; + std::array<ShaderRegister, 3> shRegisters; + std::array<ShaderRegister, 1> cxRegisters; }; @@ -119,3 +121,10 @@ const std::vector<std::pair<std::uint32_t, std::uint32_t>> ContextBaseline{ -void Register(RegisteredShader& registered, const void* code, std::uint32_t bytes, std::uint8_t type) { +void Register(RegisteredShader& registered, const void* code, std::uint32_t bytes, std::uint8_t type, std::uint32_t programRegister, std::uint32_t resourceRegister, std::uint32_t resources, ShaderRegister context) { + const auto address = reinterpret_cast<std::uintptr_t>(code); + registered.shRegisters = {{{programRegister, static_cast<std::uint32_t>(address >> 8u)}, {programRegister + 1u, static_cast<std::uint32_t>(address >> 40u)}, {resourceRegister, resources}}}; + registered.cxRegisters = {context}; + registered.shader.sh_registers = registered.shRegisters.data(); + registered.shader.num_sh_registers = registered.shRegisters.size(); + registered.shader.cx_registers = registered.cxRegisters.data(); + registered.shader.num_cx_registers = registered.cxRegisters.size(); registered.shader.file_header = 0x34333231u; @@ -195,4 +204,4 @@ int main(int argc, char** argv) { ColorMemory = AllocateWatched(2 * Block); - Register(VertexShader, VertexCode.data(), sizeof(VertexCode), 2); - Register(PixelShader, PixelCode.data(), sizeof(PixelCode), 1); + Register(VertexShader, VertexCode.data(), sizeof(VertexCode), 2, 0x0c8, 0x08b, 4u << 1u, {0x2d5, 0x2000}); + Register(PixelShader, PixelCode.data(), sizeof(PixelCode), 1, 0x008, 0x00b, 0u, {0x1b6, 0}); for (const auto& step : Steps) { ``` **2. Draw: the prepared artifact misses. This one is a design question, not a test fix.** With registration fixed, the first draw fails with: ``` AGC driver: prepared shader artifact is missing for the requested static ABI: ... stage=1 wave=64 pushOffset=0 pushCapacity=128 preparedLayouts= [0,128] ``` The layout matches, so the miss comes from the static key. The driver sets `paClVsOutCntl` from `0x207` at draw time (`Execution/src/Driver/Draw/Draw.cpp`). `RecompileCacheKey::BuildInterface` includes it (`CacheKey.hpp`, `append(key, value.paClVsOutCntl)`), and `BuildPreparedShaderKey` builds on that. Registration never sets it, so its artifact is keyed with 0, and every draw that sets the clip/cull bits misses. Even the test's first step has `DistanceVector` (bit 22) set. Also, one registered shader is drawn with four different `PA_CL_VS_OUT_CNTL` values, so a single value read at registration wouldn't cover it either. #639 had the same problem with export component order, and moved it to runtime (2a117a6e, `fix(shader): apply fragment export mappings at runtime`). The clip/cull enables probably need the same treatment, as a runtime input or a prepared variant per value, but that's your design call (and perhaps the maintainers'). #1077 adds the layer export to the same field, so it has the same problem and will follow whatever you choose here.
MichonGoddijn231849 commented 2026-10-09 08:33:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:33:39Z.


@alfalfa-star thanks for both, and sorry #1077 is waiting on this. I'll take the device check and the static-ABI registers for the test as you posted them. On the design question: since #639 the clip/cull enables in PA_CL_VS_OUT_CNTL end up in the prepared key, so every draw that sets them misses. I'll move them to runtime the way 2a117a6e did for the export mappings: the vertex stage always declares the distance arrays and reads the enables from the shader data block, and a disabled distance writes a value that never clips or culls. Parked as a draft until that rework is in; I'll ping you when it's ready so #1077 can follow.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077401072 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6077401072). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-09T08:33:39Z. --- @alfalfa-star thanks for both, and sorry #1077 is waiting on this. I'll take the device check and the static-ABI registers for the test as you posted them. On the design question: since #639 the clip/cull enables in `PA_CL_VS_OUT_CNTL` end up in the prepared key, so every draw that sets them misses. I'll move them to runtime the way 2a117a6e did for the export mappings: the vertex stage always declares the distance arrays and reads the enables from the shader data block, and a disabled distance writes a value that never clips or culls. Parked as a draft until that rework is in; I'll ping you when it's ready so #1077 can follow.
NahuelGenchi commented 2026-10-09 16:39:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-09T16:39:02Z.


Tested merged onto the testing branch from #2021, which is current main plus open PRs:

  • Setup: Ubuntu 26.04, RADV (Mesa 26.0.8), R9 380 (GFX8).
  • Merge: conflicts in CMakeLists.txt, VulkanDevice.cpp, Context.hpp and ShaderValidation.cpp. Each was an addition next to one from main, and I kept both.

Sonic Origins (PPSA05324) issues 8 draws with PA_CL_VS_OUT_CNTL = 0x00400001 (clip distance 0 through the CCDIST0 export) while it loads its title screen.

  • With this PR they are no longer refused for clip distances.
  • They now stop at the next step: prepared shader artifact is missing for the requested static ABI: ... stage=1 wave=64 pushOffset=0 pushCapacity=128 preparedLayouts= [0,128].
  • f524bbed separated artifact preparation from draws, so the vertex artifacts are probably prepared without the PA_CL_VS_OUT_CNTL bits, and the draw's key no longer finds one.

On that base, agc_driver_vertex_clip_cull_draw and agc_driver_vertex_clip_cull_draw_no_key fail with AGC driver: missing static shader ABI register 201. The test writes 0x0c9 with SET_SH_REG, but the shader registry now reads it from the registered shader header.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6085138175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6085138175). Originally posted by [NahuelGenchi](https://github.com/NahuelGenchi) on 2026-10-09T16:39:02Z. --- Tested merged onto the testing branch from #2021, which is current `main` plus open PRs: - **Setup:** Ubuntu 26.04, RADV (Mesa 26.0.8), R9 380 (GFX8). - **Merge:** conflicts in `CMakeLists.txt`, `VulkanDevice.cpp`, `Context.hpp` and `ShaderValidation.cpp`. Each was an addition next to one from `main`, and I kept both. Sonic Origins (PPSA05324) issues 8 draws with `PA_CL_VS_OUT_CNTL` = 0x00400001 (clip distance 0 through the CCDIST0 export) while it loads its title screen. - With this PR they are no longer refused for clip distances. - They now stop at the next step: `prepared shader artifact is missing for the requested static ABI: ... stage=1 wave=64 pushOffset=0 pushCapacity=128 preparedLayouts= [0,128]`. - f524bbed separated artifact preparation from draws, so the vertex artifacts are probably prepared without the `PA_CL_VS_OUT_CNTL` bits, and the draw's key no longer finds one. On that base, `agc_driver_vertex_clip_cull_draw` and `agc_driver_vertex_clip_cull_draw_no_key` fail with `AGC driver: missing static shader ABI register 201`. The test writes 0x0c9 with `SET_SH_REG`, but the shader registry now reads it from the registered shader header.
johnmaia commented 2026-10-09 17:49:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-09T17:49:40Z.


Tested this on top of current main with Disney Epic Mickey: Rebrushed (PPSA15657, UE4) on Linux / RX 7600 (RADV). Without it, the game stops right after New Game with clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001). With it, the game gets past that draw. It needed two changes on top of the PR, though:

1. Ahead-of-time preparation doesn't set paClVsOutCntl. The draw path puts the masked 0x207 into ShaderVertexStageInfo::paClVsOutCntl, which is part of the prepared-shader key. PrepareRegistered and PrepareGraphicsStages (Execution/src/Driver/Shaders/ShaderRegistry.cpp) decode the vertex info without it, so it stays 0. Every draw with any of those bits set then fails with:

AGC driver: prepared shader artifact is missing for the requested static ABI: address=… stage=7 wave=64 pushOffset=0 pushCapacity=104 preparedLayouts= [0,104]

(Same layout, different key.) Here this happened before the title screen, on a draw with PA_CL_VS_OUT_CNTL=0x01240000. Only the misc-vector bit survives the mask, and there are no clip distances at all. I fixed it by moving the mask to a shared constant in State.hpp (PositionExportLayoutBits) and setting it in both preparation paths: from state.context 0x207 in PrepareRegistered, and from decoded.state.paClVsOutCntl in PrepareGraphicsStages. Commit: johnmaia/AnyPS5@b599cfc1

2. That still wasn't enough for this game. The failing program here seems to be one the driver builds itself; its code address is a host address, not a guest one. Nothing prepares it with the right register value. As a stopgap I let PreparedAtUse prepare at draw when request.context.vertex->paClVsOutCntl != 0, which is what it already does for unregistered compute shaders. With both changes the game goes title → menu → New Game → past the clip-distance draw, and on to the next unsupported feature (UINT16_ABGR color export, #1073). The stopgap is probably not the shape you'd want upstream. A cleaner option may be to leave these bits out of the key whenever the program doesn't write position exports beyond pos0, or to prepare that internal program with the draw's 0x207.

The merge with current main conflicts in libSceAgcDriver/CMakeLists.txt, VulkanDevice.cpp, Context.hpp and ShaderValidation.cpp. In all four, both sides add lines, so keeping both resolves it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6086252761 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6086252761). Originally posted by [johnmaia](https://github.com/johnmaia) on 2026-10-09T17:49:40Z. --- Tested this on top of current `main` with Disney Epic Mickey: Rebrushed (PPSA15657, UE4) on Linux / RX 7600 (RADV). Without it, the game stops right after New Game with `clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001)`. With it, the game gets past that draw. It needed two changes on top of the PR, though: **1. Ahead-of-time preparation doesn't set `paClVsOutCntl`.** The draw path puts the masked 0x207 into `ShaderVertexStageInfo::paClVsOutCntl`, which is part of the prepared-shader key. `PrepareRegistered` and `PrepareGraphicsStages` (`Execution/src/Driver/Shaders/ShaderRegistry.cpp`) decode the vertex info without it, so it stays 0. Every draw with any of those bits set then fails with: ``` AGC driver: prepared shader artifact is missing for the requested static ABI: address=… stage=7 wave=64 pushOffset=0 pushCapacity=104 preparedLayouts= [0,104] ``` (Same layout, different key.) Here this happened before the title screen, on a draw with `PA_CL_VS_OUT_CNTL=0x01240000`. Only the misc-vector bit survives the mask, and there are no clip distances at all. I fixed it by moving the mask to a shared constant in `State.hpp` (`PositionExportLayoutBits`) and setting it in both preparation paths: from `state.context` 0x207 in `PrepareRegistered`, and from `decoded.state.paClVsOutCntl` in `PrepareGraphicsStages`. Commit: johnmaia/AnyPS5@b599cfc1 **2. That still wasn't enough for this game.** The failing program here seems to be one the driver builds itself; its code address is a host address, not a guest one. Nothing prepares it with the right register value. As a stopgap I let `PreparedAtUse` prepare at draw when `request.context.vertex->paClVsOutCntl != 0`, which is what it already does for unregistered compute shaders. With both changes the game goes title → menu → New Game → past the clip-distance draw, and on to the next unsupported feature (UINT16_ABGR color export, #1073). The stopgap is probably not the shape you'd want upstream. A cleaner option may be to leave these bits out of the key whenever the program doesn't write position exports beyond `pos0`, or to prepare that internal program with the draw's 0x207. The merge with current `main` conflicts in `libSceAgcDriver/CMakeLists.txt`, `VulkanDevice.cpp`, `Context.hpp` and `ShaderValidation.cpp`. In all four, both sides add lines, so keeping both resolves it.
MichonGoddijn231849 commented 2026-10-09 22:14:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T22:14:20Z.


Thanks @NahuelGenchi and @johnmaia, both reports point at the same gap, and it's the reason this PR is a draft. Since the prepared shaders (f524bbed), vertex artifacts are prepared without PA_CL_VS_OUT_CNTL. A draw with any of those bits then misses its prepared artifact, and the clip/cull enables have to become an input to the preparation.

@johnmaia your b599cfc1 is the right first half: a shared PositionExportLayoutBits mask, set in both PrepareRegistered and PrepareGraphicsStages. I'd like to take it into this PR with you as co-author when I bring the PR out of draft, if that's fine with you.

For the driver-built program, I'd rather not prepare at draw time. Leaving the bits out of the key when the program writes no position export beyond pos0 looks cleaner, and it would also cover your 0x01240000 case.

@NahuelGenchi the missing static shader ABI register 201 failures in the two clip/cull tests come from the same change: the registry now reads 0x0c9 from the registered header, not from SET_SH_REG. The tests need to register it in the header.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6090138412 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6090138412). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-09T22:14:20Z. --- Thanks @NahuelGenchi and @johnmaia, both reports point at the same gap, and it's the reason this PR is a draft. Since the prepared shaders (f524bbed), vertex artifacts are prepared without `PA_CL_VS_OUT_CNTL`. A draw with any of those bits then misses its prepared artifact, and the clip/cull enables have to become an input to the preparation. @johnmaia your b599cfc1 is the right first half: a shared `PositionExportLayoutBits` mask, set in both `PrepareRegistered` and `PrepareGraphicsStages`. I'd like to take it into this PR with you as co-author when I bring the PR out of draft, if that's fine with you. For the driver-built program, I'd rather not prepare at draw time. Leaving the bits out of the key when the program writes no position export beyond `pos0` looks cleaner, and it would also cover your `0x01240000` case. @NahuelGenchi the `missing static shader ABI register 201` failures in the two clip/cull tests come from the same change: the registry now reads 0x0c9 from the registered header, not from `SET_SH_REG`. The tests need to register it in the header.
TheAggie commented 2026-10-10 17:25:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T17:25:24Z.


Tested with RetroArch's Dolphin core (homebrew RetroArch, PPSA99169) running the GameCube 240p Test Suite. On Windows 11, NVIDIA RTX 5070 Ti, MinGW-w64 GCC 15.2. Without this PR it stops as soon as the ISO boots:

clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x01400303)

With it, that draw goes through. Here it needed one more piece, which may be worth knowing about before the PR comes out of draft.

Mesh path. Dolphin's draws here run on the NGG path that becomes a mesh shader. With the PR, the next stop is in the recompiler:

ShaderRecompiler::Recompile: unsupported mesh output kind

DefineMeshOutputs only takes Position, Parameter and Layer. I added clip and cull distances there:

  • a per-vertex f32[N] ClipDistance/CullDistance output array with a private per-lane copy;
  • EmitAuxPositionExport writes the copy when the stage is mesh;
  • EmitMeshEntryPoint copies each array out once;
  • ShaderValidation accepts the capabilities and the f32[1..8] built-in for mesh outputs.

With that, the 240p Suite reaches its menu and renders it. It's slow (under 1 FPS); I haven't looked into why yet. If you'd like it, I can open it as a follow-up once this PR lands, or you can take it into this one. Either is fine with me.

Two smaller things from the merge:

  • Test exits on NVIDIA: agc_driver_vertex_clip_cull_draw (and _no_key) print their pass line and then crash at exit (0xC0000005). The device is destroyed during static destruction, and the NVIDIA driver jumps to a null pointer from VulkanDevice::State::~State(). Calling LibcRunShutdown_nid_postfix() before returning, as Pm4.cpp does (and in the catch), fixes it here. Lavapipe probably doesn't show it.
  • Request version: current main already writes serialization version 15 (14 and 15 added pixel fields), so paClVsOutCntl needs version 16 now. The serializer test that rewrites a request as the previous version then needs 15, not 12.

Caveats:

  • Not current main: this is my integration branch, a main from 2026-10-07 plus my open PRs and a few local spikes. The PR's five commits were cherry-picked onto it.
  • Missing-artifact error: I didn't hit the prepared shader artifact is missing error that @NahuelGenchi and @johnmaia hit. My branch carries #1732, which prepares programs at first use when they couldn't be prepared at registration. That probably covers the same gap, so this run doesn't say anything about that part.
  • ABI register 201: I also didn't hit the missing static shader ABI register 201 test failure. My base predates that registry change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100223542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6100223542). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-10T17:25:24Z. --- Tested with RetroArch's Dolphin core (homebrew RetroArch, PPSA99169) running the GameCube 240p Test Suite. On Windows 11, NVIDIA RTX 5070 Ti, MinGW-w64 GCC 15.2. Without this PR it stops as soon as the ISO boots: ``` clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x01400303) ``` With it, that draw goes through. Here it needed one more piece, which may be worth knowing about before the PR comes out of draft. **Mesh path.** Dolphin's draws here run on the NGG path that becomes a mesh shader. With the PR, the next stop is in the recompiler: ``` ShaderRecompiler::Recompile: unsupported mesh output kind ``` `DefineMeshOutputs` only takes `Position`, `Parameter` and `Layer`. I added clip and cull distances there: - a per-vertex `f32[N]` `ClipDistance`/`CullDistance` output array with a private per-lane copy; - `EmitAuxPositionExport` writes the copy when the stage is mesh; - `EmitMeshEntryPoint` copies each array out once; - `ShaderValidation` accepts the capabilities and the `f32[1..8]` built-in for mesh outputs. With that, the 240p Suite reaches its menu and renders it. It's slow (under 1 FPS); I haven't looked into why yet. If you'd like it, I can open it as a follow-up once this PR lands, or you can take it into this one. Either is fine with me. **Two smaller things from the merge:** - **Test exits on NVIDIA:** `agc_driver_vertex_clip_cull_draw` (and `_no_key`) print their pass line and then crash at exit (0xC0000005). The device is destroyed during static destruction, and the NVIDIA driver jumps to a null pointer from `VulkanDevice::State::~State()`. Calling `LibcRunShutdown_nid_postfix()` before returning, as `Pm4.cpp` does (and in the `catch`), fixes it here. Lavapipe probably doesn't show it. - **Request version:** current `main` already writes serialization version 15 (14 and 15 added pixel fields), so `paClVsOutCntl` needs version 16 now. The serializer test that rewrites a request as the previous version then needs 15, not 12. **Caveats:** - **Not current `main`:** this is my integration branch, a `main` from 2026-10-07 plus my open PRs and a few local spikes. The PR's five commits were cherry-picked onto it. - **Missing-artifact error:** I didn't hit the `prepared shader artifact is missing` error that @NahuelGenchi and @johnmaia hit. My branch carries #1732, which prepares programs at first use when they couldn't be prepared at registration. That probably covers the same gap, so this run doesn't say anything about that part. - **ABI register 201:** I also didn't hit the `missing static shader ABI register 201` test failure. My base predates that registry change. AI-assisted (Claude Code).
MichonGoddijn231849 commented 2026-10-10 22:17:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T22:17:28Z.


@TheAggie thanks, that's very useful. The mesh-path clip and cull distances (outputs in DefineMeshOutputs, the aux export for mesh stages, the entry-point copy and the validation) are best as your own follow-up PR on top of this one once it's out of draft and merged; it keeps this one small and credits you.

Noted for when I take this out of draft: LibcRunShutdown_nid_postfix() before returning (and in the catch) in both clip/cull draw tests, and the request version moves to 16 (the previous-version serializer test to 15). It stays a draft for now: the clip/cull enables still have to become a runtime input on the prepared vertex artifacts (with @johnmaia's b599cfc1), as discussed above.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102768380 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6102768380). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-10T22:17:28Z. --- @TheAggie thanks, that's very useful. The mesh-path clip and cull distances (outputs in `DefineMeshOutputs`, the aux export for mesh stages, the entry-point copy and the validation) are best as your own follow-up PR on top of this one once it's out of draft and merged; it keeps this one small and credits you. Noted for when I take this out of draft: `LibcRunShutdown_nid_postfix()` before returning (and in the `catch`) in both clip/cull draw tests, and the request version moves to 16 (the previous-version serializer test to 15). It stays a draft for now: the clip/cull enables still have to become a runtime input on the prepared vertex artifacts (with @johnmaia's b599cfc1), as discussed above.
johnmaia commented 2026-10-10 22:50:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-10T22:50:48Z.


@MichonGoddijn231849 Yes, please take b599cfc1 into this PR. Co-author credit is fine with me.

Agreed on not preparing at draw time. My 51734288 (PreparedAtUse returning true for a vertex program with paClVsOutCntl != 0) was only a stopgap on my testing branch to get past the draw. Leaving the bits out of the key when the program has no position export beyond pos0 is cleaner.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103030670 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6103030670). Originally posted by [johnmaia](https://github.com/johnmaia) on 2026-10-10T22:50:48Z. --- @MichonGoddijn231849 Yes, please take b599cfc1 into this PR. Co-author credit is fine with me. Agreed on not preparing at draw time. My 51734288 (`PreparedAtUse` returning true for a vertex program with `paClVsOutCntl != 0`) was only a stopgap on my testing branch to get past the draw. Leaving the bits out of the key when the program has no position export beyond `pos0` is cleaner.
xXPBSXx commented 2026-10-11 07:17:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T07:17:52Z.


Another title that needs this: Kena: Bridge of Spirits (PPSA01746, Unreal Engine) on Windows. With my current stack (current main 06da1176 plus several fix branches, no audit gaps) it runs until the first draw that uses clip distances and then stops with:

clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001)

In PA_CL_VS_OUT_CNTL (the field order from shadPS4's VsOutputControl, regs_primitive.h) bit 0 is the first clip-distance enable and bit 22 is vs_out_ccdist0_enable. I tried to merge this PR into my test branch, but it has conflicts in ten files against current main, so I could not test it on Kena; it would need a rebase first. If a rebased version exists I can run Kena on it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106599789 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6106599789). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T07:17:52Z. --- Another title that needs this: Kena: Bridge of Spirits (PPSA01746, Unreal Engine) on Windows. With my current stack (current `main` 06da1176 plus several fix branches, no audit gaps) it runs until the first draw that uses clip distances and then stops with: ``` clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001) ``` In `PA_CL_VS_OUT_CNTL` (the field order from shadPS4's `VsOutputControl`, `regs_primitive.h`) bit 0 is the first clip-distance enable and bit 22 is `vs_out_ccdist0_enable`. I tried to merge this PR into my test branch, but it has conflicts in ten files against current `main`, so I could not test it on Kena; it would need a rebase first. If a rebased version exists I can run Kena on it. AI-assisted (Claude Code).
MichonGoddijn231849 commented 2026-10-11 07:59:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T07:59:37Z.


@johnmaia thanks, I'll take b599cfc1 in with you as co-author when this comes out of draft, keeping the bits out of the key when there is no position export beyond pos0.

@xXPBSXx thanks for the Kena data point (0x00400001: clip distance 0 plus vs_out_ccdist0_enable). It is a draft until the clip/cull enables are a runtime input of the prepared vertex artifacts; I'll post here when a rebased, testable head is up.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106913879 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6106913879). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-11T07:59:37Z. --- @johnmaia thanks, I'll take b599cfc1 in with you as co-author when this comes out of draft, keeping the bits out of the key when there is no position export beyond `pos0`. @xXPBSXx thanks for the Kena data point (`0x00400001`: clip distance 0 plus `vs_out_ccdist0_enable`). It is a draft until the clip/cull enables are a runtime input of the prepared vertex artifacts; I'll post here when a rebased, testable head is up.
xXPBSXx commented 2026-10-11 15:45:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T15:45:20Z.


Decoding the Kena (PPSA01746) stop clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001): register 0x207 is PA_CL_VS_OUT_CNTL (Linux gc_10_1_0_offset.h, mmPA_CL_VS_OUT_CNTL 0x0207). 0x00400001 is CLIP_DIST_ENA_0 (bit 0) plus VS_OUT_CCDIST0_VEC_ENA (bit 22) from gc_10_1_0_sh_mask.h, so the title enables exactly one clip plane and the first clip/cull-distance vec4 export, nothing else. That is the case this PR implements, so I did not build a reduced copy of it on main: a "bit 0 plus CCDIST0" subset would still need the Vulkan shaderClipDistance feature, a pipeline key, the SPIR-V ClipDistance output and the validation change, which is this PR's change. I merge-tested the PR against a11c8f7f7: 10 files conflict (libSceAgcDriver/CMakeLists.txt, VulkanDevice.cpp, Context.hpp, Pipeline.hpp, Draw.cpp, ShaderValidation.cpp, tests/Graphics.cpp, tests/ShaderMemory.cpp, RequestSerializer.cpp, TechnicalDebt.md), so it needs a rebase by its author before Kena can be tried with it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110750368 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6110750368). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T15:45:20Z. --- Decoding the Kena (PPSA01746) stop `clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001)`: register `0x207` is `PA_CL_VS_OUT_CNTL` (Linux `gc_10_1_0_offset.h`, `mmPA_CL_VS_OUT_CNTL 0x0207`). `0x00400001` is `CLIP_DIST_ENA_0` (bit 0) plus `VS_OUT_CCDIST0_VEC_ENA` (bit 22) from `gc_10_1_0_sh_mask.h`, so the title enables exactly one clip plane and the first clip/cull-distance vec4 export, nothing else. That is the case this PR implements, so I did not build a reduced copy of it on `main`: a "bit 0 plus CCDIST0" subset would still need the Vulkan `shaderClipDistance` feature, a pipeline key, the SPIR-V `ClipDistance` output and the validation change, which is this PR's change. I merge-tested the PR against `a11c8f7f7`: 10 files conflict (`libSceAgcDriver/CMakeLists.txt`, `VulkanDevice.cpp`, `Context.hpp`, `Pipeline.hpp`, `Draw.cpp`, `ShaderValidation.cpp`, `tests/Graphics.cpp`, `tests/ShaderMemory.cpp`, `RequestSerializer.cpp`, `TechnicalDebt.md`), so it needs a rebase by its author before Kena can be tried with it. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-11 18:28:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T18:28:44Z.


@MichonGoddijn231849 I merged this PR by hand onto main a11c8f7f7 (10 conflicting files) to test it on Kena and to show what a rebase needs. The result is on my fork as branch test/pr423-on-main-a11c8f7f7 (the merge commit plus one fix-up commit). It is a test merge, not a proposal to replace your branch.

What the rebase needs (all four are in that branch):

  • RequestSerializer.cpp: main already uses serialization versions 13 to 16 for other fields, so the PA_CL_VS_OUT_CNTL word has to be version 17 (WriteU32(17u), version > 17u, if (version >= 17u) info.paClVsOutCntl = ...). ShaderMemory.cpp follows: new requests start with NVNQQREAAAA=, the unsupported pair becomes version 0 and 18 (NVNQQRIAAAA=), and the "legacy vertex info" test must strip the word from a version-16 request (legacy[4] = 16u), not 12.
  • ValidateShaders/Inspect: main appended bufferInt64Atomics after sampleRateShading, so clipDistance, cullDistance come after it; the PR's Graphics.cpp test calls (6 of them) then need an extra false for bufferInt64Atomics before the two distance flags.
  • ShaderValidation.cpp: keep isDistanceCapability || in isFeatureCapability next to main's two new multisample capabilities (ImageMSArray, StorageImageMultisample). Without it every vertex shader with a ClipDistance capability fails with SPIR-V requires unsupported device capability 32.
  • Context.hpp, VulkanDevice.cpp, libSceAgcDriver/CMakeLists.txt (keep both test blocks), TechnicalDebt.md: plain "keep both" resolutions.

Tested (Windows, RTX 4080 SUPER driver, main a11c8f7f7 + this PR): agc_shader_memory, agc_driver_graphics, agc_driver_vertex_clip_cull_distances pass. agc_driver_vertex_clip_cull_draw and ..._no_key crash with an access violation at rip 0 inside libSceAgcDriver.prx; I have not found why, and I do not know whether it also happens on your branch before the merge (I did not build that), so please check that one first.

Kena (PPSA01746), 90 s: the title does not reach the clip-distance stop. It crashes with 0xc0000005 (a write to address 0 at app.exe+0x1c7a46b) right after a sceSaveDataDirNameSearch call that returned no hits. The same crash happens without this PR (it also occurred on main + #419 + #425), so I can not say anything about the clip-distance change on this title yet. I make no claim about that crash's cause.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112258434 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6112258434). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T18:28:44Z. --- @MichonGoddijn231849 I merged this PR by hand onto `main` a11c8f7f7 (10 conflicting files) to test it on Kena and to show what a rebase needs. The result is on my fork as branch `test/pr423-on-main-a11c8f7f7` (the merge commit plus one fix-up commit). It is a test merge, not a proposal to replace your branch. **What the rebase needs (all four are in that branch):** - `RequestSerializer.cpp`: `main` already uses serialization versions 13 to 16 for other fields, so the `PA_CL_VS_OUT_CNTL` word has to be version 17 (`WriteU32(17u)`, `version > 17u`, `if (version >= 17u) info.paClVsOutCntl = ...`). `ShaderMemory.cpp` follows: new requests start with `NVNQQREAAAA=`, the unsupported pair becomes version 0 and 18 (`NVNQQRIAAAA=`), and the "legacy vertex info" test must strip the word from a version-16 request (`legacy[4] = 16u`), not 12. - `ValidateShaders`/`Inspect`: `main` appended `bufferInt64Atomics` after `sampleRateShading`, so `clipDistance`, `cullDistance` come after it; the PR's `Graphics.cpp` test calls (6 of them) then need an extra `false` for `bufferInt64Atomics` before the two distance flags. - `ShaderValidation.cpp`: keep `isDistanceCapability ||` in `isFeatureCapability` next to main's two new multisample capabilities (`ImageMSArray`, `StorageImageMultisample`). Without it every vertex shader with a ClipDistance capability fails with `SPIR-V requires unsupported device capability 32`. - `Context.hpp`, `VulkanDevice.cpp`, `libSceAgcDriver/CMakeLists.txt` (keep both test blocks), `TechnicalDebt.md`: plain "keep both" resolutions. **Tested (Windows, RTX 4080 SUPER driver, main a11c8f7f7 + this PR):** `agc_shader_memory`, `agc_driver_graphics`, `agc_driver_vertex_clip_cull_distances` pass. `agc_driver_vertex_clip_cull_draw` and `..._no_key` crash with an access violation at `rip 0` inside `libSceAgcDriver.prx`; I have not found why, and I do not know whether it also happens on your branch before the merge (I did not build that), so please check that one first. **Kena (PPSA01746), 90 s:** the title does not reach the clip-distance stop. It crashes with `0xc0000005` (a write to address 0 at `app.exe+0x1c7a46b`) right after a `sceSaveDataDirNameSearch` call that returned no hits. The same crash happens without this PR (it also occurred on `main` + #419 + #425), so I can not say anything about the clip-distance change on this title yet. I make no claim about that crash's cause. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-11 21:35:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T21:35:02Z.


Kena (PPSA01746) again, now with this PR merged onto current main c5da8233a (my fork's branch test/pr423-on-c5da: the earlier hand merge plus a clean merge of main, no new conflicts), relinker and libs rebuilt, 120 s: no clip-distance stop. The title still ends with 0xc0000005 (write of address 0 at app.exe+0x1c7a46b), the same crash as before, so this PR's clip-distance path is not reached. Whether that crash is something in main or a missing piece I have not determined.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114031219 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6114031219). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T21:35:02Z. --- Kena (PPSA01746) again, now with this PR merged onto current `main` c5da8233a (my fork's branch `test/pr423-on-c5da`: the earlier hand merge plus a clean merge of `main`, no new conflicts), `relinker` and `libs` rebuilt, 120 s: no clip-distance stop. The title still ends with `0xc0000005` (write of address 0 at `app.exe+0x1c7a46b`), the same crash as before, so this PR's clip-distance path is not reached. Whether that crash is something in `main` or a missing piece I have not determined. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-11 22:09:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T22:09:19Z.


Kena (PPSA01746) on this PR merged onto main a672688e9 (plus #4021, which fixes the Windows build of Socket.cpp that is broken on main at the moment: HostPoll is used on Windows but only defined under #ifndef _WIN32), 120 s: still no clip-distance stop. This run ends with 0xc0000005 too, but at a different place than before: a read of address 0 at app.exe+0x57378d7 on TaskGraphThreadHP 12. In both crashes (this one and the earlier write at app.exe+0x1c7a46b) the last title-visible log line before the fault is a [SAVEDATA:native] dirNameSearch ... hit=0 set=0 -> 0x00000000; I only note the coincidence and do not claim it is the cause. The clip-distance path of this PR is not reached by this title in my runs.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114396482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6114396482). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T22:09:19Z. --- Kena (PPSA01746) on this PR merged onto `main` a672688e9 (plus #4021, which fixes the Windows build of `Socket.cpp` that is broken on `main` at the moment: `HostPoll` is used on Windows but only defined under `#ifndef _WIN32`), 120 s: still no clip-distance stop. This run ends with `0xc0000005` too, but at a different place than before: a read of address 0 at `app.exe+0x57378d7` on `TaskGraphThreadHP 12`. In both crashes (this one and the earlier write at `app.exe+0x1c7a46b`) the last title-visible log line before the fault is a `[SAVEDATA:native] dirNameSearch ... hit=0 set=0 -> 0x00000000`; I only note the coincidence and do not claim it is the cause. The clip-distance path of this PR is not reached by this title in my runs. AI-assisted (Claude Code).
MichonGoddijn231849 commented 2026-10-11 22:15:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T22:15:22Z.


@xXPBSXx thanks for the hand merge and the notes (serialization version 17, the bufferInt64Atomics argument order, isDistanceCapability next to the multisample capabilities). They will save time when this comes out of draft. It stays parked for now: the clip and cull enables still have to become a runtime input instead of part of the request. Kena's 0xc0000005 at app.exe+0x1c7a46b happens before any clip-distance draw, so it is a separate stop.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114466313 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6114466313). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-11T22:15:22Z. --- @xXPBSXx thanks for the hand merge and the notes (serialization version 17, the `bufferInt64Atomics` argument order, `isDistanceCapability` next to the multisample capabilities). They will save time when this comes out of draft. It stays parked for now: the clip and cull enables still have to become a runtime input instead of part of the request. Kena's `0xc0000005` at `app.exe+0x1c7a46b` happens before any clip-distance draw, so it is a separate stop.
xXPBSXx commented 2026-10-11 23:00:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T23:00:47Z.


For the record, so this PR is not blamed for it: the Kena crash at app.exe+0x1c7a46b also happens on main a672688e9 + #4021 alone, without this PR; it is tracked in #4073.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114867356 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6114867356). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T23:00:47Z. --- For the record, so this PR is not blamed for it: the Kena crash at `app.exe+0x1c7a46b` also happens on `main` a672688e9 + #4021 alone, without this PR; it is tracked in #4073. AI-assisted (Claude Code).
tibzejoker commented 2026-10-11 23:55:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-11T23:55:32Z.


GTA V (PPSA04264) reaches this path, unlike Kena. Windows 11, RTX 4090, MinGW GCC 15.2, Release.

On main 325e0a8bd plus #425, #290, #637, #4021 and a port of #448, Story mode stops about 30 s in with:

clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001)

With @xXPBSXx's hand merge of this PR (test/pr423-on-c5da) merged on top, that stop is gone and the game runs on to the next, unrelated one (a depth array sampled from base slice 1, which is #1186). The only extra conflicts against my tree were argument lists shared with #448 (demoteToHelperInvocation next to clipDistance, cullDistance) and both PRs taking request version 17 for their new field.

So 0x00400001 (one clip distance, bit 22 set) is a real case this PR covers. I did not compare the rendered output against hardware.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115324526 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6115324526). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-11T23:55:32Z. --- GTA V (PPSA04264) reaches this path, unlike Kena. Windows 11, RTX 4090, MinGW GCC 15.2, Release. On `main` 325e0a8bd plus #425, #290, #637, #4021 and a port of #448, Story mode stops about 30 s in with: ``` clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001) ``` With @xXPBSXx's hand merge of this PR (`test/pr423-on-c5da`) merged on top, that stop is gone and the game runs on to the next, unrelated one (a depth array sampled from base slice 1, which is #1186). The only extra conflicts against my tree were argument lists shared with #448 (`demoteToHelperInvocation` next to `clipDistance, cullDistance`) and both PRs taking request version 17 for their new field. So `0x00400001` (one clip distance, bit 22 set) is a real case this PR covers. I did not compare the rendered output against hardware. AI-assisted (Claude Code).
Scramblrrrr commented 2026-10-12 05:09:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T05:09:53Z.


Preparing the existing #423 implementation for the Windows 007 stack after the post-licence register-0x207 stop. Public integration head a921b0c1d360a3c14e25ff0a7c3d23fcd7304b9b: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-clip-cull-cross-test . Author-preserved carries of 52a1b69f3 and the latest 577b8d570 device/driver tests, with runtime-table capability flags retained during conflict resolution.

Our integration already uses serialized request version 16, including pixel alpha-to-coverage and float64 controls. A separate integration commit reserves version 17 for PA_CL_VS_OUT_CNTL and updates the legacy-vertex regression to version 16. This is a fork integration adaptation, not a proposed change to your upstream PR. Not tested/staged yet; build and native clip/cull, request-compatibility, graphics and BDA checks next.

The existing #4248 region-index sort is also in this prepared integration and its five selected native checks passed separately; no isolated title FPS claim for it.

AI-assisted: Codex. No title data uploaded.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118145093 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6118145093). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T05:09:53Z. --- Preparing the existing #423 implementation for the Windows 007 stack after the post-licence register-0x207 stop. Public integration head a921b0c1d360a3c14e25ff0a7c3d23fcd7304b9b: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-clip-cull-cross-test . Author-preserved carries of 52a1b69f3 and the latest 577b8d570 device/driver tests, with runtime-table capability flags retained during conflict resolution. Our integration already uses serialized request version 16, including pixel alpha-to-coverage and float64 controls. A separate integration commit reserves version 17 for PA_CL_VS_OUT_CNTL and updates the legacy-vertex regression to version 16. This is a fork integration adaptation, not a proposed change to your upstream PR. Not tested/staged yet; build and native clip/cull, request-compatibility, graphics and BDA checks next. The existing #4248 region-index sort is also in this prepared integration and its five selected native checks passed separately; no isolated title FPS claim for it. AI-assisted: Codex. No title data uploaded.
Scramblrrrr commented 2026-10-12 05:16:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T05:16:02Z.


Windows integration 188d80147ebb66f02fab8c18bcfb2cc2e296e513 passed 9/9 selected tests in 7.38 s, no skips: vertex_clip_cull_distances, vertex_clip_cull_draw (key on/off), shader_memory, graphics, bda_device, draw_cache_reuse (GPL on/off), gpu_buffer_format.

Both PM4 clip/cull modes initially passed their pixel assertions, then crashed during process teardown with a null Vulkan callback. Adding AgcDriverShutdown_nid_postfix on success and exception, as nearby driver fixtures do, makes both exit cleanly. The small fixture adaptation is in 188d80147. Request compatibility checks now cover our integration's version-16 vertex data without the new field and the version-17 format; versions 0 and 18 remain refused.

Staged only the graphics module (SHA256 82C5F896AF4DEB329A6937760AF5C8AAAED7C57726A98F576DA9C474D549E707) and started 007 on a new validated shader cache. Other staged libraries unchanged. Map on / draw cache off / quiet settings retained. The #4248 sorting change is also included, so this is an integration run, not an isolated FPS measurement. No claim of passing the game stop yet.

AI-assisted: Codex. No title data uploaded.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118204468 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6118204468). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T05:16:02Z. --- Windows integration 188d80147ebb66f02fab8c18bcfb2cc2e296e513 passed 9/9 selected tests in 7.38 s, no skips: vertex_clip_cull_distances, vertex_clip_cull_draw (key on/off), shader_memory, graphics, bda_device, draw_cache_reuse (GPL on/off), gpu_buffer_format. Both PM4 clip/cull modes initially passed their pixel assertions, then crashed during process teardown with a null Vulkan callback. Adding AgcDriverShutdown_nid_postfix on success and exception, as nearby driver fixtures do, makes both exit cleanly. The small fixture adaptation is in 188d80147. Request compatibility checks now cover our integration's version-16 vertex data without the new field and the version-17 format; versions 0 and 18 remain refused. Staged only the graphics module (SHA256 82C5F896AF4DEB329A6937760AF5C8AAAED7C57726A98F576DA9C474D549E707) and started 007 on a new validated shader cache. Other staged libraries unchanged. Map on / draw cache off / quiet settings retained. The #4248 sorting change is also included, so this is an integration run, not an isolated FPS measurement. No claim of passing the game stop yet. AI-assisted: Codex. No title data uploaded.
xXPBSXx commented 2026-10-12 05:38:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T05:38:08Z.


Two connections that may be new for the author, from the thread: (1) @Scramblrrrr's note that both vertex_clip_cull_draw modes crashed at process teardown with a null Vulkan callback until AgcDriverShutdown_nid_postfix is called matches the access violation at rip 0 inside libSceAgcDriver.prx that I saw in agc_driver_vertex_clip_cull_draw and ..._no_key when I merged this PR by hand onto a11c8f7f7 (my earlier comment): I did not check whether my crash happened before or after the pixel assertions, so I can not confirm it is the same one, but it is probably worth trying the shutdown call there too. (2) The review's remaining points are the ones listed in the review above (an execution test that draws with clip and cull distances and pins which pixels are written, gating the ClipDistance/CullDistance capabilities on the device features, and the serializer version for paClVsOutCntl); on current main the PR is CONFLICTING, and my hand merge (test/pr423-on-c5da on my fork) shows the serializer version has to move past the versions main already uses.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118430491 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6118430491). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T05:38:08Z. --- Two connections that may be new for the author, from the thread: (1) @Scramblrrrr's note that both `vertex_clip_cull_draw` modes crashed at process teardown with a null Vulkan callback until `AgcDriverShutdown_nid_postfix` is called matches the access violation at `rip 0` inside `libSceAgcDriver.prx` that I saw in `agc_driver_vertex_clip_cull_draw` and `..._no_key` when I merged this PR by hand onto `a11c8f7f7` (my earlier comment): I did not check whether my crash happened before or after the pixel assertions, so I can not confirm it is the same one, but it is probably worth trying the shutdown call there too. (2) The review's remaining points are the ones listed in the review above (an execution test that draws with clip and cull distances and pins which pixels are written, gating the `ClipDistance`/`CullDistance` capabilities on the device features, and the serializer version for `paClVsOutCntl`); on current `main` the PR is `CONFLICTING`, and my hand merge (`test/pr423-on-c5da` on my fork) shows the serializer version has to move past the versions `main` already uses. AI-assisted (Claude Code).
MichonGoddijn231849 commented 2026-10-12 16:48:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-12T16:48:24Z.


Out of draft, rebuilt on main 82b1b2e7a. @tibzejoker's 0x00400001 stop in GTA V Story mode is the reason; thanks for checking it.

What changed against main:

  • Main now enables shaderClipDistance and writes its own clip distance for an all-zero position (9db923e90). The guest clip distances share that array; the zero-position distance takes the index after them. The validator accepts f32[1..8] for clip and cull, at most eight together, so this PR only adds shaderCullDistance next to main's flag.
  • Request version 18 (main is at 17), with the legacy test now reading a version 17 vertex info without the field. @xXPBSXx, your notes on the argument order and the version matched what the merge needed.
  • agc_driver_vertex_clip_cull_draw and ..._no_key call AgcDriverShutdown_nid_postfix on success and on failure, as @Scramblrrrr found.

@johnmaia: b599cfc1 is in, with you as co-author. Registration and draw-time preparation now set the same bits. On top of it, a program with no pos1..pos3 export in its code gets no bits at all, so its artifact no longer depends on PA_CL_VS_OUT_CNTL. That covers your 0x01240000 case. The enables stay part of the request for programs that do export distances: the recompiler sizes the output arrays from them. A main change since then also matters: a missing artifact is now prepared at use instead of failing.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128650305 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/423#issuecomment-6128650305). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-12T16:48:24Z. --- Out of draft, rebuilt on main 82b1b2e7a. @tibzejoker's `0x00400001` stop in GTA V Story mode is the reason; thanks for checking it. What changed against main: - Main now enables `shaderClipDistance` and writes its own clip distance for an all-zero position (9db923e90). The guest clip distances share that array; the zero-position distance takes the index after them. The validator accepts `f32[1..8]` for clip and cull, at most eight together, so this PR only adds `shaderCullDistance` next to main's flag. - Request version 18 (main is at 17), with the legacy test now reading a version 17 vertex info without the field. @xXPBSXx, your notes on the argument order and the version matched what the merge needed. - `agc_driver_vertex_clip_cull_draw` and `..._no_key` call `AgcDriverShutdown_nid_postfix` on success and on failure, as @Scramblrrrr found. @johnmaia: b599cfc1 is in, with you as co-author. Registration and draw-time preparation now set the same bits. On top of it, a program with no `pos1`..`pos3` export in its code gets no bits at all, so its artifact no longer depends on PA_CL_VS_OUT_CNTL. That covers your `0x01240000` case. The enables stay part of the request for programs that do export distances: the recompiler sizes the output arrays from them. A main change since then also matters: a missing artifact is now prepared at use instead of failing.
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!423
No description provided.