fix(agc): refresh moved buffer bindings in draw recipes #17157
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17157"
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 PrivacyOnion on 2026-11-08T12:59:59Z.
What
Refresh the buffer bindings used by a cached draw recipe when the current draw relocates a read-only guest buffer or changes its shader-data words. A recipe created before the change currently passes
ProveCurrentbut records with the template's old bindings. A green input can consequently render the red input from the original draw.Run
MovedReadOnlyBuffersafter the recipe's resource proof and pass the resulting bindings torecordDraw, as the ordinary cached-draw path already does. If the bindings cannot be reused safely, report a buffer miss and let the caller take the ordinary draw path. The existing checks handle empty, written, inaccessible, oversized and pending-write ranges. The resource template remains unchanged; per-draw bindings retain their snapshots through the recorded batch.The regression tests create an initially unrelocated recipe, switch between red and green inputs, repeat a relocated input, and return to the original one. They read every rendered pixel for both guest-buffer addresses and shader-data words. They also exercise refusal of written, inaccessible, empty and differently sized bindings, including the ordinary null-buffer fallback.
Related work: #9508 touches this path too. Its
recipe.movedBuffersflag is initialized from!resolved.moved.empty(), and its moved-buffer check runs only when that flag was set. The regression here creates the recipe with no initial relocation and changes the binding on a later hit, so that conditional check does not cover it. This PR checks current bindings on every hit. These edits share a merge hunk and will need to be reconciled if both land; this PR does not depend on the GPU heap.Tested
Windows 11 10.0.26200, Ryzen 5 5600, NVIDIA GeForce RTX 5070, driver 616.64, Release, WinLibs GCC 15.2.0 UCRT/POSIX r7. Tested base:
eb41c5465d1fa7b8239be2a6e3a00bf9e58d3b1f. Rebased onto57c0f6a48dbefore publication; the intervening merges do not change the AGC driver, shader recompiler, libc, or CMake helper sources used by these GPU tests.The same focused tests ran on this machine and GPU against the base AGC library and the changed one, with the new tests present in both runs:
recipe pixel 0 channel 0 is 255, expected 0after selecting the green input.VUID-lines, and neither containswas not found but was requested by env var VK_INSTANCE_LAYERS. The explicit validation layer was requested in both runs; implicit overlay layers were disabled for both throughVK_LOADER_LAYERS_DISABLE=~implicit~.--windows --no-patches: launch-screen diagnostic captures on the base and change, with the same supported runtime and validation layer. The base capture alternates background tints; the corrected 900-frame capture does not show that alternation, and the process remains alive at the 90-second capture limit. The last 80 sampled frames' largest adjacent background mean RGB changes are approximately(31.121, 26.336, 25.655)on the base and(0.400, 0.364, 0.399)on the change. Camera/animation timing differs between runs; these are diagnostic color observations, not a deterministic replay or a performance measurement. Neither game log contains aVUID-or missing-layer warning.PPSA01735.exe+0x9dca1, writing address0xa4. This PR does not unblock that title.python tools/check_conventions.py --base upstream/main: passes. The requested--base origin/mainwas also run; the fork main is stale and reports 18 errors in pre-existing upstream commits, unrelated to this five-file diff.Overlap review:
python tools/pr_overlap.py --branch codex/fix-draw-recipe-buffers --repo boykopovar/AnyPS5examined 1,801 other open PRs at final head0abeac5d9a; 57 share files. It reports merge conflicts with #9508, #9897, #14032 and #16753, plus 28 comparisons it cannot complete automatically, so its exit status is 2, not a clean pass. I compared all 32 reported heads in the shared recipe path against their merge bases. Twenty-four do not changeDrawWithRecipe; #7642 changes its batch bound, #9356/#9387/#15548 select mesh stages, #9897/#14032 check vertex ranges, and #16753 changes ownership and small-list bookkeeping. The conditional buffer relocation in #9508 is described above. No other inspected branch checks later buffer/data relocation for an initially unrelocated recipe. There are no shared exports or shared new test files.No speed or new title-unblock claim is made. Diagnostic captures enable frame dumping and capture tracing; they are not performance traces.
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 file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-11-08T20:48:04Z.
Review: APPROVED
The recipe path now calls the existing
MovedReadOnlyBufferscheck before recording, then passes the resulting binding updates intoPrepareDrawBindings. That restores the normal draw path’s refresh for both relocated guest buffers and changed shader data. A rejected refresh returns a recipe miss before recording the draw. I traced that path and checked the submitted fixtures for red-to-green-to-red pixel output and fallback on unsafe bindings. The PR reports those pixel tests on an RTX 5070. Hosted Windows skipped both GPU cases, so I did not count that job as GPU execution.Pull request closed