fix(agc): import native multisample D32 depth without stencil or HTILE #19846

Merged
arthur-paraibano merged 2 commits from upstream-pr/19846 into main 2026-11-16 06:27:39 +00:00
arthur-paraibano commented 2026-11-14 02:52:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by arthur-paraibano on 2026-11-14T02:52:48Z.


What

A native multisampled D32_SFLOAT depth target with no stencil plane and no HTILE was refused at its first sample (#18127): only D32S8 targets reached the import path without HTILE, and an uneven plane hit the HTILE refusal.

  • Such a target now goes through the depth-plane path of the D32S8 target without HTILE, with the same layout, alias, guard, generation and race checks.
  • A plane that repeats one float in [0, 1] is cleared to it.
  • A plane of +0 and normal floats in (0, 1] is detiled from Z_64KB_X into a multisampled R32 float image and written into the depth aspect by the SampleOrder depth pass (FragDepth, sample shading), so it needs no VK_KHR_maintenance8.
  • Any other plane (NaN, infinities, denormals, -0, floats outside [0, 1], as reused memory leaves behind, e.g. fill patterns 0x7fff7fff and 0xffffffff) is copied bit for bit from the R32 image into the depth aspect with vkCmdCopyImage, through VK_KHR_maintenance8 and VK_EXT_depth_range_unrestricted. Without both it still throws.
  • A written owner of this kind publishes its depth plane on a guest read through the D32S8 publication path.
  • Debt entries record what is inferred (fragment order) and the bits measured as kept by the copy.

Tested

Windows 11, AMD Radeon RX 9070 XT, AMD driver 26.10.44, WinLibs GCC 15.2.0.

  • New and updated execution tests in NativeMultisampleDepth.cpp cover an uneven 4x D32 plane without HTILE (distinct words per sample read back), its publication, and planes holding NaN, infinities, denormals, -0 and out-of-range floats copied bit for bit.
  • Focused AGC tests on main (6786420207) and on this PR, same machine and GPU, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer (ctest -R 'agc_driver_native_color|agc_driver_native_fmask|agc_driver_native_msaa_vertex_input|agc_driver_sample_multisample_target|agc_driver_multisample_srgb_twin|agc_driver_cached_image_multisample_guard|agc_driver_native_depth|agc_driver_native_multisample_depth$|agc_driver_multisample_fill_host_only|agc_driver_sample_order'): main 46/47, this PR 48/49 (the two new tests pass). Both logs show the loader inserting the layer, neither has was not found but was requested, and neither has a VUID- error. The one failure, agc_driver_sample_order_grid_reference, fails the same way on main on this GPU.
  • PPSA13446 (Aphelion), tested with these two commits on an earlier main (f59a4a6e26), together with a separate queue-idle storage store fix that avoids an engine timeout: without them it stops at the first sample of the 4x D32 target without HTILE (#18127); with them it gets past it into gameplay, saves several times and runs about 300 s, then stops on a native multisample colour read-write buffer refusal that the open #6987-#7002 stack addresses.

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: Fixes #18127
  • Unblocks: PPSA13446 #18128
  • GPUs tested: AMD Radeon RX 9070 XT (gfx1201), AMD proprietary driver 26.10.44, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5306418698 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19846). Originally posted by [arthur-paraibano](https://github.com/arthur-paraibano) on 2026-11-14T02:52:48Z. --- ### What A native multisampled `D32_SFLOAT` depth target with no stencil plane and no HTILE was refused at its first sample (#18127): only D32S8 targets reached the import path without HTILE, and an uneven plane hit the HTILE refusal. - Such a target now goes through the depth-plane path of the D32S8 target without HTILE, with the same layout, alias, guard, generation and race checks. - A plane that repeats one float in [0, 1] is cleared to it. - A plane of +0 and normal floats in (0, 1] is detiled from Z_64KB_X into a multisampled R32 float image and written into the depth aspect by the SampleOrder depth pass (`FragDepth`, sample shading), so it needs no `VK_KHR_maintenance8`. - Any other plane (NaN, infinities, denormals, -0, floats outside [0, 1], as reused memory leaves behind, e.g. fill patterns `0x7fff7fff` and `0xffffffff`) is copied bit for bit from the R32 image into the depth aspect with `vkCmdCopyImage`, through `VK_KHR_maintenance8` and `VK_EXT_depth_range_unrestricted`. Without both it still throws. - A written owner of this kind publishes its depth plane on a guest read through the D32S8 publication path. - Debt entries record what is inferred (fragment order) and the bits measured as kept by the copy. ### Tested Windows 11, AMD Radeon RX 9070 XT, AMD driver 26.10.44, WinLibs GCC 15.2.0. - New and updated execution tests in `NativeMultisampleDepth.cpp` cover an uneven 4x D32 plane without HTILE (distinct words per sample read back), its publication, and planes holding NaN, infinities, denormals, -0 and out-of-range floats copied bit for bit. - Focused AGC tests on `main` (6786420207) and on this PR, same machine and GPU, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer` (`ctest -R 'agc_driver_native_color|agc_driver_native_fmask|agc_driver_native_msaa_vertex_input|agc_driver_sample_multisample_target|agc_driver_multisample_srgb_twin|agc_driver_cached_image_multisample_guard|agc_driver_native_depth|agc_driver_native_multisample_depth$|agc_driver_multisample_fill_host_only|agc_driver_sample_order'`): `main` 46/47, this PR 48/49 (the two new tests pass). Both logs show the loader inserting the layer, neither has `was not found but was requested`, and neither has a `VUID-` error. The one failure, `agc_driver_sample_order_grid_reference`, fails the same way on `main` on this GPU. - PPSA13446 (Aphelion), tested with these two commits on an earlier `main` (f59a4a6e26), together with a separate queue-idle storage store fix that avoids an engine timeout: without them it stops at the first sample of the 4x D32 target without HTILE (#18127); with them it gets past it into gameplay, saves several times and runs about 300 s, then stops on a native multisample colour read-write buffer refusal that the open #6987-#7002 stack addresses. ### 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: Fixes #18127 - [x] Unblocks: PPSA13446 #18128 - [x] GPUs tested: AMD Radeon RX 9070 XT (gfx1201), AMD proprietary driver 26.10.44, Windows 11 - [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!19846
No description provided.