fix(agc): leave a single-sample view over a published native multisample depth owner to guest memory #16365

Merged
hugodearaujo merged 6 commits from upstream-pr/16365 into main 2026-11-10 15:27:19 +00:00
hugodearaujo commented 2026-11-06 12:04:21 +00:00 (Migrated from github.com)

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


What

A title can read the memory of a native multisample D32S8 target without HTILE through a single-sample view at the depth base. Assassin's Creed Mirage (PPSA13960) does: a compute reads mip 0 of an R11G11B10F chain it wrote over the planes, at the depth address (resource 0x10f5d40000 3440x1936 x1 fmt 36 against the owner 1720x968 x4).

DepthSurfaceTexture takes every view at the base of an owner into the native path, and a single-sample view fails its identity check there: native multisample depth sampled identity or format mismatch.

For an owner the host has not written since its import or its last publication (#15688), guest memory already holds every sample. The import only accepts planes that each hold one value, and a publication writes all samples back to the planes.

This change:

  • adds DepthSurface::GuestHoldsSamples: a multisampled owner without HTILE, imported for sampling, with no refusal, not written by the host since its import or publication;
  • returns no native texture for a single-sample view at the base of such an owner, so the view reads guest memory like any other texture;
  • keeps everything else: a multisampled view still reads the owner, and a single-sample view of an owner written since its publication still throws the identity mismatch.

Tested

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

  • New agc_driver_native_depth_single_sample_view (--single-sample-view), at 2, 4 and 8 samples, on a 200x130 D32S8 target without HTILE whose planes hold 1.0 and 0x5a. A single-sample R11G11B10F view (400x260, kStandard64KB) at the depth base:
    • before any draw: left to guest memory;
    • after a draw: throws the identity mismatch;
    • after a guest read publishes the samples: left to guest memory, and the owner stays. A multisampled view still samples the owner;
    • after another draw: throws the identity mismatch again.
  • Without the change, the test fails. The base is #15688 (fa590e435a) with only the test added: the first view throws AGC graphics: native multisample depth sampled identity or format mismatch.
  • 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 fa590e435a: passes.
  • Title: Assassin's Creed Mirage (PPSA13960). Builds that had the other changes but not this one stopped at 506 s and 468 s on compute shader 0x10b4c8ad00: AGC graphics: native multisample depth sampled identity or format mismatch (the read above). 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), #16364 (pending units) 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 or on the identity mismatch (their stops, all later and separate: 452 s and 468 s, or the local VRAM guard at 482 s and 496 s).

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 (#15688 is merged)
  • Fixes: none
  • Unblocks: 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:5187540490 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16365). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-11-06T12:04:21Z. --- ### What A title can read the memory of a native multisample D32S8 target without HTILE through a single-sample view at the depth base. Assassin's Creed Mirage (PPSA13960) does: a compute reads mip 0 of an R11G11B10F chain it wrote over the planes, at the depth address (`resource 0x10f5d40000 3440x1936 x1 fmt 36` against the owner `1720x968 x4`). `DepthSurfaceTexture` takes every view at the base of an owner into the native path, and a single-sample view fails its identity check there: `native multisample depth sampled identity or format mismatch`. For an owner the host has not written since its import or its last publication (#15688), guest memory already holds every sample. The import only accepts planes that each hold one value, and a publication writes all samples back to the planes. This change: - adds `DepthSurface::GuestHoldsSamples`: a multisampled owner without HTILE, imported for sampling, with no refusal, not written by the host since its import or publication; - returns no native texture for a single-sample view at the base of such an owner, so the view reads guest memory like any other texture; - keeps everything else: a multisampled view still reads the owner, and a single-sample view of an owner written since its publication still throws the identity mismatch. ### Tested Linux 7.2.11, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests. - New `agc_driver_native_depth_single_sample_view` (`--single-sample-view`), at 2, 4 and 8 samples, on a 200x130 D32S8 target without HTILE whose planes hold 1.0 and 0x5a. A single-sample R11G11B10F view (400x260, `kStandard64KB`) at the depth base: - before any draw: left to guest memory; - after a draw: throws the identity mismatch; - after a guest read publishes the samples: left to guest memory, and the owner stays. A multisampled view still samples the owner; - after another draw: throws the identity mismatch again. - Without the change, the test fails. The base is #15688 (fa590e435a) with only the test added: the first view throws `AGC graphics: native multisample depth sampled identity or format mismatch`. - 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 fa590e435a`: passes. - Title: Assassin's Creed Mirage (PPSA13960). Builds that had the other changes but not this one stopped at 506 s and 468 s on `compute shader 0x10b4c8ad00: AGC graphics: native multisample depth sampled identity or format mismatch` (the read above). 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), #16364 (pending units) 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 or on the identity mismatch (their stops, all later and separate: 452 s and 468 s, or the local VRAM guard at 482 s and 496 s). ### 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 (#15688 is merged) - [x] Fixes: none - [x] Unblocks: 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:05 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Windows check of head 4b409e76e8, 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 20; run 3 timed out in native_depth_stencil the same three, plus publication_without_htile, 3 of 3
  • The new agc_driver_native_depth_single_sample_view passes in every run on both GPUs.
  • The timeout is this machine stalling, not the change: in that run a skipped test took 25.5 s and aliased_depth_depth_only 24 s, against under 1 s normally, and native_depth_stencil passes in the other runs on both GPUs.
  • publication_without_htile comes with the #15688 commits this branch merges. On the Intel iGPU it fails with a written D32S8 owner without HTILE did not publish its stencil samples and padding, the same D32S8 stencil pattern as the three tests that already fail on main there, and it passes on the NVIDIA GPU. I'm looking into that separately; it doesn't block this PR.
  • Not run with VK_LAYER_KHRONOS_validation.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5814054420 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16365#pullrequestreview-5814054420). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-07T17:40:05Z. **Review:** COMMENTED --- Windows check of head `4b409e76e8`, 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 20; run 3 timed out in `native_depth_stencil` | the same three, plus `publication_without_htile`, 3 of 3 | - The new `agc_driver_native_depth_single_sample_view` passes in every run on both GPUs. - The timeout is this machine stalling, not the change: in that run a skipped test took 25.5 s and `aliased_depth_depth_only` 24 s, against under 1 s normally, and `native_depth_stencil` passes in the other runs on both GPUs. - `publication_without_htile` comes with the #15688 commits this branch merges. On the Intel iGPU it fails with `a written D32S8 owner without HTILE did not publish its stencil samples and padding`, the same D32S8 stencil pattern as the three tests that already fail on `main` there, and it passes on the NVIDIA GPU. I'm looking into that separately; it doesn't block this PR. - 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!16365
No description provided.