fix(agc): record depth surface lookups and fast-prove held surfaces #1199

Closed
emirplus wants to merge 1 commit from upstream-pr/1199 into main
emirplus commented 2026-10-07 17:25:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emirplus on 2026-10-07T17:25:07Z.


What

Sets that sample a depth surface previously failed the fast proof with FastFail::NoRecord on every reuse because cachedTexture did not log a lookup record when resolving from DepthSurfaceTexture.

This change:

  • Logs depth surface lookups in cachedTexture with a depth marker.
  • Tracks surface.depth in ValidatedSurface.
  • Fast-proves depth surfaces via DepthSurfaceHolds rather than falling back to full resource walks.
  • Adds depthSurfaceTests to Graphics.cpp covering held depth surface validation.

Tested

  • Windows 11 x64, MinGW-w64 GCC 15.2.0, CMake + Ninja.
  • ctest -R agc_driver_graphics --output-on-failure: 100% passed (9.16s).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4776096856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1199). Originally posted by [emirplus](https://github.com/emirplus) on 2026-10-07T17:25:07Z. --- ### What Sets that sample a depth surface previously failed the fast proof with `FastFail::NoRecord` on every reuse because `cachedTexture` did not log a lookup record when resolving from `DepthSurfaceTexture`. This change: - Logs depth surface lookups in `cachedTexture` with a depth marker. - Tracks `surface.depth` in `ValidatedSurface`. - Fast-proves depth surfaces via `DepthSurfaceHolds` rather than falling back to full resource walks. - Adds `depthSurfaceTests` to `Graphics.cpp` covering held depth surface validation. ### Tested - Windows 11 x64, MinGW-w64 GCC 15.2.0, CMake + Ninja. - `ctest -R agc_driver_graphics --output-on-failure`: 100% passed (9.16s). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
fisherjoey commented 2026-10-07 20:00:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-07T20:00:34Z.


This is the fix proposed in #1132, down to DepthSurfaceHolds, so it should reference that issue. I opened #1132 first and followed the contributing flow: issue first, then a PR once the approach is agreed. The same change is ready on a branch, linked in the issue, and I measured it on Demon's Souls (PPSA01341 v1.07) on Linux. Per 10 s of its PS Studios movie:

before after
revalidate calls: fast / full 72142 / 18697 101101 / 2617
indirect proofs: fast / full 2187 / 9547 3017 / 463
indirect device call 193.9-229.6 us 145.7 us

Once the approach in #1132 is approved, I'd suggest closing this PR in favour of mine, or combining the two (for example, keeping the depthSurfaceTests from here in my PR with credit). Whatever the maintainers prefer.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6045781754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1199#issuecomment-6045781754). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-07T20:00:34Z. --- This is the fix proposed in #1132, down to `DepthSurfaceHolds`, so it should reference that issue. I opened #1132 first and followed the contributing flow: issue first, then a PR once the approach is agreed. The same change is ready on a branch, linked in the issue, and I measured it on Demon's Souls (PPSA01341 v1.07) on Linux. Per 10 s of its PS Studios movie: | | before | after | |---|---|---| | revalidate calls: fast / full | 72142 / 18697 | 101101 / 2617 | | indirect proofs: fast / full | 2187 / 9547 | 3017 / 463 | | indirect device call | 193.9-229.6 us | 145.7 us | Once the approach in #1132 is approved, I'd suggest closing this PR in favour of mine, or combining the two (for example, keeping the `depthSurfaceTests` from here in my PR with credit). Whatever the maintainers prefer.
oneandonlydean commented 2026-10-08 03:25:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T03:25:57Z.


Two things before this can go in. depthSurfaceTests (tests/Graphics.cpp:2055) only checks a cleared surface list and the enum values, so without the change it fails only by not building; it needs a set that samples a depth surface and fails the fast proof with no record on main. And please reference #1132, which proposed this fix first.

On fisherjoey's question: either branch works; whichever carries that test goes in, with the other credited in the description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051541483 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1199#issuecomment-6051541483). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T03:25:57Z. --- Two things before this can go in. `depthSurfaceTests` (`tests/Graphics.cpp:2055`) only checks a cleared surface list and the enum values, so without the change it fails only by not building; it needs a set that samples a depth surface and fails the fast proof with `no record` on main. And please reference #1132, which proposed this fix first. On fisherjoey's question: either branch works; whichever carries that test goes in, with the other credited in the description.
fisherjoey commented 2026-10-08 05:25:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T05:25:23Z.


Opened #1430 with the test described above: depthSurfaceProofTests builds on main unchanged, fails there with fast-fail by reason: no record, and passes with the fix. It references #1132 and credits this PR for the test idea.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6052982275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1199#issuecomment-6052982275). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-08T05:25:23Z. --- Opened #1430 with the test described above: `depthSurfaceProofTests` builds on `main` unchanged, fails there with `fast-fail by reason: no record`, and passes with the fix. It references #1132 and credits this PR for the test idea.
emirplus commented 2026-10-08 05:51:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emirplus on 2026-10-08T05:51:57Z.


I’m happy with either approach. I’d prefer to keep #1199 open if the implementation and tests can be brought into line with the maintainer’s feedback, but I’m also fine with combining the useful parts of both PRs if that’s easier to review. Thanks for the credit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6053325723 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1199#issuecomment-6053325723). Originally posted by [emirplus](https://github.com/emirplus) on 2026-10-08T05:51:57Z. --- I’m happy with either approach. I’d prefer to keep #1199 open if the implementation and tests can be brought into line with the maintainer’s feedback, but I’m also fine with combining the useful parts of both PRs if that’s easier to review. Thanks for the credit.
oneandonlydean commented 2026-10-08 06:37:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T06:37:07Z.


Closing in favour of #1430: same fix, plus a test that fails on main with no record, and it credits this PR for the test idea.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6054008085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1199#issuecomment-6054008085). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T06:37:07Z. --- Closing in favour of #1430: same fix, plus a test that fails on main with `no record`, and it credits this PR for the test idea.

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