Repository navigation
perf(agc): reuse image tables that hold a 2D array entry and its flat 2D partner - #26184
theGodspeed1999 wants to merge 1 commit into
Conversation
… 2D partner A table whose one-layer 2D array entry shares the texture of a flat 2D entry was never remembered, so every draw resolved it again. The remembered table now keeps such partner entries and binds them as a fresh resolve would. The execution test covers reuse and an image store with a pending write.
Here is the same-frame pair that was asked for on #25529. It is the Screen Reader prompt in Marvel's Wolverine (PPSA03671), at the same point in the game. The first picture is from main and the second is from this change.
I compared them pixel by pixel and found no difference at all: 0.000 on average, and 0% of the pixels changed. So this change does not alter what is drawn. The small letters on this prompt look broken in both pictures. That is a separate problem (#26043), and this change neither causes it nor fixes it. Both runs skipped two shaders that the game can't use yet (APS5_SKIP_REFUSED_DISPATCHES=1 and APS5_SKIP_REFUSED_DRAWS=1, see #6191 and #5879). AI-assisted. |
|
Thank you for your contribution! Authors with no pull requests merged into |


What
An image table that holds a one-layer 2D array entry and a flat 2D entry over the same surface was never remembered, so every draw that used it resolved all its entries again. In the Wolverine (PPSA03671) slow scene this was the main cost (see #25529).
The remembered table now keeps those partner entries, and a reused table binds them the way a fresh lookup does: the array entry shares the flat entry's texture, or is looked up on its own if the flat entry did not share it. The revalidation walk handles partner entries too.
ReusedTableCountstays at 4.How it fits with #6340: that PR lets clean entries be reused when another entry in the table cannot be; this one lets the partner entries be reused. They touch the same function but solve different cases, and either can land first (I commented there: #6340 (comment)).
It does not make the scene playable. The slow part stays at about 0.2 frames per second. What is left is that the sampled-texture cache (2 GiB) is full, so tables lose their textures, and that every queue ordering point (about 29 per second) clears the list of remembered tables. The bigger cause stays on #25529.
Tested
Windows 10 (19045), RTX 3060 Ti 8 GB (driver 617.42), Ryzen 7 5700X, Marvel's Wolverine (PPSA03671), scripted pad press (
APS5_PAD_SCRIPT_LIVE),APS5_SKIP_REFUSED_DISPATCHES=1 APS5_SKIP_REFUSED_DRAWS=1in all runs because shaders0x11d049aa00(#6191, #7395) and0x11d0125d00(#5879, #7689) are refused. The runs were made onmaineb856f9 plus this change; the branch is now rebased on709342e209.agc_driver_image_table_reuse,agc_driver_image_table_array_views,agc_driver_image_table_variants: all three passed on the same change before the rebase (onmaineb856f9). After the rebase onto709342e209I only compiled them and did not run them again. The new case inImageTableArrayViews.cppfails without the change (0 reused, 3 resolved) and passes with it. It also checks that an image store with a pending write makes the table resolve again.python3 tools/check_conventions.py --base origin/main --head HEAD: passed.Slow phase (first 30 blocks of 10 s after it starts), one run of main against six runs of this change (14 minutes each):
Reuse went up in 5 of 6 runs. In run 2 it stayed at 0.5% and the frame rate was lower than on main. Runs of the same build differ a lot (#26053), so one run is not enough to judge a speed change here. Mean over the six: about 2.0 presents per 10 s (+33%), binding time about -9%. That is a small boost.
Same-frame pair: the Screen Reader prompt from main and from this change is pixel-identical (mean difference 0.000, 0% of pixels changed). The two images are attached in a comment below.
Related issues found in the same runs: #26043 (broken small letters on the prompt, the same with and without this change), #26044 (input), #26045 (frame capture log line), #26053 (runs differ).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt.mdfiles or images added to the repository (attached to this PR)