fix(agc): import a native multisample D32S8 target whose stencil plane the guest stored its clear value into #13023
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13023"
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 JAB-dev on 2026-10-29T22:03:32Z.
What
Arcade Game Zone (PPSA19015) can be refused at the native multisample D32S8 import with
guest writes raced native multisample depth importalthough the separate stencil plane still holds its clear value: the guest stores the clear value over the plane while the host takes the plane, the write tracker sees a store, and the import gives up. The plane is now excluded from the write-generation check and proven by its content instead, read again after a fresh collect. A store of the clear value over the plane imports; a store of any other value is still refused with the same message. A guest that keeps storing the clear value after the import still throws at its next sample, as before.Tested
Windows 11, NVIDIA RTX 4070 SUPER, driver 610.88.
agc_driver_native_depth_separate_stencil: new cases at 2, 4 and 8 samples store the clear value into the plane during the import (imports and samples), and one stores another value (refused). The same-value case fails without the change.agc_driver_native_multisample_depthand the otheragc_driver_native_depth_*tests, andcheck_conventions.py.mainwith the open D32S8 import change) in all 37 focused tests (the VUIDs areVUID-VkDeviceCreateInfo-pNext-pNext,VUID-VkPhysicalDeviceProperties2-pNext-pNext,VUID-VkGraphicsPipelineCreateInfo-renderPass-06053andVUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, all reported by the base), and no log reportswas not found but was requested by env var VK_INSTANCE_LAYERS.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 jotitadev on 2026-10-30T23:56:03Z.
Review: COMMENTED
Linux run of head
93673d8da5, with a negative control for the new same-value case.Setup: Ubuntu 26.04, GCC 15.2, Release. RTX 3070 (NVIDIA 595.99.02) and lavapipe (Mesa 26.0.3), one at a time via
VK_DRIVER_FILES. Khronos validation layer 1.4.341,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1. The head merged--no-ffonto currentmainde96e3efbdwith no conflicts.StencilPlaneReadenum value and the one hook line, with none of the import change.agc_driver_native_depth_separate_stencilthen fails on both devices withguest writes raced native multisample depth import. So the new case does catch the refusal this PR removes.agc_driver_native_multisample_depth, theagc_driver_native_depth_*tests,multisample_retirement,depth_plane_fillanddepth_surface_from_storage. 15/15 in 3 of 3 runs on each device, 0VUID-lines.agc_driver_native_depth_driver_queued_fillruns its HTILE check here instead of skipping. On the RTX 3070 it checks 6 of 6 cases; on lavapipe it checks 4, and the 2-sample cases are unavailable.VkDeviceCreateInfo-pNext-pNextandvkCmdCopyImage-srcImage-01548/01551, which the CI already lists formain.^agcsuite (without display/flip/lds_atomics64, no layer,--timeout 60): 1136/1136 on the RTX 3070 and 1136/1136 on lavapipe.ninja allplus everyagc*_teststarget builds. GCC prints no warnings on the lines this PR adds.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux); lavapipe (Mesa 26.0.3, Linux).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:50:44Z.
Review: COMMENTED
Neutral flag: this branch is #13021's branch plus one commit (
fix(agc): import a native multisample D32S8 target whose stencil plane...); the other ~40 commits, including theorigin/pr-9533merge, are shared with #13021 and with the prerequisite series. Only the stencil-plane-clear fix is new here. Please mark which of the two should merge first and state it underDepends on, or reduce this PR to its own commit so the diff (+2398/-172) is the topic.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:37:44Z.
Review: APPROVED
Reviewed — approved
The PR's own change (
790e422437) proves the separate stencil plane by its content after a fresh collect, instead of by its write generation. It is sound, the focused tests pass, and the new same-value case fails when the old check is put back.What I ran
Head
474d5989695cd1ca836b90923e0d78d3bf299d85, merged--no-ffontomain9090972b7e91fd266819cbd77a8b058e177b5682. The merge was clean. The build tree was Release, GCC 14.2.0, Ninja,BUILD_TESTING=ON. The machine is Debian 13 (VM, 32 vCPU Xeon Gold 6136), with Vulkan through lavapipe (Mesa 26.1.6, LLVM 19) and no GPU.Results
git diff --checkcheck_conventions.pylibs(script)agc_driver_division, the denormal-mode tests,unwrap_self,vector_constant_factor_tininess) also fail onmainVUID-linesagc_driver_native_depth_bda_clear, a device limitation), all under 3 s eachagc_driver_native_depth_separate_stencilchecked=42 unavailable=21agc_driver_native_depth_publicationgit status --porcelainemptyseparate_stencil output (merged tree)
Negative control
main's production files cannot be restored as they are: the test needs theDepthPublicationStage::StencilPlaneReadhook, which this branch adds through #13021. So I put back only the import check frommain. I replaced the block after the plane read withmain'sif (!GuestMemory::UnchangedSinceAll(state.initial)) return refuse("guest writes raced native multisample depth import");. The hook and the whole test source stayed the same. After a rebuild,agc_driver_native_depth_separate_stencilfailed:I then restored the merged
DepthSurface.cppand rebuilt.separate_stencilandpublicationpassed again, and the worktree was back to the merged tree. This agrees with jotitadev's negative control and RNK123's one-expression mutation in the discussion. It is a third run of the same check, on lavapipe and GCC 14.Findings
Blocking
None.
Non-blocking
WriteChangedIfHeld,UnchangedSinceLastCollect,PublishToGuest, the publication tests and the debt entry). This PR's own topic is the 15 lines inprepareDepthSampling(core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:221-241in the merged tree) and the two newPlaneFaultcases. CnRJay already raised this, and the author answered and declaredDepends on: #13021. I mention it only so this PR is merged after #13021. I read the publication part only as far as it affects the import change; its full review belongs on #13021.debt-lengthwarning fromcheck_conventions.pyis on the "Native multisampled depth sampling" entry (docs/dev/debt/libSceAgcDriver.md:67). That entry is already far over 1000 characters onmain, and this branch only shortens it, through #13021's commit. The warning is not from this PR.Correctness of the change
UnchangedSinceAllonly when it was proven by content (provedPlane). Aliased or unproven planes keep the old generation check.CollectWritesUncached, and the plane is read again.Not verified
separate_stencilreports 21 cases unavailable on this device, so the 2- and 8-sample same-value cases may not all have run on this machine. The discussion has reports that they run on an RTX 3070 (jotitadev) and an RX 9060 XT with RADV (RNK123).Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T05:45:58Z.
Review: APPROVED
Re-checked — approved
Since my review of
474d598, the only changes are two merges ofmain:456c2ef40binto the publication branch, which resolved a conflict inVulkanDevice.cpp, andf49ecfc3bainto this branch. The resolution is correct, and the focused tests still pass. The two new failures in the script's run also happen onmain.What changed since my last review
0a3252876f…f6e7798ba9).456c2ef40bresolved a conflict incore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp.mainhad added the scratch-pool lookup (ScratchPoolFor) inrecordDispatch. The branch'sresources.RequireGuestBuffers()now comes right afterStoreDrawnLinearTouching, before the scratch-pool block.What I ran
Head
f49ecfc3ba4ef68f14e2fba312267dde8921aba0, merged--no-ffontomain5cb015caaaaf83f8ee431414ee6a457b5b307d49(merged treecf1f9afcfa321796927b3c32e6e4cd60da475eeb). Debian 13 VM, GCC 14.2.0, Release, lavapipe (Mesa 26.1.6).git diff --checkcheck_conventions.pydebt-lengthwarning as before, ondocs/dev/debt/libSceAgcDriver.md:67(already there onmain)libs(script)main(see below); 0 timeoutsVUID-linesagc_driver_native_depth_bda_clear, a device limitation)separate_stencilandpublicationafter the restoregit status --porcelainis emptyThe two failures the script lists as new do not come from this PR:
agc_driver_image_sample_lod_clamp_shader_lane. This test was added onmainbyfe18496c95, after the script's baseline096c455. With the PR's 9 production files restored frommainand the target rebuilt, it still fails with the samethread 0 component 1 is 0.000000, expected 0.062500message.unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group. This subtest is new onmaintoo, from the unwrap test split (a8090ef04e). It fails onos.chownwithEINVALin this sandbox. The PR touches nothing intools/.Previous findings
Depends onsays.DepthSurface.cppinprepareDepthSampling).debt-lengthwarning: No longer applies as a finding against this PR. The warning is unchanged, and the entry was already over the limit onmain.New findings
Blocking
None.
Non-blocking
None. In the resolved
recordDispatch,RequireGuestBuffers()still runs beforerecorder.Commands/OverlapCommandstakes the command buffer, which is what24869a37eaintends. TheScratchPoolForblockmainadded sits between the two and does not take a command buffer first.Not verified
474d598(range-diff=), so the negative control from my previous review still applies.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T06:45:09Z.
Review: APPROVED
Re-checked — approved
Since my review of
f49ecfc, the only change is a new merge ofmain. It resolves a conflict inDraw.cppwithmain's stencil-write-intent depth view (merged intomainin66749882e0). The resolution keeps both sides correctly. The checks pass, and so do the focused tests, including the stencil-plane test thatmainadded.What changed since my last review
0a3252876f…f6e7798ba9).6e2b8263c2(maind1ae628bc2into the publication branch) resolved a conflict incore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp, in two places:prepareDrawandDrawWithRecipe.mainchanged: it replacedDepthSurfaceView(...)withDepthSurfaceViewWithStencilWriteIntent(..., writesStencilTarget(state)). ItsNoteDepthSurfaceWritecall stayed right after the view.NoteDepthSurfaceWritemoved later, afterresolveDrawResourcesinprepareDrawand afterCheckBufferAliasesinDrawWithRecipe.main's new view call and keeps the branch's laterNoteDepthSurfaceWriteplacement, atDraw.cpp:3089andDraw.cpp:3879. Neither side is lost, and the call is not duplicated.writesDepthTargetalready includeswritesStencilTarget(Draw.cpp:398), so the moved call still notes stencil-only writes.4767e11930(the publication branch into this branch) carries only thatmainmerge.What I ran
Head
4767e11930a92af5cadcb224b61eef6ee22589ad, merged--no-ffontomaind1ae628bc2f62459cce1e9872ba5632c938c71f2(merged tree09053e576e99960cf70ef8fa883c4ab312eb7671). Debian 13 VM, GCC 14.2.0, Release, lavapipe (Mesa 26.1.6).git diff --checkcheck_conventions.pydebt-lengthwarning ondocs/dev/debt/libSceAgcDriver.md:67, already there onmainlibs(script)mainVUID-linesagc_driver_stencil_plane_memoryfrommainagc_driver_native_depth_bda_clear, a device limitation)git status --porcelainis emptyPrevious findings
Depends onsays.prepareDepthSamplinginDepthSurface.cppis unchanged.New findings
Blocking
None.
Non-blocking
None.
Not verified
=), and the merge changed no test of this PR. The earlier negative control still applies.f49ecfc, not this head.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:43:33Z.
Review: APPROVED
Re-checked — approved
Since
4767e11, the only change is a new merge ofmain. It resolves conflicts inGuestMemory.cppanddocs/dev/debt/libSceAgcDriver.mdand keeps both sides in each. The checks and the focused tests pass. The one newVUID-the script reports comes from a test thatmainadded, not from this PR.What changed since my last review
0a3252876f…f6e7798ba9).0180bafe62(main4f41f4c375into the publication branch) resolved two conflicts:Execution/src/GuestMemory.cpp:mainaddedWriteChanged(..., byteStoreLimit)andWriteChangedKeepingGuest, both throughwriteChanged(..., keepGuest). The branch had addedWriteChangedIfHeld. The resolution keeps all three, placed next to each other. All of the branch's other tracker changes are intact:cpuUnchanged, thewalkedparameter ofrangeUnchanged,storeOwn(..., complete)andUnchangedSinceLastCollect.git diff 4f41f4c375 4e3f9208d2on this file is exactly the branch's earlier change againstd1ae628bc2.main's callers (GuestBufferMemory.cpp:6837,GuestBufferMemory.cpp:6846) and its test (tests/Pm4.cpp:895) still reachWriteChangedKeepingGuest.main's new "Native multisampled D32S8 depth without HTILE" entry is kept atdocs/dev/debt/libSceAgcDriver.md:70.DepthSurface.cppmerged without conflicts withmain's import of D32S8 targets without HTILE. I checked how that new owner interacts with publication:sampling.initialholds two planes (DepthSurface.cpp:190), soNoteHostWritecaptures two.PublishToGuestthen throws at its explicitpublication.size() == 3ucheck (DepthSurface.cpp:2184). It fails loudly rather than mis-indexing the stencil plane as HTILE.a4cd5ea600(the publication branch into this branch) carries only that merge.What I ran
Head
a4cd5ea60044c2ea4e331a0ac99fec155d09027e, merged--no-ffontomain4f41f4c375f5abb487dbd184fbc150f31994d762(merged tree4e3f9208d2d619691bc38032ab1b3250e43bab82). Debian 13 VM, GCC 14.2.0, Release, lavapipe (Mesa 26.1.6).git diff --checkcheck_conventions.pydebt-lengthwarning ondocs/dev/debt/libSceAgcDriver.md:69(the sampling entry, whichmainalready flagged)libs(script)mainVUID-lines:agc_driver_native_depth_uniform_planes, which did not run on the baseline (see below)agc_driver_native_depth_bda_clear, a device limitation)git status --porcelainis emptyAbout the new VUID.
agc_driver_native_depth_uniform_planeswas added bymain. The script's baseline (d1ae628bc2) is older than that test, so it had nothing to compare against. When I ran the test alone with the layer, it passes and prints 8 ×VUID-vkCmdDispatch-groupCountX-00386.Message
69144 is 129 × 67 × 8. The source is the test's own fetch:
fetch.Run(batch.Handle(), extent.width * extent.height * samples)inCheckUniformPlanesWithoutHtile(tests/execution/NativeMultisampleDepth.cpp:3165-3167, and again for the stencil plane right after it).Fetch::Run(NativeMultisampleDepth.cpp:519-522) dispatches that count asgroupCountX.{129u, 67u}(NativeMultisampleDepth.cpp:3112).This PR does not touch that function. The VUID is
main's, so I do not count it against this PR. It is worth a separate fix onmain: split the dispatch, or use a 2D grid.Previous findings
Depends onsays.=), and the merge did not touchprepareDepthSampling's stencil proof.New findings
Blocking
None.
Non-blocking
main's D32S8 owners without HTILE (docs/dev/debt/libSceAgcDriver.md:68).DepthSurface.cpp:190) also throws on a guest read. Its two captured planes failpublication.size() == 3u(DepthSurface.cpp:2184).Not verified
main: CMake regeneration is not permitted in my sandbox.mainfrom the source instead. The dispatch size comes frommain's unchanged test code, which this PR does not modify.f49ecfc, not this head.