feat(agc): add experimental depth clear and copy recognition #1395

Open
TibixDev wants to merge 11 commits from upstream-pr/1395 into main
TibixDev commented 2026-10-08 01:47:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T01:47:41Z.


Status after review

Draft: rasterized coverage still unproven.

Rechecked the implementation in a27e8e19f0e4: both DecodeDepthClearPass(const QueueState&) and DecodeDepthCopyPass(const QueueState&) decide from register state. Their full viewport/scissor checks do not examine the draw's vertex/index geometry. Two draws with the same registers but different coverage can therefore select the same full-image operation.

The decoder and Vulkan image-operation fixtures cannot close that gap. This remains a draft until there is a reference-backed coverage proof with partial/cull/clip negative cases, or the original rasterized operation is implemented. Main's explicit rejection must remain the baseline. #1346 and #1371 have merged; #1368 is the remaining open feature dependency, and its newly rebased implementation must replace the old embedded copy before any eventual integration. No unsafe recognition path was promoted or marked complete.

What

Draft for coverage review. Recognize depth/stencil clear and override-copy draws before shader compilation. Record the selected image operations on the GPU and refresh sampled views after copies.

Tested

Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass.

Checklist

  • Current-main implementation and outstanding review requirements complete.
  • Isolated title benefit / reference validation established where required.
  • Depends on: #1368; #1346 and #1371 are merged.
  • AI-assisted: yes.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4780678803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1395). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-08T01:47:41Z. --- ### Status after review **Draft: rasterized coverage still unproven.** Rechecked the implementation in `a27e8e19f0e4`: both `DecodeDepthClearPass(const QueueState&)` and `DecodeDepthCopyPass(const QueueState&)` decide from register state. Their full viewport/scissor checks do not examine the draw's vertex/index geometry. Two draws with the same registers but different coverage can therefore select the same full-image operation. The decoder and Vulkan image-operation fixtures cannot close that gap. This remains a draft until there is a reference-backed coverage proof with partial/cull/clip negative cases, or the original rasterized operation is implemented. Main's explicit rejection must remain the baseline. #1346 and #1371 have merged; #1368 is the remaining open feature dependency, and its newly rebased implementation must replace the old embedded copy before any eventual integration. No unsafe recognition path was promoted or marked complete. ### What Draft for coverage review. Recognize depth/stencil clear and override-copy draws before shader compilation. Record the selected image operations on the GPU and refresh sampled views after copies. ### Tested Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass. ### Checklist - [ ] Current-main implementation and outstanding review requirements complete. - [ ] Isolated title benefit / reference validation established where required. - [x] Depends on: #1368; #1346 and #1371 are merged. - [x] AI-assisted: yes.
TibixDev commented 2026-10-08 07:21:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T07:21:42Z.


Rebased on e705d430. Updated the #1368 prerequisite and preserved upstream changes. Grouped the depth limitations with graphics notes. This remains a draft: rasterized draw coverage is not yet proved.

Fedora 44 Release: agc_driver_tests, agc_driver_graphics_tests, agc_driver_pm4_tests, agc_driver_recorder_tests build; the targeted tests and contribution checks pass. Windows CI is pending.
RADV and lavapipe: --depth-array-only, --depth-clear-only, --depth-copy-only pass with core and synchronization validation; no validation errors.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6054797034 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1395#issuecomment-6054797034). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-08T07:21:42Z. --- Rebased on `e705d430`. Updated the #1368 prerequisite and preserved upstream changes. Grouped the depth limitations with graphics notes. This remains a draft: rasterized draw coverage is not yet proved. Fedora 44 Release: `agc_driver_tests`, `agc_driver_graphics_tests`, `agc_driver_pm4_tests`, `agc_driver_recorder_tests` build; the targeted tests and contribution checks pass. Windows CI is pending. RADV and lavapipe: `--depth-array-only`, `--depth-clear-only`, `--depth-copy-only` pass with core and synchronization validation; no validation errors.
TibixDev commented 2026-10-12 04:52:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-12T04:52:23Z.


Review-pass update:

Rechecked the implementation in a27e8e19f0e4: both DecodeDepthClearPass(const QueueState&) and DecodeDepthCopyPass(const QueueState&) decide from register state. Their full viewport/scissor checks do not examine the draw's vertex/index geometry. Two draws with the same registers but different coverage can therefore select the same full-image operation.

The decoder and Vulkan image-operation fixtures cannot close that gap. This remains a draft until there is a reference-backed coverage proof with partial/cull/clip negative cases, or the original rasterized operation is implemented. Main's explicit rejection must remain the baseline. #1346 and #1371 have merged; #1368 is the remaining open feature dependency, and its newly rebased implementation must replace the old embedded copy before any eventual integration. No unsafe recognition path was promoted or marked complete.

I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117978063 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1395#issuecomment-6117978063). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-12T04:52:23Z. --- Review-pass update: Rechecked the implementation in `a27e8e19f0e4`: both `DecodeDepthClearPass(const QueueState&)` and `DecodeDepthCopyPass(const QueueState&)` decide from register state. Their full viewport/scissor checks do not examine the draw's vertex/index geometry. Two draws with the same registers but different coverage can therefore select the same full-image operation. The decoder and Vulkan image-operation fixtures cannot close that gap. This remains a draft until there is a reference-backed coverage proof with partial/cull/clip negative cases, or the original rasterized operation is implemented. Main's explicit rejection must remain the baseline. #1346 and #1371 have merged; #1368 is the remaining open feature dependency, and its newly rebased implementation must replace the old embedded copy before any eventual integration. No unsafe recognition path was promoted or marked complete. I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit.
MarcZX10 commented 2026-11-19 04:35:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T04:35:49Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: stop recognizing clear and copy draws as full-image operations until rasterized coverage is proven or preserved by the implementation.

What I ran

  • Reviewed head cedec6e1d5765800c2ffb039d8675d864d27cd57; no build or tests were run.
  • Read review/description.md, review/commits.md, review/manifest.json, and review/diff.patch; examined the relevant decoder and draw-dispatch code at the pinned head.
  • Commands: not run; repository access was through repo_read.py.

Results

Check Result Note
Diff and manifest review passed Prepared bundle inspected
Coverage of fast-path draws failed Geometry does not gate replacement
Build and tests not run No execution environment available

Findings

Blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:823 and core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:875: the decoders accept full viewport and scissor bounds as proof of full-surface coverage, but do not evaluate vertex/index geometry, clipping, or culling. DrawPrecheck.cpp dispatches the recognized draw directly to whole-image clear/copy operations (core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp:28 and core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp:38). A draw with partial rasterized coverage can therefore change pixels the original draw would leave untouched. Keep these paths rejected until coverage is proven or the rasterized operation is implemented.

Non-blocking

None.

Not verified

  • Build, automated tests, Linux/Windows CI, and console behavior were not run.
  • review/files.json could not be read through the provided reader; exclusion metadata is unverified. The manifest lists 14 changed files, all marked included, and those files' changes are represented in the reviewed diff.

To get this to a good state

  • Require a reference-backed proof of full rasterized coverage, including partial, cull, and clip negative cases, or implement the original rasterized operation. Then rerun the relevant build and tests.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5969374571 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1395#pullrequestreview-5969374571). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T04:35:49Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: stop recognizing clear and copy draws as full-image operations until rasterized coverage is proven or preserved by the implementation. ## What I ran - Reviewed head `cedec6e1d5765800c2ffb039d8675d864d27cd57`; no build or tests were run. - Read `review/description.md`, `review/commits.md`, `review/manifest.json`, and `review/diff.patch`; examined the relevant decoder and draw-dispatch code at the pinned head. - Commands: not run; repository access was through `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Diff and manifest review | passed | Prepared bundle inspected | | Coverage of fast-path draws | failed | Geometry does not gate replacement | | Build and tests | not run | No execution environment available | ## Findings ### Blocking - `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:823` and `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:875`: the decoders accept full viewport and scissor bounds as proof of full-surface coverage, but do not evaluate vertex/index geometry, clipping, or culling. `DrawPrecheck.cpp` dispatches the recognized draw directly to whole-image clear/copy operations (`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp:28` and `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp:38`). A draw with partial rasterized coverage can therefore change pixels the original draw would leave untouched. Keep these paths rejected until coverage is proven or the rasterized operation is implemented. ### Non-blocking None. ## Not verified - Build, automated tests, Linux/Windows CI, and console behavior were not run. - `review/files.json` could not be read through the provided reader; exclusion metadata is unverified. The manifest lists 14 changed files, all marked included, and those files' changes are represented in the reviewed diff. ## To get this to a good state - Require a reference-backed proof of full rasterized coverage, including partial, cull, and clip negative cases, or implement the original rasterized operation. Then rerun the relevant build and tests.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1395:upstream-pr/1395'
git switch 'upstream-pr/1395'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1395'
git switch 'upstream-pr/1395'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1395'
git switch 'upstream-pr/1395'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1395'
git switch 'main'
git merge --squash 'upstream-pr/1395'
git switch 'main'
git merge --ff-only 'upstream-pr/1395'
git switch 'main'
git merge 'upstream-pr/1395'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1395
No description provided.