fix(agc): attach a smaller native multisample depth extent with the same Z_X layout to its owner #15690

Merged
hugodearaujo merged 12 commits from upstream-pr/15690 into main 2026-11-09 01:46:36 +00:00
hugodearaujo commented 2026-11-04 06:29:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-11-04T06:29:27Z.


What

Assassin's Creed Mirage (PPSA13960) uses dynamic resolution on a 4-sample D32S8 depth target without HTILE. It draws the planes at 1920x1080, a guest access publishes them (#15688), and the next frame binds the same depth and stencil addresses with every field equal except the extent, 1872x1056. A new owner over the planes of a host-written owner is refused, so the title stops with a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented.

On the console both extents address the same memory. For 4-sample Z_X, a 64 KiB block is 64x64 pixels for 32-bit depth and 128x128 for the 8-bit stencil plane. 1872x1056 and 1920x1080 pad to the same pitch and padded height on both planes (30x17 and 15x9 blocks), so every pixel of the smaller extent has the address it has in the larger one.

A multisampled depth target without HTILE is now drawn into a resident owner when:

  • every field except the extent is equal,
  • its width and height are no larger than the owner's,
  • and the Z_X pitch, padded height and footprint of its depth and stencil planes, from MultisampleTextureLayout, are the owner's.

The owner keeps its image and samples. The draw's framebuffer is the render extent, which may be smaller than the attachment. The same rule applies where a draw notes its depth write and where the sample-order and sample-location paths look up the owner. Those paths take the owner's extent for the reorder, since the whole image is in host order.

Still refused, as before:

  • a larger extent (the image would be too small),
  • another pitch, padded height or XOR,
  • an owner with HTILE, whose metadata layout at the smaller extent is not verified,
  • a descriptor that samples the smaller extent (native multisample depth sampled identity or format mismatch).

Tested

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

  • New agc_driver_native_depth_smaller_extent (--smaller-extent), at 2, 4 and 8 samples:
    • A uniform-plane D32S8 owner without HTILE at 104x67 is drawn with per-sample depth.
    • 97x66 with the same layout returns the owner's view. A draw at that extent lands in the owner: sampling the owner gives the new samples inside 97x66 and the first draw's samples outside it, for every sample.
    • The fixture was 200x130 and 193x129 until 8cc85b8cb1. The fetch runs one workgroup per sample, so at 4 and 8 samples it dispatched 104000 and 208000 groups, past the 65536 maxComputeWorkGroupCount[0] of an Intel iGPU (found in review). The new sizes keep the same pitch and padded height on both planes at 2, 4 and 8 samples, still span more than one block in each axis, and dispatch at most 55744 groups.
    • The test does not assert the refusals listed above, since those are unimplemented paths rather than refusals by design (per review).
    • Without the change the test fails with a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented.
  • Validation layer, paired, same machine (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1), the 21 agc_driver_native_multisample_depth / agc_driver_native_depth_* tests, on 8cc85b8cb1 (#15688's head 79a72e5259 merged): with DepthSurface.cpp from #15688 and the new test, 20 of 21, the new test failing as above; with this change, 21 of 21. Neither log has a VUID- line or "was not found but was requested". The same pair on #15688's earlier head 288fc4e584 gave 15 of 16 and 16 of 16.
  • tools/check_conventions.py: passes.
  • Title: Assassin's Creed Mirage (PPSA13960), title, New Game, Assassin, Full Synchronization Off, on main 1c8c0efc8c + #13963 (fc1dfc03ab, needed for an earlier stop) + #15688:
    • without this change: stops at 476 s on the identity refusal above. A logging build shows the bound target as depth 0x1249300000 stencil 0x124b2e0000 htile 0 1872x1056 over the published 1920x1080 owner of the same addresses, every other field equal.
    • with it: the 1872x1056 binds attach to the 1920x1080 owner and the title draws into it. It then stops at 470 s, when compute shader 0x10b4c89700 reads the planes again: native multisample depth publication over pending storage image writes is not implemented. That is a separate stop.

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: #15688 (stacked on it: an attachment over a written owner publishes it first, and without it a no-HTILE owner cannot publish)
  • Fixes: none
  • Unblocks: PPSA13960 #7534 (moves it to its next stop)
  • GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5149987345 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15690). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-11-04T06:29:27Z. --- ### What Assassin's Creed Mirage (PPSA13960) uses dynamic resolution on a 4-sample D32S8 depth target without HTILE. It draws the planes at 1920x1080, a guest access publishes them (#15688), and the next frame binds the same depth and stencil addresses with every field equal except the extent, 1872x1056. A new owner over the planes of a host-written owner is refused, so the title stops with `a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented`. On the console both extents address the same memory. For 4-sample Z_X, a 64 KiB block is 64x64 pixels for 32-bit depth and 128x128 for the 8-bit stencil plane. 1872x1056 and 1920x1080 pad to the same pitch and padded height on both planes (30x17 and 15x9 blocks), so every pixel of the smaller extent has the address it has in the larger one. A multisampled depth target without HTILE is now drawn into a resident owner when: - every field except the extent is equal, - its width and height are no larger than the owner's, - and the Z_X pitch, padded height and footprint of its depth and stencil planes, from `MultisampleTextureLayout`, are the owner's. The owner keeps its image and samples. The draw's framebuffer is the render extent, which may be smaller than the attachment. The same rule applies where a draw notes its depth write and where the sample-order and sample-location paths look up the owner. Those paths take the owner's extent for the reorder, since the whole image is in host order. Still refused, as before: - a larger extent (the image would be too small), - another pitch, padded height or XOR, - an owner with HTILE, whose metadata layout at the smaller extent is not verified, - a descriptor that samples the smaller extent (`native multisample depth sampled identity or format mismatch`). ### Tested Linux 7.2.11, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests. - New `agc_driver_native_depth_smaller_extent` (`--smaller-extent`), at 2, 4 and 8 samples: - A uniform-plane D32S8 owner without HTILE at 104x67 is drawn with per-sample depth. - 97x66 with the same layout returns the owner's view. A draw at that extent lands in the owner: sampling the owner gives the new samples inside 97x66 and the first draw's samples outside it, for every sample. - The fixture was 200x130 and 193x129 until `8cc85b8cb1`. The fetch runs one workgroup per sample, so at 4 and 8 samples it dispatched 104000 and 208000 groups, past the 65536 `maxComputeWorkGroupCount[0]` of an Intel iGPU (found in review). The new sizes keep the same pitch and padded height on both planes at 2, 4 and 8 samples, still span more than one block in each axis, and dispatch at most 55744 groups. - The test does not assert the refusals listed above, since those are unimplemented paths rather than refusals by design (per review). - Without the change the test fails with `a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented`. - Validation layer, paired, same machine (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`), the 21 `agc_driver_native_multisample_depth` / `agc_driver_native_depth_*` tests, on `8cc85b8cb1` (#15688's head `79a72e5259` merged): with `DepthSurface.cpp` from #15688 and the new test, 20 of 21, the new test failing as above; with this change, 21 of 21. Neither log has a `VUID-` line or "was not found but was requested". The same pair on #15688's earlier head `288fc4e584` gave 15 of 16 and 16 of 16. - `tools/check_conventions.py`: passes. - Title: Assassin's Creed Mirage (PPSA13960), title, New Game, Assassin, Full Synchronization Off, on `main` 1c8c0efc8c + #13963 (fc1dfc03ab, needed for an earlier stop) + #15688: - without this change: stops at 476 s on the identity refusal above. A logging build shows the bound target as `depth 0x1249300000 stencil 0x124b2e0000 htile 0 1872x1056` over the published 1920x1080 owner of the same addresses, every other field equal. - with it: the 1872x1056 binds attach to the 1920x1080 owner and the title draws into it. It then stops at 470 s, when compute shader 0x10b4c89700 reads the planes again: `native multisample depth publication over pending storage image writes is not implemented`. That is a separate stop. ### 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: #15688 (stacked on it: an attachment over a written owner publishes it first, and without it a no-HTILE owner cannot publish) - [x] Fixes: none - [x] Unblocks: PPSA13960 #7534 (moves it to its next stop) - [x] GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.11 - [x] AI-assisted: yes
Superseabas commented 2026-11-04 17:09:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-04T17:09:51Z.

Review: APPROVED


Head 6c1c4ef23f merged onto current main b11c7bf84f (clean merge, local only): code read, red/green check and a run on AMD's Windows driver, which no run of this stack has covered yet, with an NVIDIA Blackwell run alongside.

Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release, BUILD_TESTING=ON. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -R '^agc_driver_native_(depth|multisample_depth).*$', ANYPS5_GPU selecting the device (confirmed by Selected GPU). In each tree one test, agc_driver_native_depth_driver_queued_fill, skips on Windows as on main:

GPU Driver main #15688 merged this PR merged
NVIDIA GeForce RTX 5070 Ti (10de:2c05) 621.01 16 + 1 skip 18 + 1 skip 19 + 1 skip
AMD Radeon Graphics, Ryzen 7 7700X iGPU (1002:164e) AMD 26.10.2 16 + 1 skip 18 + 1 skip 19 + 1 skip
  • There are no VUID- lines and no missing-layer line in any run.
  • Red check: the merged tree with only this PR's own DepthSurface.cpp change reversed (git diff of #15688's head fa590e435a against this head, applied in reverse) fails the new agc_driver_native_depth_smaller_extent on both GPUs. It fails with a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented, the stop the description names.
  • check_conventions.py --base main passes on the merge.

Read through the change:

  • sameLayoutWithin accepts only a multisampled owner without HTILE and with depthSwizzle 24 that is at least as wide and tall as the target. The target, resized to the owner's extent, must be sameSurface. For the depth plane and for the stencil (or the depth width again when there is no separate stencil), the Z_64KB_X layout must give the same pitch, padded height and byte size at both extents, so the smaller target addresses the same bytes as the owner.
  • holdsTarget replaces sameSurface in the write notice, the sample-order and sample-location lookups and the feedback check. The view lookup only falls back to a sameLayoutWithin owner when no surface matched.
  • DepthSurfaceOrderTarget now returns the owner's extent, which matches the image it hands out.
  • The debt entry states what stays unimplemented. Per the requested change, the test keeps the positive reuse and per-sample readback, including bytes outside the smaller extent, and no longer asserts the refusals.

I found nothing to change.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5772537552 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15690#pullrequestreview-5772537552). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-04T17:09:51Z. **Review:** APPROVED --- Head `6c1c4ef23f` merged onto current `main` `b11c7bf84f` (clean merge, local only): code read, red/green check and a run on AMD's Windows driver, which no run of this stack has covered yet, with an NVIDIA Blackwell run alongside. Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), Release, `BUILD_TESTING=ON`. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ctest -R '^agc_driver_native_(depth|multisample_depth).*$'`, `ANYPS5_GPU` selecting the device (confirmed by `Selected GPU`). In each tree one test, `agc_driver_native_depth_driver_queued_fill`, skips on Windows as on `main`: | GPU | Driver | `main` | #15688 merged | this PR merged | |---|---|---|---|---| | NVIDIA GeForce RTX 5070 Ti (`10de:2c05`) | 621.01 | 16 + 1 skip | 18 + 1 skip | 19 + 1 skip | | AMD Radeon Graphics, Ryzen 7 7700X iGPU (`1002:164e`) | AMD 26.10.2 | 16 + 1 skip | 18 + 1 skip | 19 + 1 skip | - There are no `VUID-` lines and no missing-layer line in any run. - Red check: the merged tree with only this PR's own `DepthSurface.cpp` change reversed (`git diff` of #15688's head `fa590e435a` against this head, applied in reverse) fails the new `agc_driver_native_depth_smaller_extent` on both GPUs. It fails with `a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented`, the stop the description names. - `check_conventions.py --base main` passes on the merge. Read through the change: - `sameLayoutWithin` accepts only a multisampled owner without HTILE and with `depthSwizzle` 24 that is at least as wide and tall as the target. The target, resized to the owner's extent, must be `sameSurface`. For the depth plane and for the stencil (or the depth width again when there is no separate stencil), the Z_64KB_X layout must give the same pitch, padded height and byte size at both extents, so the smaller target addresses the same bytes as the owner. - `holdsTarget` replaces `sameSurface` in the write notice, the sample-order and sample-location lookups and the feedback check. The view lookup only falls back to a `sameLayoutWithin` owner when no surface matched. - `DepthSurfaceOrderTarget` now returns the owner's extent, which matches the image it hands out. - The debt entry states what stays unimplemented. Per the requested change, the test keeps the positive reuse and per-sample readback, including bytes outside the smaller extent, and no longer asserts the refusals. I found nothing to change. AI-assisted: yes (Claude Code)
gabichuuuuu commented 2026-11-08 12:41:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T12:41:16Z.

Review: COMMENTED


Ran 75d55bd6f1 merged on main 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos validation layer 1.4.368), ctest -R '^agc_driver_native_(multisample_depth|depth_)' -V.

main change, 2 runs each
NVIDIA 20/20, no VUID- 22/22 both times, no VUID-
Intel 17/20, no VUID- 18/22 both times, 2 validation errors per run

On Intel the new agc_driver_native_depth_smaller_extent dispatches past the device limit. It reports "Passed", but each run logs this once with 104000 and once with 208000, right after its samples=2 and samples=4 cases:

Validation Error: [ VUID-vkCmdDispatch-groupCountX-00386 ]
vkCmdDispatch(): groupCountX (104000) exceeds device limit maxComputeWorkGroupCount[0] (65536).

#15688 (the branch under this one) has no validation error in the same tests on the same GPU, so the dispatch comes in with this PR's smaller-extent path. NVIDIA's limit is far higher, so the layer stays quiet there. A dispatch over the limit is undefined behaviour, so this isn't a pass on Intel. The X count needs splitting into chunks of at most maxComputeWorkGroupCount[0], or spreading over Y.

The four Intel failures are #15688's publication_without_htile plus the three that fail on main too (#16883). The layer was inserted in every test, and no log has was not found but was requested by env var VK_INSTANCE_LAYERS. #15707, which builds on this branch, shows the same two errors.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5817911298 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15690#pullrequestreview-5817911298). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T12:41:16Z. **Review:** COMMENTED --- Ran `75d55bd6f1` merged on `main` 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Khronos validation layer 1.4.368), `ctest -R '^agc_driver_native_(multisample_depth|depth_)' -V`. | | `main` | change, 2 runs each | |---|---|---| | NVIDIA | 20/20, no `VUID-` | 22/22 both times, no `VUID-` | | Intel | 17/20, no `VUID-` | 18/22 both times, 2 validation errors per run | **On Intel the new `agc_driver_native_depth_smaller_extent` dispatches past the device limit.** It reports "Passed", but each run logs this once with 104000 and once with 208000, right after its `samples=2` and `samples=4` cases: ``` Validation Error: [ VUID-vkCmdDispatch-groupCountX-00386 ] vkCmdDispatch(): groupCountX (104000) exceeds device limit maxComputeWorkGroupCount[0] (65536). ``` #15688 (the branch under this one) has no validation error in the same tests on the same GPU, so the dispatch comes in with this PR's smaller-extent path. NVIDIA's limit is far higher, so the layer stays quiet there. A dispatch over the limit is undefined behaviour, so this isn't a pass on Intel. The X count needs splitting into chunks of at most `maxComputeWorkGroupCount[0]`, or spreading over Y. The four Intel failures are #15688's `publication_without_htile` plus the three that fail on `main` too (#16883). The layer was inserted in every test, and no log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. #15707, which builds on this branch, shows the same two errors. 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!15690
No description provided.