fix(agc): order driver stores over a depth plane by record order #25610
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25610"
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 sherySJ on 2026-11-22T11:33:24Z.
What
Carries https://github.com/boykopovar/AnyPS5/pull/15621 by @Astronaut10,
fix(agc): order driver stores over a depth plane by record order, onto currentmain. Astronaut10's two commits (eab4ee3ac6,db1f5844d8) and authorship are kept unchanged; the only additions are two merge commits ofmain(42120ad25c, then a clean one of314bcdbc21that touches nothing underlibSceAgcDriver) and no history was rewritten. The ask on #15621 on 2026-11-20 had no reply in 48 hours.The change: the driver's own stores over a depth plane are ordered by when their results were recorded, not by when they are stamped. Pending storage-image layers and drawn depth units carry a record order (
NextRecordOrder),KeepNewerDepthUnitsleaves the units drawn after a store was recorded, and binding or sampling a plane first stores the pending images over it. Without it, a colour image aliasing a depth plane makes every unit look guest-written and the drawn depth is replaced by the colour bytes.What the merge resolved (per-hunk notes in a comment below):
DepthSurface.hpp,Texture.hpp,DepthSurface.cpp(3 hunks) andGuestBufferMemory.cppconflicted; both sides were kept in each. InSyncFromMemory, main's #16373 backing-generation logic andstoringflag stay as they are and the PR's pending-store call runs first, before the generation is read. InMarkDirectWrites, main's trackerorder(fromMarkPossiblyWritten) and the PR's record order are separate values, so the PR's is renamedrecordOrder. The PR's debt entry moved from the debt file into the fragmentdocs/dev/debt/changes/agc-depth-plane-aliased-store.md.Credit: XairRrR approved with a two-sided control (each half of the change has a check that fails when that half is disabled); Superseabas validated on Windows with an AMD integrated GPU and an RTX 5070 Ti; cookie42073-cmd found and fixed a wrapper test that passed with the protection removed and validated on an Intel UHD 770 and an RTX 4070 SUPER; ryanc2112 validated on an RX 570; blawesom ran validation on an RX 9070 XT; MarcZX10 approved the old head.
Overlap: open https://github.com/boykopovar/AnyPS5/pull/23739 edits
SyncFromMemoryandTexture.cpp; not adapted to here.Tested
Linux only: Intel HD Graphics 520 (SKL GT2, Mesa ANV) and llvmpipe (LLVM 23.1.3), Khronos validation layer 1.4.363 inserted by the loader (
Insert instance layer "VK_LAYER_KHRONOS_validation"in every log, nowas not found but was requested),ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1. Astro Bot not tested here.Other devices: goldrake13 ran the depth families and the two half controls on Windows 11 with an RTX 4070 SUPER and an Intel UHD 770 (https://github.com/boykopovar/AnyPS5/pull/25610#issuecomment-7079608990): RTX 77 of 77 on the carry and 76 of 76 on
main, 3 of 3 rounds; UHD 770 failures are the same onmain(agc_driver_native_depth_other_identity, and the intermittentagc_driver_native_depth_publicationfrom #16883); each half control fails on both GPUs. throny ran the selectedagc_*set with the validation layer on Windows 11 with an RTX 4080 (https://github.com/boykopovar/AnyPS5/pull/25610#issuecomment-7082172971): 2059 of 2060 passed with 0VUID-messages, the same asmainon that machine; the one failure is the intermittentagc_driver_store_over_untrackedfrom #22670. Helldiverr ran the focused depth tests with the validation layer on Windows 11 with an AMD Radeon AI PRO R9700 (RDNA4, gfx1201) on this head merged ontomain0756b37503(https://github.com/boykopovar/AnyPS5/pull/25610#issuecomment-7097432641): 3 of 3 rounds pass with 0VUID-messages, the negative control and both half controls fail as on NVIDIA.agc_driver_depth_plane_*agc_driver_depth_*+agc_driver_native_depth_*VUID-mainmainFailure sets and
VUID-sets are identical (empty). The new case does not needshaderStorageImageReadWithoutFormat(it draws anR32_SFLOATcolour target); it runs inagc_driver_depth_plane_sampling_unimported, which does not skip here.Negative controls (HD 520 and llvmpipe,
agc_driver_depth_plane_sampling_unimportedfails each time, the other sampling tests pass):main's production files (with the two new functions reduced to a counter and a pass-through so the test links):D32 plane drawn after an aliasing image's results were recorded, sampled after those results were stored: texel 0 read 0x3f800000, expected 0x3e800000.KeepNewerDepthUnitsreturnsstamp()):D32 plane sampled after a GPU write recorded before its draw completed: texel 0 read 0x3e800000, expected 0x3ec00000.StorePendingImagesreturns at once): the same "sampled after those results were stored" check fails.python3 tools/check_conventions.py --base origin/mainpasses. The exact commands and results are in a comment below.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T12:00:14Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the available code supports the alias-store ordering fix, though I could not verify every changed source file.
What I ran
Reviewed head
8321321f54f6703d23fccc9bd839ba44952cd714. No tests or build commands were run. Readdescription.md,commits.md,manifest.json, anddiff.patch; read the included filesDepthSurface.hpp,GuestBufferMemory.hpp,Texture.hpp,DepthSurface.cpp, the sampling test CMake file and source, and the debt entry. Read targeted ranges of excludedGuestBufferMemory.cppandTexture.cppusingrepo_read.py.Results
Findings
Blocking
None in the code reviewed.
Non-blocking
None.
Not verified
Did not run build, tests, or the convention checker. The PR description reports Linux test runs and negative controls, but these were not independently run. Did not read the full text of
GuestBufferMemory.cpporTexture.cpp; only targeted changed ranges were read. The remaining portions of the added sampling test, platform behavior beyond the reported Linux runs, and physical-console behavior were not verified. No files were excluded by diff filtering;manifest.jsonmarksGuestBufferMemory.cppandTexture.cppas too large for the review folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T05:11:21Z.
Review: COMMENTED
Actionable comments posted: 1
Architecture findings (1)
Advisory architecture findings (1)
3e82ed74-87f4-47f5-b69d-6e60e31ba4d8Reviewing files that changed from the base of the PR and between
eb828e6fbcand0a3ca3f2e9.core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_plane_sampling_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cppdocs/dev/debt/changes/agc-depth-plane-aliased-store.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T05:13:20Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing in the inspected code shows a verified blocking defect; the reported validation is author supplied, and some changed code was not independently inspected.
What I ran
Reviewed head
0a3ca3f2e9e51bad5ab16374505cfb89fc833f41from the prepared review bundle usingrepo_read.py. No tests or builds were run.Read:
description.md,commits.md,manifest.json,diff.patch, and the changed lines 8658–8678 inGuestBufferMemory.cpp. Other changed files were not read at the repository head.files.jsonwas unavailable through the review reader; the manifest identifiesGuestBufferMemory.cppandTexture.cppas excluded because they were too large for the review folder.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
The full contents and surrounding call paths of changed
DepthSurface.hpp,GuestBufferMemory.hpp,Texture.hpp,DepthSurface.cpp,GuestBufferMemory.cpp,Texture.cpp, the test sources, and the debt entry were not independently inspected. Build, test, and hardware behavior were not verified; results in the PR description are author supplied. The reader did not exposereview/files.json, so excluded-file details are based onmanifest.jsonand the supplied diff.To get this to a good state
Nothing is required.