Skip to content

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

Draft
Thimo188 wants to merge 11 commits into
mainfrom
upstream-pr/1395
Draft

Thimo188 wants to merge 11 commits into
mainfrom
upstream-pr/1395

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#1395, originally opened by TibixDev.

Source commit: cedec6e1d5765800c2ffb039d8675d864d27cd57. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


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. boykopovar#1346 and boykopovar#1371 have merged; boykopovar#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

Assemble 2D depth/stencil array views from the resident render-target slices,
copying only slices changed by attachment use or explicit clears. Preserve
BASE_ARRAY subviews and first-layer views, and reject missing resident layers.
Record the remaining layout and guest-memory coherence limitations.

Validation: agc_driver_graphics passed. GPU depth-array and depth-clear tests
passed with Khronos core and synchronization validation enabled, covering D16,
D32/S8, cached binding refresh, render-pass writes, stencil isolation, subviews,
and missing layers. Match the test command pool to the runtime's reset flags.
The Skyrim menu was observed through GPU captures; the desktop was locked
before a new loading attempt, so gameplay remains unverified.

AI-assisted implementation.
Detile nonresident layers using their absolute guest slice index while preserving resident depth and stencil images. Refresh guest-backed layers after writes and switch to rendered contents when a resident layer appears. Reject unbacked and compressed guest layers.

Validation: depth-array and depth-clear GPU regressions pass with Khronos core and synchronization validation. Tests cover mixed D16 and D32/S8 arrays, guest writes, slice swizzles, subviews and newly rendered layers. Graphics CTest passes.

AI-assisted implementation.
Version depth and stencil independently after draws and clears. Keep attachment lookup read-only so a gather during resource binding cannot hide a later attachment write.

Validated GPU sampling, aspect isolation and copy counts with Vulkan synchronization validation; graphics tests pass. Written with AI assistance.
Cache gathered depth storage and guest snapshots separately from component views. Keep gathered images alive through surviving views and preserve independent aspect, layer and metadata identities.

Add allocation/copy/upload checks, view lifetime sampling and pending-copy exception cleanup coverage. Correct test fixture destruction order after an old-code failing assertion caused an RX6600 reset. Remaining validation used CPU-only lavapipe; depth and graphics checks pass. Written with AI assistance.
Avoid assuming low virtual addresses remain unmapped after driver activity. Reserve guard storage for the unbacked-slice checks and release it after GPU cleanup.

AI-assisted: yes.
Exclude COLOR_INVALID attachments from the effective write mask while preserving later MRT export indices and depth-only rendering. Validated with the graphics tests and Skyrim menu draws.

AI-assisted implementation and testing by OpenAI Codex.
Extract the held draw decoders and resident-image copy path for review. Register bounds do not prove rasterized coverage; preserve this as an explicit draft blocker in TechnicalDebt. CPU decoding and Vulkan image-operation tests pass on RX 6600 and llvmpipe, without establishing arbitrary geometry or console equivalence. AI-assisted: yes.
@Thimo188 Thimo188 closed this Dec 2, 2026
@Thimo188 Thimo188 reopened this Dec 2, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants