fix(agc): start a new native multisample depth owner when an overwriting draw binds a published owner under pending storage units #17890

Merged
hugodearaujo merged 7 commits from upstream-pr/17890 into main 2026-11-14 11:46:40 +00:00
hugodearaujo commented 2026-11-09 20:56:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-11-09T20:56:03Z.


What

Assassin's Creed Mirage (PPSA13960) stops before its title screen, at 73-81 s:

compute shader 0x1000810a00: AGC graphics: native multisample depth publication over pending storage image writes is not implemented

The target is a 4-sample D32S8 depth target without HTILE (960x540 in our logs). #16363's overwrite proof imports it, and its samples are then published to guest memory. After that the host doesn't write it. A compute pass then writes an R11G11B10F storage image at the same base, so storage units stay pending over the depth plane. The next frame binds the target again with a draw that writes every sample (depth ALWAYS with writes, stencil ALWAYS/REPLACE, mask 0xff). That bind finds the published owner and reuses it. Once the draw writes the owner, its next publication meets the pending units and throws the message above.

On the console the target and the storage image are the same memory, and that draw overwrites every sample. So no sample of the old owner survives, and the storage results are just the memory under the new draw.

The change. DepthSurfaceViewWithStencilWriteIntent now starts a new owner when all three of these hold:

  • the draw passes #16363's overwrite intent (overwrittenStencil);
  • the owner it would reuse is published and not written since (#16365's GuestHoldsSamples);
  • storage units are pending over one of its planes (#16364's StorageTexture::AnyPendingUnitsOverlap).

The old owner is marked inactive and its depth guards are removed. It isn't host-written, so releaseRetired (#15300) frees it when the new owner is created. The new owner imports guest memory as any new owner does, and its import stores the pending results first. Its planes are then uneven, so #16363's proof decides after the draw, as for any other overwriting first draw.

Nothing else changes:

  • a bind without that draw still reuses the published owner, and its publication still refuses;
  • an owner written since its publication is reused as before;
  • an owner with no pending units over its planes is reused as before.

The depth surface debt entry, which lists when a published owner is released and a new one imported, now names this case too.

Cost: one new owner per such bind, so one overwrite proof (#16363: a recorder sync and a stencil readback). The released owner is freed at once (#15300). In Mirage (two 300 s runs of a local logging build), this path starts a new owner in two bursts, for 960x540 x4 targets, and never between them:

  • 9 and 14 new owners for one target (depth 0x10db960000) at 50-70 s, around where the build without this change stops;
  • from 251-261 s on, in the opening scene after Full Synchronization Off: one more for that target, then 24 and 41 for another (depth 0x10dfd20000). That is about one new owner per presented frame (12 new owners against 12 presents in each of two 10 s windows).

The title screen and the menu (70-255 s) start none, and they run at 0.6-2 presents per second either way. The opening scene runs at 1.1-2.6 presents per second. The build without this change stops before that point, so this cost cannot be compared directly. Device VRAM in use stays at 12.4-12.7 GB from 75 s to the end of every run with this change, with no growth.

Tested

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

  • New agc_driver_native_depth_overwritten_published (--overwritten-published), at 2, 4 and 8 samples, on a 200x130 D32S8 target without HTILE over uniform planes. The owner is imported, drawn and published by a guest read. Then a linear storage image is cleared over its depth plane from 64 KiB in, and its results are left pending. Then one of:
    • a bind without an overwriting draw: the owner and its view are reused. After a draw, a guest read still refuses with native multisample depth publication over pending storage image writes is not implemented;
    • a bind by an overwriting draw: a new owner and a new view start, the pending results are stored before its import, it samples the draw's per-sample depths after the draw, and a guest read then publishes it.
  • Negative control. The same test on the base without the change (main 6719b01bf3 + #16363 + #16364 + #16365, test only) fails at each sample count with AGC graphics: an overwriting draw over a published owner under storage results did not start a new owner. The first case is the unchanged behaviour, so it passes there too. It runs first in each sample count, so the log shows the base behaviour before the failure.
  • On lavapipe (Mesa llvmpipe, LLVM 23.1.4) the new test passes at 4 and 8 samples. The test skips 2 samples there because the device doesn't support it.
  • 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"):
    • base (main 6719b01bf3 + #16363 + #16364 + #16365): 66 tests, 64 pass, 2 skip;
    • this change: 67 tests, 65 pass, 2 skip. The new test is the 67th.
    • Both runs skip the same two tests, agc_storage_pending_key_refresh and agc_storage_clear_hand_over. The loader inserted the layer in both runs. Neither log has a VUID- line, a validation warning, or "was not found but was requested".
  • tools/check_conventions.py --base 6719b01bf3: passes (exit 0, no findings).
  • On current main. The head, 3b3fefa541, is this change with main f439f7f3a0 merged in (a clean merge, with this PR's lines unchanged). It builds, and the same validation command, run without agc_storage_write_back_scratch, gives 66 tests: 64 pass, the same 2 skip, and the new test is among the passes. No log has a VUID- line, and check_conventions passes.
  • NVIDIA, by Doorriiaann (comment): RTX 3070, driver 610.57.04, Debian 13, GCC 13.3.0, Release, with the validation layer and the ctest -V -R pattern above, 3 runs on each side.
    • main f439f7f3a0: 63 tests, all pass 3 of 3.
    • This PR at 3b3fefa541: 67 tests, all pass 3 of 3. That includes agc_storage_pending_key_refresh and agc_storage_clear_hand_over, which skip on the RX 9070 XT, and agc_storage_write_back_scratch. The new test runs at 2, 4 and 8 samples.
    • No VUID- line, and the layer was found.
    • Negative control on 57f21b13b8: fails 3 of 3 with an overwriting draw over a published owner under storage results did not start a new owner.
  • Windows, by JJenkx (comment): this PR at 3b3fefa541 merged onto main e7c3bfd130, a clean merge. Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), WinLibs GCC 15.2 UCRT, Release. agc_driver_native_multisample_depth, agc_driver_native_depth_pending_units, agc_driver_native_depth_overwritten_planes, agc_driver_native_depth_overwritten_published and agc_driver_native_depth_single_sample_view pass 3 of 3 each, none skipped.
  • NVIDIA and Intel, by Lucke0051 (comment): this PR at 08ba519102 merged onto main 1ee5cd7cc3, CachyOS (Linux 7.3.1), GCC 16.2.1, Release, compared with main on the same machine, ctest -R '^(agc|video_out|shader)'. On an RTX 3070 Ti (NVIDIA 615.78.08) and an Intel UHD Graphics 630 (Mesa 26.2.6, ANV): no difference from main, and agc_driver_native_depth_overwritten_published passes 3 of 3 alone. No validation layer there.
  • With #15941 (d4583e9ccd) merged on top: the new test and the same 67 tests pass (65 pass, 2 skip, no VUID- line). That still holds when the test's storage access passes DepthReadCause::Reuse, as #15941's cachedStorageTexture does. With that Reuse access, #15941 without this change (the test only) fails as the base does: AGC graphics: an overwriting draw over a published owner under storage results did not start a new owner.
    • Why the case keeps its meaning: since 9452ca6e35, #15941 retires an owner at a Reuse access only when that access's publication took a guest byte. A published owner has nothing left to publish there, so it is kept, and the bind reaches this change as it does without #15941. When a Reuse publication does take a guest byte, #15941 retires the owner, and the next bind already creates a new owner without this change.
    • Either merge order works. The two changes touch different lines. Merging #15941 onto this branch conflicts only in lines from #16363 and #16365 (PublishToGuest's declaration and RequireNoResidentDepthRead_nid_no_patch's signature) and in the publication debt entry. Those are the same conflicts as merging #15941 onto those PRs alone.
  • Title: Assassin's Creed Mirage (PPSA13960): title, New Game, Assassin, Full Synchronization Off, 300 s per run, interleaved, on main 6719b01bf3 + #13963 (97f05cbd72) + #16363 + #16364 + #16365:
    • without this change, 3 runs: all 3 stopped before the title screen (81 s, 73 s, 75 s) on the message above;
    • with this change, 3 runs: none stopped. All 3 got through the title (103-120 s), New Game (199-216 s), Assassin and Full Synchronization Off into the opening scene. They ran the full 300 s.
    • two more runs with a local print where this change starts an owner: neither stopped, and both ran 300 s into the opening scene. The counts are under Cost above.
    • Earlier runs on main 6b58dfa474 + #13963 + #16364 + #16363 + #16365 + #15941 (d4583e9ccd) + #16974 (since merged), 720 s each, recomputed from their logs:
      • without this change, 5 runs (one plain build, four with local logging): all stopped at 73-77 s on the message above;
      • with this change's code, 6 runs: all got through the title (102-114 s) and New Game (184-225 s). They stopped later, on separate messages:
        • a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented at 448 s and 573 s;
        • initial multisample color contents overlap resident native depth at 515 s and 454 s;
        • a storage image access ... overlaps multisampled color target ... whose samples are only on the host at 455 s;
        • the local VRAM guard at 490 s.
  • Limits.
    • The overwrite proof shows that the draw reached every sample of the new owner. It doesn't show that the console keeps the old owner's samples nowhere else.
    • A published owner bound by any other draw while storage units are pending over its planes still throws at its next publication, as before.

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 (#16363, #16364 and #16365 are merged)
  • Fixes: none
  • Unblocks: PPSA13960 together with #13963, #16363, #16364 and #16365 (past the title screen into New Game)
  • GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.14; lavapipe (Mesa llvmpipe) for the new test; NVIDIA RTX 3070, driver 610.57.04, Debian 13 (by Doorriiaann); AMD Radeon RX 6700 XT, Windows 11 (by JJenkx); NVIDIA RTX 3070 Ti and Intel UHD Graphics 630 (ANV), Linux (by Lucke0051)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5231041972 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17890). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-11-09T20:56:03Z. --- ### What Assassin's Creed Mirage (PPSA13960) stops before its title screen, at 73-81 s: ``` compute shader 0x1000810a00: AGC graphics: native multisample depth publication over pending storage image writes is not implemented ``` The target is a 4-sample D32S8 depth target without HTILE (960x540 in our logs). #16363's overwrite proof imports it, and its samples are then published to guest memory. After that the host doesn't write it. A compute pass then writes an R11G11B10F storage image at the same base, so storage units stay pending over the depth plane. The next frame binds the target again with a draw that writes every sample (depth ALWAYS with writes, stencil ALWAYS/REPLACE, mask 0xff). That bind finds the published owner and reuses it. Once the draw writes the owner, its next publication meets the pending units and throws the message above. On the console the target and the storage image are the same memory, and that draw overwrites every sample. So no sample of the old owner survives, and the storage results are just the memory under the new draw. **The change.** `DepthSurfaceViewWithStencilWriteIntent` now starts a new owner when all three of these hold: - the draw passes #16363's overwrite intent (`overwrittenStencil`); - the owner it would reuse is published and not written since (#16365's `GuestHoldsSamples`); - storage units are pending over one of its planes (#16364's `StorageTexture::AnyPendingUnitsOverlap`). The old owner is marked inactive and its depth guards are removed. It isn't host-written, so `releaseRetired` (#15300) frees it when the new owner is created. The new owner imports guest memory as any new owner does, and its import stores the pending results first. Its planes are then uneven, so #16363's proof decides after the draw, as for any other overwriting first draw. Nothing else changes: - a bind without that draw still reuses the published owner, and its publication still refuses; - an owner written since its publication is reused as before; - an owner with no pending units over its planes is reused as before. The depth surface debt entry, which lists when a published owner is released and a new one imported, now names this case too. Cost: one new owner per such bind, so one overwrite proof (#16363: a recorder sync and a stencil readback). The released owner is freed at once (#15300). In Mirage (two 300 s runs of a local logging build), this path starts a new owner in two bursts, for 960x540 x4 targets, and never between them: - 9 and 14 new owners for one target (depth `0x10db960000`) at 50-70 s, around where the build without this change stops; - from 251-261 s on, in the opening scene after Full Synchronization Off: one more for that target, then 24 and 41 for another (depth `0x10dfd20000`). That is about one new owner per presented frame (12 new owners against 12 presents in each of two 10 s windows). The title screen and the menu (70-255 s) start none, and they run at 0.6-2 presents per second either way. The opening scene runs at 1.1-2.6 presents per second. The build without this change stops before that point, so this cost cannot be compared directly. Device VRAM in use stays at 12.4-12.7 GB from 75 s to the end of every run with this change, with no growth. ### Tested Linux 7.2.14, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests. - New `agc_driver_native_depth_overwritten_published` (`--overwritten-published`), at 2, 4 and 8 samples, on a 200x130 D32S8 target without HTILE over uniform planes. The owner is imported, drawn and published by a guest read. Then a linear storage image is cleared over its depth plane from 64 KiB in, and its results are left pending. Then one of: - a bind without an overwriting draw: the owner and its view are reused. After a draw, a guest read still refuses with `native multisample depth publication over pending storage image writes is not implemented`; - a bind by an overwriting draw: a new owner and a new view start, the pending results are stored before its import, it samples the draw's per-sample depths after the draw, and a guest read then publishes it. - **Negative control.** The same test on the base without the change (`main` 6719b01bf3 + #16363 + #16364 + #16365, test only) fails at each sample count with `AGC graphics: an overwriting draw over a published owner under storage results did not start a new owner`. The first case is the unchanged behaviour, so it passes there too. It runs first in each sample count, so the log shows the base behaviour before the failure. - On lavapipe (Mesa llvmpipe, LLVM 23.1.4) the new test passes at 4 and 8 samples. The test skips 2 samples there because the device doesn't support it. - 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"`): - base (`main` 6719b01bf3 + #16363 + #16364 + #16365): 66 tests, 64 pass, 2 skip; - this change: 67 tests, 65 pass, 2 skip. The new test is the 67th. - Both runs skip the same two tests, `agc_storage_pending_key_refresh` and `agc_storage_clear_hand_over`. The loader inserted the layer in both runs. Neither log has a `VUID-` line, a validation warning, or "was not found but was requested". - `tools/check_conventions.py --base 6719b01bf3`: passes (exit 0, no findings). - **On current `main`.** The head, `3b3fefa541`, is this change with `main` f439f7f3a0 merged in (a clean merge, with this PR's lines unchanged). It builds, and the same validation command, run without `agc_storage_write_back_scratch`, gives 66 tests: 64 pass, the same 2 skip, and the new test is among the passes. No log has a `VUID-` line, and `check_conventions` passes. - **NVIDIA, by Doorriiaann** ([comment](https://github.com/boykopovar/AnyPS5/pull/17890#issuecomment-6752324240)): RTX 3070, driver 610.57.04, Debian 13, GCC 13.3.0, Release, with the validation layer and the `ctest -V -R` pattern above, 3 runs on each side. - `main` f439f7f3a0: 63 tests, all pass 3 of 3. - This PR at `3b3fefa541`: 67 tests, all pass 3 of 3. That includes `agc_storage_pending_key_refresh` and `agc_storage_clear_hand_over`, which skip on the RX 9070 XT, and `agc_storage_write_back_scratch`. The new test runs at 2, 4 and 8 samples. - No `VUID-` line, and the layer was found. - Negative control on `57f21b13b8`: fails 3 of 3 with `an overwriting draw over a published owner under storage results did not start a new owner`. - **Windows, by JJenkx** ([comment](https://github.com/boykopovar/AnyPS5/pull/17890#issuecomment-6753250869)): this PR at `3b3fefa541` merged onto `main` e7c3bfd130, a clean merge. Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), WinLibs GCC 15.2 UCRT, Release. `agc_driver_native_multisample_depth`, `agc_driver_native_depth_pending_units`, `agc_driver_native_depth_overwritten_planes`, `agc_driver_native_depth_overwritten_published` and `agc_driver_native_depth_single_sample_view` pass 3 of 3 each, none skipped. - **NVIDIA and Intel, by Lucke0051** ([comment](https://github.com/boykopovar/AnyPS5/pull/17890#issuecomment-6802666275)): this PR at `08ba519102` merged onto `main` 1ee5cd7cc3, CachyOS (Linux 7.3.1), GCC 16.2.1, Release, compared with `main` on the same machine, `ctest -R '^(agc|video_out|shader)'`. On an RTX 3070 Ti (NVIDIA 615.78.08) and an Intel UHD Graphics 630 (Mesa 26.2.6, ANV): no difference from `main`, and `agc_driver_native_depth_overwritten_published` passes 3 of 3 alone. No validation layer there. - **With #15941** (d4583e9ccd) merged on top: the new test and the same 67 tests pass (65 pass, 2 skip, no `VUID-` line). That still holds when the test's storage access passes `DepthReadCause::Reuse`, as #15941's `cachedStorageTexture` does. With that `Reuse` access, #15941 without this change (the test only) fails as the base does: `AGC graphics: an overwriting draw over a published owner under storage results did not start a new owner`. - Why the case keeps its meaning: since 9452ca6e35, #15941 retires an owner at a `Reuse` access only when that access's publication took a guest byte. A published owner has nothing left to publish there, so it is kept, and the bind reaches this change as it does without #15941. When a `Reuse` publication does take a guest byte, #15941 retires the owner, and the next bind already creates a new owner without this change. - Either merge order works. The two changes touch different lines. Merging #15941 onto this branch conflicts only in lines from #16363 and #16365 (`PublishToGuest`'s declaration and `RequireNoResidentDepthRead_nid_no_patch`'s signature) and in the publication debt entry. Those are the same conflicts as merging #15941 onto those PRs alone. - Title: Assassin's Creed Mirage (PPSA13960): title, New Game, Assassin, Full Synchronization Off, 300 s per run, interleaved, on `main` 6719b01bf3 + #13963 (97f05cbd72) + #16363 + #16364 + #16365: - without this change, 3 runs: all 3 stopped before the title screen (81 s, 73 s, 75 s) on the message above; - with this change, 3 runs: none stopped. All 3 got through the title (103-120 s), New Game (199-216 s), Assassin and Full Synchronization Off into the opening scene. They ran the full 300 s. - two more runs with a local print where this change starts an owner: neither stopped, and both ran 300 s into the opening scene. The counts are under Cost above. - Earlier runs on `main` 6b58dfa474 + #13963 + #16364 + #16363 + #16365 + #15941 (d4583e9ccd) + #16974 (since merged), 720 s each, recomputed from their logs: - without this change, 5 runs (one plain build, four with local logging): all stopped at 73-77 s on the message above; - with this change's code, 6 runs: all got through the title (102-114 s) and New Game (184-225 s). They stopped later, on separate messages: - `a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented` at 448 s and 573 s; - `initial multisample color contents overlap resident native depth` at 515 s and 454 s; - `a storage image access ... overlaps multisampled color target ... whose samples are only on the host` at 455 s; - the local VRAM guard at 490 s. - **Limits.** - The overwrite proof shows that the draw reached every sample of the new owner. It doesn't show that the console keeps the old owner's samples nowhere else. - A published owner bound by any other draw while storage units are pending over its planes still throws at its next publication, as before. ### 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 (#16363, #16364 and #16365 are merged) - [x] Fixes: none - [x] Unblocks: PPSA13960 together with #13963, #16363, #16364 and #16365 (past the title screen into New Game) - [x] GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.14; lavapipe (Mesa llvmpipe) for the new test; NVIDIA RTX 3070, driver 610.57.04, Debian 13 (by Doorriiaann); AMD Radeon RX 6700 XT, Windows 11 (by JJenkx); NVIDIA RTX 3070 Ti and Intel UHD Graphics 630 (ANV), Linux (by Lucke0051) - [x] 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!17890
No description provided.