AGC: sets that sample a depth surface never pass the fast proof (no record) #1132
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-07T13:24:17Z.
Summary
cachedTexture(Graphics/src/ShaderResources.cpp:285onmaine79c971f) returnsDepthSurfaceTexture's object before anylogLookup. A set that samples a depth surface therefore has no lookup record for that element, sofastRevalidatefails withno record(:1446) on every reuse andRevalidatetakes the full walk. The walk then succeeds, because the depth surface hands out the same object each time, so the only cost is one full walk per dispatch.Evidence
Demon's Souls (PPSA01341 v1.07), PS Studios movie, per 10 s:
[rescache] revalidate 90839 calls 4934.6 ms: fast 72142, full 18697. Fast-failno record18100. Full walks 3574 ms (191 us each).[recipe] indirect: proofs fast 2187, full 9547, 133.6 us per proof.The attract movie shows the same pattern: about 15k
no recordfast-fails per 10 s.Proposed fix
ValidatedSurfacecarries the flag.fastRevalidate,fastRevalidateEach) prove a depth element with a newDepthSurfaceHolds(context, address, texture): the newest surface at the address still hands out that object, which is what the walk'sDepthSurfaceTexturelookup would return. The memory, keys and pending checks are skipped for that element.depth surface, covers the case where the surface no longer hands it out.Measured on the movie, per 10 s:
The fps did not change on its own: queue 0's wait for the GPU mutex took up the time saved (254-255 presents per 10 s before, 255 after).
agc_driver_graphicsandguest_agc_driver_resourcespass.#425 and #454 change the same lookup: per-use depth copies that never serve templates, and retired surfaces. A depth record would have to skip per-use copies, and
DepthSurfaceHoldswould have to treat a retired surface as not holding. I'd base the change on those if they land first.Found on Linux 7.2 (Nobara 44), GCC 16, RTX 5070 Ti (595.91.07), with Demon's Souls PPSA01341 v1.07. Measured on
mainatc1241ad0with #157, #861, #864 and #1051, plus the path fix from #1047.I can send a PR for this if the approach looks right.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-07T18:01:17Z.
The fix described above is ready on a branch, rebased on current
main(cea1ef13): https://github.com/fisherjoey/AnyPS5/compare/main...fisherjoey:AnyPS5:fix/depth-surface-recordOne commit. It adds the depth record,
DepthSurfaceHoldsin both fast proofs, and adepth surfacefast-fail reason. The full walk is unchanged.agc_driverandguest_agc_driverpass (159 of 159;agc_driver_lds_atomics64andagc_driver_scalar_sop1excluded, they fail on this GPU onmaintoo). It has no new test, since the proof path would need a real draw into a depth target.I'll open the PR if the approach looks right.
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T11:53:07Z.
This is a valuable performance optimization for depth surface validation. Based on my review of recent PRs related to the AGC driver and shader recompiler, I can provide some context:
The issue correctly identifies that
cachedTexturereturnsDepthSurfaceTexture's object before anylogLookup, which means sets that sample a depth surface never pass the fast proof. The proposed fix of logging a record flagged as depth and proving it with a newDepthSurfaceHoldscheck seems reasonable.Some observations based on similar issues I've seen:
I'd suggest implementing this fix, as it addresses a real performance bottleneck in depth surface validation that affects many titles.