fix(agc): refresh depth planes over compared shared memory #15058
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15058"
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 lgqdaxia on 2026-11-02T12:58:54Z.
What
When Windows direct memory becomes shared, later CPU writes may stop producing write notifications. Keep a baseline of the depth bytes, compare it in 64 KiB chunks, and reload the units that changed. Other units retain their newer GPU depth. A new baseline becomes available only after the entire depth plane has been read successfully.
Mirrors of the same depth plane now apply write-back reports in store order. Each report carries the bytes its store covered. A pending GPU report waits on the recorder that issued it, and discarding a batch drops its report. An overlapping multisampled color target stays available for a later clear.
An identical CPU store is invisible to byte comparison. A scan can span concurrent writes or remaps. CPU and GPU edits within one tracking unit are resolved at unit granularity.
Tested
Windows 11 Pro 26300, RTX 3080 Laptop, NVIDIA 621.14. The Vulkan test catches an interrupted first baseline read and retries the same bind with unchanged guest memory.
8ddf55bb32reloaded the depth plane on retry.d2928534bfleft it alone and detected a subsequent CPU write through the shared mapping. No skips or Vulkan validation errors.Earlier checks and integration notes
09830ea6b5and passed on8ddf55bb32, with no skips or Vulkan validation errors. They cover reordered CPU/GPU completion (left unit 0.25, right unit 0.75), switching logical devices with a write pending, and discarding a submission.0f107f9812passed six of nine matched cases. Two failed on the first CPU write through an alias and one on a large tracking unit.09830ea6b5passed all nine. A separate color-then-depth draw sampled and stored the newer depth on both builds.3a99781a7cpassed all three color-target memo cases. Applying only the earlier depth patch8378a3d27cmade all three fail.f4a1b94085restored the later color clear and passed all nine selected tests.8378a3d27c, with zero skips. Native Linux run and logs.2f6d40f29bpassed four of seven GPU cases.6b7ff32a11passed all seven. Nine CPU/mock cases also passed. With #20324's independent allocation counter, both graphics/profile cases counted one known DLL allocation and zero allocations across 16 warmed draws. Restoring the old depth code produced 16 allocations.286b14d2f7passed seven of eight GPU cases and failed on the alias write.5bc84c8fe6passed eight. 2026-11-03, driver 610.74. Main04a9eb4fa2had 31 passes, one expected failure and one skip.f7a4c34d44had 32 passes and the same skip. AMD review and NVIDIA/Linux results.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 BunnyFl on 2026-11-02T15:11:00Z.
Review: APPROVED
Windows 11, AMD Radeon RX 9070 XT (RDNA 4), driver 32.0.32015.7029, WinLibs GCC,
BUILD_TESTING=ON, PR merged into currentmain, withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1.agc_driver_depth_compared_sharedpasses, with 0 VUIDs.main'sDepthSurface.cpp,Texture.cppandTexture.hpprestored, it fails, with the same validation output (0 VUIDs).I didn't run the #11995 composition the PR mentions; that merge order still needs agreeing.
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T15:37:57Z.
Review: APPROVED
@lgqdaxia re-checked at
f7a4c34d44.git range-diffof my approved2f951e73e1against this head shows one code change and one new test:remainingis now also recorded inmarkedwith itsdepthMark(core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:3323), as the other branch already does (:3351).CompletionUnmap(core/libs/prx/libSceAgcDriver/tests/execution/DepthComparedShared.cpp:305), registered asagc_driver_depth_compared_shared_completion_unmap, unmaps the right depth unit inside a completion. It checks that only the left unit is stored, that its GPU depth arrives, and that the unmapped unit's guest bytes stay untouched.What I ran: head
f7a4c34d44merged ontomainb11c7bf84f, Windows 11, WinLibs GCC, Release, AMD Radeon RX 9070 XT, driver 32.0.32015.12012, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:agc_driver_depth_compared_sharedandagc_driver_depth_compared_shared_completion_unmap: 2 of 2 pass. The log has noVUID-,SYNC-HAZARDor missing-layer line. There is nomainrun to compare: the build ofmainb11c7bf84fstops withunknown target 'agc_driver_depth_compared_shared_tests', the executable this PR registers.marked.push_backlines removed,_completion_unmapfails withcompletion-deferred depth forgot the right unit's unmap notification. Mysedremoved both:3323and:3351. That shows the test needs the marking, but not which of the two branches it reaches.pr_overlap.py --branch: 68 open PRs touch the same files, none the same exports.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T18:48:54Z.
Review: COMMENTED
Reviewed — no blocking findings
The change at head
8378a3d27c0a64b0265ab9a7809ea1b9744e7573has no verified blocking defect in the reviewed code; reported Windows results are author supplied, and I did not run checks.What I ran
Read the prepared description, commit list, diff and manifest, plus changed source and test context through
repo_read.py. No commands or tests were run. Read all changed files except the added lines ofTexture.cpp, which were inspected directly in targeted ranges.Results
Texture.cppadditions not all readFindings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
The added lines of
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppwere not all read; the file was excluded from the prepared review folder for size, and only the write-back observer and write-back path ranges were read.core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppandcore/libs/prx/libSceAgcDriver/tests/execution/DepthComparedShared.cppwere read selectively, not across every added line. No tests were run; platform behavior beyond the inspected code and author-reported Windows test results remains unverified. The prepared review materials did not includefiles.json; excluded files could not be checked from that list.To get this to a good state
Nothing is required. Optional: review the remaining changed lines in
Texture.cppandDepthSurface.cpp, then run the focused tests on the target platforms.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:11:54Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing in the inspected changes blocks merging; the review is incomplete because one changed production file was excluded from the prepared folder and its changed ranges were only partially read.
What I ran
Reviewed head
f4a1b94085046d5fa1cac888bfc96099b592fd79usingrepo_read.pyreader tools. No build or tests were run. The author reports Windows 11 GPU and CPU test results in the PR description; these were not independently verified.Results
Findings
Blocking
None in the inspected code.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppwas excluded from the prepared files because it was too large. I read its relevant observer and write-back ranges through the reader, but not the full file. No build, tests, or runtime checks were performed independently. Author-reported test results were not verified.Read:
GuestMemory.hpp,GuestMemory.cpp,Texture.hpp,DepthSurface.cpp,MultisampleTarget.cpp,MappedCopy.cpp,agc_driver_depth_compared_shared_tests.cmake,CachedImageMultisampleGuard.cpp,DepthComparedShared.cpp, andfix-compared-shared-depth-refresh.md; plus the prepared description, commits, manifest, and diff.files.jsonwas unavailable through the reader; manifest indicates the excluded file above.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T07:43:20Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected change blocks merging; the reported focused tests are author-reported and were not run in this review.
What I ran
Reviewed head
1ea31966825d37f0b34781844e9704551ecd9abb. No commands or tests were run.Results
Negative control
Not run in this review. The description reports a negative control on earlier heads, not the reviewed head.
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Sources
The prepared diff and changed source files were reviewed at the pinned head. The change adds bounded depth snapshot comparisons, completion-time write-back observation, and a non-retiring observation guard.
Not verified
Read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch,GuestMemory.hpp,GuestMemory.cpp,Texture.hpp,DepthSurface.cpp,MultisampleTarget.cpp, relevantTexture.cppranges,MappedCopy.cpp,agc_driver_depth_compared_shared_tests.cmake,CachedImageMultisampleGuard.cpp,DepthComparedShared.cpp, and the debt fragment.Texture.cppwas not included in the prepared full-text files; relevant ranges were read through the repository reader.Excluded from review:
files.jsonwas not available in the reader; the tool listed the changed files and reported all as included exceptTexture.cpp, which was too large. Build and runtime behavior, including GPU/console behavior, were not independently verified. No repository-pinned permalinks were available through the reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T09:38:53Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the focused code review found no verified defect in the changed synchronization and observation paths.
What I ran
Reviewed head
09830ea6b5a6165bf35ad733e02bc110c5e0260eagainst the prepared diff. No tests or build commands were run; the test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
Texture.cppwas excluded from the prepared review files; I read the relevant changed ranges through the pinned reader. I did not read all added lines in every changed file, including the complete new depth test, mapped-copy test, CMake snippets, and debt note. No build, test, or runtime validation was performed during this review. The PR description reports passing author-run checks, which are not independently verified here.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T09:41:10Z.
Review: COMMENTED
Actionable comments posted: 2
Architecture findings (2)
Advisory architecture findings (2)
d1741537-f729-4a23-9762-0113995bd801Reviewing files that changed from the base of the PR and between
1ea3196682and09830ea6b5.core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/execution/CachedImageMultisampleGuard.cppIncluded 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-30T12:37:22Z.
Review: COMMENTED
Reviewed — comments
The inspected code has no verified blocking defect, but this review is incomplete because several changed files were not read in full and no checks were run.
What I ran
Reviewed head
8ddf55bb32e919d14488eab76ba41905ddc59d86using the prepared diff andrepo_read.py. No build or tests were run.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
Read:
GuestMemory.hpp,GuestMemory.cppdiff;Texture.hppdiff; relevantDepthSurface.cppsections; relevantMultisampleTarget.cppdiff; relevantTexture.cppwrite-back and observer sections;MappedCopy.cpplines 1–150;DepthComparedShared.cpplines 1–180; and the new depth test CMake file. The prepareddiff.patchwas read through its available contents.Not read in full:
Texture.cpp,DepthComparedShared.cpp,CachedImageMultisampleGuard.cpp, the full test changes, anddocs/dev/debt/changes/fix-compared-shared-depth-refresh.md. No build, automated test, or console test was run. The author-reported Windows test results were not independently verified.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed-file contents and run the relevant checks on this head.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T12:48:33Z.
Review: COMMENTED
Architecture findings (1)
Advisory architecture findings (1)
98a40b3d-39de-4023-b04c-28dfa04ebe4aReviewing files that changed from the base of the PR and between
09830ea6b5and8ddf55bb32.core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_compared_shared_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/DepthComparedShared.cppIncluded 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-30T13:06:58Z.
Review: COMMENTED
Reviewed — no blocking findings
The changed implementation and tests show no verified blocking defect; I could not run the checks in this review session, so a formal approval is not justified.
What I ran
Reviewed head
d2928534bf931d37fb171af00092ac6b99dbc161usingrepo_read.pyto inspect the prepared diff and changed source. No build or tests were run. The Windows Vulkan results in the PR description are author-reported, not results from this session.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and runtime behavior were not verified in this session, including the Windows Vulkan paths. The PR description reports Windows 11 and RTX 3080 Laptop GPU checks; those results were not independently confirmed here.
Reviewed all 12 changed files listed in the manifest using the prepared diff and targeted source reads.
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppwas excluded fromreview/files/because it exceeded the folder limit; I read the relevant changed source ranges throughrepo_read.py.To get this to a good state
Nothing is required. Optional: run the added Windows Vulkan and mapped-copy tests in CI before merge.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T13:10:34Z.
Review: COMMENTED
Architecture findings (2)
Advisory architecture findings (2)
a433317b-9c5e-498d-a54e-c2584fecb259Reviewing files that changed from the base of the PR and between
8ddf55bb32andd2928534bf.core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_compared_shared_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/DepthComparedShared.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:45:19Z.
Review: COMMENTED
The trial merge onto
c1601e56d5was clean. I checked the ordering of per-unit depth comparisons and the observer that waits for pending write-back reports. Retain the discarded-batch and completion-unmap tests alongside an ordinary shared-memory update. The important assertion is that a changed CPU unit refreshes without overwriting newer GPU depth in another unit. The native compared-shared behavior still needs Windows coverage; local lavapipe controls are pending.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.