fix(agc): refuse writable buffer feedback with native depth #10497
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10497"
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 Ondra97 on 2026-10-24T04:29:20Z.
What
A declared writable shader buffer overlapping a native multisample depth attachment's depth, stencil or HTILE is refused before pipeline creation or recording. The attachment check runs before noting a depth write and after draw resources are rebuilt. Sampled-native-depth overlap is checked before either guest-publication pass can retire the native identity; deferred image records remain available through the final stage-B check. Dynamically addressed BDA stores remain outside these declared-range checks.
The November 17 refresh integrated main
0859a63ae9fd0a311c7fb74dd49f2692a3f1c2e8, #10469 atdf36ea58024006c8bfd006b87c533e3a7a8bda8dand #10492 at66a2da10bc1880d167b1da20825a5b432f27460a. All three exact heads and the previous published #10497 head remain ancestors; published history is preserved. The carried #10492 update includes its transfer-write barrier for repeated staging writes.Main already includes #19846's bare-D32 path. Bare D32 retains its owner; D32 with HTILE retires only after both planes commit. Main's D32S8 publication/retention, overwritten-plane and alias proofs, allocation/snapshot checks, repeat-draw behavior and new native-depth test registrations are retained. Shared prerequisite debt fragments replace the duplicated inherited entries. The four reviewed HTILE-clear assertions retain their explicit D32 diagnostics and existing D32 guards; D16 publication remains refused.
The established prerequisite order remains #9950 -> (#10469/#10492) -> #10497 -> #7002 (existing #7002 agreement). #19846 is merged and no longer needs an order decision. The #15941 author accepts either order; whichever lands second must preserve both D32-with-HTILE retirement and its separate guest-byte-dependent reuse policy, including bare-D32 retention. #20186's earlier fixture overlap is an adjacent discarded-clear insertion. Draft #20315's proof-shortcut coordination remains unconfirmed. This refresh does not claim a complete new all-PR overlap scan or qualify the foreign colour/reuse/proof stacks.
The separate resource-build stage-A/GpuMutex lock-order question remains outstanding. This refresh preserves that code and does not establish concurrent deadlock safety.
The November 19 sync integrates main
b68affac18ca39391a3800d5cb51735d085c014dand carries the exact updated #10469 and #10492 heads2ade1d253ee1505300c4dcf2f01bd128cba20276and804659939aebb28904cbc3e64146b33c4d6b364e. Both prerequisite merges retained this branch's existing combined test fixture. Main includes #15941, and its reuse rule is retained alongside D32 HTILE retirement after both planes commit.Tested
November 19 Windows Release validation compared head
dd491492ea7735b4c3a8d5931a3c6e78bd4c6e3fwith the exactb68affac18ca39391a3800d5cb51735d085c014dmain build and run also used for #10492. The full runtime build and all 31 common Vulkan CTests passed on both revisions. The five publication and buffer feedback CTests passed on this head. All selected CTests confirmed the NVIDIA RTX 4070 Ti SUPER (driver 621.24) and inserted Khronos validation 1.4.335. No VUID or synchronization hazard was logged. Two internal HTILE write-coverage assertions skipped on each revision. The focused serial runs leave the separate concurrent stage-A lock-order question open. Earlier results below retain their original revisions.November 17, 2026 (Europe/Prague): submitted source
7a318d5d26135835bee7ba087987da37f266c05e, paired with main0859a63ae9fd0a311c7fb74dd49f2692a3f1c2e8. Each revision is checked out cleanly in the task's isolated source worktree and configured/built in the same exclusively owned full-runtime build root before testing. The main run precedes the final candidate rebuild/run. Selected executables and runtime/staging libraries are hashed before and after each run; dependencies use verified clean checkouts at every exact pinned submodule revision.Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X; 31.66 GiB RAM; NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24. WinLibs GCC 15.2.0 UCRT POSIX SEH r7, CMake 4.3.1, Ninja 1.13.2 and native Python 3.14.7. Both Release full-runtime configurations enable
BUILD_TESTINGand SPIRV-Tools. The relinker, all libraries and the four focused fixture targets build successfully. Top-level builds use three compiler jobs and nested builds one; build arms and GPU runs are serial.One serial iteration per revision uses the same native-depth/sample-target/graphics selection. The candidate additionally registers its five publication/feedback cases. The pass counts include the host-only
agc_driver_graphicsmock fixture. Every Vulkan fixture shows the loader inserting Khronos validation 1.4.335; no requested layer is missing. The runs require Vulkan, disable normal shader caches, enableAPS5_VERIFY_SHAPE_MEMO=1and synchronization validation, and select the RTX 4070 Ti SUPER. This is synthetic runtime/GPU coverage, not a title or console run.The explicit skip in each arm is
agc_driver_native_depth_driver_queued_fill, because compared host imports do not retain the write-watch proof. There are also 2 partial HTILE subcase skips in main and 2 in the candidate inside passing clear tests. Those omit positive imported-HTILE tracked-store/completed-clear proof; pass counts do not establish that coverage. The unchanged D16 refusal and all four D32-only diagnostic/range controls are retained. The candidate's attachment-buffer and sampled-buffer refusal cases, buffer publication, dispatch-item publication and cached-draw publication execute successfully. Main's bare-D32 publication and the retained D32S8/native-depth cases are included. Longest selected CTest: main 12.27 s; candidate 12.73 s.Conventions pass with zero errors and one inherited debt-length warning. All current AGC debt fragments validate against the exact canonical AGC debt file in an isolated component mirror; whitespace and sync against the pinned main snapshot pass. The global
python tools/debt_fold.py --checkfails identically on the clean base and candidate because main'stest-libc-wcstombs.mdandfix-libc-wcstombs-zero-capacity.mdboth change the same libc entry. Those upstream fragments are unchanged here; a globally clean debt-fold result is not claimed. No full CTest suite, Linux/cross-vendor run, new game/console result or performance claim is made. Full hosted Linux/Windows builds need a maintainer dispatch for this new head; previous results do not validate it. The historical Windows run42928913595/ job130222440442remains deferred at the user's request and was not polled or rerun.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:22:48Z.
Review: CHANGES_REQUESTED
The reported GPU validation is detailed, and the literal-main/red-control evidence is useful. I do not see a separate functional defect from this diff review. I am requesting follow-up on the repository overlap gate before approval: the current overlap report lists open PRs that edit the same implementation and registration regions, but the checklist names only #10492 and #10469 as dependencies, while the body says merge coordination remains outstanding. In particular, #7002 and #8963 touch the same ShaderResources helper/binding sites; #9533, #9717, and #9742 overlap DepthSurface.cpp and/or the same test-registration block; and #8105 also overlaps the CMake registration region. Please agree on merge order with the relevant authors and update the Depends on/coordination information so the integration order is explicit. If any overlap report is stale or only an adjacent registration edit, explain that in the PR so the gate can be resolved without implying an unnecessary dependency. I did not run the GPU tests locally; the hosted relinker/context jobs are skipped, and the full Linux/Windows jobs are also skipped. The test results above are author-reported.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T22:10:46Z.
Review: COMMENTED
A Linux run on NVIDIA and lavapipe, since the PR's runs are Windows/RTX only. The red check holds on both devices. On each device something fails in the publication/feedback modes, and neither shows on the 4070 Ti or in the NVIDIA CI.
Setup. Ubuntu 26.04, GCC 15.2, Release. RTX 3070 (NVIDIA 595.99.02) and lavapipe (Mesa 26.0.3).
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, ctest-j1. Head99e4666c92merged ontomain7d9a2fc713(clean). The selection is the native-depth tests,agc_driver_sample_multisample_targetandagc_driver_graphics, 12 tests.Red. Main plus only the PR's
NativeMultisampleDepth.cppand CMake changes:attachment_buffer_feedbackfails with the overlap not refused ("a writable shader buffer overlaps a native depth attachment"), andsampled_buffer_feedbackfails with "sampled feedback refusal poisoned later depth access". That holds 3/3 on the 3070 and 1/1 on lavapipe. The fixture's other modes also fail there, because they need the D32 publication from the carried #10492/#10469 history.RTX 3070, Khronos VVL 1.4.341, ×3: 10/12 pass.
agc_driver_native_depth_buffer_publicationand_buffer_publication_itemsrun to the end ("paired GPU fill overwrites native depth and metadata in wave32 and wave64") and then abort (SIGABRT, 3/3) at process exit. The backtrace goesDriver::~Driver→Driver::stop→DevicePointer::Reset→VulkanDevice::State::~State→abortinsidelibVkLayer_khronos_validation.so. No validation message comes before it. They pass with the CI's VVL 1.3.275 (1/1) and with no layer (3/3). Both tests come with #10492's commits. I couldn't symbolize the layer frame (stripped .deb build), so I can't say yet whether the layer or the device teardown is at fault.lavapipe: five modes fail on every run, 3/3 with 1.4.341 and 1/1 each with no layer and with 1.3.275:
buffer_publication,buffer_publication_items,cached_draw_publication,attachment_buffer_feedbackandsampled_buffer_feedback. Each fails with:On lavapipe the write-watch probe reports
host imports resolve write protection: yes ... imported ranges are compared, so an imported range doesn't stay watched. The NVIDIA cards report "imported ranges stay watched". The refusal is theGuestMemory::Watchedcheck inDepthSurface.cpp's native-depth import. The older modes of the same fixture pass on lavapipe. The HTILE path already handles this device class withPrepareImportWatch(...) == ImportWatch::Unwatch, but the new modes don't, so on a compared-import device they need the same handling or a skip (77). With 1.4.341, the first two also hit the same exit abort as on the 3070.GPUs tested: NVIDIA RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T00:06:20Z.
Review: COMMENTED
Follow-up on the RTX 3070 exit abort from my run above (
native_depth_buffer_publicationand_itemswith layer 1.4.341). It comes from #10492's test, not from this PR or the layer.--buffer-publicationruns on the driver singleton's device and never stops the driver. The device's last reference therefore dies inDriver::~Driverat static destruction, and the layer aborts in that late teardown. It is the same pattern53886418d9fixed forCheckDriverPath. AddingDriverTestAccess::Stop()(Driver::Get().stop()) and calling it before that mode returns makes both tests pass 3 of 3 with 1.4.341 on the 3070. They also pass with 1.3.275 and with no layer. The diff and the numbers are on #10492: https://github.com/boykopovar/AnyPS5/pull/10492The lavapipe result is unchanged: the new modes still need a
PrepareImportWatchcheck or a skip on devices whose imports are compared.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T18:22:19Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
862a8ba26e26fef662c3419a6eabb72f5f3b6e27from the prepared diff and pinned readerrepo_read.py. I ran no build or test commands; the environment exposes reader tools only. The description reports focused Windows 11 tests and convention/sync checks, with explicit skips and limitations; these are author-reported, not runs performed in this review.Results
Findings
Blocking
None.
Non-blocking
GpuMutexwhilerequireGuestBuffersis called during stage-A resource validation. The description says the related lock/deadlock question remains outstanding. Please confirm lock ordering for the stage-A caller before relying on this path under concurrent resource builds. This is an unresolved risk, not a demonstrated deadlock.Not verified
The full text of
ShaderResources.cppwas excluded from the review bundle; I read the changed hunk throughrepo_read.pyand inspected the relevantbuildComplete,requireGuestBuffers, and draw caller ranges. Other changed files read:DepthSurface.cpp,Draw.cpp,agc_driver_native_multisample_depth_tests.cmake,NativeMultisampleDepth.cpp, anddocs/dev/debt/changes/native-depth-buffer-feedback.md. No additional repository files were read. I did not run tests, inspect CI output, verify the author’s reported environment, or establish console behavior. The author reports two partial driver-import subcase skips and leaves full driver-import HTILE coverage and the lock question unresolved.To get this to a good state
Nothing is required. Optional: resolve the stage-A/GpuMutex lock-order question and add coverage for the driver-import subcases currently skipped.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T13:04:19Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
7a318d5d26135835bee7ba087987da37f266c05e(PR #10497, basemain).diff.patch), then a few head-pinned context reads withrepo_read.py.Results
files.jsoncoverageFindings
Blocking
None verified.
Non-blocking
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:3182:ApplyFastClear()runs in the non-stencil path before the laterpublishable,sampling.refusaland pending-clear requires. If one of those throws, the clear has already been applied. I did not check whether a refused publication can leave that state visible.core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp:408:PublicationRefusalmaps every non-D16 format to the "needs the texture detiler" message. The D32S8 paths inCheckDepthTargetuse it too. A different refusal from those formats would still match, or fail for the wrong reason. Not checked against the throw sites.core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:4480:Revalidatenow callsrequireGuestBuffers(), which can takeGpuMutex(ShaderResources.cpp:7376). The mutex is re-entrant (GuestMemory.cpp:3251), so I found no self-deadlock. The lock-order question the description already lists as open is still open.Sources
GpuMutex:github.com/boykopovar/AnyPS5@7a318d5d26/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp (L3251)Not verified
files.json: thereviewedset was not opened, so I cannot say every listed file was read.GuestBufferMemory.cpp,ShaderResources.cpp) were read only at the lines shown above, not in full.GpuMutex(the author's own open item).python tools/debt_fold.py --check, which the author reports fails identically on the base.To get this to a good state
Nothing is required.
Optional: the three non-blocking points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T11:20:46Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code and reported validation support merging.
What I ran
Reviewed head
dd491492ea7735b4c3a8d5931a3c6e78bd4c6e3fagainst the prepared diff and pinned source usingrepo_read.py. I did not run build or tests; the validation below is author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Read:
DepthSurface.cpp,Draw.cpp,GuestBufferMemory.cpp,ShaderResources.cpp,agc_driver_native_multisample_depth_tests.cmake, and the relevant sections ofNativeMultisampleDepth.cpp, plusdescription.md,commits.md,manifest.json, anddiff.patch. The changed filesNativeMultisampleDepth.cppandShaderResources.cppwere only read in targeted ranges. No changed lines inDepthSurface.cpp, the test CMake file, or the three debt fragments were read from the prepared full-text files. The complete changed-file inventory inmanifest.jsonwas not reviewed; no test execution, full runtime build, concurrent stage-A lock-order check, or console run was performed. Author-reported validation is not independently confirmed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:55:32Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing in the inspected changes blocks merge; I could not complete review of all changed files or run checks on this head, so approval is not justified.
What I ran
Read the prepared diff at head
47212bcf5076e114a6beb418591aecdc261e7a3fand inspected the targeted source ranges throughrepo_read.py. No build or tests were run by me. The description reports Windows Release validation on a different head; those results are author-reported only.Results
Findings
Blocking
None found in the inspected changes.
Non-blocking
None.
Not verified
I read
description.md,commits.md,manifest.json,diff.patch, and the full included files:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp,core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake, and the three changed debt fragments. I also read targeted ranges incore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppandcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp.GuestBufferMemory.cppandShaderResources.cppare excluded from the prepared full-file bundle as too large; the reader was not available to inspect these through its prescribed plain command.NativeMultisampleDepth.cppis included in the manifest but its full text was not read. No test, build, Linux/cross-vendor, or console run was performed by me. The author-reported checks target earlier revisions, not the exact reviewed head.To get this to a good state
Nothing is required.
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.