fix(agc): count pending storage writes over a depth plane as a later writer #10854

Merged
milescoviello merged 2 commits from upstream-pr/10854 into main 2026-10-30 00:20:31 +00:00
milescoviello commented 2026-10-25 05:22:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-25T05:22:39Z.


What

Forspoken (PPSA03984) sometimes stops in its opening on:

AGC graphics: sampling the depth plane of depth surface 0xa22c040000 (1920x1080, vk format 130) as a 1920x1080 texture of guest format 22 (vk 100), tile mode 7, dimension 1, levels 0-4, slice 0 is not implemented (T# a22c0400 c1600000 010dc1df 91b40924 00000000 00700040 007b0000 00a22cc4)

It happened in 2 of the 19 runs I made today: one on main 52a8bed576, one on a branch that does not touch this code. Across the 196 Forspoken runs I have logs of, it happened 3 times. The T# describes a 5-level R32 float chain (MAX_MIP 4, SW_64KB_R_X) at the base of the title's single-level 1920x1080 D32 depth surface. The title builds that chain with compute passes, which write it as storage images (levels 0-0, 1-1 and so on), and then samples it whole. The depth plane cannot serve that view.

DepthSurfaceTexture follows a last-writer rule, pinned by agc_driver_depth_surface_last_writer. While the depth surface is the last writer of its memory, a view its plane cannot serve is refused. Once a later write lands in the plane, the surface is retired and the view is read from guest memory. Only writes the CPU can see counted, though. The chain passes are a later writer too, but their results stay pending in storage images until something flushes them. When the title sampled the chain before they were flushed, the surface still looked current, so the view was refused.

A diagnostic build logged the 5-level view 13 to 35 times per 250 s run. Each time, pending storage results overlapped the plane (the chain's 1-1 storage image at the base). In those runs they had already reached memory, so the surface was retired. The stop is the same sample taken before they reached memory.

How

  • DepthSurface::OverwrittenOnGpu(): whether a storage image with pending results overlaps the depth or stencil plane (StorageTexture::AnyPendingOverlaps).
  • DepthSurfaceTexture: the branch that retires the surface (storing what the plane holds that memory lacks) and leaves the view to guest memory now also takes a view the plane cannot serve when OverwrittenOnGpu() holds, as it does when the plane's memory was written. Every view the plane serves, and every refusal while nothing else writes the plane, is unchanged.

Tested

  • Rebased onto main 951f374c87 as c1db5c5b37, after #12207 changed the planes line in DepthSurfaceTexture (cube arrays). The resolution keeps #12207's line and this PR's OverwrittenOnGpu() condition, and git range-diff shows only that context change. On this head, the 45 tests matching depth|^agc_driver_graphics$|sampled_cache_budget$ pass 3 of 3. Khronos validation 1.4.363 over the same 45 passes 45 of 45 on main 951f374c87 and on this head, with 42 Vulkan devices created on each, no VUID- message and no layer-missing line.
  • Retire over drawn depth (bd0f124c89, test only, from XairRrR's review): a new case draws depth 0.5 that is only on the GPU, writes level 1 of the chain, then takes the view, which retires the surface, and flushes. Level 1 in guest memory matches a run without the depth write, and level 0 holds the drawn depth. agc_driver_depth_surface_from_storage and agc_driver_depth_surface_last_writer pass 3 of 3.

Linux: Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, NVIDIA 615.71.09, on main e7e3e9c198.

  • Red/green: agc_driver_depth_surface_from_storage gains PendingChainCase:

    • It writes level 1 of a two-level R32 float chain over a plane with a compute dispatch, and flushes it so the chain's storage image exists, as the title's does from frame to frame.
    • It then draws a D32 surface there, writes the chain again and leaves the result pending.
    • It requires a two-level view to be left to guest memory and the depth surface to be retired.

    With only the test on main (43ce466d69) it fails 3 of 3 with the title's message (sampling the depth plane of depth surface ... (64x32, vk format 126) as a 64x32 texture of guest format 22 (vk 100), tile mode 4, dimension 1, levels 0-1, slice 0 is not implemented). With this change it passes 3 of 3.

  • Focused tests: the 38 tests matching depth|^agc_driver_graphics$|sampled_cache_budget$ pass 3 of 3, including agc_driver_depth_surface_last_writer, agc_driver_depth_plane_sampling and agc_driver_depth_plane_guest_layers, which pin the refusals and the plane-served views.

  • Khronos validation 1.4.363 over the same 38, each arm run as VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R "$R" -V -j4: 38 of 38 pass on main e7e3e9c198 and on this head. Neither log has a layer-missing line or a VUID- message. Correction (10-27): not all of these tests put the layer to work. On current main the regex matches 39 tests, and 29 of them create a Vulkan device (counted from Physical device selected per test). The 10 that run on a test fixture's own device and never load the layer are agc_depth_copy_kept_bytes, agc_depth_range_remap, agc_driver_depth_bounds_emulation_draw, agc_driver_depth_bounds_state, agc_driver_depth_plane_guest_layers, agc_driver_depth_storage, agc_driver_depth_surface_last_writer, agc_driver_graphics, agc_driver_sampled_cache_budget and agc_driver_unused_viewport_depth, so the clean result doesn't cover those.

  • Windows 11 VM (GT 1030, driver 582.78, WinLibs GCC 15.2.0 r7), the same regex: 37 of the 38 pass 3 of 3 on the merge base e7e3e9c198 and on this head alike, including agc_driver_depth_surface_from_storage with the new case. The other one, agc_driver_depth_plane_partial_store, fails the same way on both (repeated lookups of the first layer of an unchanged array proved no refresh), so it is not caused by this change.

  • Forspoken: 4 runs of 250 s on this change plus a report line in both branches of the decision (not part of this PR), warm, 16G, pad input. All 4 ran to the timeout. The 5-level view was retired 1, 3, 3 and 6 times, always through the existing written-in-memory path, so the stop's race didn't come up in those runs. It is rare: 2 stops in today's 19 runs on code without this change. The case it fixes is the one the new test builds.

  • AMD, Linux (tablefrogpillow, RADV, Mesa 25.2.8): RX Vega 56 (GCN5), RX 7900 GRE (RDNA3) and the 7800X3D iGPU (RDNA2). agc_driver_depth_surface_from_storage passes on all three with the Khronos layer on. The 787 shader/AGC tests fail identically on this head and the merge base (4 pre-existing GCN5 float tests). With DepthSurface.cpp reverted and the new test kept, the test fails.

  • AMD, Windows (brummilab, RX 6600 XT, driver 32.0.21045.16010, WinLibs GCC 15.2.0 r7): the same 38 under the Khronos layer, 37 of 38 on main e05ba6fee and on the merge with this head, 0 VUID- messages on either. The one failure on both is agc_driver_depth_plane_partial_store (#10664).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA03984 #12711 (Forspoken's intermittent stop on a sampled mip chain over its depth surface)
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04.1; NVIDIA GeForce GT 1030, driver 582.78, Windows 11 VM; AMD RX Vega 56, RX 7900 GRE and Raphael iGPU (RADV, by tablefrogpillow); AMD RX 6600 XT, Windows 11 (by brummilab)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5002082068 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10854). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-25T05:22:39Z. --- ### What Forspoken (PPSA03984) sometimes stops in its opening on: ``` AGC graphics: sampling the depth plane of depth surface 0xa22c040000 (1920x1080, vk format 130) as a 1920x1080 texture of guest format 22 (vk 100), tile mode 7, dimension 1, levels 0-4, slice 0 is not implemented (T# a22c0400 c1600000 010dc1df 91b40924 00000000 00700040 007b0000 00a22cc4) ``` It happened in 2 of the 19 runs I made today: one on `main` 52a8bed576, one on a branch that does not touch this code. Across the 196 Forspoken runs I have logs of, it happened 3 times. The T# describes a 5-level R32 float chain (`MAX_MIP` 4, `SW_64KB_R_X`) at the base of the title's single-level 1920x1080 D32 depth surface. The title builds that chain with compute passes, which write it as storage images (levels `0-0`, `1-1` and so on), and then samples it whole. The depth plane cannot serve that view. `DepthSurfaceTexture` follows a last-writer rule, pinned by `agc_driver_depth_surface_last_writer`. While the depth surface is the last writer of its memory, a view its plane cannot serve is refused. Once a later write lands in the plane, the surface is retired and the view is read from guest memory. Only writes the CPU can see counted, though. The chain passes are a later writer too, but their results stay pending in storage images until something flushes them. When the title sampled the chain before they were flushed, the surface still looked current, so the view was refused. A diagnostic build logged the 5-level view 13 to 35 times per 250 s run. Each time, pending storage results overlapped the plane (the chain's `1-1` storage image at the base). In those runs they had already reached memory, so the surface was retired. The stop is the same sample taken before they reached memory. ### How - `DepthSurface::OverwrittenOnGpu()`: whether a storage image with pending results overlaps the depth or stencil plane (`StorageTexture::AnyPendingOverlaps`). - `DepthSurfaceTexture`: the branch that retires the surface (storing what the plane holds that memory lacks) and leaves the view to guest memory now also takes a view the plane cannot serve when `OverwrittenOnGpu()` holds, as it does when the plane's memory was written. Every view the plane serves, and every refusal while nothing else writes the plane, is unchanged. ### Tested - **Rebased** onto `main` `951f374c87` as `c1db5c5b37`, after #12207 changed the `planes` line in `DepthSurfaceTexture` (cube arrays). The resolution keeps #12207's line and this PR's `OverwrittenOnGpu()` condition, and `git range-diff` shows only that context change. On this head, the 45 tests matching `depth|^agc_driver_graphics$|sampled_cache_budget$` pass 3 of 3. Khronos validation 1.4.363 over the same 45 passes 45 of 45 on `main` `951f374c87` and on this head, with 42 Vulkan devices created on each, no `VUID-` message and no layer-missing line. - **Retire over drawn depth (`bd0f124c89`, test only, from XairRrR's review):** a new case draws depth 0.5 that is only on the GPU, writes level 1 of the chain, then takes the view, which retires the surface, and flushes. Level 1 in guest memory matches a run without the depth write, and level 0 holds the drawn depth. `agc_driver_depth_surface_from_storage` and `agc_driver_depth_surface_last_writer` pass 3 of 3. Linux: Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, NVIDIA 615.71.09, on `main` e7e3e9c198. - **Red/green:** `agc_driver_depth_surface_from_storage` gains `PendingChainCase`: - It writes level 1 of a two-level R32 float chain over a plane with a compute dispatch, and flushes it so the chain's storage image exists, as the title's does from frame to frame. - It then draws a D32 surface there, writes the chain again and leaves the result pending. - It requires a two-level view to be left to guest memory and the depth surface to be retired. With only the test on `main` (`43ce466d69`) it fails 3 of 3 with the title's message (`sampling the depth plane of depth surface ... (64x32, vk format 126) as a 64x32 texture of guest format 22 (vk 100), tile mode 4, dimension 1, levels 0-1, slice 0 is not implemented`). With this change it passes 3 of 3. - **Focused tests:** the 38 tests matching `depth|^agc_driver_graphics$|sampled_cache_budget$` pass 3 of 3, including `agc_driver_depth_surface_last_writer`, `agc_driver_depth_plane_sampling` and `agc_driver_depth_plane_guest_layers`, which pin the refusals and the plane-served views. - **Khronos validation** 1.4.363 over the same 38, each arm run as `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R "$R" -V -j4`: 38 of 38 pass on `main` e7e3e9c198 and on this head. Neither log has a layer-missing line or a `VUID-` message. Correction (10-27): not all of these tests put the layer to work. On current `main` the regex matches 39 tests, and 29 of them create a Vulkan device (counted from `Physical device selected` per test). The 10 that run on a test fixture's own device and never load the layer are `agc_depth_copy_kept_bytes`, `agc_depth_range_remap`, `agc_driver_depth_bounds_emulation_draw`, `agc_driver_depth_bounds_state`, `agc_driver_depth_plane_guest_layers`, `agc_driver_depth_storage`, `agc_driver_depth_surface_last_writer`, `agc_driver_graphics`, `agc_driver_sampled_cache_budget` and `agc_driver_unused_viewport_depth`, so the clean result doesn't cover those. - **Windows 11 VM** (GT 1030, driver 582.78, WinLibs GCC 15.2.0 r7), the same regex: 37 of the 38 pass 3 of 3 on the merge base `e7e3e9c198` and on this head alike, including `agc_driver_depth_surface_from_storage` with the new case. The other one, `agc_driver_depth_plane_partial_store`, fails the same way on both (`repeated lookups of the first layer of an unchanged array proved no refresh`), so it is not caused by this change. - **Forspoken:** 4 runs of 250 s on this change plus a report line in both branches of the decision (not part of this PR), warm, 16G, pad input. All 4 ran to the timeout. The 5-level view was retired 1, 3, 3 and 6 times, always through the existing written-in-memory path, so the stop's race didn't come up in those runs. It is rare: 2 stops in today's 19 runs on code without this change. The case it fixes is the one the new test builds. - **AMD, Linux** ([tablefrogpillow](https://github.com/boykopovar/AnyPS5/pull/10854#issuecomment-6397316036), RADV, Mesa 25.2.8): RX Vega 56 (GCN5), RX 7900 GRE (RDNA3) and the 7800X3D iGPU (RDNA2). `agc_driver_depth_surface_from_storage` passes on all three with the Khronos layer on. The 787 shader/AGC tests fail identically on this head and the merge base (4 pre-existing GCN5 float tests). With `DepthSurface.cpp` reverted and the new test kept, the test fails. - **AMD, Windows** ([brummilab](https://github.com/boykopovar/AnyPS5/pull/10854#issuecomment-6399904520), RX 6600 XT, driver 32.0.21045.16010, WinLibs GCC 15.2.0 r7): the same 38 under the Khronos layer, 37 of 38 on `main` `e05ba6fee` and on the merge with this head, 0 `VUID-` messages on either. The one failure on both is `agc_driver_depth_plane_partial_store` (#10664). ### 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: none - [x] Fixes: none - [x] Unblocks: PPSA03984 #12711 (Forspoken's intermittent stop on a sampled mip chain over its depth surface) - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04.1; NVIDIA GeForce GT 1030, driver 582.78, Windows 11 VM; AMD RX Vega 56, RX 7900 GRE and Raphael iGPU (RADV, by tablefrogpillow); AMD RX 6600 XT, Windows 11 (by brummilab) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 05:34:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T05:34:09Z.

Review: APPROVED


Reviewed exact head bddb3093f6c32ef193cb01a17127f51c23506977 against current main e7e3e9c. The new predicate queries pending and currently-flushing storage textures against both depth and optional stencil address ranges; it only participates when the cached depth plane cannot serve the requested view, preserving the existing supported-view path. On a later overlapping GPU write, the existing stale-plane retirement/store path runs before refusing the depth-plane import, allowing the texture path to use guest memory. The new regression writes and flushes a mip-chain storage image, draws a depth surface over that memory, leaves another level write pending, then verifies the incompatible multi-level view is not served by the stale depth surface and that the surface retires. The PR reports focused Linux/Vulkan-validation and Windows tests, plus a stated baseline-identical Windows failure; these are author-reported. I independently ran the conventions checker and diff whitespace check on this exact head; both pass. GitHub conventions/intake/labels/eligibility/report pass; product jobs are skipped. I found no blocking issue in this focused change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641727215 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10854#pullrequestreview-5641727215). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T05:34:09Z. **Review:** APPROVED --- Reviewed exact head bddb3093f6c32ef193cb01a17127f51c23506977 against current main e7e3e9c. The new predicate queries pending and currently-flushing storage textures against both depth and optional stencil address ranges; it only participates when the cached depth plane cannot serve the requested view, preserving the existing supported-view path. On a later overlapping GPU write, the existing stale-plane retirement/store path runs before refusing the depth-plane import, allowing the texture path to use guest memory. The new regression writes and flushes a mip-chain storage image, draws a depth surface over that memory, leaves another level write pending, then verifies the incompatible multi-level view is not served by the stale depth surface and that the surface retires. The PR reports focused Linux/Vulkan-validation and Windows tests, plus a stated baseline-identical Windows failure; these are author-reported. I independently ran the conventions checker and diff whitespace check on this exact head; both pass. GitHub conventions/intake/labels/eligibility/report pass; product jobs are skipped. I found no blocking issue in this focused change.
XairRrR commented 2026-10-29 04:14:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T04:14:26Z.

Review: APPROVED


Reviewed — approved

The change merges cleanly onto current main, the focused depth tests pass under the Khronos layer with no new VUID- messages, and reverting DepthSurface.cpp makes the new PendingChainCase fail with the title's message; one non-blocking gap in test coverage is noted below.

What I ran

  • PR head: bddb3093f6c32ef193cb01a17127f51c23506977
  • main: b433c40f2f46aa2e59e19806010a839ac8572d64 (merge base of the PR: e7e3e9c1984c293f06bff08428b8c89b7b932ac2)
  • Merged tree: main + PR head with --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/10854/head:refs/review/10854
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/10854
git diff --check origin/main...refs/review/10854
python3 tools/check_conventions.py --base origin/main

T="agc_driver_depth_surface_from_storage_tests agc_driver_depth_surface_last_writer_tests agc_driver_depth_plane_sampling_tests agc_driver_depth_plane_guest_layers_tests agc_driver_depth_storage_tests agc_driver_depth_storage_dispatch_tests agc_driver_depth_storage_reuse_tests agc_driver_depth_plane_partial_store_tests agc_driver_depth_plane_fill_tests agc_driver_depth_plane_buffer_memory_tests agc_driver_depth_bits_guest_memory_tests agc_driver_depth_fast_clear_tests agc_driver_graphics_tests agc_driver_sampled_cache_budget_tests"
cmake --build build -j10 --target $T

R='^agc_driver_(depth_surface_from_storage|depth_surface_last_writer|depth_plane_sampling|depth_plane_guest_layers|depth_storage|depth_storage_dispatch|depth_storage_reuse|depth_plane_partial_store|depth_plane_fill|depth_plane_buffer_memory|depth_bits_guest_memory|depth_fast_clear|graphics|sampled_cache_budget)$'
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 -R "$R" -V -j4 --output-on-failure --timeout 120
# same build + ctest on origin/main in the same worktree

# negative control
git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
cmake --build build -j10 --target agc_driver_depth_surface_from_storage_tests
ANYPS5_REQUIRE_VULKAN=1 build/tests/agc_driver_depth_surface_from_storage_tests   # 3 runs

# probe (temporary, not part of the PR): snapshot of the plane after the chain's first flush,
# compared with the plane after the retire and a final FlushPending; also with the plane refilled
# with 0.25 before the depth draw, and with APS5_TRACE_FLUSH=1

Results

Check Result
Merge onto main Clean (auto-merge of DepthSurface.cpp)
git diff --check Clean
tools/check_conventions.py --base origin/main All conventions checks passed.
Build of the 14 focused test targets, merged tree and main OK
Focused tests, merged tree, Khronos layer 14/14 passed
Focused tests, main, Khronos layer 14/14 passed
VUID- lines, merged tree / main 0 / 0
was not found but was requested by env var VK_INSTANCE_LAYERS Absent from both logs
Tests where the loader inserted VK_LAYER_KHRONOS_validation 13 of 14 on both sides (not agc_driver_graphics)
agc_driver_depth_surface_from_storage run time 0.69 s
Negative control (production file reverted) Fails 3 of 3
Probe: chain level-1 texels after retire + flush 32 of 32 unchanged, with and without the refill
Checklist lines (Depends on, Fixes, Unblocks, GPUs tested, AI-assisted) All present; Unblocks names discussion #12711, the Forspoken bring-up for this stop
Merged tree, ctest excerpt
10/14 Test #1015: agc_driver_depth_surface_from_storage ...   Passed    0.69 sec
12/14 Test #1016: agc_driver_depth_surface_last_writer ....   Passed    0.27 sec
13/14 Test #1373: agc_driver_sampled_cache_budget .........   Passed    1.54 sec
14/14 Test  #948: agc_driver_graphics .....................   Passed    5.54 sec
100% tests passed out of 14
Probe output, merged tree
PROBE level-1 texels written by the chain: 32, changed after retire+flush: 0
depth surface from storage tests passed

With APS5_TRACE_FLUSH=1, the last flushes for plane 8 are:

[flush] image 0x7fcc57fe0000+0x10000 for test 0x7fcc57fe0000+0x10000
[flush] image 0x7fcc57fe0000+0x10000 for probe 0x7fcc57fe0000+0x10000

No depth plane store flush appears, so the retire in PendingChainCase stores nothing from the depth plane.

Negative control

I restored only core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp from main and kept the PR's test. agc_driver_depth_surface_from_storage failed in 3 of 3 runs:

Failure
AGC graphics: a two-level view of a depth plane that a pending storage write covers was refused: AGC graphics: sampling the depth plane of depth surface 0x7f14e8190000 (64x32, vk format 126) as a 64x32 texture of guest format 22 (vk 100), tile mode 4, dimension 1, levels 0-1, slice 0 is not implemented (T# ...)

This is the failure the description gives for main. It matches tablefrogpillow's revert check on RADV.

Findings

Blocking

None.

Non-blocking

  1. The new case does not cover a retire that stores stale depth units under pending results. The new condition at DepthSurface.cpp:2385 sends a surface to retireStoringStale when results are pending on the GPU. That function was written for the memory-written case. At DepthSurface.cpp:1826-1832, it leaves out only the units that WrittenUnits reports as written in guest memory. Results still pending in a storage image are not in memory yet, so their units stay in units, and StoreDepthPlane stores the older depth contents for them. The FlushPending at DepthSurface.cpp:1836 then writes back both the chain image and the mirror. It collects them in pending-list order (Texture.cpp:4229-4249) and stores them in that order (Texture.cpp:4298-4305). The mirror joins that list during the retire, after the chain image, so where their texels overlap, the older depth data would be written last.

    I could not show this going wrong. In PendingChainCase the surface has no stale units at the retire: the trace shows no depth plane store flush, and the chain's 32 level-1 texels are intact afterwards. The case therefore pins the refusal and the retire, but not what guest memory holds after a retire whose surface has unstored depth.

    Suggested follow-up: add a case where the drawn depth is still only on the GPU when the view is taken, then check the chain texels in guest memory after the flush. If they are lost, leave out the units that StorageTexture::AnyPendingOverlaps reports, or store the plane before the pending images are written back. This is the title's situation if the chain is built while its depth is unstored, so it is worth confirming before relying on the retired view's contents.

Not verified

  • The Forspoken stop and the run counts in the description: I did not launch the title.
  • Whether the ordering in finding 1 occurs with the title's 1920x1080 SW_64KB_R_X layout, where the chain's levels lie inside the depth plane's bytes.
  • agc_driver_graphics did not load the validation layer on either side, so its clean VUID- result does not cover it.
  • I did not run the full test suite. I did not run the other tests matching the description's depth|... regex (for example the multisample, native-depth and depth-bounds ones) or any AMD or Windows configuration.
  • The overlap with PR 12207 flagged by the pr-overlap bot: this PR merges cleanly with current main, but I did not check the two PRs against each other.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692780097 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10854#pullrequestreview-5692780097). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T04:14:26Z. **Review:** APPROVED --- # Reviewed — approved The change merges cleanly onto current `main`, the focused depth tests pass under the Khronos layer with no new `VUID-` messages, and reverting `DepthSurface.cpp` makes the new `PendingChainCase` fail with the title's message; one non-blocking gap in test coverage is noted below. ## What I ran - PR head: `bddb3093f6c32ef193cb01a17127f51c23506977` - `main`: `b433c40f2f46aa2e59e19806010a839ac8572d64` (merge base of the PR: `e7e3e9c1984c293f06bff08428b8c89b7b932ac2`) - Merged tree: `main` + PR head with `--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/10854/head:refs/review/10854 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/10854 git diff --check origin/main...refs/review/10854 python3 tools/check_conventions.py --base origin/main T="agc_driver_depth_surface_from_storage_tests agc_driver_depth_surface_last_writer_tests agc_driver_depth_plane_sampling_tests agc_driver_depth_plane_guest_layers_tests agc_driver_depth_storage_tests agc_driver_depth_storage_dispatch_tests agc_driver_depth_storage_reuse_tests agc_driver_depth_plane_partial_store_tests agc_driver_depth_plane_fill_tests agc_driver_depth_plane_buffer_memory_tests agc_driver_depth_bits_guest_memory_tests agc_driver_depth_fast_clear_tests agc_driver_graphics_tests agc_driver_sampled_cache_budget_tests" cmake --build build -j10 --target $T R='^agc_driver_(depth_surface_from_storage|depth_surface_last_writer|depth_plane_sampling|depth_plane_guest_layers|depth_storage|depth_storage_dispatch|depth_storage_reuse|depth_plane_partial_store|depth_plane_fill|depth_plane_buffer_memory|depth_bits_guest_memory|depth_fast_clear|graphics|sampled_cache_budget)$' 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 -R "$R" -V -j4 --output-on-failure --timeout 120 # same build + ctest on origin/main in the same worktree # negative control git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp cmake --build build -j10 --target agc_driver_depth_surface_from_storage_tests ANYPS5_REQUIRE_VULKAN=1 build/tests/agc_driver_depth_surface_from_storage_tests # 3 runs # probe (temporary, not part of the PR): snapshot of the plane after the chain's first flush, # compared with the plane after the retire and a final FlushPending; also with the plane refilled # with 0.25 before the depth draw, and with APS5_TRACE_FLUSH=1 ``` ## Results | Check | Result | |---|---| | Merge onto `main` | Clean (auto-merge of `DepthSurface.cpp`) | | `git diff --check` | Clean | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build of the 14 focused test targets, merged tree and `main` | OK | | Focused tests, merged tree, Khronos layer | 14/14 passed | | Focused tests, `main`, Khronos layer | 14/14 passed | | `VUID-` lines, merged tree / `main` | 0 / 0 | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | Absent from both logs | | Tests where the loader inserted `VK_LAYER_KHRONOS_validation` | 13 of 14 on both sides (not `agc_driver_graphics`) | | `agc_driver_depth_surface_from_storage` run time | 0.69 s | | Negative control (production file reverted) | Fails 3 of 3 | | Probe: chain level-1 texels after retire + flush | 32 of 32 unchanged, with and without the refill | | Checklist lines (Depends on, Fixes, Unblocks, GPUs tested, AI-assisted) | All present; Unblocks names discussion #12711, the Forspoken bring-up for this stop | <details><summary>Merged tree, ctest excerpt</summary> ``` 10/14 Test #1015: agc_driver_depth_surface_from_storage ... Passed 0.69 sec 12/14 Test #1016: agc_driver_depth_surface_last_writer .... Passed 0.27 sec 13/14 Test #1373: agc_driver_sampled_cache_budget ......... Passed 1.54 sec 14/14 Test #948: agc_driver_graphics ..................... Passed 5.54 sec 100% tests passed out of 14 ``` </details> <details><summary>Probe output, merged tree</summary> ``` PROBE level-1 texels written by the chain: 32, changed after retire+flush: 0 depth surface from storage tests passed ``` With `APS5_TRACE_FLUSH=1`, the last flushes for plane 8 are: ``` [flush] image 0x7fcc57fe0000+0x10000 for test 0x7fcc57fe0000+0x10000 [flush] image 0x7fcc57fe0000+0x10000 for probe 0x7fcc57fe0000+0x10000 ``` No `depth plane store` flush appears, so the retire in `PendingChainCase` stores nothing from the depth plane. </details> ## Negative control I restored only `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` from `main` and kept the PR's test. `agc_driver_depth_surface_from_storage` failed in 3 of 3 runs: <details><summary>Failure</summary> ``` AGC graphics: a two-level view of a depth plane that a pending storage write covers was refused: AGC graphics: sampling the depth plane of depth surface 0x7f14e8190000 (64x32, vk format 126) as a 64x32 texture of guest format 22 (vk 100), tile mode 4, dimension 1, levels 0-1, slice 0 is not implemented (T# ...) ``` </details> This is the failure the description gives for `main`. It matches tablefrogpillow's revert check on RADV. ## Findings ### Blocking None. ### Non-blocking 1. **The new case does not cover a retire that stores stale depth units under pending results.** The new condition at [`DepthSurface.cpp:2385`](https://github.com/boykopovar/AnyPS5/blob/bddb3093f6c32ef193cb01a17127f51c23506977/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L2385-L2385) sends a surface to `retireStoringStale` when results are pending on the GPU. That function was written for the memory-written case. At [`DepthSurface.cpp:1826-1832`](https://github.com/boykopovar/AnyPS5/blob/bddb3093f6c32ef193cb01a17127f51c23506977/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1826-L1832), it leaves out only the units that `WrittenUnits` reports as written in guest memory. Results still pending in a storage image are not in memory yet, so their units stay in `units`, and `StoreDepthPlane` stores the older depth contents for them. The `FlushPending` at [`DepthSurface.cpp:1836`](https://github.com/boykopovar/AnyPS5/blob/bddb3093f6c32ef193cb01a17127f51c23506977/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1836-L1836) then writes back both the chain image and the mirror. It collects them in pending-list order ([`Texture.cpp:4229-4249`](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L4229-L4249)) and stores them in that order ([`Texture.cpp:4298-4305`](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L4298-L4305)). The mirror joins that list during the retire, after the chain image, so where their texels overlap, the older depth data would be written last. I could not show this going wrong. In `PendingChainCase` the surface has no stale units at the retire: the trace shows no `depth plane store` flush, and the chain's 32 level-1 texels are intact afterwards. The case therefore pins the refusal and the retire, but not what guest memory holds after a retire whose surface has unstored depth. Suggested follow-up: add a case where the drawn depth is still only on the GPU when the view is taken, then check the chain texels in guest memory after the flush. If they are lost, leave out the units that `StorageTexture::AnyPendingOverlaps` reports, or store the plane before the pending images are written back. This is the title's situation if the chain is built while its depth is unstored, so it is worth confirming before relying on the retired view's contents. ## Not verified - The Forspoken stop and the run counts in the description: I did not launch the title. - Whether the ordering in finding 1 occurs with the title's 1920x1080 `SW_64KB_R_X` layout, where the chain's levels lie inside the depth plane's bytes. - `agc_driver_graphics` did not load the validation layer on either side, so its clean `VUID-` result does not cover it. - I did not run the full test suite. I did not run the other tests matching the description's `depth|...` regex (for example the multisample, native-depth and depth-bounds ones) or any AMD or Windows configuration. - The overlap with PR 12207 flagged by the pr-overlap bot: this PR merges cleanly with current `main`, but I did not check the two PRs against each other.
XairRrR commented 2026-10-29 05:37:28 +00:00 (Migrated from github.com)

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

Review: APPROVED


Re-checked — approved

The only new commit, bd0f124c89, adds the test-only RetireStoresDepthCase in answer to my earlier non-blocking finding. The production change is unchanged and still merges, builds and passes under the Khronos layer on current main. The new case does not check what its description says, though; details are under New findings (non-blocking).

What changed since my last review

  • One commit, bd0f124c89 (test(agc): a retire that stores depth drawn on the GPU keeps the pending chain over it). It touches only tests/execution/DepthSurfaceFromStorage.cpp: it adds RetireOverPendingChain / RetireStoresDepthCase and grows the test block from 9 to 11 planes.
  • The description's Tested section gained a "Retire over drawn depth" line, and the author replied to my finding (comment).

What I ran

  • PR head: bd0f124c890381d21433494e3c7837a5534cc089 (previously reviewed: bddb3093f6c32ef193cb01a17127f51c23506977)
  • main: 52c09d567d2fa453494dd720fcf53a98149468e4
  • Merged tree: main + PR head with --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/10854/head:refs/review/10854
git diff bddb3093f6c32ef193cb01a17127f51c23506977 refs/review/10854
git checkout --detach origin/main && git merge --no-ff --no-edit refs/review/10854
git diff --check origin/main...refs/review/10854
python3 tools/check_conventions.py --base origin/main

# same 14 focused targets and regex as in my previous review
cmake --build build -j10 --target $T
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 -R "$R" -V -j4 --output-on-failure --timeout 120
# same build + ctest on origin/main in the same worktree

APS5_TRACE_FLUSH=1 ANYPS5_REQUIRE_VULKAN=1 build/tests/agc_driver_depth_surface_from_storage_tests

# probes (temporary, reverted afterwards):
#  a) fprintf at the top of retireStoringStale: AnyStale(), mirrorable(); stale/written unit counts
#  b) in RetireStoresDepthCase: count of level-1 texels that differ from the control, level-0 texels at 0.5, disjoint
#  c) (a)+(b) again with the drawn surface's swizzle set to 24 (SW_64KB_Z_X, the T#'s tile mode)

# negative control
git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
#   with PendingChainCase disabled so that only the new case runs; 3 runs

Results

Check Result
Merge onto main Clean (auto-merge of DepthSurface.cpp)
git diff --check Clean
tools/check_conventions.py --base origin/main All conventions checks passed.
Focused tests, merged tree, Khronos layer 14/14 passed
Focused tests, main, Khronos layer 14/14 passed
VUID- lines, merged tree / main 0 / 0
was not found but was requested by env var VK_INSTANCE_LAYERS Absent from both logs
Tests where the loader inserted the layer 13 of 14 on both sides (not agc_driver_graphics)
agc_driver_depth_surface_from_storage run time 0.75 s
Negative control, new case alone Fails 3 of 3
Probe (a), PR's test as written Drawn surface: anyStale=0 mirrorable=0 at the retire
Probe (b), PR's test as written level1 texels 16384 differ 0; level0 texels 16384 at 0.5 0; disjoint 0
Probe (c), swizzle 24 anyStale=0 mirrorable=1 at the retire; a depth plane store flush runs before it; 2048 level-1 texels differ (0.25 → 0.5), the new case fails
Probe (c) output (swizzle 24), drawn plane, two runs

Run with probe (a) and APS5_TRACE_FLUSH=1:

[flush] image 0x7f1214330000+0x10000 for test 0x7f1214330000+0x10000
[flush] image 0x7f1214330000+0x10000 for depth plane store 0x7f1214330000+0x10000
PROBE retire 0x7f1214330000 anyStale=0 mirrorable=1
[flush] image 0x7f1214330000+0x10000 for test 0x7f1214330000+0x10000
AGC graphics: a retire that stored depth drawn only on the GPU changed level 1 of the chain a pending storage write produced

Run with probe (b):

PROBE texel 0 kept 0.25 stored 0.5
PROBE level1 texels 16384 differ 2048; level0 texels 16384 at 0.5 2048; disjoint 0
AGC graphics: a retire that stored depth drawn only on the GPU changed level 1 of the chain a pending storage write produced

Negative control

I restored only core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp from main. With PendingChainCase in place the binary stops there first, so I also disabled that call for this run. RetireStoresDepthCase then failed 3 of 3, at DepthSurfaceTexture:

AGC graphics: sampling the depth plane of depth surface 0x7f1e88120000 (64x32, vk format 126) as a 64x32 texture of guest format 22 (vk 100), tile mode 4, dimension 1, levels 0-1, slice 0 is not implemented

So the new case needs the fix, but it fails on the same refusal PendingChainCase already pins, before reaching its own guest-memory checks.

Previous findings

  1. Retire storing stale depth over pending results (non-blocking): no longer applies in the sequences I could build, but the new test does not show it. With the T#'s layout (swizzle 24), the drawn depth is stored by FlushDepthPlanes (DepthSurface.cpp:2078, flush reason depth plane store at L2136) before retireStoringStale is entered. At the retire, AnyStale() is false, so the ordering I described cannot arise. The chain row and the drawn 64x32 depth were both in guest memory afterwards. In the PR's own configuration the path is never reached at all (see New findings 1), so this conclusion comes from my probe, not from the committed test.

New findings

Blocking

None.

Non-blocking

  1. RetireStoresDepthCase passes without checking the drawn depth, and does not reach the store path it is named after. The description says "Level 1 in guest memory matches a run without the depth write, and level 0 holds the drawn depth". On this tree, neither half holds:

    • The drawn surface comes from Plane() (DepthSurfaceFromStorage.cpp:152-153), which leaves the harness swizzle at its default 0 (DepthFastClearHarness.hpp:44). mirrorable() requires SW_64KB_Z_X (DepthSurface.cpp:1778-1779), so retireStoringStale takes its plain retire branch (L1818-L1819). Probe (b) shows that none of the 16384 texels of the plane hold 0.5 after the flush, so the drawn depth never reaches guest memory in this case.
    • For this 64x32, 2-level, tile-mode-24 T#, DescribeSurface gives both levels the same 64 KiB range (disjoint 0 in probe (b)). The level-0 check is skipped by if (!stored.disjoint) return; (L234). The "level 1" comparison at L233 compares the whole plane. It is equal only because no depth was written in either run.
    • With the layout the T# actually uses (swizzle 24), the depth is stored and the chain row survives, but the case then fails. The 2048 texels of the drawn depth differ from the control (0.25 → 0.5) inside the whole-plane "level 1" range. This is the expected result, not a driver bug.

    Why it matters: the case adds a guest-memory claim to the Tested section that the test does not check, and a future regression in that path would not fail it. Suggested fix: draw with swizzle = 24 so the surface is mirrorable and matches the T#. Compare only the texels the chain dispatch writes (the row StoreRow stores at level 1), and check the drawn texels for 0.5, instead of relying on tiledOffset/tiledSize ranges that overlap here. Also drop the silent return when the ranges overlap, so the depth check always runs. Then correct the Tested line to match.

Not verified

  • Which caller triggers the FlushDepthPlanes store before the retire in probe (c). I saw it in the flush trace before retireStoringStale, and did not trace the call stack.
  • Whether some other sequence, not a compute storage write, can leave stale depth units under a pending storage image at the retire.
  • The Forspoken stop, and the AMD and Windows results in the description (author- and tester-reported). I did not launch the title.
  • agc_driver_graphics did not load the validation layer on either side. I did not run the full suite or the other tests matching the description's regex.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693327247 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10854#pullrequestreview-5693327247). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T05:37:28Z. **Review:** APPROVED --- # Re-checked — approved The only new commit, `bd0f124c89`, adds the test-only `RetireStoresDepthCase` in answer to my earlier non-blocking finding. The production change is unchanged and still merges, builds and passes under the Khronos layer on current `main`. The new case does not check what its description says, though; details are under New findings (non-blocking). ## What changed since my last review - One commit, `bd0f124c89` (`test(agc): a retire that stores depth drawn on the GPU keeps the pending chain over it`). It touches only `tests/execution/DepthSurfaceFromStorage.cpp`: it adds `RetireOverPendingChain` / `RetireStoresDepthCase` and grows the test block from 9 to 11 planes. - The description's Tested section gained a "Retire over drawn depth" line, and the author replied to my finding ([comment](https://github.com/boykopovar/AnyPS5/pull/10854#issuecomment-6488702219)). ## What I ran - PR head: `bd0f124c890381d21433494e3c7837a5534cc089` (previously reviewed: `bddb3093f6c32ef193cb01a17127f51c23506977`) - `main`: `52c09d567d2fa453494dd720fcf53a98149468e4` - Merged tree: `main` + PR head with `--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/10854/head:refs/review/10854 git diff bddb3093f6c32ef193cb01a17127f51c23506977 refs/review/10854 git checkout --detach origin/main && git merge --no-ff --no-edit refs/review/10854 git diff --check origin/main...refs/review/10854 python3 tools/check_conventions.py --base origin/main # same 14 focused targets and regex as in my previous review cmake --build build -j10 --target $T 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 -R "$R" -V -j4 --output-on-failure --timeout 120 # same build + ctest on origin/main in the same worktree APS5_TRACE_FLUSH=1 ANYPS5_REQUIRE_VULKAN=1 build/tests/agc_driver_depth_surface_from_storage_tests # probes (temporary, reverted afterwards): # a) fprintf at the top of retireStoringStale: AnyStale(), mirrorable(); stale/written unit counts # b) in RetireStoresDepthCase: count of level-1 texels that differ from the control, level-0 texels at 0.5, disjoint # c) (a)+(b) again with the drawn surface's swizzle set to 24 (SW_64KB_Z_X, the T#'s tile mode) # negative control git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp # with PendingChainCase disabled so that only the new case runs; 3 runs ``` ## Results | Check | Result | |---|---| | Merge onto `main` | Clean (auto-merge of `DepthSurface.cpp`) | | `git diff --check` | Clean | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Focused tests, merged tree, Khronos layer | 14/14 passed | | Focused tests, `main`, Khronos layer | 14/14 passed | | `VUID-` lines, merged tree / `main` | 0 / 0 | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | Absent from both logs | | Tests where the loader inserted the layer | 13 of 14 on both sides (not `agc_driver_graphics`) | | `agc_driver_depth_surface_from_storage` run time | 0.75 s | | Negative control, new case alone | Fails 3 of 3 | | Probe (a), PR's test as written | Drawn surface: `anyStale=0 mirrorable=0` at the retire | | Probe (b), PR's test as written | `level1 texels 16384 differ 0; level0 texels 16384 at 0.5 0; disjoint 0` | | Probe (c), swizzle 24 | `anyStale=0 mirrorable=1` at the retire; a `depth plane store` flush runs before it; 2048 level-1 texels differ (0.25 → 0.5), the new case fails | <details><summary>Probe (c) output (swizzle 24), drawn plane, two runs</summary> Run with probe (a) and `APS5_TRACE_FLUSH=1`: ``` [flush] image 0x7f1214330000+0x10000 for test 0x7f1214330000+0x10000 [flush] image 0x7f1214330000+0x10000 for depth plane store 0x7f1214330000+0x10000 PROBE retire 0x7f1214330000 anyStale=0 mirrorable=1 [flush] image 0x7f1214330000+0x10000 for test 0x7f1214330000+0x10000 AGC graphics: a retire that stored depth drawn only on the GPU changed level 1 of the chain a pending storage write produced ``` Run with probe (b): ``` PROBE texel 0 kept 0.25 stored 0.5 PROBE level1 texels 16384 differ 2048; level0 texels 16384 at 0.5 2048; disjoint 0 AGC graphics: a retire that stored depth drawn only on the GPU changed level 1 of the chain a pending storage write produced ``` </details> ## Negative control I restored only `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` from `main`. With `PendingChainCase` in place the binary stops there first, so I also disabled that call for this run. `RetireStoresDepthCase` then failed 3 of 3, at `DepthSurfaceTexture`: ``` AGC graphics: sampling the depth plane of depth surface 0x7f1e88120000 (64x32, vk format 126) as a 64x32 texture of guest format 22 (vk 100), tile mode 4, dimension 1, levels 0-1, slice 0 is not implemented ``` So the new case needs the fix, but it fails on the same refusal `PendingChainCase` already pins, before reaching its own guest-memory checks. ## Previous findings 1. **Retire storing stale depth over pending results (non-blocking): no longer applies in the sequences I could build, but the new test does not show it.** With the T#'s layout (swizzle 24), the drawn depth is stored by `FlushDepthPlanes` ([`DepthSurface.cpp:2078`](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L2078-L2078), flush reason `depth plane store` at [L2136](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L2136-L2136)) before `retireStoringStale` is entered. At the retire, `AnyStale()` is false, so the ordering I described cannot arise. The chain row and the drawn 64x32 depth were both in guest memory afterwards. In the PR's own configuration the path is never reached at all (see New findings 1), so this conclusion comes from my probe, not from the committed test. ## New findings ### Blocking None. ### Non-blocking 1. **`RetireStoresDepthCase` passes without checking the drawn depth, and does not reach the store path it is named after.** The description says "Level 1 in guest memory matches a run without the depth write, and level 0 holds the drawn depth". On this tree, neither half holds: - The drawn surface comes from `Plane()` ([`DepthSurfaceFromStorage.cpp:152-153`](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/tests/execution/DepthSurfaceFromStorage.cpp#L152-L153)), which leaves the harness `swizzle` at its default 0 ([`DepthFastClearHarness.hpp:44`](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hpp#L44-L44)). `mirrorable()` requires `SW_64KB_Z_X` ([`DepthSurface.cpp:1778-1779`](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1778-L1779)), so `retireStoringStale` takes its plain `retire` branch ([L1818-L1819](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1818-L1819)). Probe (b) shows that none of the 16384 texels of the plane hold 0.5 after the flush, so the drawn depth never reaches guest memory in this case. - For this 64x32, 2-level, tile-mode-24 T#, `DescribeSurface` gives both levels the same 64 KiB range (`disjoint 0` in probe (b)). The level-0 check is skipped by `if (!stored.disjoint) return;` ([L234](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/tests/execution/DepthSurfaceFromStorage.cpp#L234-L234)). The "level 1" comparison at [L233](https://github.com/boykopovar/AnyPS5/blob/bd0f124c890381d21433494e3c7837a5534cc089/core/libs/prx/libSceAgcDriver/tests/execution/DepthSurfaceFromStorage.cpp#L233-L233) compares the whole plane. It is equal only because no depth was written in either run. - With the layout the T# actually uses (swizzle 24), the depth is stored and the chain row survives, but the case then fails. The 2048 texels of the drawn depth differ from the control (0.25 → 0.5) inside the whole-plane "level 1" range. This is the expected result, not a driver bug. Why it matters: the case adds a guest-memory claim to the Tested section that the test does not check, and a future regression in that path would not fail it. Suggested fix: draw with `swizzle = 24` so the surface is mirrorable and matches the T#. Compare only the texels the chain dispatch writes (the row `StoreRow` stores at level 1), and check the drawn texels for 0.5, instead of relying on `tiledOffset`/`tiledSize` ranges that overlap here. Also drop the silent `return` when the ranges overlap, so the depth check always runs. Then correct the Tested line to match. ## Not verified - Which caller triggers the `FlushDepthPlanes` store before the retire in probe (c). I saw it in the flush trace before `retireStoringStale`, and did not trace the call stack. - Whether some other sequence, not a compute storage write, can leave stale depth units under a pending storage image at the retire. - The Forspoken stop, and the AMD and Windows results in the description (author- and tester-reported). I did not launch the title. - `agc_driver_graphics` did not load the validation layer on either side. I did not run the full suite or the other tests matching the description's regex.
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!10854
No description provided.