Skip to content

perf(agc): filter absent depth surface addresses before scanning - #4646

Closed
Scramblrrrr wants to merge 2 commits into
boykopovar:mainfrom
Scramblrrrr:codex/depth-surface-address-filter
Closed

Scramblrrrr wants to merge 2 commits into
boykopovar:mainfrom
Scramblrrrr:codex/depth-surface-address-filter

Conversation

@Scramblrrrr

@Scramblrrrr Scramblrrrr commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Image-table draws can query thousands of texture addresses while hundreds of depth surfaces are retained. An address that never belonged to a depth or stencil plane scans the surface vector on every lookup. A Windows 007 worker profile identified these failed scans as a CPU hot spot during loading.

Keep a conservative set of (device, address) keys for created depth and stencil planes. An absent key returns before the preliminary scan and GPU lock; possible matches retain the existing lookup, extent, format, sampling, and fast-clear behavior. Admit keys before construction, so failed construction leaves only a harmless false positive. Clearing a device removes its keys while preserving depth-plane copy cleanup. The set owns no surface or texture pointers.

The existing recorder depth-proof fixture checks a miss before surface creation, then the successful lookup and fast proof. A focused CTest selector runs this coverage independently and returns skip77 if null descriptors are unavailable.

Tested

This is separate from #1199/#1430 depth fast proofs and #4448 storage-import/comparison policy. Open #4683 overlaps surface creation and device cleanup. A separate combined branch was validated on its earlier main base, but its plane ownership changes are not included here and compatibility with #454 retirement remains under review.

Checklist

  • Based on main at the exact revision above; overlapping work checked
  • One topic; generic behavior
  • No unsupported-path bypass or silent stub
  • No inline code comments, investigation notes, images or title data added
  • No third-party dependency changes
  • Depends on: none
  • Unblocks: none; addresses a profiled CPU hot spot
  • AI-assisted: yes (Codex)

@Scramblrrrr

Copy link
Copy Markdown
Contributor Author

Acknowledged #4683 overlap. #4683 carries current depth/stencil plane contents between different pairings and chooses the plane's latest owner; #4646 only filters addresses that could never match a surface. They do not implement the same behavior and neither depends on the other.

The combined lookup must keep the conservative address admission before construction, remove device keys on teardown, and apply the negative-address check before any fallback surface scan in the new plane lookup. #4683's owner updates and aspect-copy/fast-clear handling must remain intact. This is source-level overlap analysis, not combined native/game validation. Both heads currently report MERGEABLE; #4646 remains draft, with no007 FPS claim.

AI-assisted: Codex.

@Scramblrrrr

Copy link
Copy Markdown
Contributor Author

Combined source branch is prepared on current main43e3a70f8143f014f621c48abbdb137fffd7346e: https://github.com/Scramblrrrr/AnyPS5/tree/codex/depth-filter-plane-pairing-current-main , head9d5d0f94965dd100a52015abf78bec34349ddaf1. This retains both #4646 commits and author-preserved #4683 head35c4b5cde, resolving only DepthSurface.cpp conflicts. Negative admission check now lives at the start of planeSurface; both addresses are admitted before a newly created surface is constructed, and device cleanup keeps both key and owner-map removals. All #4683 pairing/copy tests and #4646 recorder lookup/CLI coverage remain. Source/diff-check/conventions pass. Not built/staged; native combined validation will follow after the separate007 test ends. No game/FPS claim, no competing PR. AI-assisted: Codex.

@Scramblrrrr

Copy link
Copy Markdown
Contributor Author

Combined Windows validation completed for9d5d0f94965dd100a52015abf78bec34349ddaf1 on main43e3a70f8143f014f621c48abbdb137fffd7346e: both #4646 commits plus author-preserved #4683 35c4b5c. Fresh graphics/recorder target builds, RTX5070Ti/GCC15.2/Release/toolsOFF.

Full mocked agc_driver_graphics PASS4.67s and native agc_depth_surface_lookup PASS0.55s,2/2 in5.56s, no skip. Production-only negative restores DepthSurface.cpp from preceding814a830e2 (filter kept, pairing fix removed), fixtures/CMake unchanged: graphics FAIL "a depth plane paired with another stencil plane must carry its depth over", native lookup control PASS,2-test total5.16s. Restore/touch/rebuild positive: graphics4.84s/native lookup0.35s,2/2 PASS5.24s. Source clean/diff-check/conventions pass. All both PRs' fixture/registration changes retained; address guard is in the common planeSurface helper before lookup/fallback scan, keys admitted before construction and cleared by device.

Branch: https://github.com/Scramblrrrr/AnyPS5/tree/codex/depth-filter-plane-pairing-current-main . This is combined PR compatibility/native validation, not a game cross-test or real-GPU readback of pairing copies. None of these generic build artifacts were staged into007; its ongoing runtime stack remains separate. No FPS claim. AI-assisted: Codex.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
@Scramblrrrr
Scramblrrrr force-pushed the codex/depth-surface-address-filter branch from c67a868 to c3ef8bc Compare October 13, 2026 00:17
@Scramblrrrr

Copy link
Copy Markdown
Contributor Author

Rebase completed and pushed: c3ef8bc on main1c5e62878ab01af05d5a75bd94146228f5dea9d4, retaining only this PR's two commits. Preserved #425 plane-copy cleanup/clear initialization; the negative address guard now runs in the preliminary locked lookup before its vector scan/GPU lock. The new memory-value HTILE clear from #3816 is retained unchanged.

Windows11/GCC15.2/RTX5070Ti/Release: fresh four-target build. Focused native depth lookup0.55s, full mocked graphics4.68s, native depth fast clear0.52s and native depth-plane sampling0.56s,4/4 PASS6.55s, no skips. Source clean, diff/conventions pass. Validation ran after the separate007 game ended; no native tests/builds concurrent with that game. PR description rewritten for this base/result. None of these generic build libraries staged into007. No FPS/rendering cure claimed. AI-assisted: Codex.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants