fix(agc): retire native multisample depth owners that guest writes replace #21719
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21719"
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 nauxph on 2026-11-16T16:44:10Z.
What
Two guest writes over a native multisample depth owner now retire it, so the next use imports its planes from guest memory again instead of throwing
guest writes over native multisample depth are not implemented:Allocation::written) over a host-written owner publishes the owner and retires it (DepthReadCause::Write). The publication is as strict as a read: a byte it cannot decide (equal to its snapshot, the host's differing, no driver store covering it) still throws, unlikeReuseandAttachment. Read-only buffers keep publishing the owner and leaving it resident, as before.GuestReplacedSincePublication, checked next to main'sPublishedUnderStorageretirement). An owner whose import took a value from a colour target over its planes is excluded and still throws, since importing it again would take the same value. Sampling such an owner as a texture still throws.A writable buffer over the depth target attached by the same draw is not handled here: a depth-writing draw then throws when its owner is retired while it resolves resources. #10497 refuses that case explicitly.
The #17915 publication test that required the refusal after guest writes during publication (
PublicationWrite::Pages,Queued,DriverSame*) now requires the new import. The debt entry records both cases; whether the console keeps the samples resident across such writes is unmeasured.This branch carries #17915 (which carries #15941) with current
mainmerged into it; this PR's change is the commitfix(agc): retire native multisample depth owners that guest writes replace(5a21f30384), and the merges are onlymain. The firstmainmerge (8504bca2bd) resolves three conflicts:PublishToGuest(DepthReadCause)beside main'sPublishedUnderStorage, main'sSurfaceGuestByteswith #17915'sDepthReadCause::Reusein the two storage-image guards, and the D32S8 debt line keeping #17915's wording with main's "D16 and HTILE D32 owners". The second (86dca243db,main0859a63ae9) resolves one, in the vertex buffer loop ofDraw.cpp: #17915'sDepthReadCause::ReuseonRequireNoMultisampleTargetwith main's newInPlaceDrawInputarguments.Related, different scope: #10497 refuses a writable buffer over a depth target attached in the same draw (this PR handles owners that are not attached); #10469 publishes and retires GPU-written D32 owners with HTILE. After the second
mainmerge,pr_overlapconfirms no line overlap; it fails closed on 70 open PRs that conflict withmainand could not be compared. #22062 conflicts as text with this PR atPublishToGuestand the debt entry; whichever lands second resolves it. None of the other open PRs it could not compare touchesrequireGuestBuffers,DepthReadCauseor the attachment retirement this PR extends. My colour follow-up on #7002 touches the same storage-image and written-buffer guards; I will rebase whichever of the two lands second.Tested
Windows 11 Pro 26200, AMD Radeon RX 9070 XT, AMD driver 26.10.44, WinLibs GCC 15.2.0 (ucrt r7), Release.
agc_driver_native_depth_publication:ReuseCase::ShaderBufferWrite(a written buffer retires the owner, the next bind imports the guest bytes),ReuseCase::GuestWriteAfterRead(a read keeps the owner, a later guest write makes the next bind import again) andReuseCase::UndecidedShaderBufferWrite(a written buffer over an undecided byte throws and keeps the owner). Without the source change the test fails withguest writes over native multisample depth are not implemented.ctest -R '^agc_' -V, same environment as below, all execution tests built) on the base and on this PR: 1913 tests each, the same 134 failures on both (they fail on this GPU and OS without this change;agc_driver_upload_cache_read_only_flushdoes not build with MinGW on either), no test that passes on the base fails here, and noVUID-line in either log.maine4caa07950+ #17915 (merge8504bca2bd) and on this PR, same machine and GPU, withANYPS5_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' -V): 53/53 on both. Both logs show the loader inserting the layer, neither haswas not found but was requested, and neither has aVUID-line. After the secondmainmerge (86dca243db), the same focused run is 53/53 again, with the layer inserted and noVUID-line.maintogether with #17915 and the #7002 colour publication: it got past both depth stops (a written compute buffer over a host-written D32 owner, then a published owner whose planes the game rewrote), from 377 s to the end of a 600 s run. On currentmain, with this PR and its colour counterpart on #7002 combined, the title stops earlier, at 61 s and 123 s in two runs, onRect-list SPIR-V: custom per-vertex interpolation is unsupported, before it reaches the depth stops; so this branch could not be exercised in game on currentmain.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 MarcZX10 on 2026-11-16T17:21:09Z.
Review: COMMENTED
Reviewed — no blocking findings
The change’s retirement paths are supported by the inspected code and regression cases, but I could not run checks in this review session, so a formal approval is not justified.
What I ran
Reviewed head
5a21f30384a5c083050d24a1993ac7683b362f43using the prepared description, commit list, manifest, diff, and pinned repository reader. No commands or tests were run.Results
Negative control
Not run in this review session. The description reports that the focused regression fails without the source change.
Findings
Blocking
None.
Non-blocking
None.
Sources
The changed implementation, tests, and debt entry were inspected at the pinned head. The full
ShaderResources.cpptext was excluded from the review bundle; its changed hunk and surrounding function were read through the repository reader.Not verified
I did not run the tests or independently verify the author-reported Windows and GPU results. Console behavior remains unmeasured according to the description. The full contents of
ShaderResources.cppwere not read.Files read at relevant changed lines:
DepthSurface.hpp,MultisampleTarget.hpp,DepthSurface.cpp,Draw.cpp,MultisampleTarget.cpp,ShaderResources.cpp,agc_driver_native_multisample_depth_tests.cmake,NativeMultisampleDepth.cpp, anddocs/dev/debt/libSceAgcDriver.md. The manifest marks onlyShaderResources.cppas excluded from the bundle because it was too large; its changed lines were read through the reader.To get this to a good state
Nothing is required. Optional: run the focused native multisample depth tests on the reviewed head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T13:18:48Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
86dca243db(base main).No build and no test was run here.
Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:1433:GuestReplacedSincePublicationonly compares the planes with the activation snapshot (sampling.initial). It does not require that a publication happened. The description and the debt entry say "kept after its publication". An owner that was activated and then written by the guest, without ever being published, is retired at its next attachment bind (DepthSurface.cpp:4074). That is wider than the description. The new tests inNativeMultisampleDepth.cppdo not cover this case.core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:1437:CollectWritesruns over the whole sampling range on every attachment bind that finds an existing owner (DepthSurface.cpp:4074). The cost is not measured.Sources
Not verified
GuestMemory::UnchangedSinceAllandCollectWriteswere not read, so the same-value store cases were not checked against their implementation.ShaderResources.cppis too large for the review folder. Only the changed line 7381 was read at head. Lines 1531 and 1930 were seen only in diff.patch.DepthSurface.cpp,Draw.cppandMultisampleTarget.cppwere read at their changed hunks and the ranges above, not as whole files.MultisampleTarget.hppnow includesDepthSurface.hpp. The direct includes ofDepthSurface.hppwere checked. Transitive includes were not, so an include cycle was not ruled out.To get this to a good state
Nothing is required.
Optional: confirm whether the
GuestReplacedSincePublicationretirement is meant to cover owners that were never published (first Non-blocking item), and consider a test for that case.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:15:40Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the available evidence supports merging, though the changed shader resource source was not included in the review bundle.
What I ran
Inspected the prepared diff and targeted sources at head
5e2c18041055ca59a715fc9ac8a4ce95dab2ba89usingrepo_read.py. No tests or builds were run.Results
Findings
Blocking
None in the reviewed code.
Non-blocking
None.
Not verified
ShaderResources.cppwas excluded from the review bundle; only therequireGuestBuffersfunction range was read throughrepo_read.py. The rest of that changed file and the full execution test file were not read. No tests, builds, console behavior, or author-reported results were independently verified.To get this to a good state
Nothing is required.