fix(agc): publish native multisample depth next to a storage image whose pending units lie past its planes #16364

Merged
hugodearaujo merged 7 commits from upstream-pr/16364 into main 2026-11-10 17:20:35 +00:00
hugodearaujo commented 2026-11-06 12:04:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-11-06T12:04:18Z.


What

A native multisample depth publication (#13021) refuses when storage results are pending over its planes: native multisample depth publication over pending storage image writes is not implemented.

The check asks StorageTexture::AnyPendingOverlaps, which looks at whole images. So an image that only starts inside a plane refuses the publication even when every unit it still has pending lies past the plane. Nothing pending is then under the planes, and the publication would not overwrite any of it.

That case is common, because the depth import already stores the pending units over its planes (FlushPending works per unit). The image is left pending only past them.

This change:

  • adds StorageTexture::AnyPendingUnitsOverlap. It answers the same question per tracked unit: an image being flushed still counts whole, and a pending image counts only through its units marked pending that overlap the range;
  • uses it for the publication's pending check. Results pending over a plane still refuse, as before.

The publication debt entry now says "pending storage-image units over a plane".

Tested

Linux 7.2.11, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests.

  • New agc_driver_native_depth_pending_units (--pending-units), at 2, 4 and 8 samples:
    • A 200x130 D32S8 target with a depth-only HTILE that proves a clear of 0, and a separate stencil plane of 0x5a.
    • A 256x1152 32-bit storage image in 64 KiB units (kStandard64KB) starts in the last unit of the stencil plane and runs 1.1 MiB past it. Its results are pending (a clear to 0x5a5a5a5a).
    • The import stores the unit over the plane and leaves the rest pending. After a draw, a guest read publishes every depth and stencil sample. The units past the planes stay pending.
  • Without the change, the test fails. The base is main 5299939ecf with only the test added (the new query unused): it fails with AGC graphics: native multisample depth publication over pending storage image writes is not implemented.
  • Validation layer, paired, same machine (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V -R "native_depth|native_multisample|depth_storage|depth_surface|agc_storage_|multisample_guest|repeat_storage_guard|cached_image|storage_flush_ordering|storage_one_slice|storage_read_during|storage_write_back|msaa_address_on_plane", 55 tests):
    • base as above: 54 of 55;
    • this change: 55 of 55.
    • The loader inserted the layer in both runs. Neither log has a VUID- line or "was not found but was requested". Both have the same 20 WARNING-VkImageSubresourceRange-layerCount-compatibility lines.
  • tools/check_conventions.py --base origin/main: passes.
  • Title: Assassin's Creed Mirage (PPSA13960). This change is one of four that move the title past native multisample depth plane without HTILE does not hold one depth value in [0, 1]: #16363 (overwrite proof), #16365 (single-sample view) and #15941 (or a change that starts a new owner under pending storage results). Its effect shows only together with the others, so the runs are in #16363. In short, on main 5299939ecf + #13963 (7d548223bd) + #15707 (a8c5df4e69), the run without the changes stopped at 484 s on that message, and none of the four runs with them stopped on it (their stops, all later and separate: 452 s and 468 s, or the local VRAM guard at 482 s and 496 s). The import's flush leaves exactly this case: in Mirage the storage image over the planes runs past them.
  • Title: PRAGMATA (PPSA02530) stops on this refusal on its boot loading screen, before the title, in exactly this PR's case: 128x64 4-sample D32 targets with HTILE whose planes lie inside a 3840x2160 storage image (32 MiB, 510 units of 64 KiB) that has results pending, none of them over the planes. In a 1202 s run with this PR, a local print at the check saw 2346 such publications, and none had a pending unit over a plane.
    • Tree: main eaec74e322 + #12898 + #14367 + #9999 + #10497, Linux 7.2.14, same GPU and Mesa. On current main the title also needs #10497: without it the boot stops at 82 s on sample-preserving guest publication of native multisample depth is not implemented for this owner.
    • From a gameplay save, 600 s per run, interleaved, 3 runs per side:
      • without this PR, all 3 stopped on the loading screen, at 91 s, 87 s and 94 s, on AGC graphics: native multisample depth publication over pending storage image writes is not implemented (in two of them inside a compute shader dispatch);
      • with it, none stopped. All 3 loaded the save and played the full 600 s.
    • A longer run with this PR played on to 1645 s with no emulator error. It ended when the 20 GiB memory scope we run games in ran out (a kernel OOM kill inside the scope).

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: PPSA02530 past its boot loading screen (with #10497, see Tested); PPSA13960 together with the changes listed under Tested
  • GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5187539984 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16364). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-11-06T12:04:18Z. --- ### What A native multisample depth publication (#13021) refuses when storage results are pending over its planes: `native multisample depth publication over pending storage image writes is not implemented`. The check asks `StorageTexture::AnyPendingOverlaps`, which looks at whole images. So an image that only starts inside a plane refuses the publication even when every unit it still has pending lies past the plane. Nothing pending is then under the planes, and the publication would not overwrite any of it. That case is common, because the depth import already stores the pending units over its planes (`FlushPending` works per unit). The image is left pending only past them. This change: - adds `StorageTexture::AnyPendingUnitsOverlap`. It answers the same question per tracked unit: an image being flushed still counts whole, and a pending image counts only through its units marked pending that overlap the range; - uses it for the publication's pending check. Results pending over a plane still refuse, as before. The publication debt entry now says "pending storage-image units over a plane". ### Tested Linux 7.2.11, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests. - New `agc_driver_native_depth_pending_units` (`--pending-units`), at 2, 4 and 8 samples: - A 200x130 D32S8 target with a depth-only HTILE that proves a clear of 0, and a separate stencil plane of 0x5a. - A 256x1152 32-bit storage image in 64 KiB units (`kStandard64KB`) starts in the last unit of the stencil plane and runs 1.1 MiB past it. Its results are pending (a clear to 0x5a5a5a5a). - The import stores the unit over the plane and leaves the rest pending. After a draw, a guest read publishes every depth and stencil sample. The units past the planes stay pending. - Without the change, the test fails. The base is `main` 5299939ecf with only the test added (the new query unused): it fails with `AGC graphics: native multisample depth publication over pending storage image writes is not implemented`. - Validation layer, paired, same machine (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V -R "native_depth|native_multisample|depth_storage|depth_surface|agc_storage_|multisample_guest|repeat_storage_guard|cached_image|storage_flush_ordering|storage_one_slice|storage_read_during|storage_write_back|msaa_address_on_plane"`, 55 tests): - base as above: 54 of 55; - this change: 55 of 55. - The loader inserted the layer in both runs. Neither log has a `VUID-` line or "was not found but was requested". Both have the same 20 `WARNING-VkImageSubresourceRange-layerCount-compatibility` lines. - `tools/check_conventions.py --base origin/main`: passes. - Title: Assassin's Creed Mirage (PPSA13960). This change is one of four that move the title past `native multisample depth plane without HTILE does not hold one depth value in [0, 1]`: #16363 (overwrite proof), #16365 (single-sample view) and #15941 (or a change that starts a new owner under pending storage results). Its effect shows only together with the others, so the runs are in #16363. In short, on `main` 5299939ecf + #13963 (7d548223bd) + #15707 (a8c5df4e69), the run without the changes stopped at 484 s on that message, and none of the four runs with them stopped on it (their stops, all later and separate: 452 s and 468 s, or the local VRAM guard at 482 s and 496 s). The import's flush leaves exactly this case: in Mirage the storage image over the planes runs past them. - Title: PRAGMATA (PPSA02530) stops on this refusal on its boot loading screen, before the title, in exactly this PR's case: 128x64 4-sample D32 targets with HTILE whose planes lie inside a 3840x2160 storage image (32 MiB, 510 units of 64 KiB) that has results pending, none of them over the planes. In a 1202 s run with this PR, a local print at the check saw 2346 such publications, and none had a pending unit over a plane. - Tree: `main` eaec74e322 + #12898 + #14367 + #9999 + #10497, Linux 7.2.14, same GPU and Mesa. On current `main` the title also needs #10497: without it the boot stops at 82 s on `sample-preserving guest publication of native multisample depth is not implemented for this owner`. - From a gameplay save, 600 s per run, interleaved, 3 runs per side: - without this PR, all 3 stopped on the loading screen, at 91 s, 87 s and 94 s, on `AGC graphics: native multisample depth publication over pending storage image writes is not implemented` (in two of them inside a compute shader dispatch); - with it, none stopped. All 3 loaded the save and played the full 600 s. - A longer run with this PR played on to 1645 s with no emulator error. It ended when the 20 GiB memory scope we run games in ran out (a kernel OOM kill inside the scope). ### 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 - [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: PPSA02530 past its boot loading screen (with #10497, see Tested); PPSA13960 together with the changes listed under Tested - [x] GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.11 - [x] AI-assisted: yes
gabichuuuuu commented 2026-11-07 17:40:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T17:40:06Z.

Review: COMMENTED


Windows check of head 55817a857a, merged onto main 4e44ed59b2 (clean merge), with main from the same build directory as the control.

Setup: Windows 11 x64, WinLibs GCC 15.2.0 r7, Release, full build. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R '^agc_driver_native_depth_', 3 runs per GPU on each side.

NVIDIA laptop GPU, driver 610 Intel iGPU, same machine
main 3 of 3 runs pass 3 of 3 runs fail stencil_view, uniform_planes and publication
this PR 2 of 3 runs pass all 19; run 3 timed out in aliased_depth_depth_only the same three as main, nothing new
  • The new agc_driver_native_depth_pending_units passes in every run on both GPUs.
  • The timeout is this machine stalling, not the change: in the same run pending_units took 29.7 s and a skipped test 6.1 s, against under 1 s normally, and aliased_depth_depth_only passes in the other runs on both GPUs.
  • The three Intel failures are on main too, so this PR adds none. I'm looking into them separately.
  • Not run with VK_LAYER_KHRONOS_validation.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5814054525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16364#pullrequestreview-5814054525). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-07T17:40:06Z. **Review:** COMMENTED --- Windows check of head `55817a857a`, merged onto `main` `4e44ed59b2` (clean merge), with `main` from the same build directory as the control. **Setup:** Windows 11 x64, WinLibs GCC 15.2.0 r7, Release, full build. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R '^agc_driver_native_depth_'`, 3 runs per GPU on each side. | | NVIDIA laptop GPU, driver 610 | Intel iGPU, same machine | |---|---|---| | `main` | 3 of 3 runs pass | 3 of 3 runs fail `stencil_view`, `uniform_planes` and `publication` | | this PR | 2 of 3 runs pass all 19; run 3 timed out in `aliased_depth_depth_only` | the same three as `main`, nothing new | - The new `agc_driver_native_depth_pending_units` passes in every run on both GPUs. - The timeout is this machine stalling, not the change: in the same run `pending_units` took 29.7 s and a skipped test 6.1 s, against under 1 s normally, and `aliased_depth_depth_only` passes in the other runs on both GPUs. - The three Intel failures are on `main` too, so this PR adds none. I'm looking into them separately. - Not run with `VK_LAYER_KHRONOS_validation`. AI-assisted: yes.
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!16364
No description provided.