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

Closed
Scramblrrrr wants to merge 2 commits from upstream-pr/4646 into main
Scramblrrrr commented 2026-10-12 17:37:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T17:37:56Z.


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

  • Rebased onto main 1c5e62878ab01af05d5a75bd94146228f5dea9d4, including merged #425 and #3816. Head c3ef8bc9ed4208fada2203e8f04b8aca35aa7ccb; only the two original PR commits carried.
  • Windows11, GCC15.2, RTX5070Ti, Release: fresh graphics, recorder, depth-plane sampling and depth fast-clear target builds.
  • agc_depth_surface_lookup 0.55s, full mocked agc_driver_graphics 4.68s, native agc_driver_depth_fast_clear 0.52s and agc_driver_depth_plane_sampling 0.56s: 4/4 pass, total6.55s, no skips.
  • Source conventions and git diff --check pass. The new preliminary lookup introduced by #425 is guarded before its scan; plane-copy cleanup and initialization remain.
  • Separate 007 integration already carries the equivalent earlier filter at 34b85f2a8. Its current scene remains slow and partially black; this PR is not a rendering cure or a demonstrated FPS improvement. Exact runtime heads/configuration and ongoing cross-tests are on #2523. Title code, profiles, screenshots and dumps stay local.

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)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4832938464 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4646). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T17:37:56Z. --- ### 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 - Rebased onto main `1c5e62878ab01af05d5a75bd94146228f5dea9d4`, including merged #425 and #3816. Head `c3ef8bc9ed4208fada2203e8f04b8aca35aa7ccb`; only the two original PR commits carried. - Windows11, GCC15.2, RTX5070Ti, Release: fresh graphics, recorder, depth-plane sampling and depth fast-clear target builds. - `agc_depth_surface_lookup` 0.55s, full mocked `agc_driver_graphics` 4.68s, native `agc_driver_depth_fast_clear` 0.52s and `agc_driver_depth_plane_sampling` 0.56s: 4/4 pass, total6.55s, no skips. - Source conventions and `git diff --check` pass. The new preliminary lookup introduced by #425 is guarded before its scan; plane-copy cleanup and initialization remain. - Separate 007 integration already carries the equivalent earlier filter at `34b85f2a8`. Its current scene remains slow and partially black; this PR is not a rendering cure or a demonstrated FPS improvement. Exact runtime heads/configuration and ongoing cross-tests are on #2523. Title code, profiles, screenshots and dumps stay local. 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 - [x] Based on main at the exact revision above; overlapping work checked - [x] One topic; generic behavior - [x] No unsupported-path bypass or silent stub - [x] No inline code comments, investigation notes, images or title data added - [x] No third-party dependency changes - [x] Depends on: none - [x] Unblocks: none; addresses a profiled CPU hot spot - [x] AI-assisted: yes (Codex)
Scramblrrrr commented 2026-10-12 23:00:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T23:00:59Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134259747 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4646#issuecomment-6134259747). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T23:00:59Z. --- 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 commented 2026-10-12 23:04:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T23:04:09Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134297874 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4646#issuecomment-6134297874). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T23:04:09Z. --- 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 commented 2026-10-12 23:16:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T23:16:06Z.


Combined Windows validation completed for9d5d0f94965dd100a52015abf78bec34349ddaf1 on main43e3a70f8143f014f621c48abbdb137fffd7346e: both #4646 commits plus author-preserved #4683 35c4b5cde. 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134441291 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4646#issuecomment-6134441291). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T23:16:06Z. --- Combined Windows validation completed for9d5d0f94965dd100a52015abf78bec34349ddaf1 on main43e3a70f8143f014f621c48abbdb137fffd7346e: both #4646 commits plus author-preserved #4683 35c4b5cde. 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.
Scramblrrrr commented 2026-10-13 00:18:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-13T00:18:15Z.


Rebase completed and pushed: c3ef8bc9ed 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135153384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4646#issuecomment-6135153384). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-13T00:18:15Z. --- Rebase completed and pushed: c3ef8bc9ed4208fada2203e8f04b8aca35aa7ccb 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 commented 2026-10-14 02:38:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:38:45Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159655477 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4646#issuecomment-6159655477). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:38:45Z. --- 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.

Pull request closed

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!4646
No description provided.