feat(libSceAgcDriver): draw PS4 (GCN) command buffers #9431

Merged
Get-fix merged 3 commits from upstream-pr/9431 into main 2026-10-29 08:31:14 +00:00
Get-fix commented 2026-10-21 21:51:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-21T21:51:02Z.


What

Part 3 of the PS4 Limbo stack, split out of #6977 (the whole stack is listed in #6978). Only the last two commits are this PR; the three below them are #9430.

  • PS4 color and depth targets (CB_COLOR_ATTRIB / DB_Z_INFO tile mode indices) as resident targets, PS4 graphics EOP events registered per queue, and the PS4 display buffer read as Display2DThin.

  • PS4 tile modes as XOR equations in the existing GPU detiler:

    • 1D and 2D thin and display;
    • depth with tile split (split slices a surface apart, bank rotated per slice);
    • PRT and LINEAR_GENERAL.

    Layered surfaces with several mip levels are stored level by level for sampled textures. 3D and thick modes, and storage or depth views of mipmapped PS4 arrays, throw.

  • A 1920x1080 PS4 render target is a 1920x1088 surface; a texture over its top-left corner with the same pitch and tiling is a GPU block copy instead of a trip through guest memory.

  • The PS4 SDK pattern-fill compute kernel runs as a GPU fill when it repeats one dword, so render targets and HTILE are cleared without a CPU drain. Two-dword patterns keep running the kernel. Run as fills, Limbo's clears of its 64-bit target made its gameplay advance about half as far per frame (same input and save, every frame dumped), although the stored values are equal. The cause is not known yet, so the shortcut is left out.

  • The 4 KiB display-buffer alignment error now names linear and PS4 buffers, and video_out_flip_ps4 expects that text (26d651d3e).

Sources and limits are in docs/dev/debt/libSceAgcDriver.md (addrlib formulas and shadPS4's GB_TILE_MODE tables, not console measurements).

Tested

Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88), on main 7e2ba73e4 with #9430:

  • agc_driver_graphics: the GCN address equations against a separate implementation of addrlib's ComputeSurfaceAddrFromCoordMicroTiled / MacroTiled for every mode and element size, Limbo's depth layout, and a level-by-level array layout.
  • agc_driver_gcn_detile (new, GPU): a PS4-tiled pattern through the real detiler shader for every mode, including depth split and PRT, at 1 to 16 bytes per element.
  • agc_driver_pattern_buffer_fill: Limbo's captured clear decodes to its 44-bit target.
  • This branch alone (with #9430): of the 915 AGC, shader, recompiler and VideoOut tests in the validation run below, 909 pass and 3 skip for device features this GPU lacks. The 3 that fail also fail on main 7e2ba73e4 on this machine: agc_driver_sample_order and its --grid-reference and --recipe-depth-locations cases. video_out_flip_ps4 passes, as on main.
  • With #9432 on top: the full suite of 1,893 tests: 1,886 pass and 4 skip, the same 4 that skip on main. The 3 that fail also fail on main 7e2ba73e4 on this machine: agc_driver_sample_order and its --grid-reference and --recipe-depth-locations cases.
  • Limbo (CUSA01664) runs in game with #9432 on top (details there).
  • Validation layer: ctest -R "^(agc|video_out|shader|recompiler|gcn)" -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363), on main 7e2ba73e4 and on this branch with #9430, same machine and GPU. Both builds use -DANYPS5_VIDEO_OUT_TEST_DRIVER=windows, so the 14 VideoOut flip tests get a real display.
    • Neither log reports the layer missing.
    • main: 913 tests; 907 pass, 3 skip and 3 fail (the agc_driver_sample_order cases).
    • This branch: the same 913 tests with the same results, plus agc_gcn_decode and agc_driver_gcn_detile, which pass.
    • Both logs hold the same 50 VUID- errors in the same 8 existing PS5 tests, with the same IDs and counts test for test (agc_driver_prepared_exports, the three agc_driver_sample_order cases and four others). This PR adds none.
    • The same holds with #9432 on top.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #9430
  • Fixes: none
  • Unblocks: Limbo (CUSA01664) #6978, with #9432 on top
  • GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 610.88, Windows 11
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4958852118 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9431). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-21T21:51:02Z. --- ### What Part 3 of the PS4 Limbo stack, split out of #6977 (the whole stack is listed in #6978). Only the last two commits are this PR; the three below them are #9430. - PS4 color and depth targets (`CB_COLOR_ATTRIB` / `DB_Z_INFO` tile mode indices) as resident targets, PS4 graphics EOP events registered per queue, and the PS4 display buffer read as Display2DThin. - PS4 tile modes as XOR equations in the existing GPU detiler: - 1D and 2D thin and display; - depth with tile split (split slices a surface apart, bank rotated per slice); - PRT and LINEAR_GENERAL. Layered surfaces with several mip levels are stored level by level for sampled textures. 3D and thick modes, and storage or depth views of mipmapped PS4 arrays, throw. - A 1920x1080 PS4 render target is a 1920x1088 surface; a texture over its top-left corner with the same pitch and tiling is a GPU block copy instead of a trip through guest memory. - The PS4 SDK pattern-fill compute kernel runs as a GPU fill when it repeats one dword, so render targets and HTILE are cleared without a CPU drain. Two-dword patterns keep running the kernel. Run as fills, Limbo's clears of its 64-bit target made its gameplay advance about half as far per frame (same input and save, every frame dumped), although the stored values are equal. The cause is not known yet, so the shortcut is left out. - The 4 KiB display-buffer alignment error now names linear and PS4 buffers, and `video_out_flip_ps4` expects that text (26d651d3e). Sources and limits are in `docs/dev/debt/libSceAgcDriver.md` (addrlib formulas and shadPS4's GB_TILE_MODE tables, not console measurements). ### Tested Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88), on `main` 7e2ba73e4 with #9430: - `agc_driver_graphics`: the GCN address equations against a separate implementation of addrlib's `ComputeSurfaceAddrFromCoordMicroTiled` / `MacroTiled` for every mode and element size, Limbo's depth layout, and a level-by-level array layout. - `agc_driver_gcn_detile` (new, GPU): a PS4-tiled pattern through the real detiler shader for every mode, including depth split and PRT, at 1 to 16 bytes per element. - `agc_driver_pattern_buffer_fill`: Limbo's captured clear decodes to its 44-bit target. - This branch alone (with #9430): of the 915 AGC, shader, recompiler and VideoOut tests in the validation run below, 909 pass and 3 skip for device features this GPU lacks. The 3 that fail also fail on `main` 7e2ba73e4 on this machine: `agc_driver_sample_order` and its `--grid-reference` and `--recipe-depth-locations` cases. `video_out_flip_ps4` passes, as on `main`. - With #9432 on top: the full suite of 1,893 tests: 1,886 pass and 4 skip, the same 4 that skip on `main`. The 3 that fail also fail on `main` 7e2ba73e4 on this machine: `agc_driver_sample_order` and its `--grid-reference` and `--recipe-depth-locations` cases. - Limbo (CUSA01664) runs in game with #9432 on top (details there). - Validation layer: `ctest -R "^(agc|video_out|shader|recompiler|gcn)" -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363), on `main` 7e2ba73e4 and on this branch with #9430, same machine and GPU. Both builds use `-DANYPS5_VIDEO_OUT_TEST_DRIVER=windows`, so the 14 VideoOut flip tests get a real display. - Neither log reports the layer missing. - `main`: 913 tests; 907 pass, 3 skip and 3 fail (the `agc_driver_sample_order` cases). - This branch: the same 913 tests with the same results, plus `agc_gcn_decode` and `agc_driver_gcn_detile`, which pass. - Both logs hold the same 50 `VUID-` errors in the same 8 existing PS5 tests, with the same IDs and counts test for test (`agc_driver_prepared_exports`, the three `agc_driver_sample_order` cases and four others). This PR adds none. - The same holds with #9432 on top. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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: #9430 - [x] Fixes: none - [x] Unblocks: Limbo (CUSA01664) #6978, with #9432 on top - [x] GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 610.88, Windows 11 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-22 04:48:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:48:27Z.

Review: DISMISSED


The address-equation comparison against addrlib, GPU detiler tests, Limbo run, and paired Vulkan validation are detailed and useful. I found two repository checklist gaps before this change can be considered ready:

  1. The PR description claims the 1920×1080 target optimization increased Limbo from 42 fps to 57–58 fps. The contribution rules require performance claims to include the trace_digest summary lines from main and the change on the same machine and scene, with the traces attached. I could not find those summary lines or trace attachments in the PR description/comments. Please attach the paired report, or remove the comparative speed claim and retain only the functional correctness evidence.

  2. The branch is 534 commits behind current main; the reported tests use cecb540a6. Please update the dependency stack to current main, refresh the overlap/conventions/intake checks, and rerun the focused AGC/shader/VideoOut tests against that same current baseline with the required validation-layer environment. The current paired GPU report is strong for the older baseline, but does not cover the present merge base.

The hosted eligibility, intake, labels, and report checks pass; full Linux/Windows/relinker jobs are skipped. I did not rerun the author's Windows/NVIDIA tests locally because this workspace has no checkout/build matching the PR head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609388579 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9431#pullrequestreview-5609388579). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T04:48:27Z. **Review:** DISMISSED --- The address-equation comparison against addrlib, GPU detiler tests, Limbo run, and paired Vulkan validation are detailed and useful. I found two repository checklist gaps before this change can be considered ready: 1. The PR description claims the 1920×1080 target optimization increased Limbo from 42 fps to 57–58 fps. The contribution rules require performance claims to include the `trace_digest` summary lines from `main` and the change on the same machine and scene, with the traces attached. I could not find those summary lines or trace attachments in the PR description/comments. Please attach the paired report, or remove the comparative speed claim and retain only the functional correctness evidence. 2. The branch is 534 commits behind current `main`; the reported tests use `cecb540a6`. Please update the dependency stack to current `main`, refresh the overlap/conventions/intake checks, and rerun the focused AGC/shader/VideoOut tests against that same current baseline with the required validation-layer environment. The current paired GPU report is strong for the older baseline, but does not cover the present merge base. The hosted eligibility, intake, labels, and report checks pass; full Linux/Windows/relinker jobs are skipped. I did not rerun the author's Windows/NVIDIA tests locally because this workspace has no checkout/build matching the PR head.
Get-fix commented 2026-10-22 11:06:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-22T11:06:51Z.


@MarcZX10 thanks, both points are done:

  1. Speed claim: removed from the description. I have no trace_digest pair from main and the change for it, so only the functional evidence stays.

  2. Rebase and reruns: the stack is rebased onto main 7e2ba73e4. On that base I reran, on main and on the change, same machine and GPU:

    • the focused AGC, shader and VideoOut tests;
    • the paired validation-layer runs, for this PR alone and with #9432 on top.

    The conventions and overlap checks are refreshed. Results are in the description.

The rerun found one real problem in this PR. It renamed the 4 KiB alignment error to "only supported for linear and PS4 buffers", but video_out_flip_ps4 still looked for the old text, so the test failed with this PR. The new commit 26d651d3e updates the expected text. My earlier description wrongly said video_out_flip_ps4 also failed on main: on 7e2ba73e4 it passes, and it passes with this PR.

Overlap report, beyond the #9430 entries answered there. Some open PRs change the same lines as this one:

  • #6612 (@milescoviello) rewrites the stage-routing checks in DecodeShaderStages, the block this PR's PS4 legacy-vertex branch is placed before.
  • #6905 (@parl0v) changes TextureDetile.comp where this PR adds the depth tile-split offset. If #6905 lands first, the split offset goes before its ranged = tiledOffset, so the range covers the split slice.
  • #7085 (@Amoenus) extends the same blockUnits condition in Texture.cpp.
  • #7978 (@fma-rc) changes AgcDriverDeliverEopInterrupt and the graphics event trigger. This PR registers those events by queue and ident instead of by id; both changes combine.
  • #8109 (@ebosido444-ai) replaces the depth layer-pitch check in layeredDepthStorage. The refusal this PR adds there, for PS4 arrays stored level by level, has to stay.
  • #9412 (@Antifrag) and #9700 (@frankea) each add ranges to DrawKeyRegisters, as this PR does. The ranges add up and the array size becomes their sum.

Other open PRs only add lines at the same place: #7948 (@Amoenus) next to the new GuestTextureResource fields, and #9020 and #9335 next to DecodeGcnColorBuffer.

None of these needs the other first. Whichever of them lands before this stack, I rebase the stack onto it and merge by hand as noted above, so none of the authors has to change anything. That is why Depends on stays #9430 only. If any of you would rather this stack go first, say so and I'll note the order.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339234359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9431#issuecomment-6339234359). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-22T11:06:51Z. --- @MarcZX10 thanks, both points are done: 1. **Speed claim:** removed from the description. I have no `trace_digest` pair from `main` and the change for it, so only the functional evidence stays. 2. **Rebase and reruns:** the stack is rebased onto `main` 7e2ba73e4. On that base I reran, on `main` and on the change, same machine and GPU: - the focused AGC, shader and VideoOut tests; - the paired validation-layer runs, for this PR alone and with #9432 on top. The conventions and overlap checks are refreshed. Results are in the description. The rerun found one real problem in this PR. It renamed the 4 KiB alignment error to "only supported for linear and PS4 buffers", but `video_out_flip_ps4` still looked for the old text, so the test failed with this PR. The new commit 26d651d3e updates the expected text. My earlier description wrongly said `video_out_flip_ps4` also failed on `main`: on 7e2ba73e4 it passes, and it passes with this PR. **Overlap report, beyond the #9430 entries answered there.** Some open PRs change the same lines as this one: - #6612 (@milescoviello) rewrites the stage-routing checks in `DecodeShaderStages`, the block this PR's PS4 legacy-vertex branch is placed before. - #6905 (@parl0v) changes `TextureDetile.comp` where this PR adds the depth tile-split offset. If #6905 lands first, the split offset goes before its `ranged = tiledOffset`, so the range covers the split slice. - #7085 (@Amoenus) extends the same `blockUnits` condition in `Texture.cpp`. - #7978 (@fma-rc) changes `AgcDriverDeliverEopInterrupt` and the graphics event trigger. This PR registers those events by queue and ident instead of by id; both changes combine. - #8109 (@ebosido444-ai) replaces the depth layer-pitch check in `layeredDepthStorage`. The refusal this PR adds there, for PS4 arrays stored level by level, has to stay. - #9412 (@Antifrag) and #9700 (@frankea) each add ranges to `DrawKeyRegisters`, as this PR does. The ranges add up and the array size becomes their sum. Other open PRs only add lines at the same place: #7948 (@Amoenus) next to the new `GuestTextureResource` fields, and #9020 and #9335 next to `DecodeGcnColorBuffer`. None of these needs the other first. Whichever of them lands before this stack, I rebase the stack onto it and merge by hand as noted above, so none of the authors has to change anything. That is why `Depends on` stays #9430 only. If any of you would rather this stack go first, say so and I'll note the order. AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-22 11:20:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T11:20:00Z.


@Get-fix the rebase onto main looks right to me. The new Require in decodeDepth that refuses PS4 depth targets with mip levels sits behind gcn like the rest of that function's PS4 branches, so PS5 depth decoding is still main's code. The flip-test update for the "linear and PS4 buffers" message matches the DisplayBuffer.cpp change.

One blocker, though: this commit doesn't compile on Linux x86-64 with GCC and libstdc++. bool legacyVertex in ShaderStages (Graphics/include/State.hpp:35) trips the two size checks in Graphics/src/PipelineJournal.cpp:38-39:

static assertion failed: State changed: update CanonicalPipelineState and the recipe codec
  the comparison reduces to '(792 == 784)'
static assertion failed: ShaderStages changed: update the recipe codec
  the comparison reduces to '(116 == 112)'

The checks only exist under __linux__ && __x86_64__ && __GLIBCXX__, so a Windows or macOS build doesn't see them. The CI here hasn't run on this head yet, which is why nothing flagged it.

Could you:

  1. update the two sizes to 792 and 116, and
  2. decide what the journal does with legacyVertex, as the assert asks. As far as I can see, pipeline creation doesn't read it: it only picks the vertex program in DrawDecode.cpp, and Pipeline.cpp never reads it. If so, CanonicalPipelineState can leave it at false and the recipe codec doesn't need to carry it, and a short comment next to the size checks saying so would help the next person. If pipeline creation does depend on it, it needs to go into CanonicalPipelineState and be encoded and decoded next to tessellation (PipelineJournal.cpp:172-176 and :226-228), with the journal version bumped.

We'll run the full CI on the new head once that's in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339477431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9431#issuecomment-6339477431). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T11:20:00Z. --- @Get-fix the rebase onto `main` looks right to me. The new `Require` in `decodeDepth` that refuses PS4 depth targets with mip levels sits behind `gcn` like the rest of that function's PS4 branches, so PS5 depth decoding is still `main`'s code. The flip-test update for the "linear and PS4 buffers" message matches the `DisplayBuffer.cpp` change. One blocker, though: this commit doesn't compile on Linux x86-64 with GCC and libstdc++. `bool legacyVertex` in `ShaderStages` (`Graphics/include/State.hpp:35`) trips the two size checks in `Graphics/src/PipelineJournal.cpp:38-39`: ``` static assertion failed: State changed: update CanonicalPipelineState and the recipe codec the comparison reduces to '(792 == 784)' static assertion failed: ShaderStages changed: update the recipe codec the comparison reduces to '(116 == 112)' ``` The checks only exist under `__linux__ && __x86_64__ && __GLIBCXX__`, so a Windows or macOS build doesn't see them. The CI here hasn't run on this head yet, which is why nothing flagged it. Could you: 1. update the two sizes to 792 and 116, and 2. decide what the journal does with `legacyVertex`, as the assert asks. As far as I can see, pipeline creation doesn't read it: it only picks the vertex program in `DrawDecode.cpp`, and `Pipeline.cpp` never reads it. If so, `CanonicalPipelineState` can leave it at `false` and the recipe codec doesn't need to carry it, and a short comment next to the size checks saying so would help the next person. If pipeline creation does depend on it, it needs to go into `CanonicalPipelineState` and be encoded and decoded next to `tessellation` (`PipelineJournal.cpp:172-176` and `:226-228`), with the journal version bumped. We'll run the full CI on the new head once that's in.
adriadam10 commented 2026-10-24 02:30:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-24T02:30:28Z.

Review: CHANGES_REQUESTED


Two things block this head, both already reported above and not yet done:

  • Linux x86-64 / libstdc++ build: bool legacyVertex in ShaderStages (Graphics/include/State.hpp:35) trips the size checks at Graphics/src/PipelineJournal.cpp:38-39 (116 vs 112, 792 vs 784). Update the sizes, and decide whether legacyVertex belongs in CanonicalPipelineState and the recipe codec (it selects the vertex program in DrawDecode.cpp, so either encode it with a journal version bump, or show with a test that the selected shader identity already separates the two cases).
  • Conflict with main: GuestTextureResource.hpp (keep fmaskCmaskAddress and the new gcnPitch/gcnPow2Pad/gcnLinearGeneral). main now has State at 824 bytes and journal format 8, so the asserts need the values from the rebased tree.

After the rebase, rerun the focused AGC tests and the validation-layer comparison on the new head; the Linux Build run will be the gate.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5636428098 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9431#pullrequestreview-5636428098). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-24T02:30:28Z. **Review:** CHANGES_REQUESTED --- Two things block this head, both already reported above and not yet done: - Linux x86-64 / libstdc++ build: `bool legacyVertex` in `ShaderStages` (`Graphics/include/State.hpp:35`) trips the size checks at `Graphics/src/PipelineJournal.cpp:38-39` (116 vs 112, 792 vs 784). Update the sizes, and decide whether `legacyVertex` belongs in `CanonicalPipelineState` and the recipe codec (it selects the vertex program in `DrawDecode.cpp`, so either encode it with a journal version bump, or show with a test that the selected shader identity already separates the two cases). - Conflict with `main`: `GuestTextureResource.hpp` (keep `fmaskCmaskAddress` and the new `gcnPitch`/`gcnPow2Pad`/`gcnLinearGeneral`). `main` now has `State` at 824 bytes and journal format 8, so the asserts need the values from the rebased tree. After the rebase, rerun the focused AGC tests and the validation-layer comparison on the new head; the Linux Build run will be the gate.
XairRrR commented 2026-10-29 05:50:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T05:50:33Z.

Review: APPROVED


Reviewed — approved

The head merges cleanly into current main and builds on Linux x86-64 with GCC/libstdc++, including the updated PipelineJournal.cpp size asserts. The focused AGC tests pass under the validation layer with no VUID- lines, and mutating the new tiling, detile and fill code makes the new tests fail.

What I ran

  • PR head: eefa50841267cd0bd5352af17248139445fb0613
  • main: 52c09d567d2fa453494dd720fcf53a98149468e4
  • Tested tree: main with the head merged (--no-ff), in a clean worktree. Release, GCC 16.2.1, Ninja.
  • Machine: Arch Linux 7.2.11-zen, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08).
git fetch origin main pull/9431/head:refs/review/9431
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/9431
git diff --check origin/main...refs/review/9431
python3 tools/check_conventions.py --base origin/main
cmake -S . -B build
cmake --build build -j10 --target agc_driver_register_key_tests agc_driver_graphics_tests \
  agc_driver_bc_block_copy_tests agc_driver_gcn_detile_tests agc_driver_pattern_buffer_fill_tests \
  agc_driver_pipeline_journal_tests video_out_flip_tests agc_gcn_decode_tests \
  agc_display_buffer_dcc_tests agc_driver_recorder_tests agc_driver_tests linear_display_buffer_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \
VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -j4 -V --output-on-failure -R \
  '^(agc_driver_register_key|agc_driver_graphics|agc_driver_bc_block_copy|agc_driver_gcn_detile|agc_driver_pattern_buffer_fill|agc_driver_pipeline_journal|agc_pipeline_journal|agc_driver_graphics_maps_fallback|video_out_flip_ps4|agc_gcn_decode|agc_display_buffer_dcc|agc_resident_present|agc_driver_eop_interrupts|linear_display_buffer)$'
# then the same build and ctest on origin/main (without agc_driver_gcn_detile, which main lacks)

Results

Check Result
Merge into main Clean (auto-merged BufferFill.cpp, VulkanDevice.cpp, DepthSurface.cpp, ShaderReplay.cpp, Flip.cpp, the debt doc)
git diff --check Clean
check_conventions.py --base origin/main All conventions checks passed.
Build, merged tree (Linux x86-64, libstdc++) OK. The sizeof(State) == 920 / sizeof(ShaderStages) == 164 asserts hold, so the build failure reported on 26d651d3e is fixed
Focused tests, merged tree 13 passed, 1 skipped (video_out_flip_ps4: no display in the sandbox)
Focused tests, main 12 passed, 1 skipped (video_out_flip_ps4, same reason)
VUID- lines 0 on merged tree, 0 on main
was not found but was requested by env var VK_INSTANCE_LAYERS Absent from both logs; the loader inserted VK_LAYER_KHRONOS_validation in both runs
Test durations Longest is agc_driver_pipeline_journal at 6.9 s; agc_driver_gcn_detile 1.0 s
Merged tree, ctest summary
 1/14 Test #1569: agc_pipeline_journal ................   Passed    0.00 sec
 2/14 Test #1785: agc_gcn_decode ......................   Passed    0.00 sec
 3/14 Test  #715: agc_driver_register_key .............   Passed    0.84 sec
 4/14 Test  #759: agc_display_buffer_dcc ..............   Passed    0.00 sec
 5/14 Test #1125: agc_driver_gcn_detile ...............   Passed    1.01 sec
 6/14 Test  #897: agc_driver_eop_interrupts ...........   Passed    0.00 sec
 7/14 Test  #825: agc_resident_present ................   Passed    0.40 sec
 8/14 Test  #958: agc_driver_bc_block_copy ............   Passed    0.43 sec
 9/14 Test #1302: agc_driver_pattern_buffer_fill ......   Passed    0.74 sec
10/14 Test #1754: linear_display_buffer ...............   Passed    0.03 sec
11/14 Test #2319: video_out_flip_ps4 ..................***Skipped   0.05 sec
12/14 Test  #948: agc_driver_graphics .................   Passed    5.04 sec
13/14 Test #1306: agc_driver_pipeline_journal .........   Passed    6.92 sec
14/14 Test #1590: agc_driver_graphics_maps_fallback ...   Passed    5.55 sec
100% tests passed out of 14

video_out_flip_ps4: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform

main, ctest summary
 1/13 Test #1301: agc_driver_pattern_buffer_fill ......   Passed    0.93 sec
 2/13 Test  #715: agc_driver_register_key .............   Passed    0.83 sec
 3/13 Test  #958: agc_driver_bc_block_copy ............   Passed    0.50 sec
 4/13 Test  #825: agc_resident_present ................   Passed    0.38 sec
 5/13 Test #1753: linear_display_buffer ...............   Passed    0.03 sec
 6/13 Test #1568: agc_pipeline_journal ................   Passed    0.00 sec
 7/13 Test  #759: agc_display_buffer_dcc ..............   Passed    0.00 sec
 8/13 Test  #897: agc_driver_eop_interrupts ...........   Passed    0.01 sec
 9/13 Test #1784: agc_gcn_decode ......................   Passed    0.00 sec
10/13 Test #2318: video_out_flip_ps4 ..................***Skipped   0.03 sec
11/13 Test  #948: agc_driver_graphics .................   Passed    4.26 sec
12/13 Test #1589: agc_driver_graphics_maps_fallback ...   Passed    4.93 sec
13/13 Test #1305: agc_driver_pipeline_journal .........   Passed    7.13 sec
100% tests passed out of 13

Negative control

Reverting all production files does not give a useful control here, because the new tests call GcnTiling, ComputeGcnMipLayout and MatchesGcnPatternFillKernel, which only exist in this PR, so the tests would just fail to compile. Instead, on the merged tree I changed one thing in each of three production spots, rebuilt and ran the three tests:

  • TextureTiling.cpp GcnTiling: bank rotation per split slice (banks / 2 + 1) changed to (banks / 2).
  • TextureDetile.comp: dropped the split * params.splitStride offset.
  • BufferFill.hpp DecodeGcnPatternFillRange: high address mask 0xfff widened to 0xffff.

All three tests failed, each on the change aimed at it:

agc_driver_graphics ............***Failed  AGC graphics: PS4 tile mode 19 at 2 bytes: element 0,4 is at 540672, addrlib places it at 542720
agc_driver_gcn_detile ..........***Failed  AGC graphics: PS4 tile mode 19 at 2 bytes: element 0,4 byte 0 detiled as 154, expected 52
agc_driver_pattern_buffer_fill .***Failed  AGC graphics: PS4 fill addresses kept bits above 44

So the addrlib reference in tests/TextureTiling.cpp catches errors in the equation builder on its own, and the GPU test catches a missing split offset in the shader. I restored the files afterwards.

Findings

Blocking

None.

On the earlier legacyVertex question (@oneandonlydean, @ntamas94): legacyVertex is read in only one place, DrawDecode.cpp:170, where it picks the vertex program. Nothing in Pipeline.cpp or the journal reads it. So leaving it out of CanonicalPipelineState matches what pipeline creation uses, and the size-only update in eefa508412 is enough for the guards. The build confirms the new sizes.

Non-blocking

  1. Re-adding an event with a different queue keeps the old queue. In Eq/src/Event.cpp:50-51, AddEvent de-duplicates on (eq, ident) only. If an ident that is already registered on an equeue is added again with a different queue, the kqueue entry is updated (EV_ADD), but g_registrations keeps the first queue. AgcDriverDeliverEopInterrupt then fires that ident for the old queue and never for the new one. With the PS5 entry point, queue == ident, so this cannot happen there; it can happen through AgcDriverAddQueueEqEvent_nid_postfix. Suggested fix: update queue on the existing registration, or throw when it differs.
  2. The new entry points have no caller and no test in this PR. These are AgcDriverAddQueueEqEvent_nid_postfix / AgcDriverDeleteQueueEqEvent_nid_postfix (Event.hpp:11-12) and AgcDriverSubmitGraphics_nid_postfix / AgcDriverUseGcnShaders_nid_postfix (EntryPoints.cpp:95-102). The same goes for the tilingMode == 2 display-buffer path (DisplayBuffer.cpp:150-154): only the error text is exercised, by video_out_flip_ps4. I assume the callers arrive with #9432. A small agc_driver_eop_interrupts case for queue/ident registration, and a DisplayBufferSize/DecodeDisplayBuffer case for a 1920x1080 PS4 buffer (expected 1920x1088 bytes), would cover them here.
  3. <array> is included twice in GuestTextureResource.cpp:8-10. Drop the new line 8.
  4. The shadPS4 link in the debt entry points at a branch. The entry is docs/dev/debt/libSceAgcDriver.md:79, and it links shadPS4's tiling.cpp at blob/main. That source is what the GB_TILE_MODE tables are taken from, so a commit permalink would keep the citation stable. The same applies to the image_info.cpp mention two entries below, which has no link at all.
  5. The PR description is out of date. It says "Only the last two commits are this PR; the three below them are #9430". #9430 is merged, and the branch now has three commits, the last being eefa508412 (the journal guard fix). The Tested section still describes main 7e2ba73e4 and 26d651d3e. Please refresh it so it matches the head that gets merged.

Not verified

  • video_out_flip_ps4 and the real PS4 flip/present path: the sandbox has no display, so the test skipped on both trees. I checked the expected string against DisplayBuffer.cpp:147 by reading the code only.
  • The aggregate libs target and the full suite: I built and ran only the targets listed above.
  • Whether the GCN tiling equations match a console. The tests compare against a second implementation of the addrlib formulas, not against hardware, as the debt entry says.
  • Windows/MinGW, AMD GPUs, and Limbo (CUSA01664) in game.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693419493 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9431#pullrequestreview-5693419493). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T05:50:33Z. **Review:** APPROVED --- # Reviewed — approved The head merges cleanly into current `main` and builds on Linux x86-64 with GCC/libstdc++, including the updated `PipelineJournal.cpp` size asserts. The focused AGC tests pass under the validation layer with no `VUID-` lines, and mutating the new tiling, detile and fill code makes the new tests fail. ## What I ran - PR head: `eefa50841267cd0bd5352af17248139445fb0613` - `main`: `52c09d567d2fa453494dd720fcf53a98149468e4` - Tested tree: `main` with the head merged (`--no-ff`), in a clean worktree. Release, GCC 16.2.1, Ninja. - Machine: Arch Linux 7.2.11-zen, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). ```sh git fetch origin main pull/9431/head:refs/review/9431 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/9431 git diff --check origin/main...refs/review/9431 python3 tools/check_conventions.py --base origin/main cmake -S . -B build cmake --build build -j10 --target agc_driver_register_key_tests agc_driver_graphics_tests \ agc_driver_bc_block_copy_tests agc_driver_gcn_detile_tests agc_driver_pattern_buffer_fill_tests \ agc_driver_pipeline_journal_tests video_out_flip_tests agc_gcn_decode_tests \ agc_display_buffer_dcc_tests agc_driver_recorder_tests agc_driver_tests linear_display_buffer_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \ VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -j4 -V --output-on-failure -R \ '^(agc_driver_register_key|agc_driver_graphics|agc_driver_bc_block_copy|agc_driver_gcn_detile|agc_driver_pattern_buffer_fill|agc_driver_pipeline_journal|agc_pipeline_journal|agc_driver_graphics_maps_fallback|video_out_flip_ps4|agc_gcn_decode|agc_display_buffer_dcc|agc_resident_present|agc_driver_eop_interrupts|linear_display_buffer)$' # then the same build and ctest on origin/main (without agc_driver_gcn_detile, which main lacks) ``` ## Results | Check | Result | |---|---| | Merge into `main` | Clean (auto-merged `BufferFill.cpp`, `VulkanDevice.cpp`, `DepthSurface.cpp`, `ShaderReplay.cpp`, `Flip.cpp`, the debt doc) | | `git diff --check` | Clean | | `check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build, merged tree (Linux x86-64, libstdc++) | OK. The `sizeof(State) == 920` / `sizeof(ShaderStages) == 164` asserts hold, so the build failure reported on 26d651d3e is fixed | | Focused tests, merged tree | 13 passed, 1 skipped (`video_out_flip_ps4`: no display in the sandbox) | | Focused tests, `main` | 12 passed, 1 skipped (`video_out_flip_ps4`, same reason) | | `VUID-` lines | 0 on merged tree, 0 on `main` | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | Absent from both logs; the loader inserted `VK_LAYER_KHRONOS_validation` in both runs | | Test durations | Longest is `agc_driver_pipeline_journal` at 6.9 s; `agc_driver_gcn_detile` 1.0 s | <details><summary>Merged tree, ctest summary</summary> ``` 1/14 Test #1569: agc_pipeline_journal ................ Passed 0.00 sec 2/14 Test #1785: agc_gcn_decode ...................... Passed 0.00 sec 3/14 Test #715: agc_driver_register_key ............. Passed 0.84 sec 4/14 Test #759: agc_display_buffer_dcc .............. Passed 0.00 sec 5/14 Test #1125: agc_driver_gcn_detile ............... Passed 1.01 sec 6/14 Test #897: agc_driver_eop_interrupts ........... Passed 0.00 sec 7/14 Test #825: agc_resident_present ................ Passed 0.40 sec 8/14 Test #958: agc_driver_bc_block_copy ............ Passed 0.43 sec 9/14 Test #1302: agc_driver_pattern_buffer_fill ...... Passed 0.74 sec 10/14 Test #1754: linear_display_buffer ............... Passed 0.03 sec 11/14 Test #2319: video_out_flip_ps4 ..................***Skipped 0.05 sec 12/14 Test #948: agc_driver_graphics ................. Passed 5.04 sec 13/14 Test #1306: agc_driver_pipeline_journal ......... Passed 6.92 sec 14/14 Test #1590: agc_driver_graphics_maps_fallback ... Passed 5.55 sec 100% tests passed out of 14 ``` `video_out_flip_ps4`: `skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform` </details> <details><summary><code>main</code>, ctest summary</summary> ``` 1/13 Test #1301: agc_driver_pattern_buffer_fill ...... Passed 0.93 sec 2/13 Test #715: agc_driver_register_key ............. Passed 0.83 sec 3/13 Test #958: agc_driver_bc_block_copy ............ Passed 0.50 sec 4/13 Test #825: agc_resident_present ................ Passed 0.38 sec 5/13 Test #1753: linear_display_buffer ............... Passed 0.03 sec 6/13 Test #1568: agc_pipeline_journal ................ Passed 0.00 sec 7/13 Test #759: agc_display_buffer_dcc .............. Passed 0.00 sec 8/13 Test #897: agc_driver_eop_interrupts ........... Passed 0.01 sec 9/13 Test #1784: agc_gcn_decode ...................... Passed 0.00 sec 10/13 Test #2318: video_out_flip_ps4 ..................***Skipped 0.03 sec 11/13 Test #948: agc_driver_graphics ................. Passed 4.26 sec 12/13 Test #1589: agc_driver_graphics_maps_fallback ... Passed 4.93 sec 13/13 Test #1305: agc_driver_pipeline_journal ......... Passed 7.13 sec 100% tests passed out of 13 ``` </details> ## Negative control Reverting all production files does not give a useful control here, because the new tests call `GcnTiling`, `ComputeGcnMipLayout` and `MatchesGcnPatternFillKernel`, which only exist in this PR, so the tests would just fail to compile. Instead, on the merged tree I changed one thing in each of three production spots, rebuilt and ran the three tests: - `TextureTiling.cpp` `GcnTiling`: bank rotation per split slice `(banks / 2 + 1)` changed to `(banks / 2)`. - `TextureDetile.comp`: dropped the `split * params.splitStride` offset. - `BufferFill.hpp` `DecodeGcnPatternFillRange`: high address mask `0xfff` widened to `0xffff`. All three tests failed, each on the change aimed at it: ``` agc_driver_graphics ............***Failed AGC graphics: PS4 tile mode 19 at 2 bytes: element 0,4 is at 540672, addrlib places it at 542720 agc_driver_gcn_detile ..........***Failed AGC graphics: PS4 tile mode 19 at 2 bytes: element 0,4 byte 0 detiled as 154, expected 52 agc_driver_pattern_buffer_fill .***Failed AGC graphics: PS4 fill addresses kept bits above 44 ``` So the addrlib reference in `tests/TextureTiling.cpp` catches errors in the equation builder on its own, and the GPU test catches a missing split offset in the shader. I restored the files afterwards. ## Findings ### Blocking None. On the earlier `legacyVertex` question (@oneandonlydean, @ntamas94): `legacyVertex` is read in only one place, [`DrawDecode.cpp:170`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp#L170), where it picks the vertex program. Nothing in `Pipeline.cpp` or the journal reads it. So leaving it out of [`CanonicalPipelineState`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp#L1489-L1497) matches what pipeline creation uses, and the size-only update in eefa508412 is enough for the guards. The build confirms the new sizes. ### Non-blocking 1. **Re-adding an event with a different queue keeps the old queue.** In [`Eq/src/Event.cpp:50-51`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Eq/src/Event.cpp#L50-L51), `AddEvent` de-duplicates on `(eq, ident)` only. If an `ident` that is already registered on an equeue is added again with a different `queue`, the kqueue entry is updated (`EV_ADD`), but `g_registrations` keeps the first queue. `AgcDriverDeliverEopInterrupt` then fires that ident for the old queue and never for the new one. With the PS5 entry point, `queue == ident`, so this cannot happen there; it can happen through `AgcDriverAddQueueEqEvent_nid_postfix`. Suggested fix: update `queue` on the existing registration, or throw when it differs. 2. **The new entry points have no caller and no test in this PR.** These are `AgcDriverAddQueueEqEvent_nid_postfix` / `AgcDriverDeleteQueueEqEvent_nid_postfix` ([`Event.hpp:11-12`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Eq/include/Event.hpp#L11-L12)) and `AgcDriverSubmitGraphics_nid_postfix` / `AgcDriverUseGcnShaders_nid_postfix` ([`EntryPoints.cpp:95-102`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp#L95-L102)). The same goes for the `tilingMode == 2` display-buffer path ([`DisplayBuffer.cpp:150-154`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Execution/src/DisplayBuffer.cpp#L150-L154)): only the error text is exercised, by `video_out_flip_ps4`. I assume the callers arrive with #9432. A small `agc_driver_eop_interrupts` case for queue/ident registration, and a `DisplayBufferSize`/`DecodeDisplayBuffer` case for a 1920x1080 PS4 buffer (expected 1920x1088 bytes), would cover them here. 3. **`<array>` is included twice** in [`GuestTextureResource.cpp:8-10`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp#L8-L10). Drop the new line 8. 4. **The shadPS4 link in the debt entry points at a branch.** The entry is [`docs/dev/debt/libSceAgcDriver.md:79`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/docs/dev/debt/libSceAgcDriver.md#L79), and it links shadPS4's `tiling.cpp` at `blob/main`. That source is what the GB_TILE_MODE tables are taken from, so a commit permalink would keep the citation stable. The same applies to the `image_info.cpp` mention two entries below, which has no link at all. 5. **The PR description is out of date.** It says "Only the last two commits are this PR; the three below them are #9430". #9430 is merged, and the branch now has three commits, the last being eefa508412 (the journal guard fix). The `Tested` section still describes `main` 7e2ba73e4 and 26d651d3e. Please refresh it so it matches the head that gets merged. ## Not verified - `video_out_flip_ps4` and the real PS4 flip/present path: the sandbox has no display, so the test skipped on both trees. I checked the expected string against [`DisplayBuffer.cpp:147`](https://github.com/boykopovar/AnyPS5/blob/eefa50841267cd0bd5352af17248139445fb0613/core/libs/prx/libSceAgcDriver/Execution/src/DisplayBuffer.cpp#L147) by reading the code only. - The aggregate `libs` target and the full suite: I built and ran only the targets listed above. - Whether the GCN tiling equations match a console. The tests compare against a second implementation of the addrlib formulas, not against hardware, as the debt entry says. - Windows/MinGW, AMD GPUs, and Limbo (CUSA01664) in game.
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!9431
No description provided.