Skip to content

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

Draft
TibixDev wants to merge 11 commits into
boykopovar:mainfrom
TibixDev:pr/depth-pass-recognition
Draft

TibixDev wants to merge 11 commits into
boykopovar:mainfrom
TibixDev:pr/depth-pass-recognition

Conversation

@TibixDev

@TibixDev TibixDev commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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

@TibixDev

TibixDev commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

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
TibixDev force-pushed the pr/depth-pass-recognition branch from bfd1d9e to 5b34fef Compare October 8, 2026 07:21
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 8, 2026
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.
@TibixDev
TibixDev force-pushed the pr/depth-pass-recognition branch from 5b34fef to cedec6e Compare October 8, 2026 08:28
This was referenced Oct 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant