feat(agc): publish a written native multisample D32 owner without stencil #16501

Closed
JJenkx wants to merge 1 commit from upstream-pr/16501 into main
JJenkx commented 2026-11-06 22:58:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-06T22:58:38Z.


What

#13021 publishes a host-written native multisample D32S8 owner to its guest planes when the guest reads them. A native owner without stencil (VK_FORMAT_D32_SFLOAT) is imported and guarded the same way, but PublishToGuest refused it: a guest read of a host-written D32 owner threw sample-preserving guest publication of native multisample depth is not implemented for this owner.

This publishes a D32 owner whose HTILE is depth-only, through the same path, without a stencil plane:

  • Capture: NoteHostWrite captures the owner's planes (depth and HTILE) when the host first writes it, as for D32S8.
  • Publication: PublishToGuest accepts a D32 owner with two planes. It reads back and retiles only the depth plane (plane 2, the stencil plane, only when present). HTILE is stored expanded with the depth aspect only. That gives the same depth-only word, 0xfffc000f, that a D32S8 owner with a separate stencil plane already gets.
  • Sample shadow: the shadow refresh before the readback no longer copies a stencil aspect for a D32 owner. With it, the copy was invalid (VUID-vkCmdCopyImage-aspectMask-00142/00143) and the published samples were wrong.

Still refused, unchanged: D16 owners, and D32 owners whose HTILE keeps stencil fields. I don't know what the console leaves in those stencil fields when there is no stencil. CheckDrawFeedback keeps covering that refusal. The libSceAgcDriver debt entry is updated.

Tested

Arch Linux 7.2.11, Ryzen 9 7950X, RX 6650 XT (RADV Mesa 26.2.6), GCC 16.2.1, Release, on main 1080643b1e. Tests ran with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and Khronos validation 1.4.363 loaded; VK_LOADER_DEBUG=layer's Insert instance layer lines confirm it.

New check, CheckDepthOnlyPublication in agc_driver_native_depth_publication, at 2, 4 and 8 samples:

  1. A D32 4x/2x/8x target with a depth-only HTILE and no stencil, depth bytes pre-filled with 0xa5. A draw writes 0.25 + (sample + 1) / 16 per sample.
  2. A guest read publishes. Every depth sample must be at its Z_X offset, padding must keep 0xa5, every HTILE word must be 0xfffc000f, and the owner must stay resident with the same view.
  3. A second draw at 0.5 and a second read must publish again.

Results, ctest -R 'native_depth|native_multisample|depth_publication|write_track|guest_memory|multisample', 52 tests:

  • This change: 52 of 52 pass, three repeats (--repeat until-fail:3), with no VUID- messages. agc_driver_guest_memory_lifetime_converted (needs the relinker and its fixture module) was run separately, three of three.
  • Red check: the same tree with only DepthSurface.cpp restored from main fails agc_driver_native_depth_publication on the refusal above. Everything else passes.

Independent runs on other GPUs (both on head b43c96c27b, without the validation layer):

  • @Ethan-Hainline (comment): Windows 11, Radeon Vega (GCN), AMD driver 31.0.21924.4004. agc_driver_native_depth_publication passes 3 of 3, and each run checks 2, 4 and 8 samples.
  • @milescoviello (comment): Windows 11, GeForce GT 1030 (Pascal), NVIDIA 582.78. The native depth tests give the same result at the merge base and at this head: 16 of 18 pass in each of 3 runs, with the same skip and one test not built on both sides. agc_driver_native_depth_publication, with the new check, passes 3 of 3.

A title, Resident Evil Village (PPSA01556, #5169), 01.210.000, APS5_PLAYGO_UNLISTED_CHUNKS=installed. Inputs: Cross at 30 and 40 s, Up at 48 s, Cross at 52 s, then Cross every 12 s, which answers "Play in VR Mode?" with No.

  • On main: it stops at 78 s on this refusal, from a compute shader reading a 128x64 4x D32 owner with a depth-only HTILE and no stencil.
  • With this change: that read publishes, and the title stops at the same point in its log on the next check in that path, external GPU writes over native multisample depth are not implemented. With #15941 also merged, the stop is the same.

So this does not unblock the title on its own.

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 (D32S8 without HTILE) edits the same Require line in PublishToGuest; whichever lands second needs a one-line merge.
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.6, Arch Linux 7.2.11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5195900837 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16501). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-06T22:58:38Z. --- ### What #13021 publishes a host-written native multisample D32S8 owner to its guest planes when the guest reads them. A native owner without stencil (`VK_FORMAT_D32_SFLOAT`) is imported and guarded the same way, but `PublishToGuest` refused it: a guest read of a host-written D32 owner threw `sample-preserving guest publication of native multisample depth is not implemented for this owner`. This publishes a D32 owner whose HTILE is depth-only, through the same path, without a stencil plane: - **Capture:** `NoteHostWrite` captures the owner's planes (depth and HTILE) when the host first writes it, as for D32S8. - **Publication:** `PublishToGuest` accepts a D32 owner with two planes. It reads back and retiles only the depth plane (plane 2, the stencil plane, only when present). HTILE is stored expanded with the depth aspect only. That gives the same depth-only word, `0xfffc000f`, that a D32S8 owner with a separate stencil plane already gets. - **Sample shadow:** the shadow refresh before the readback no longer copies a stencil aspect for a D32 owner. With it, the copy was invalid (`VUID-vkCmdCopyImage-aspectMask-00142`/`00143`) and the published samples were wrong. Still refused, unchanged: D16 owners, and D32 owners whose HTILE keeps stencil fields. I don't know what the console leaves in those stencil fields when there is no stencil. `CheckDrawFeedback` keeps covering that refusal. The `libSceAgcDriver` debt entry is updated. ### Tested Arch Linux 7.2.11, Ryzen 9 7950X, RX 6650 XT (RADV Mesa 26.2.6), GCC 16.2.1, Release, on `main` `1080643b1e`. Tests ran with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1` and Khronos validation 1.4.363 loaded; `VK_LOADER_DEBUG=layer`'s `Insert instance layer` lines confirm it. **New check,** `CheckDepthOnlyPublication` in `agc_driver_native_depth_publication`, at 2, 4 and 8 samples: 1. A D32 4x/2x/8x target with a depth-only HTILE and no stencil, depth bytes pre-filled with `0xa5`. A draw writes `0.25 + (sample + 1) / 16` per sample. 2. A guest read publishes. Every depth sample must be at its Z_X offset, padding must keep `0xa5`, every HTILE word must be `0xfffc000f`, and the owner must stay resident with the same view. 3. A second draw at `0.5` and a second read must publish again. **Results**, `ctest -R 'native_depth|native_multisample|depth_publication|write_track|guest_memory|multisample'`, 52 tests: - **This change:** 52 of 52 pass, three repeats (`--repeat until-fail:3`), with no `VUID-` messages. `agc_driver_guest_memory_lifetime_converted` (needs the relinker and its fixture module) was run separately, three of three. - **Red check:** the same tree with only `DepthSurface.cpp` restored from `main` fails `agc_driver_native_depth_publication` on the refusal above. Everything else passes. **Independent runs on other GPUs** (both on head `b43c96c27b`, without the validation layer): - @Ethan-Hainline ([comment](https://github.com/boykopovar/AnyPS5/pull/16501#issuecomment-6700296226)): Windows 11, Radeon Vega (GCN), AMD driver 31.0.21924.4004. `agc_driver_native_depth_publication` passes 3 of 3, and each run checks 2, 4 and 8 samples. - @milescoviello ([comment](https://github.com/boykopovar/AnyPS5/pull/16501#issuecomment-6701085752)): Windows 11, GeForce GT 1030 (Pascal), NVIDIA 582.78. The native depth tests give the same result at the merge base and at this head: 16 of 18 pass in each of 3 runs, with the same skip and one test not built on both sides. `agc_driver_native_depth_publication`, with the new check, passes 3 of 3. **A title,** Resident Evil Village (PPSA01556, #5169), 01.210.000, `APS5_PLAYGO_UNLISTED_CHUNKS=installed`. Inputs: Cross at 30 and 40 s, Up at 48 s, Cross at 52 s, then Cross every 12 s, which answers "Play in VR Mode?" with No. - **On `main`:** it stops at 78 s on this refusal, from a compute shader reading a 128x64 4x D32 owner with a depth-only HTILE and no stencil. - **With this change:** that read publishes, and the title stops at the same point in its log on the next check in that path, `external GPU writes over native multisample depth are not implemented`. With #15941 also merged, the stop is the same. So this does not unblock the title on its own. ### 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. #15688 (D32S8 without HTILE) edits the same `Require` line in `PublishToGuest`; whichever lands second needs a one-line merge. - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.6, Arch Linux 7.2.11 - [x] AI-assisted: yes
gabichuuuuu commented 2026-11-08 14:46:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T14:46:32Z.

Review: COMMENTED


Ran b43c96c27b 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 main + only this PR's NativeMultisampleDepth.cpp diff change, 2 runs each
NVIDIA 20/20 19/20 20/20
Intel 17/20 17/20 17/20
  • On NVIDIA, without the DepthSurface.cpp change, the new case makes agc_driver_native_depth_publication fail with "sample-preserving guest publication of native multisample depth is not implemented for this owner". With it, the test passes both times.
  • On the Intel iGPU, agc_driver_native_depth_publication (with stencil_view and uniform_planes) already fails on main (#16883), so Intel can't show the fix. The same three fail with the change, and nothing new fails there.
  • The middle column applies only this PR's diff to the test file. NativeMultisampleDepth.cpp gained 196 lines on main since the branch point.
  • The layer was inserted in every test. No log has was not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has a VUID-. To be sure validation messages reach these logs, the same layer with best practices on printed 28 BestPractices- warnings into an agc_driver_recorder log on each GPU.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5818315065 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16501#pullrequestreview-5818315065). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T14:46:32Z. **Review:** COMMENTED --- Ran `b43c96c27b` 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` | `main` + only this PR's `NativeMultisampleDepth.cpp` diff | change, 2 runs each | |---|---|---|---| | NVIDIA | 20/20 | 19/20 | 20/20 | | Intel | 17/20 | 17/20 | 17/20 | - On NVIDIA, without the `DepthSurface.cpp` change, the new case makes `agc_driver_native_depth_publication` fail with "sample-preserving guest publication of native multisample depth is not implemented for this owner". With it, the test passes both times. - On the Intel iGPU, `agc_driver_native_depth_publication` (with `stencil_view` and `uniform_planes`) already fails on `main` (#16883), so Intel can't show the fix. The same three fail with the change, and nothing new fails there. - The middle column applies only this PR's diff to the test file. `NativeMultisampleDepth.cpp` gained 196 lines on `main` since the branch point. - The layer was inserted in every test. No log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and no log on either side has a `VUID-`. To be sure validation messages reach these logs, the same layer with best practices on printed 28 `BestPractices-` warnings into an `agc_driver_recorder` log on each GPU. AI-assisted: yes.

Pull request closed

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!16501
No description provided.