fix(agc): import native multisample depth whose HTILE is not ITERATE_256 #6557
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6557"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T20:36:49Z.
What
Fixes #6362. The initial import of native multisample depth (
DepthSurface.cpp) refused a target whose HTILE is notITERATE_256. The import never reads compressed Z planes. It writes the HTILE clear words and the expanded samples, and neither depends onITERATE_256:radv_get_htile_fast_clear_valuebuilds the clear word from the depth value, stencil presence and VRS only.HtileMetadataBytes) has noITERATE_256input.ac_descriptors.csetsITERATE_256only for TC-compatible reads of compressed MSAA HTILE ("TC-compatible MSAA HTILE requires ITERATE_256"), which is the sampling path, not this import.The import now requires pipe-aligned HTILE without VRS, with
ITERATE_256on or off.CheckResourcestill requires the resource and the target to agree onITERATE_256, so a later sample of the same memory with a different setting is still refused. The debt entry indocs/dev/debt/libSceAgcDriver.mdnames the sources.agc_driver_native_multisample_depthnow runs every target withITERATE_256on and off (24 cases), and its mismatch case flips the bit both ways. The eligibility case that usedITERATE_256 = falseas the HTILE refusal now uses a misaligned HTILE address. Onmainthe test fails at the firstITERATE_256 = falsetarget.Next blocker for the title, not in this PR: compute shader
0x211200d000reads the depth back from guest memory and hitssample-preserving guest publication of native multisample depth is not implemented. No open PR implements it. #6498 and #6480 refuse related paths; @Gashrod1's #6297, #6300 and #6423 work on native multisample depth sampling.Tested
APS5_NO_HOST_IMPORT=1(the #6374 workaround). Before: the load stops at the #6362 refusal. After: it passes that point and stops at the next blocker above.ctest -R "agc|shader|video_out" -j 8on both GPUs. NVIDIA: all pass. AMD: the 3 tests of #5271 fail, as onmain.agc_driver_gpu_indirect_arguments_misaligned_writer_ahead(frommain) does not build with GCC/MinGW (requested alignment '65536' exceeds object file maximum 8192), so it did not run on either GPU.agc_driver_native_multisample_depth: passes on both GPUs, fails onmain.python tools/check_conventions.py --base upstream/main: passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T20:46:43Z.
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.
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-15T21:43:51Z.
Tested on Linux x86-64 (Release build, lavapipe / llvmpipe LLVM 20.1.2), with 7716b6258 merged into main
31cbb55d7:agc_driver_native_multisample_depth,agc_driver_native_depth_clears,agc_driver_native_depth_clear_refusalsandagc_driver_native_depth_retirementpass.agc_driver_native_multisample_depthfails withAGC graphics: multisample target refusal did not match sample-preserving guest publication:(the reason after the colon is empty).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Gashrod1 on 2026-10-16T08:08:54Z.
@simonbronk this overlaps with #6300 in three places:
prepareDepthSamplingeligibility line, where #6300 adds the D32S8 checks just above it;CheckDepthTargetsignature and the eligibility cases in the test;The two changes are independent, so whichever lands second has to rebase. If #6557 lands first, I'll rebase #6300 onto it.
About the Onimusha blocker: on Dave the Diver,
sample-preserving guest publication of native multisample depth is not implementedalso showed up in cases that were not real publication:Releasing the owner in those cases is on my local branch and will come as a PR. If compute shader
0x211200d000really reads the live depth back from guest memory, that is publication, and it is still not implemented. The same check on your side would tell which case Onimusha hits: whether the read range was rewritten by the CPU after the import.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-16T12:17:36Z.
@Gashrod1 agreed: the two are independent, and whichever lands second rebases. If #6300 goes first, I'll rebase this one.
On the publication stop: I checked the cases you list on the title. The first stop was an unwritten surface (only a depth-test draw with depth writes off between the import and the read), and #6727 retires it. The next one, after #6762, is a real write: a
DB_SHADER_CONTROL0x45 draw replaces the stencil of the 4-sample D32 target, and compute0x211183a700reads that memory (details in #6570). So the title needs the publication itself. Your owner-release branch is still welcome; I'll run it on the title when it's a PR.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T03:22:44Z.
Review: COMMENTED
Apple GPU / MoltenVK run. As written,
agc_driver_native_multisample_depthis skipped on macOS. With a local test-only patch it runs on Metal: it fails without the fix and passes with it.Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head
752cca10f, PR diff applied cleanly. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main + SPIRV-Cross #2704.Tested: the tree is
maina373e85e5+ mugurc's macOS series (ci/macos-series-2, includes ImportWatched) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plainmain(it doesn't build on macOS yet). #6639 and #6636 were stacked in the same build (no conflicts). Base on that tree: 40^agcfailures with MoltenVK 1.4.2 and 26 with MoltenVK main + #2704.libvulkan.so.1on everything but Windows and doesn't enableVK_KHR_portability_enumeration. On macOS it printsskipped, no usable Vulkan device: AGC graphics: cannot load Vulkan, so ctest counts it as passed with or without the fix. Even with alibvulkan.so.1symlink,vkCreateInstancereturns -9. This was already the case onmainand isn't from this PR (PresentationPass.cppandPerformanceOverlay.cppload Vulkan the same way).libvulkan.1.dylibon__APPLE__, portability enumeration on the instance, andVK_KHR_portability_subseton the device. With that patch, 16 of the 24 cases run (D16 and D32, 2x and 4x,ITERATE_256on and off). The M2 Max has no 8x depth, so the other 8 are unavailable (Native multisampled depth cases checked=16 unavailable=8).DepthSurface.cppback to the base): fails withmultisample target refusal did not match sample-preserving guest publication:, the same message coltken95 saw on lavapipe.^agcsuite with the stack: the base failures on each driver, plusagc_driver_address_draw_reusefrom #6636 (reported there).The loader fix probably belongs in a separate PR, not here.
GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704)
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.