fix(libSceAgcDriver): size a PS4 depth target's HTILE in 512x512 blocks #10435

Merged
ntamas94 merged 10 commits from upstream-pr/10435 into main 2026-11-02 10:25:57 +00:00
ntamas94 commented 2026-10-24 00:14:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ntamas94 on 2026-10-24T00:14:10Z.


What

A PS4 depth target's HTILE spans 16 KiB per 512x512 pixel block. HtileMetadataBytes gave every target the PS5 size, 32 KiB per 1024x512 block. The two agree only when the width is a multiple of 1024. For a 512x512 target the PS5 size is twice the real one.

Gang Beasts (CUSA04865, Unity) clears each 512x512 spot-light shadow map by filling 16 KiB of its HTILE with zero, using the compact pattern fill kernel. Measured against 32 KiB:

  • the fill did not cover the HTILE, so it never became a fast clear;
  • when the shadow map was bound, the HTILE check read 16 KiB past the metadata, saw words that are not a clear and kept the old depth.

The shadow casters then drew over the previous frames' depth, and on the elevator stage the shadows of earlier frames stayed on the floor and the back wall. The 4096x4096 directional shadow map (1 MiB fill) and the 2048x1152 camera depth (0x30000-byte fill) were cleared, because both sizes agree for those widths.

While PS4 (GCN) shaders run, HtileMetadataBytes now uses the PS4 block, as DecodeState already does for the depth extent. The HTILE fill coverage check, the bind-time HTILE read and the HTILE slice step all go through it. PS5 targets are unchanged. The 512x512 block is the macro tile addrlib's CI ComputeTileDataWidthAndHeight gives for 32-bit HTILE words, 16384 cache bits and the 8 pipes of P8_32x32_16x16, the pipe configuration the PS4 tiling code here already assumes. The HTILE debt entry says so.

Tested

Windows 11 Pro (10.0.26200), WinLibs GCC, NVIDIA GeForce RTX 2080 (driver 617.14), Release build with BUILD_TESTING=ON, on this branch (ps4/agc-gcn at 26d651d3e plus this commit):

  • agc_driver_graphics now checks the PS4 HTILE size for 512x512, 256x256, 2048x1152 and 4096x4096 targets, and that a 16 KiB fill covers a 512x512 PS4 target's HTILE while a shorter one does not. It passes; with DepthSurface.cpp reverted to the base it fails (a PS4 HTILE is 16 KiB per 512x512 block).

  • The depth execution tests pass: depth_bias_per_face, depth_bits_guest_memory, depth_clear_hle, depth_compare_copy, depth_fast_clear, depth_fast_clear_submit, depth_htile_write, depth_plane_buffer_memory, depth_plane_fill, depth_plane_guest_layers, depth_plane_partial_store, depth_plane_sampling, depth_range_remap_draw, depth_storage, depth_storage_dispatch, depth_storage_reuse, depth_surface_from_storage, depth_surface_last_writer, gcn_detile, native_depth_bda_clear, native_multisample_depth, native_depth_retirement, native_depth_clears, native_depth_clear_refusals, pattern_buffer_fill, sample_mask_depth_stencil, stencil_replay, stencil_replay_no_gpl.

  • Gang Beasts, with the equivalent change (the PS4 size chosen per depth target) on my bring-up branch (#7941): on the elevator stage the shadows follow the characters and no longer stay behind. A trace of that stage showed that before the change, the two 512x512 spot shadow maps got no clear in 2.5 s while the 4096x4096 map got one each frame.

  • tools/check_conventions.py --base refs/pr/9431 with this title and description: no findings.

  • Paired validation-layer run of the 30 tests above, on the base (26d651d3e) and this branch, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and VK_LOADER_DEBUG=warn,error, ctest -V, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0. Both logs carry the loader's adding layers "VK_LAYER_KHRONOS_validation" line and neither reports was not found but was requested by env var VK_INSTANCE_LAYERS. VUID- ids on the base: 0; on this branch: 0; new on this branch: 0. The base run covered 24 of the 30 tests, including the failing agc_driver_graphics; this branch ran all 30.

  • After merging current main into this branch (cedf987d5, to resolve the conflicts it inherited from #9431 in DepthSurface.cpp and GuestTextureResource.hpp): the same validation-layer run passes 31 of 31 tests (the 31st, depth_storage_reuse_draw_pipeline, comes from main), VUID- ids: 0; check_conventions.py --base origin/main: no findings.

  • 2026-10-29, head 41c0489401 on main 66405c3250 after #9431 landed: 40 depth, gcn_detile and pattern_buffer_fill tests with the validation layer, three runs on the head and one on the base, 0 VUID- ids; details in the review reply.

Checklist

  • Based on current main; no other open PR implements the same functions (merged with main 66405c3250 after #9431 landed; searched open boykopovar/AnyPS5 PRs for HTILE size, HtileMetadataBytes and PS4 HTILE on 2026-10-24)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#9431, merged 2026-10-29)
  • Fixes: none
  • Unblocks: CUSA04865 #7941
  • GPUs tested: NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4990877240 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10435). Originally posted by [ntamas94](https://github.com/ntamas94) on 2026-10-24T00:14:10Z. --- ### What A PS4 depth target's HTILE spans 16 KiB per 512x512 pixel block. `HtileMetadataBytes` gave every target the PS5 size, 32 KiB per 1024x512 block. The two agree only when the width is a multiple of 1024. For a 512x512 target the PS5 size is twice the real one. Gang Beasts (CUSA04865, Unity) clears each 512x512 spot-light shadow map by filling 16 KiB of its HTILE with zero, using the compact pattern fill kernel. Measured against 32 KiB: - the fill did not cover the HTILE, so it never became a fast clear; - when the shadow map was bound, the HTILE check read 16 KiB past the metadata, saw words that are not a clear and kept the old depth. The shadow casters then drew over the previous frames' depth, and on the elevator stage the shadows of earlier frames stayed on the floor and the back wall. The 4096x4096 directional shadow map (1 MiB fill) and the 2048x1152 camera depth (0x30000-byte fill) were cleared, because both sizes agree for those widths. While PS4 (GCN) shaders run, `HtileMetadataBytes` now uses the PS4 block, as `DecodeState` already does for the depth extent. The HTILE fill coverage check, the bind-time HTILE read and the HTILE slice step all go through it. PS5 targets are unchanged. The 512x512 block is the macro tile addrlib's CI `ComputeTileDataWidthAndHeight` gives for 32-bit HTILE words, 16384 cache bits and the 8 pipes of `P8_32x32_16x16`, the pipe configuration the PS4 tiling code here already assumes. The HTILE debt entry says so. ### Tested Windows 11 Pro (10.0.26200), WinLibs GCC, NVIDIA GeForce RTX 2080 (driver 617.14), Release build with `BUILD_TESTING=ON`, on this branch (`ps4/agc-gcn` at `26d651d3e` plus this commit): - `agc_driver_graphics` now checks the PS4 HTILE size for 512x512, 256x256, 2048x1152 and 4096x4096 targets, and that a 16 KiB fill covers a 512x512 PS4 target's HTILE while a shorter one does not. It passes; with `DepthSurface.cpp` reverted to the base it fails (`a PS4 HTILE is 16 KiB per 512x512 block`). - The depth execution tests pass: `depth_bias_per_face`, `depth_bits_guest_memory`, `depth_clear_hle`, `depth_compare_copy`, `depth_fast_clear`, `depth_fast_clear_submit`, `depth_htile_write`, `depth_plane_buffer_memory`, `depth_plane_fill`, `depth_plane_guest_layers`, `depth_plane_partial_store`, `depth_plane_sampling`, `depth_range_remap_draw`, `depth_storage`, `depth_storage_dispatch`, `depth_storage_reuse`, `depth_surface_from_storage`, `depth_surface_last_writer`, `gcn_detile`, `native_depth_bda_clear`, `native_multisample_depth`, `native_depth_retirement`, `native_depth_clears`, `native_depth_clear_refusals`, `pattern_buffer_fill`, `sample_mask_depth_stencil`, `stencil_replay`, `stencil_replay_no_gpl`. - Gang Beasts, with the equivalent change (the PS4 size chosen per depth target) on my bring-up branch (#7941): on the elevator stage the shadows follow the characters and no longer stay behind. A trace of that stage showed that before the change, the two 512x512 spot shadow maps got no clear in 2.5 s while the 4096x4096 map got one each frame. - `tools/check_conventions.py --base refs/pr/9431` with this title and description: no findings. - Paired validation-layer run of the 30 tests above, on the base (`26d651d3e`) and this branch, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1` and `VK_LOADER_DEBUG=warn,error`, `ctest -V`, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0. Both logs carry the loader's `adding layers "VK_LAYER_KHRONOS_validation"` line and neither reports `was not found but was requested by env var VK_INSTANCE_LAYERS`. `VUID-` ids on the base: 0; on this branch: 0; new on this branch: 0. The base run covered 24 of the 30 tests, including the failing `agc_driver_graphics`; this branch ran all 30. - After merging current `main` into this branch (`cedf987d5`, to resolve the conflicts it inherited from #9431 in `DepthSurface.cpp` and `GuestTextureResource.hpp`): the same validation-layer run passes 31 of 31 tests (the 31st, `depth_storage_reuse_draw_pipeline`, comes from `main`), `VUID-` ids: 0; `check_conventions.py --base origin/main`: no findings. - 2026-10-29, head `41c0489401` on `main` `66405c3250` after #9431 landed: 40 depth, `gcn_detile` and `pattern_buffer_fill` tests with the validation layer, three runs on the head and one on the base, 0 `VUID-` ids; details in the review reply. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions (merged with `main` `66405c3250` after #9431 landed; searched open boykopovar/AnyPS5 PRs for HTILE size, `HtileMetadataBytes` and PS4 HTILE on 2026-10-24) - [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: none (#9431, merged 2026-10-29) - [x] Fixes: none - [x] Unblocks: CUSA04865 #7941 - [x] GPUs tested: NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-24 22:01:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T22:01:44Z.

Review: CHANGES_REQUESTED


Reviewed exact head cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c against refreshed upstream main c8d34aa8f4d8058d57169cc1e423ba6db00faaf0.

The PS4 HTILE sizing change is threaded through target layout, fill coverage, bind-time checking, and slice addressing; the body includes useful unit, Vulkan validation-layer, and Gang Beasts evidence. The PR is a five-commit stack including #9431, with merge base e2b9700a98d377aa32296cd886f16f40c4d4f76a; current main has 20 later commits. A merge-tree preview is clean and current-main conventions/diff-check pass, but the reported 31-test integration run is on the older stack and the hosted product jobs are skipped.

Please refresh the #9431 dependency stack and this follow-up onto current main, then rerun the focused PS4 texture/HTILE and depth execution suite with the Vulkan validation layer requested. Preserve the earlier base/change comparison where feasible, and report exact tests and skips on the updated head. This is an integration-verification request for a broad AGC change; I found no specific defect in the patch from the current-head-only inspection.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640196371 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10435#pullrequestreview-5640196371). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T22:01:44Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c` against refreshed upstream `main` `c8d34aa8f4d8058d57169cc1e423ba6db00faaf0`. The PS4 HTILE sizing change is threaded through target layout, fill coverage, bind-time checking, and slice addressing; the body includes useful unit, Vulkan validation-layer, and Gang Beasts evidence. The PR is a five-commit stack including #9431, with merge base `e2b9700a98d377aa32296cd886f16f40c4d4f76a`; current main has 20 later commits. A merge-tree preview is clean and current-main conventions/diff-check pass, but the reported 31-test integration run is on the older stack and the hosted product jobs are skipped. Please refresh the #9431 dependency stack and this follow-up onto current main, then rerun the focused PS4 texture/HTILE and depth execution suite with the Vulkan validation layer requested. Preserve the earlier base/change comparison where feasible, and report exact tests and skips on the updated head. This is an integration-verification request for a broad AGC change; I found no specific defect in the patch from the current-head-only inspection.
XairRrR commented 2026-10-29 03:41:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T03:41:32Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The HTILE sizing change is correct and its test works when applied to current main alone. But the PR head conflicts with main in three files and does not build on Linux, so it can't merge as it stands.

What I ran

  • PR head: cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c
  • main: b433c40f2f46aa2e59e19806010a839ac8572d64
  • Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release, Ninja, BUILD_TESTING=ON, in a clean worktree.
git fetch origin main pull/10435/head:refs/review/10435
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/10435     # conflicts, aborted
git merge --abort
git checkout --detach refs/review/10435
git diff --check origin/main...refs/review/10435
python3 tools/check_conventions.py --base origin/main
cmake -S . -B build
cmake --build build -j10 --target core/libs/prx/libSceAgcDriver/CMakeFiles/libSceAgcDriver.dir/Graphics/src/PipelineJournal.cpp.o

# The PR's own commit c8b8d24aef applied alone onto main (the only conflicts were the include lines; I kept both sides)
git checkout --detach origin/main
git cherry-pick -n c8b8d24aef
cmake --build build -j10 --target agc_driver_graphics_tests agc_driver_depth_clear_hle_tests \
  agc_driver_depth_fast_clear_tests agc_driver_depth_fast_clear_submit_tests agc_driver_depth_htile_write_tests \
  agc_driver_depth_plane_fill_tests agc_driver_pattern_buffer_fill_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 -V -j4 --output-on-failure \
  -R 'agc_driver_(graphics|depth_fast_clear|depth_fast_clear_submit|depth_htile_write|pattern_buffer_fill|depth_plane_fill|depth_clear_hle)$'
# Negative control: DepthSurface.cpp restored from origin/main, then rebuild and ctest -R 'agc_driver_graphics$'
# Baseline: plain origin/main, same build and the same validation-layer ctest command

Results

Check Result
Merge into main Conflicts in Graphics/include/State.hpp, Graphics/src/State.cpp and tests/Graphics.cpp
git diff --check clean
check_conventions.py --base origin/main (PR head) All conventions checks passed
Build of the PR head (Linux, GCC 16) Fails: PipelineJournal.cpp:38 and :39 static_assert
c8b8d24aef alone on main: 7 focused tests with the validation layer 7/7 passed
main baseline: same 7 tests with the validation layer 7/7 passed
VUID- lines (change / main) 0 / 0
was not found but was requested by env var VK_INSTANCE_LAYERS absent in both logs; both carry adding layers "VK_LAYER_KHRONOS_validation"
Test time agc_driver_graphics 4.3 s; the others are under 1.5 s
PR head build failure
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:38:29: error: static assertion failed: State changed: update CanonicalPipelineState and the recipe codec
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:39:36: error: static assertion failed: ShaderStages changed: update the recipe codec
  • the comparison reduces to '(116 == 112)'
ninja: build stopped: subcommand failed.
Focused tests, PR commit on main (validation layer on)
1/7 Test #1003: agc_driver_depth_fast_clear ..........   Passed    0.53 sec
2/7 Test #1004: agc_driver_depth_fast_clear_submit ...   Passed    0.90 sec
3/7 Test #1005: agc_driver_depth_htile_write .........   Passed    0.42 sec
4/7 Test  #999: agc_driver_depth_clear_hle ...........   Passed    1.17 sec
5/7 Test #1007: agc_driver_depth_plane_fill ..........   Passed    0.43 sec
6/7 Test #1301: agc_driver_pattern_buffer_fill .......   Passed    0.76 sec
7/7 Test  #948: agc_driver_graphics ..................   Passed    4.26 sec
100% tests passed out of 7

Negative control

On top of the cherry-picked commit I restored only Graphics/src/DepthSurface.cpp from origin/main and kept the new test. agc_driver_graphics then fails as it should:

1/1 Test #948: agc_driver_graphics ..............***Failed    0.05 sec
AGC graphics: a PS4 HTILE is 16 KiB per 512x512 block

Findings

Blocking

  1. Conflicts with main. A merge into b433c40f2f conflicts in Graphics/include/State.hpp (ShaderStages fields and the DrawKeyRegisters table), Graphics/src/State.cpp (decodeDepthPlane extent and mip checks, DecodeShaderStages) and tests/Graphics.cpp. This confirms the conflict oneandonlydean reported. All three conflicts are in the carried copy of #9431, not in this PR's own commit. #9431 has been updated since (head eefa5084126) and GitHub now reports it as mergeable. Rebasing this PR's one commit onto #9431's current head, or onto main once #9431 lands, should resolve them.

  2. The PR head does not build on Linux. This reproduces TechLevelZero's report on the head itself, without merging main first. The bool legacyVertex that the carried #9431 commit adds to ShaderStages (State.hpp:35) breaks the size asserts in PipelineJournal.cpp:38-39 (116 == 112). #9431's current head has new values for these asserts, so the rebase in finding 1 should fix this as well. I did not check whether that head also serializes the new field in the recipe codec, as TechLevelZero asked; that question belongs on #9431.

Non-blocking

  1. The description names three callers of HtileMetadataBytes: the fill coverage check, the bind-time read and the slice step. The head has more. One is the multisample HTILE size in Graphics/src/MultisampleTarget.cpp:847; others are the initial-state and HTILE write ranges in DepthSurface.cpp. In PS4 mode all of them now get the PS4 size. That is consistent, because HTILE covers 8x8 pixels regardless of the sample count, but none of the tests covers a multisampled PS4 target. A sentence in the description would help reviewers after the rebase.
  2. The test switches the process-wide mode with SetGcnGuestShaders(true) and switches it back after two Requires (tests/Graphics.cpp:2402-2405). A failing Require ends the test anyway, so this is fine today. A scoped guard would keep later checks in DepthStencilTests from inheriting GCN mode if the test ever stops failing fast.

The sizing itself (DepthSurface.cpp:2415-2420) checks out. One 4-byte HTILE word per 8x8 tile gives 64 × 64 words × 4 B = 16 KiB per 512x512 block. The 2048x1152 case rounds to 4 × 3 blocks (0x30000) and 4096x4096 to 8 × 8 blocks (1 MiB). Both match the fill sizes in the description. PS5 targets keep the 1024x512 / 32 KiB path.

Not verified

  • The PR head's own tests. libSceAgcDriver does not compile at that head on Linux, so I ran the PR's commit on main instead (see above).
  • Any of the PS4 (GCN) draw path from #9431. It is out of scope for this follow-up and does not build here.
  • The Gang Beasts (CUSA04865) result. I did not launch any title.
  • Windows builds.

To get this to a good state

  1. Rebase c8b8d24aef onto #9431's current head (or onto main after #9431 merges) so that the conflicts and the PipelineJournal.cpp asserts go away.
  2. Re-run agc_driver_graphics and the listed depth, gcn_detile and pattern_buffer_fill tests on the rebased head, with the validation layer requested. Report the head SHA, the pass/skip counts and the VUID- comparison in the description.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692576397 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10435#pullrequestreview-5692576397). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T03:41:32Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The HTILE sizing change is correct and its test works when applied to current `main` alone. But the PR head conflicts with `main` in three files and does not build on Linux, so it can't merge as it stands. ## What I ran - PR head: `cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c` - `main`: `b433c40f2f46aa2e59e19806010a839ac8572d64` - Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release, Ninja, `BUILD_TESTING=ON`, in a clean worktree. ```sh git fetch origin main pull/10435/head:refs/review/10435 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/10435 # conflicts, aborted git merge --abort git checkout --detach refs/review/10435 git diff --check origin/main...refs/review/10435 python3 tools/check_conventions.py --base origin/main cmake -S . -B build cmake --build build -j10 --target core/libs/prx/libSceAgcDriver/CMakeFiles/libSceAgcDriver.dir/Graphics/src/PipelineJournal.cpp.o # The PR's own commit c8b8d24aef applied alone onto main (the only conflicts were the include lines; I kept both sides) git checkout --detach origin/main git cherry-pick -n c8b8d24aef cmake --build build -j10 --target agc_driver_graphics_tests agc_driver_depth_clear_hle_tests \ agc_driver_depth_fast_clear_tests agc_driver_depth_fast_clear_submit_tests agc_driver_depth_htile_write_tests \ agc_driver_depth_plane_fill_tests agc_driver_pattern_buffer_fill_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 -V -j4 --output-on-failure \ -R 'agc_driver_(graphics|depth_fast_clear|depth_fast_clear_submit|depth_htile_write|pattern_buffer_fill|depth_plane_fill|depth_clear_hle)$' # Negative control: DepthSurface.cpp restored from origin/main, then rebuild and ctest -R 'agc_driver_graphics$' # Baseline: plain origin/main, same build and the same validation-layer ctest command ``` ## Results | Check | Result | |---|---| | Merge into `main` | **Conflicts** in `Graphics/include/State.hpp`, `Graphics/src/State.cpp` and `tests/Graphics.cpp` | | `git diff --check` | clean | | `check_conventions.py --base origin/main` (PR head) | All conventions checks passed | | Build of the PR head (Linux, GCC 16) | **Fails**: `PipelineJournal.cpp:38` and `:39` `static_assert` | | `c8b8d24aef` alone on `main`: 7 focused tests with the validation layer | 7/7 passed | | `main` baseline: same 7 tests with the validation layer | 7/7 passed | | `VUID-` lines (change / `main`) | 0 / 0 | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | absent in both logs; both carry `adding layers "VK_LAYER_KHRONOS_validation"` | | Test time | `agc_driver_graphics` 4.3 s; the others are under 1.5 s | <details><summary>PR head build failure</summary> ``` core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:38:29: error: static assertion failed: State changed: update CanonicalPipelineState and the recipe codec core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:39:36: error: static assertion failed: ShaderStages changed: update the recipe codec • the comparison reduces to '(116 == 112)' ninja: build stopped: subcommand failed. ``` </details> <details><summary>Focused tests, PR commit on main (validation layer on)</summary> ``` 1/7 Test #1003: agc_driver_depth_fast_clear .......... Passed 0.53 sec 2/7 Test #1004: agc_driver_depth_fast_clear_submit ... Passed 0.90 sec 3/7 Test #1005: agc_driver_depth_htile_write ......... Passed 0.42 sec 4/7 Test #999: agc_driver_depth_clear_hle ........... Passed 1.17 sec 5/7 Test #1007: agc_driver_depth_plane_fill .......... Passed 0.43 sec 6/7 Test #1301: agc_driver_pattern_buffer_fill ....... Passed 0.76 sec 7/7 Test #948: agc_driver_graphics .................. Passed 4.26 sec 100% tests passed out of 7 ``` </details> ## Negative control On top of the cherry-picked commit I restored only `Graphics/src/DepthSurface.cpp` from `origin/main` and kept the new test. `agc_driver_graphics` then fails as it should: ``` 1/1 Test #948: agc_driver_graphics ..............***Failed 0.05 sec AGC graphics: a PS4 HTILE is 16 KiB per 512x512 block ``` ## Findings ### Blocking 1. **Conflicts with `main`.** A merge into `b433c40f2f` conflicts in `Graphics/include/State.hpp` (`ShaderStages` fields and the `DrawKeyRegisters` table), `Graphics/src/State.cpp` (`decodeDepthPlane` extent and mip checks, `DecodeShaderStages`) and `tests/Graphics.cpp`. This confirms the conflict oneandonlydean reported. All three conflicts are in the carried copy of #9431, not in this PR's own commit. #9431 has been updated since (head `eefa5084126`) and GitHub now reports it as mergeable. Rebasing this PR's one commit onto #9431's current head, or onto `main` once #9431 lands, should resolve them. 2. **The PR head does not build on Linux.** This reproduces TechLevelZero's report on the head itself, without merging `main` first. The `bool legacyVertex` that the carried #9431 commit adds to `ShaderStages` ([State.hpp:35](https://github.com/boykopovar/AnyPS5/blob/cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c/core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp#L35-L35)) breaks the size asserts in [PipelineJournal.cpp:38-39](https://github.com/boykopovar/AnyPS5/blob/cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp#L38-L39) (`116 == 112`). #9431's current head has new values for these asserts, so the rebase in finding 1 should fix this as well. I did not check whether that head also serializes the new field in the recipe codec, as TechLevelZero asked; that question belongs on #9431. ### Non-blocking 1. The description names three callers of `HtileMetadataBytes`: the fill coverage check, the bind-time read and the slice step. The head has more. One is the multisample HTILE size in `Graphics/src/MultisampleTarget.cpp:847`; others are the initial-state and HTILE write ranges in `DepthSurface.cpp`. In PS4 mode all of them now get the PS4 size. That is consistent, because HTILE covers 8x8 pixels regardless of the sample count, but none of the tests covers a multisampled PS4 target. A sentence in the description would help reviewers after the rebase. 2. The test switches the process-wide mode with `SetGcnGuestShaders(true)` and switches it back after two `Require`s ([tests/Graphics.cpp:2402-2405](https://github.com/boykopovar/AnyPS5/blob/cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L2402-L2405)). A failing `Require` ends the test anyway, so this is fine today. A scoped guard would keep later checks in `DepthStencilTests` from inheriting GCN mode if the test ever stops failing fast. The sizing itself ([DepthSurface.cpp:2415-2420](https://github.com/boykopovar/AnyPS5/blob/cedf987d5ba4ee2f0c4c0184599ad5b3f8705d1c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L2415-L2420)) checks out. One 4-byte HTILE word per 8x8 tile gives 64 × 64 words × 4 B = 16 KiB per 512x512 block. The 2048x1152 case rounds to 4 × 3 blocks (0x30000) and 4096x4096 to 8 × 8 blocks (1 MiB). Both match the fill sizes in the description. PS5 targets keep the 1024x512 / 32 KiB path. ## Not verified - The PR head's own tests. `libSceAgcDriver` does not compile at that head on Linux, so I ran the PR's commit on `main` instead (see above). - Any of the PS4 (GCN) draw path from #9431. It is out of scope for this follow-up and does not build here. - The Gang Beasts (CUSA04865) result. I did not launch any title. - Windows builds. ## To get this to a good state 1. Rebase `c8b8d24aef` onto #9431's current head (or onto `main` after #9431 merges) so that the conflicts and the `PipelineJournal.cpp` asserts go away. 2. Re-run `agc_driver_graphics` and the listed depth, `gcn_detile` and `pattern_buffer_fill` tests on the rebased head, with the validation layer requested. Report the head SHA, the pass/skip counts and the `VUID-` comparison in the description.
MarcZX10 commented 2026-10-29 09:45:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:45:32Z.

Review: APPROVED


Re-checked — approved

The refreshed branch removes its duplicate #9431 changes and keeps the PR's HTILE fix isolated to the size helper, the focused assertion, and the debt entry. The current-main merge preview is clean; current main f7e84c4cf1609cc10bac95a44cd431805e5ebc8a has no intervening changes to those touched files since the reported integration base 66405c3250.

The author reports 40 focused depth, detile, pattern-fill and graphics tests passing on the updated head in two of three runs, with the other run's two native-depth tests timing out under a concurrent 16-job build and then passing three reruns. The validation layer loaded, and all runs reported zero VUIDs. The base comparison passed 40/40; the earlier negative control showed the PS4 HTILE regression on main. The author also reports conventions and git diff --check passing. I did not run a local build or GPU tests.

No blocking issue remains. Approval covers exact head 41c0489401b6ed32f01bcfa4d0f9a0e9052e9788.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695705152 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10435#pullrequestreview-5695705152). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:45:32Z. **Review:** APPROVED --- # Re-checked — approved The refreshed branch removes its duplicate #9431 changes and keeps the PR's HTILE fix isolated to the size helper, the focused assertion, and the debt entry. The current-main merge preview is clean; current `main` `f7e84c4cf1609cc10bac95a44cd431805e5ebc8a` has no intervening changes to those touched files since the reported integration base `66405c3250`. The author reports 40 focused depth, detile, pattern-fill and graphics tests passing on the updated head in two of three runs, with the other run's two native-depth tests timing out under a concurrent 16-job build and then passing three reruns. The validation layer loaded, and all runs reported zero VUIDs. The base comparison passed 40/40; the earlier negative control showed the PS4 HTILE regression on main. The author also reports conventions and `git diff --check` passing. I did not run a local build or GPU tests. No blocking issue remains. Approval covers exact head `41c0489401b6ed32f01bcfa4d0f9a0e9052e9788`.
XairRrR commented 2026-10-29 10:37:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T10:37:36Z.

Review: APPROVED


Re-checked — approved

The branch now carries only this PR's HTILE change, merged with current main, so the conflicts and the Linux build failure from my last review are gone. The change itself is line-for-line the commit I reviewed before, and it builds and passes the focused tests with the validation layer on.

What changed since my last review

  • Three merge commits from main (93667d0313, 41c0489401, b5b541e3fb). After #9431 landed, git diff origin/main...b5b541e3fb shows three files, +11/−3: HtileMetadataBytes in DepthSurface.cpp, the PS4 checks in tests/Graphics.cpp and one sentence in the HtileFillCovers debt entry. Its +/- lines match c8b8d24aef exactly. The only change is that it now also adds the RdnaInstructionDecoder.hpp include next to main's includes.
  • The author replied point by point (2026-10-29 09:44 UTC) and reported a 40-test validation-layer run on 41c0489401. Since then the head moved to b5b541e3fb, another merge from main. It changes nothing under Graphics/ or the GCN decoder compared with 41c0489401.
  • The description's Tested section and checklist now name the post-#9431 base.

What I ran

  • PR head: b5b541e3fbd8e4fbb675afde4200a97d7bb2fe9d
  • main: 8958e22ad924f64b726c561828093f3a295e27b8
  • Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release, Ninja, BUILD_TESTING=ON, in a clean worktree.
git fetch origin main pull/10435/head:refs/review/10435
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/10435          # clean
git diff --check origin/main...refs/review/10435
python3 tools/check_conventions.py --base origin/main
cmake -S . -B build
cmake --build build -j10 --target <the 28 test executables behind the regex below>
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 -V -j4 --output-on-failure \
  -R '^agc_driver_(graphics|gcn_detile|pattern_buffer_fill|depth_|native_multisample_depth|native_depth_|sample_mask_depth_stencil|stencil_replay)'

# Negative control: on the merged tree, restore only DepthSurface.cpp from origin/main
git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
cmake --build build -j10 --target agc_driver_graphics_tests
ctest --test-dir build --output-on-failure -R '^agc_driver_graphics$'   # same env vars

# Baseline: restore the test and debt files too (the tree is then main's), rebuild, same ctest command
git checkout origin/main -- core/libs/prx/libSceAgcDriver/tests/Graphics.cpp docs/dev/debt/libSceAgcDriver.md

Results

Check Result
Merge into main 8958e22ad9 clean
git diff --check clean
check_conventions.py --base origin/main All conventions checks passed
Build, Linux GCC 16 (libSceAgcDriver, including PipelineJournal.cpp, plus 28 test executables) OK
Merged tree: 41 focused tests, validation layer on 41/41 passed, 9.0 s total; slowest agc_driver_graphics_maps_fallback 5.6 s
main baseline: same 41 tests 41/41 passed
VUID- lines (change / main) 0 / 0
was not found but was requested by env var VK_INSTANCE_LAYERS absent in both logs; both carry adding layers "VK_LAYER_KHRONOS_validation"

The regex selects the author's 40 tests plus agc_driver_graphics_maps_fallback. native_multisample_depth and native_depth_clears took 1.6 s each here. The 30 s timeouts the author saw in their second run did not occur in this run.

Merged tree, ctest summary
100% tests passed out of 41
Total Test time (real) =   9.03 sec

Previous findings

  • Blocking 1, conflicts with main: Resolved. The merge into 8958e22ad9 is clean, and the branch no longer carries a copy of #9431.
  • Blocking 2, Linux build failure in PipelineJournal.cpp:38-39: Resolved. The merged tree compiles PipelineJournal.cpp and links all the test executables with GCC 16. The ShaderStages/State definitions are main's.
  • Non-blocking 1, the description lists three callers: Still open (minor). It still names three callers. The PS4 size also reaches the initial-state and HTILE write ranges in DepthSurface.cpp and MultisampleTarget.cpp:966. That last call sits behind a Z64KBX tile-mode check, so a GCN target is unlikely to reach it.
  • Non-blocking 2, process-wide SetGcnGuestShaders toggle in the test without a scoped guard (tests/Graphics.cpp:2483-2486): Still open (minor). It is unchanged and fine as long as Require fails fast.

New findings

Blocking

None.

Non-blocking

  1. The Tested section reports the 40-test run on 41c0489401. The head is now b5b541e3fb. I confirmed that the extra merge changes nothing under Graphics/ or the GCN decoder, and the run above covers the current head. Updating the SHA in the description would keep it accurate.

Negative control

On the merged tree I restored only Graphics/src/DepthSurface.cpp from origin/main and kept the new test. agc_driver_graphics then fails as it should:

1/1 Test #951: agc_driver_graphics ..............***Failed    0.04 sec
AGC graphics: a PS4 HTILE is 16 KiB per 512x512 block

Not verified

  • The Gang Beasts (CUSA04865) result. I did not launch any title.
  • Windows builds, and the timeouts the author saw under load on Windows.
  • A multisampled PS4 depth target. No test covers one.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696342085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10435#pullrequestreview-5696342085). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T10:37:36Z. **Review:** APPROVED --- # Re-checked — approved The branch now carries only this PR's HTILE change, merged with current `main`, so the conflicts and the Linux build failure from my last review are gone. The change itself is line-for-line the commit I reviewed before, and it builds and passes the focused tests with the validation layer on. ## What changed since my last review - Three merge commits from `main` (`93667d0313`, `41c0489401`, `b5b541e3fb`). After #9431 landed, `git diff origin/main...b5b541e3fb` shows three files, +11/−3: `HtileMetadataBytes` in `DepthSurface.cpp`, the PS4 checks in `tests/Graphics.cpp` and one sentence in the `HtileFillCovers` debt entry. Its `+`/`-` lines match `c8b8d24aef` exactly. The only change is that it now also adds the `RdnaInstructionDecoder.hpp` include next to `main`'s includes. - The author replied point by point (2026-10-29 09:44 UTC) and reported a 40-test validation-layer run on `41c0489401`. Since then the head moved to `b5b541e3fb`, another merge from `main`. It changes nothing under `Graphics/` or the GCN decoder compared with `41c0489401`. - The description's Tested section and checklist now name the post-#9431 base. ## What I ran - PR head: `b5b541e3fbd8e4fbb675afde4200a97d7bb2fe9d` - `main`: `8958e22ad924f64b726c561828093f3a295e27b8` - Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release, Ninja, `BUILD_TESTING=ON`, in a clean worktree. ```sh git fetch origin main pull/10435/head:refs/review/10435 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/10435 # clean git diff --check origin/main...refs/review/10435 python3 tools/check_conventions.py --base origin/main cmake -S . -B build cmake --build build -j10 --target <the 28 test executables behind the regex below> 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 -V -j4 --output-on-failure \ -R '^agc_driver_(graphics|gcn_detile|pattern_buffer_fill|depth_|native_multisample_depth|native_depth_|sample_mask_depth_stencil|stencil_replay)' # Negative control: on the merged tree, restore only DepthSurface.cpp from origin/main git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp cmake --build build -j10 --target agc_driver_graphics_tests ctest --test-dir build --output-on-failure -R '^agc_driver_graphics$' # same env vars # Baseline: restore the test and debt files too (the tree is then main's), rebuild, same ctest command git checkout origin/main -- core/libs/prx/libSceAgcDriver/tests/Graphics.cpp docs/dev/debt/libSceAgcDriver.md ``` ## Results | Check | Result | |---|---| | Merge into `main` `8958e22ad9` | clean | | `git diff --check` | clean | | `check_conventions.py --base origin/main` | All conventions checks passed | | Build, Linux GCC 16 (`libSceAgcDriver`, including `PipelineJournal.cpp`, plus 28 test executables) | OK | | Merged tree: 41 focused tests, validation layer on | 41/41 passed, 9.0 s total; slowest `agc_driver_graphics_maps_fallback` 5.6 s | | `main` baseline: same 41 tests | 41/41 passed | | `VUID-` lines (change / `main`) | 0 / 0 | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | absent in both logs; both carry `adding layers "VK_LAYER_KHRONOS_validation"` | The regex selects the author's 40 tests plus `agc_driver_graphics_maps_fallback`. `native_multisample_depth` and `native_depth_clears` took 1.6 s each here. The 30 s timeouts the author saw in their second run did not occur in this run. <details><summary>Merged tree, ctest summary</summary> ``` 100% tests passed out of 41 Total Test time (real) = 9.03 sec ``` </details> ## Previous findings - Blocking 1, conflicts with `main`: **Resolved.** The merge into `8958e22ad9` is clean, and the branch no longer carries a copy of #9431. - Blocking 2, Linux build failure in `PipelineJournal.cpp:38-39`: **Resolved.** The merged tree compiles `PipelineJournal.cpp` and links all the test executables with GCC 16. The `ShaderStages`/`State` definitions are `main`'s. - Non-blocking 1, the description lists three callers: **Still open** (minor). It still names three callers. The PS4 size also reaches the initial-state and HTILE write ranges in `DepthSurface.cpp` and `MultisampleTarget.cpp:966`. That last call sits behind a `Z64KBX` tile-mode check, so a GCN target is unlikely to reach it. - Non-blocking 2, process-wide `SetGcnGuestShaders` toggle in the test without a scoped guard ([tests/Graphics.cpp:2483-2486](https://github.com/boykopovar/AnyPS5/blob/b5b541e3fbd8e4fbb675afde4200a97d7bb2fe9d/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L2483-L2486)): **Still open** (minor). It is unchanged and fine as long as `Require` fails fast. ## New findings ### Blocking None. ### Non-blocking 1. The Tested section reports the 40-test run on `41c0489401`. The head is now `b5b541e3fb`. I confirmed that the extra merge changes nothing under `Graphics/` or the GCN decoder, and the run above covers the current head. Updating the SHA in the description would keep it accurate. ## Negative control On the merged tree I restored only `Graphics/src/DepthSurface.cpp` from `origin/main` and kept the new test. `agc_driver_graphics` then fails as it should: ``` 1/1 Test #951: agc_driver_graphics ..............***Failed 0.04 sec AGC graphics: a PS4 HTILE is 16 KiB per 512x512 block ``` ## Not verified - The Gang Beasts (CUSA04865) result. I did not launch any title. - Windows builds, and the timeouts the author saw under load on Windows. - A multisampled PS4 depth target. No test covers one.
MarcZX10 commented 2026-10-29 10:57:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T10:57:32Z.

Review: APPROVED


Re-reviewed current head b5b541e3fbd8e4fbb675afde4200a97d7bb2fe9d. Its only new commit merges current main bc3e33f4; the PR diff remains the same three-file HTILE sizing fix, focused assertion, and debt entry reviewed at 41c04894. The author’s 40-test Vulkan-validation comparison covers the rebased code and reports the layer loaded with zero VUIDs; the two timeouts were rerun successfully and the main baseline comparison passed. I checked the current-main merge preview, ran git diff --check and current-main conventions successfully. Main since bc3e33f4 has no changes to the three PR paths. I did not run local GPU tests; hosted Windows passes, and product Linux/specialized CI jobs are skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696592658 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10435#pullrequestreview-5696592658). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T10:57:32Z. **Review:** APPROVED --- Re-reviewed current head `b5b541e3fbd8e4fbb675afde4200a97d7bb2fe9d`. Its only new commit merges current `main` `bc3e33f4`; the PR diff remains the same three-file HTILE sizing fix, focused assertion, and debt entry reviewed at `41c04894`. The author’s 40-test Vulkan-validation comparison covers the rebased code and reports the layer loaded with zero VUIDs; the two timeouts were rerun successfully and the main baseline comparison passed. I checked the current-main merge preview, ran `git diff --check` and current-main conventions successfully. Main since `bc3e33f4` has no changes to the three PR paths. I did not run local GPU tests; hosted Windows passes, and product Linux/specialized CI jobs are skipped.
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!10435
No description provided.