Skip to content

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

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
arthur-paraibano:fix/agc-import-native-d32-depth-without-htile
Nov 16, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
arthur-paraibano:fix/agc-import-native-d32-depth-without-htile

Conversation

@arthur-paraibano

@arthur-paraibano arthur-paraibano commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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 (6786420) 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 (f59a4a6), 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 (AGC: native multisample D32 depth without stencil or HTILE over an uneven plane is refused at its first sample (Aphelion PPSA13446) #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 feat(agc): snapshot resident multisample color bytes #6987-feat(agc): publish native color for read-only shader buffers #7002 stack addresses.

Checklist

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Ran the new agc_driver_native_multisample_depth test on Linux across three AMD RADV generations (head d06b8b146e, ANYPS5_NO_SHADER_CACHE=1, Khronos validation layer 1.4.363):

GPU arch agc_driver_native_multisample_depth VUID-
RX Vega 56 (VEGA10) GCN5 pass 0
Radeon 680M (gfx1036) RDNA2 pass 0
RX 7900 GRE (NAVI31) RDNA3 pass 0

Clean on real AMD hardware across all three gens, 0 VUID- validation errors. (CI's lavapipe run doesn't cover the RADV import path this touches, so this is the real-AMD-HW datapoint.)

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Windows check of head d06b8b146e, merged onto main 54b04ddae7. Setup: Windows 11 Enterprise 22621, MinGW-w64 GCC 15.2 UCRT, Release.

The merge with current main does not compile, so no tests ran:

core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp:266:9: error: 'recording' was not declared in this scope

This is a semantic conflict with #16752 (54b04ddae7, suppress redundant graphics pipeline and dynamic state commands), merged just before this run:

  • main after perf(agc): suppress redundant graphics pipeline and dynamic state commands #16752: routes SampleOrder.cpp's depth path through a CommandState& recording parameter, with calls such as recording.SetViewport, recording.SetScissor and recording.BindPipeline.
  • This PR: written against the earlier file. Git merges the text cleanly, but main's recording. calls end up in code where this PR no longer has a recording in scope.

A rebase onto main that adapts the PR's SampleOrder.cpp changes to the CommandState interface should resolve it.

AI-assisted: yes.

@github-actions github-actions Bot added fix error Closes an issue (Fixes #N) unblocks title Names a title ID on the Unblocks line labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp L219-228
PR 10469 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L1953, L2978-2980, L3015, L3019
PR 10492 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L1953, L2978-2980, L3015, L3019
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake L59
PR 10497 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L1953, L2978-2980, L3015, L3019
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake L59
PR 16880 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L1018-1021, L1953, L2978-2980, L3015, L3019

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7002 docs/dev/debt/libSceAgcDriver.md
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7449 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/SampleOrder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 9335 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9950 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10049 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 10743 docs/dev/debt/libSceAgcDriver.md
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 11825 docs/dev/debt/libSceAgcDriver.md
PR 12904 docs/dev/debt/libSceAgcDriver.md
PR 13809 docs/dev/debt/libSceAgcDriver.md
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/SampleOrder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13963 docs/dev/debt/libSceAgcDriver.md
PR 14944 docs/dev/debt/libSceAgcDriver.md
PR 15456 docs/dev/debt/libSceAgcDriver.md
PR 15529 docs/dev/debt/libSceAgcDriver.md
PR 15548 docs/dev/debt/libSceAgcDriver.md
PR 15621 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 16260 docs/dev/debt/libSceAgcDriver.md
PR 16368 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 16483 docs/dev/debt/libSceAgcDriver.md
PR 17611 docs/dev/debt/libSceAgcDriver.md
PR 17899 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 17915 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 17956 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 18057 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 18185 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 18515 docs/dev/debt/libSceAgcDriver.md
PR 20041 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 20156 docs/dev/debt/libSceAgcDriver.md
PR 20186 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
docs/dev/debt/libSceAgcDriver.md
PR 20187 docs/dev/debt/libSceAgcDriver.md
PR 20315 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp

@Doorriiaann

Copy link
Copy Markdown
Contributor

An NVIDIA run of the head as it is (not merged with current main, which JJenkx found does not compile), next to the AMD runs: RTX 3070 (8 GB), NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13, kernel 6.12.115, GCC 13.3.0 Release, validation layer 1.4.335, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -R 'native_multisample_depth|native_depth' -V, 3 runs each.

merge-base fdeac00 this PR d06b8b1
native depth tests 28, all passed 3/3 30, all passed 3/3: the same 28 and agc_driver_native_depth_bare_publication, agc_driver_native_depth_uneven_plane
VUID- lines / layer not found 0 / 0 0 / 0

Negative control: this PR's NativeMultisampleDepth.cpp and agc_driver_native_multisample_depth_tests.cmake on the merge-base, 3 runs: agc_driver_native_depth_bare_publication fails 3/3 with AGC graphics: a written D32 owner without stencil or HTILE did not publish its samples and padding, agc_driver_native_depth_uneven_plane with AGC graphics: native multisample depth initial import requires pipe-aligned or depth-only HTILE without VRS, and the other 28 pass.

AI-assisted: yes

arthur-paraibano and others added 2 commits November 14, 2026 15:44
…ncil or HTILE

A native multisampled D32_SFLOAT target with no stencil plane and no
HTILE was refused at its first sample, because only D32S8 targets
reached the path without HTILE.

Route it to a depth-plane path with the same layout, alias, guard,
generation and race checks. A plane that repeats one float in [0, 1]
is cleared to it; any other plane is detiled from Z_64KB_X, uploaded
into an R32 multisampled image and written into the depth aspect by
the SampleOrder depth pass, so the import does not need
VK_KHR_maintenance8. Planes with a sample FragDepth cannot store
exactly, and devices without the needed features, still throw.

A written owner of this kind now publishes its depth plane on a guest
read through the D32S8 publication path.

Fixes boykopovar#18127

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for bit

A native multisampled D32 depth target without stencil or HTILE whose
plane holds NaN, infinities, denormals, -0 or floats outside [0, 1] was
refused at its first sample, because FragDepth cannot store such words.
Reused guest memory leaves exactly these words behind (fill patterns
such as 0x7fff7fff and 0xffffffff).

With VK_KHR_maintenance8 and VK_EXT_depth_range_unrestricted, such a
plane is now detiled into a multisampled R32 float image and copied into
the depth aspect with vkCmdCopyImage. Planes of +0 and normal floats in
(0, 1] keep the FragDepth draw; devices without both extensions still
throw. The kept bits are measured per device and recorded in the debt
entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arthur-paraibano
arthur-paraibano force-pushed the fix/agc-import-native-d32-depth-without-htile branch from d06b8b1 to 5b659cf Compare November 14, 2026 19:24
@arthur-paraibano

Copy link
Copy Markdown
Contributor Author

Thanks for the runs on RADV and NVIDIA.

@JJenkx: rebased onto main 6786420207 and adapted the depth sample import to the CommandState interface from #16752. RecordDepthSampleImport and the SampleOrder import pass now take a CommandState&, and the DepthSurface caller passes the recorder's GraphicsState(), or a local CommandState for a standalone batch, so the dynamic-state tracking stays correct for the draws that follow. Each commit builds on its own.

Focused tests with the validation layer on the same machine and GPU (RX 9070 XT): main 46/47, this PR 48/49, no VUID- in either log; the one failure, agc_driver_sample_order_grid_reference, fails the same way on main on this GPU.

Overlap: #10469 (carried by #10492 and #10497) also widens capturePublication and PublishToGuest beyond D32S8, for D32 with HTILE; this PR does it for D32 without stencil or HTILE. The lines conflict but the cases are disjoint, so whichever is merged second needs both conditions. @Ondra97, happy to rebase this one onto yours if it goes first.

AI-assisted: yes.

@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 14, 2026
@ghost

ghost commented Nov 14, 2026 •

Copy link
Copy Markdown

Windows + NVIDIA run of head 5b659cf3c1, merged with git merge --no-ff onto main ee25ae607b (clean merge).

Setup: Windows 11 Pro, NVIDIA GeForce RTX 5070 Ti, driver 621.01, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON, ANYPS5_REQUIRE_VULKAN=1. Both sides carry the diff of #19899, without which main does not compile on MinGW. The FPS Monitor implicit layer is disabled with DISABLE_LAYER=1 (#20011); VK_LAYER_NV_optimus, VK_LAYER_NV_present and VK_LAYER_RTSS stay loaded.

main ee25ae607b this PR
build completes completes
focused tests (the two new ones, agc_driver_native_depth_bare_publication and agc_driver_native_depth_uneven_plane, and the eight the description names: agc_driver_native_multisample_depth, agc_driver_native_msaa_vertex_input, agc_driver_cached_image_multisample_guard, agc_driver_multisample_fill_host_only, agc_driver_multisample_srgb_twin, agc_driver_sample_multisample_target, agc_driver_sample_order, agc_driver_sample_order_grid_reference) the eight existing ones pass 9 pass in 3 of 3 serial runs; agc_driver_sample_order_grid_reference skips on both sides ("the device does not keep depth drawn at custom sample locations at those locations")
same tests with ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363), VK_LOADER_DEBUG=layer, ctest -V the eight existing ones pass or skip as above, layer inserted, 0 VUID- lines same results, layer inserted, 0 VUID- lines
ctest -R '^(agc|shader|video_out|guest_video_out)' -j 12 0 failed 1836 tests, 0 failed, 20 skipped

On main the whole suite (5610 tests) passes on this machine with the same environment.

AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit 769d303 into boykopovar:main Nov 16, 2026
2 of 4 checks passed
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 16, 2026
oneandonlydean pushed a commit that referenced this pull request Nov 19, 2026
Keeps both edits to the native D32S8 guest publication debt entry: this branch's wording, with main's D16 and HTILE D32 owners from #19846.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs fix error Closes an issue (Fixes #N) unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: native multisample D32 depth without stencil or HTILE over an uneven plane is refused at its first sample (Aphelion PPSA13446)

5 participants