fix(agc): look up cached draws at the fixed pixel push slot #2900
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2900"
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 JAB-dev on 2026-10-10T18:17:53Z.
What
Fixes a regression from #2661: with pipeline libraries on (the default), cached draws were never reused, which cost Animal Well about 10 FPS on Windows (42 -> 52 FPS with this fix). It's a one-line change and keeps #2661's single fragment library.
Why: #2661 places the pixel shader's push constants at the fixed fragment slot (byte 128) and the draw cache records that offset, but
Driver::lookupDrawstill expected the old stacked offset after the vertex shader's push bytes. Every pixel stage missed as a layout mismatch, so each draw was captured and materialized again and no draw recipe was used.The lookup now advances its cursor with
Graphics::StagePushOffset, asDriver::drawandPrepareGraphicsStagesdo. Without pipeline librariesStagePushOffsetreturns the cursor unchanged, so that path is unaffected.Draw-cache counters in PPSA22520 (Animal Well):
APS5_PROFILE_DRAW, 10 smain57f96fd2bTested
Windows 11, WinLibs GCC 15.2.0, RTX 4070 SUPER (NVIDIA, pipeline libraries on by default). Measured on
main57f96fd2b; rebased onto9f87be5cc, which changes nothing in the draw path.main42.5 / 41.8, this PR 52.8 / 51.0 (two runs each). Reverting only #2661 gave 50.9 / 53.7.agc_pipeline_library,agc_pipeline_library_off,agc_pipeline_library_fast_only,agc_driver,agc_driver_graphics,agc_recorder_kept_bytespass.tools/check_conventions.py --base origin/mainpasses.lookupDrawhits: the driver tests don't draw through the draw cache, so this has no new test. Full ctest not run. Linux not tested.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T20:59:43Z.
A regression test for this fix, if you want one: AlxcBTW/AnyPS5#29 (
24103825) moves the stage walk out oflookupDrawintoDriver::MatchDrawEntry, which takes the guest memory validation as a callback, and addsagc_driver_draw_cache_layout, which checks the walk without a device. With fixed slots the fragment variant at the slot has to hit and one packed after the vertex push constants is never validated; without them it is the other way round, and a variant at neither offset is a layout miss. With this PR'sStagePushOffsetline removed fromMatchDrawEntry, the test fails withthe fixed-slot lookup picked the wrong fragment variant, whileagc_driverstill passes, so the existing tests don't cover this. Full CI passed on top ofmain262c0316(Windows 720/720, Linux 712/712), andagc_driver*passes 254/254 on an RTX 5070 Laptop.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-10T21:02:02Z.
Thanks! I opened #2980 a bit earlier with a test for this: it submits the same draw twice through the driver and requires the second one to hit the draw cache. With the
StagePushOffsetline removed it fails with pipeline libraries on. Yours checks the walk without a device, so it also runs where there's no Vulkan device. Fine with me if either or both go in.