fix(agc): prepare a draw or dispatch again when the memory it captured changed before it was recorded #7446

Merged
EagleBearerYS merged 6 commits from upstream-pr/7446 into main 2026-11-02 07:55:58 +00:00
EagleBearerYS commented 2026-10-18 06:49:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T06:49:49Z.


What

Onimusha: Way of the Sword (PPSA27836) gets a draw that binds zeros where the game has written buffer descriptors. In frankea's run on #5769 (main 5de7a46e0b plus a diagnostic branch, Windows 11, RTX 4090, cold and warm caches), it shows once per run, before any input:

[gpu] guest snapshot differs from registered memory: snapshot 0x2112c009d0+0x20 (live region 0x2112c00000+0x10000, writable, host-backed) differs first at +0x2; the live region serves the GPU (1 mismatches so far; APS5_SNAPSHOT_CHECK_FATAL=1 fails the dispatch instead)
[gpu]   snapshot 0x2112c009d0+0x20 from +0x0, words: snapshot 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | live 04400000 0001001d 00304f30 30005004 00000000 08000000 00000000 00000000; read by a draw on queue 0, program 0x2107e36000
  • The two lines: the first is main's. The second comes from the diagnostic branch, which isn't in this PR. Every record it lists is a capture of eight zero dwords where the live memory now holds a V#: records 0x30 apart, read by one draw on queue 0.
  • What it means: the draw captured the array before the game filled it.
  • On screen: frankea saw nothing wrong up to the title screen and menus. The title can't reach a scene yet, for other reasons (#6374, #4276), so whether those draws show anything is open.

Why the zeros stay:

  1. A draw's descriptor tables and the other memory its shaders read are captured, then prepared.
  2. Only after that is the draw recorded under the GPU lock, or handed to the draw pipeline's committer.
  3. The recompiler bakes the captured words into the draw's bindings and specialization.
  4. AddSnapshot only warns for a live region, so a table the title writes in that window stays bound as captured.

The change: at the last point the queue worker handles a draw or dispatch, it compares the regions it captured with guest memory. If they differ, it prepares the packet again from current memory, once.

  • Where it checks:
    • after taking the GPU lock and before recording, on both synchronous draw paths;
    • before the first record of a CPU-path indirect draw;
    • in the dispatch loop;
    • right before a draw or dispatch item goes to the draw pipeline.
  • How it reads: the pages are read as AddSnapshot reads them, with no flush and no sync.
  • On a difference: the GPU lock is released and the packet is prepared again. The second pass records as before.
  • Counter: the [labels] line counts the packets prepared again "for captured memory that changed before recording".

Related:

  • #1864 fixed the compute twin (#1787) by landing a cross-queue wait before the dispatch reads memory. The graphics queue is exempt from that landing, as its libSceAgcDriver debt entry says. This PR updates that entry.
  • #6911 fixes a different source of the same warning: an ahead-resolved compute dispatch comparing freed words. This check skips ahead-resolved dispatches, so the two compose.

What it doesn't cover:

  • a write that lands after the draw is handed to the committer and before it's recorded. AddSnapshot still only warns there;
  • writes between the records of one CPU-path indirect packet;
  • a second change after the one retry;
  • GPU writes that the CPU-visible pages don't show yet;
  • a draw finished on the draw finisher thread (APS5_DRAW_PIPELINE, off by default): it isn't prepared again, and commits as on main.

Cost, on a synthetic draw harness modeled on Resident Evil Village (PPSA01556)'s draw stream (not in the tree; Linux, lavapipe, 100 frames of 1,000 draws). Each draw compares 9.5 regions, 978 bytes.

where the captured memory lives compare per draw
the guest arena, where a title's direct, flexible and heap memory is, answered from the arena's page table 742–787 ns (about 80 ns per region)
a plain memcmp of the same bytes, for scale 286 ns
host memory outside the arena, where each region asks the kernel for its pages about 5 µs

Tested

  • GitHub's Linux (lavapipe, Mesa 25.2.8) and Windows runners (verify run):
    • Red: with only the five check blocks removed (the seam, the counter and the tests kept), the four tests fail 3 of 3 runs on Linux.
    • Green: with them, all four pass 20 of 20 runs.
    • Windows: they build and skip there, as GitHub's Windows runner has no Vulkan device.
    • Suites: libc and libkernel pass on both.
  • Windows, the full CI build (fork Build): none of the 1438 tests fails: 895 pass and 543 skip, the four new ones among the skips, and check_skips passes.
  • Linux, a run that mirrors CI's Linux job (a cloud machine, Ubuntu 24.04, GCC 13.3, Mesa lavapipe 25.2.8 with LLVM 20.1.2):
    • 1411 tests, against 1407 on main f1af6c5915. The only status changes are the four new tests. The 5 failures on both are that machine's IPv6 tests.
    • The new tests pass 80 of 80 runs (20 each).
  • New tests:
    • agc_driver_draw_recapture_on_change (pipelined, and _inline with APS5_PIPELINED_DRAWS=0): a draw through a descriptor table whose V# changes from zero to valid after the capture must bind the valid V# and be prepared again once. An unchanged table is not prepared again. Red: "the draw bound the zero V# captured before the table changed".
    • agc_driver_dispatch_recapture_on_change (and _items with APS5_PIPELINE_DISPATCH=1): the same for a dispatch whose table's V# moves to another buffer.
    • How the change is made: both tests change memory at the same point every run, through Driver::SetCaptureCheckHook, with no second thread.
  • Onimusha: Way of the Sword (PPSA27836, 01.000.001), run by cadenasynyster on Windows 11 26200 with an NVIDIA GeForce RTX 5070 Ti (driver 617.42), WinLibs GCC 15.2.0, Release, APS5_GPU_CHECKPOINTS=1 (comment). The tree is main b51c65d plus #7506, a libc export the title needs to load, with and without this PR, one run each, from the menus to the first story-mode load:
    • captures of 0x20 bytes in 0x2112c00000+0x10000 that differ from registered memory: 2 without this PR and 0 with it; with APS5_NO_HOST_IMPORT=1, 4 without and 1 with;

    • with host imports off, the run with this PR also logged four warnings the run without it didn't, 0x38 bytes at +0x158 of four 2 MiB regions. They didn't come back in the reruns below;

    • both stop where main stops: #6374's device loss with host imports, and a register 0x203 refusal without them.

    • Reruns with host imports off and APS5_PROFILE_DRAW=1, two runs of each build, alternated, on the same tree and route (comment):

      run build last "(N mismatches so far)" packets prepared again for captured memory that changed 0x38-byte warnings at +0x158
      1 without 61 – 0
      2 with 5 2 0
      3 without 52 – 0
      4 with 11 2 0

      All four stop at the same register 0x203 = 0x00000045 refusal. The single runs above with host imports off had totals of 38 without this PR and 17 with it. The prepared-again count is the last one the [labels] line printed (about every 10 s).

  • Onimusha: Way of the Sword (PPSA27836), run by frankea on Windows 11 26200 with an NVIDIA GeForce RTX 4090 (driver 616.92), WinLibs GCC 15.2.0, Release, with no input and a 240 s cap in the boot and front-end load (comment). main c3591adf9 with and without this PR (3fd9a62aed), two runs each, one of each with APS5_PROFILE_DRAW=1:
    • without this PR, both runs print one guest snapshot differs from registered memory warning (snapshot 0x2112c002e0+0x20);
    • with it, neither does. The profiled run's [labels] line counts one packet redone for captured memory that changed before recording, from its first report on, in the same window;
    • the unprofiled run with this PR started from a cold shader cache and may not have reached that draw within the cap, so frankea rests the result on the warm run and the two controls;
    • WAIT_REG_MEM_64 timeouts and "still pinned" lines vary from run to run on plain main too, so frankea reads nothing into them.
  • AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, run by LeandroLP23 at 3fd9a62aed on main 6efb7261b with 13 other open PRs, built once as one tree (comment):
    • agc_driver_dispatch_recapture_on_change and agc_driver_draw_recapture_on_change pass 3 of 3 runs;
    • of all the agc_* tests, 713 of 716 pass. LeandroLP23 reports that the 3 that fail (agc_driver_host_import_lifetime, agc_driver_quad_pixel_mask and agc_driver_layered_volume_vertex_no_gpl) fail the same way on unchanged main there.
  • cc60990a43, a merge of main 0db47b263d. The only conflict was in Draw.cpp: main's #6946 moved the second half of draw() into finishDraw, which runs inline by default, or on a draw finisher thread with APS5_DRAW_PIPELINE set. This PR's checks moved into finishDraw with it, and prepare the draw again through its queue and packet, as main's own label recapture does. A draw finished on the finisher thread has no queue to prepare from, so it isn't checked (see What it doesn't cover). On GitHub's runners (run), the four tests pass 10 runs in a row on Linux, none skipped. On Windows they build and skip, as the runner has no Vulkan device. The libc and libkernel suites pass on both, run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • An ^agc sweep on Linux (run): 856 of 920 pass, 62 skip and 2 fail:
      • agc_driver_sgpr_pattern_fill_keys, main's #8715 test, under the sweep's parallel load ("the dispatch completed 17 times without a pending write over the keys"), as on main;
      • agc_driver_queued_index_read_order, main's #6914 test ("the queued draw's commit stored the image's results over its index buffer"). Run alone with up to 20 repeats, it fails on its first run with "the image write left no pending result to order against": on this merge (run), on #9129's merge of the same main (run), whose diff doesn't touch the draw path, and on main 0db47b263d itself (run).
    • The same sweep on Windows: 261 of 936 pass and 673 skip without a Vulkan device. main's agc_driver_pipelined_metadata_pass and agc_driver_pipelined_metadata_pass_draw_pipeline (from #6946) fail at vkCreateInstance (-9) on GitHub's device-less runner, before this PR's code; upstream's Windows job builds them as skipped stubs.
  • Windows with host imports on, at cc60990a43, on an NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11 10.0.26300, WinLibs GCC 15.2.0, Release, the case wachi35676 reported and GitHub's Windows runner can't run. Each run makes 3 host imports.
    • The head: the four tests pass 10 of 10 each, none skipped.
    • With #7476's fix (0623263512) reverted on the same head: agc_driver_draw_recapture_on_change fails on its 4th run and _inline on its 9th, with wachi35676's message ("brightest color byte 0 (the zero V# captured before the change was bound), 1 packet(s) prepared again"); the two dispatch tests pass 10 of 10. That matches LeandroLP23's bisect on AMD.
    • Why: diagnostic logging in that reverted build shows the draw prepared again in every run. In the runs that pass, the colour target's results are written back before the target's host import is rewatched. In the runs that fail, the import is rewatched first, and the target's results are never written back before the test reads it, so it reads the untouched zeros, which the test reports as the zero V#. #7476 keeps a settled import compared while a storage image overlaps it, so that rewatch doesn't happen under the colour target.
  • Not tested: Intel hardware; a title on AMD hardware; more than two title runs of each build; host imports on with APS5_PROFILE_DRAW=1.
  • 1d6d1ff5a5, a merge of main 19cb822f84, after adriadam10's approval at cc60990a43. The only conflict was in docs/dev/debt/libSceAgcDriver.md. main (#8281) rewrote the shader float mode entry, and this PR changes the WAIT_REG_MEM entry under it; the merge keeps main's float mode entry and this PR's WAIT_REG_MEM entry. main's changes to Driver::dispatch and Driver::finishDraw are away from this PR's checks. This PR's added and removed lines are unchanged.
    • On GitHub's runners, ×10 (run): on Linux, agc_driver_draw_recapture_on_change and agc_driver_dispatch_recapture_on_change pass: 2 run, 2 pass, 0 skip, 0 fail. On Windows both skip, since the runner has no Vulkan device: 2 run, 0 pass, 2 skip, 0 fail.
    • The libc and libkernel suites pass on both runners, run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • NVIDIA GeForce RTX 5070 Ti (0x10de:0x2c05) and an AMD Radeon RDNA2 iGPU (0x1002:0x13c0), Windows 11, by @wachi35676 (comment): 1d6d1ff5a5 merged onto main b90d009d9f with the four draw calls taking tail.packetOffset (see the next bullet), WinLibs GCC 15.2.0, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, host imports on. agc_driver_draw_recapture_on_change, _inline, agc_driver_dispatch_recapture_on_change and _items pass 3 of 3 on both GPUs, none skipped. The draw case reports brightest color byte 255 (the valid V# was bound), 1 packet(s) prepared again, so the failure they reported at 3fd9a62ae is gone.
  • a4a99c3afc, a merge of main 47f9cee2cd (run). The textual merge is clean, but main's ea65a95401 (#5431) gives Driver::draw a packetOffset parameter, and this PR's four redraw calls in Draw.cpp didn't compile against it, as wachi35676 found. The merge passes tail.packetOffset there, as main's own redraw after captured labels does. This PR's other changed lines are the same as before. The four recapture tests pass 10 runs in a row on Linux: 4 run, 4 pass, 0 skip, 0 fail. Windows builds them and skips all 4, since that runner has no Vulkan device. Suites: libc and libkernel pass on Linux (144 and 209), and libc passes on Windows (171). Windows' libkernel suite runs 227 tests and fails guest_timed_join_import_libkernel_sys and guest_timed_join_import_libkernel_web, which this PR doesn't touch; main 88f99678bf fails the same two in this verify's Windows job (run), and main's own Windows CI passes them. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • a4a99c3afc on main 898a7fef4, rechecked by @wachi35676 (comment): the pushed head merges cleanly and builds without changes. On the RTX 5070 Ti and the AMD RDNA2 iGPU, with host imports on, agc_driver_draw_recapture_on_change, _inline, agc_driver_dispatch_recapture_on_change and _items pass 3 of 3. The changed-table draw reports brightest color byte 255 (the valid V# was bound), 1 packet(s) prepared again.
  • 0b272314cc, a merge of main 0836dfdf4f (run). #12862 moved libSceAgcDriver's test registrations into tests/cmake/; the conflict in CMakeLists.txt is resolved with tools/agc_test_split.py resolve, which moves this PR's registrations into a new tests/cmake/agc_driver_draw_recapture_on_change_tests.cmake (+10 lines). Nothing else conflicted. Apart from the move, this PR's diff is unchanged. With -DBUILD_TESTING=ON, ctest -N gives 3079 tests: main's 3075 plus its 4 tests, each listed once. agc_driver_dispatch_recapture_on_change, agc_driver_dispatch_recapture_on_change_items, agc_driver_draw_recapture_on_change, agc_driver_draw_recapture_on_change_inline pass 10 runs in a row. Linux: 4 run, 4 pass, 0 skip, 0 fail. Windows: 4 run, 0 pass, 4 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (199 and 308) and on Windows (226 and 330). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

Checklist

  • Based on main f1af6c5915, with main 0db47b263d merged in at cc60990a43 and main 19cb822f84 at 1d6d1ff5a5 (merges cleanly with current main); no other open PR implements the same functions. Overlaps (git merge-tree with each PR merged into main 1c523bdb48), each in adjacent lines where both sides stay:
    • Draw.cpp: #1896 (indirect draws pipelined behind the packet worker, draft) widens the pipelined branch to indirect draws where this PR adds its check; keep #1896's condition with the check in the branch. #6612 (tessellation followed by an NGG geometry stage) and #6679 (merged hull programs) look up the indirect user-data words with UserDataWords next to this PR's recordedOne; keep their lookups and add recordedOne.
    • Dispatch.cpp: #5497 (DCC keys read behind a pattern fill kernel's fast clear) adds its pattern match where this PR adds captureChecked; keep both.
    • Driver.hpp: #7275 (opt-in render-state overrides) declares HotReloadShaders next to SetCaptureCheckHook; keep both.
    • GuestBufferMemory.cpp: #6636 (ours, reused address-based draw builds) moves the live-snapshot condition into liveSnapshotCompared, where this PR adds snapshot.compared; the merge reads live && (snapshot.compared || !liveSnapshotCompared(snapshot.address, snapshot.bytes.size())).
    • The libSceAgcDriver debt file: #6760 (f64 min and max input denormal mode) edits the shader float mode entry, the line before the WAIT_REG_MEM entry this PR edits; keep both.
  • 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 under Silent stubs in their library's technical debt file
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none (wrong descriptors in PPSA27836 #5769, not a stop)
  • GPUs tested: Mesa lavapipe 25.2.8 (llvmpipe, LLVM 20.1.2), Linux (GitHub's runner and a cloud machine); NVIDIA GeForce RTX 5070 Ti (driver 617.42), Windows 11, for Onimusha: Way of the Sword (cadenasynyster); NVIDIA GeForce RTX 4090 (driver 616.92), Windows 11, for Onimusha: Way of the Sword (frankea); AMD Radeon 860M (driver 32.0.13058.8001), Windows 11, the tests only (LeandroLP23); NVIDIA GeForce RTX 3070 Laptop GPU (617.42), Windows 11, the four tests with host imports on, and with #7476's fix reverted; NVIDIA GeForce RTX 5070 Ti and an AMD Radeon RDNA2 iGPU, Windows 11, the four tests with host imports on (wachi35676)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4907055654 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-18T06:49:49Z. --- ### What Onimusha: Way of the Sword (PPSA27836) gets a draw that binds zeros where the game has written buffer descriptors. In [frankea's run on #5769](https://github.com/boykopovar/AnyPS5/discussions/5769#discussioncomment-19009181) (`main` 5de7a46e0b plus a diagnostic branch, Windows 11, RTX 4090, cold and warm caches), it shows once per run, before any input: ``` [gpu] guest snapshot differs from registered memory: snapshot 0x2112c009d0+0x20 (live region 0x2112c00000+0x10000, writable, host-backed) differs first at +0x2; the live region serves the GPU (1 mismatches so far; APS5_SNAPSHOT_CHECK_FATAL=1 fails the dispatch instead) [gpu] snapshot 0x2112c009d0+0x20 from +0x0, words: snapshot 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | live 04400000 0001001d 00304f30 30005004 00000000 08000000 00000000 00000000; read by a draw on queue 0, program 0x2107e36000 ``` - **The two lines:** the first is `main`'s. The second comes from the diagnostic branch, which isn't in this PR. Every record it lists is a capture of eight zero dwords where the live memory now holds a V#: records 0x30 apart, read by one draw on queue 0. - **What it means:** the draw captured the array before the game filled it. - **On screen:** frankea saw nothing wrong up to the title screen and menus. The title can't reach a scene yet, for other reasons (#6374, #4276), so whether those draws show anything is open. **Why the zeros stay:** 1. A draw's descriptor tables and the other memory its shaders read are captured, then prepared. 2. Only after that is the draw recorded under the GPU lock, or handed to the draw pipeline's committer. 3. The recompiler bakes the captured words into the draw's bindings and specialization. 4. `AddSnapshot` only warns for a live region, so a table the title writes in that window stays bound as captured. **The change:** at the last point the queue worker handles a draw or dispatch, it compares the regions it captured with guest memory. If they differ, it prepares the packet again from current memory, once. - **Where it checks:** - after taking the GPU lock and before recording, on both synchronous draw paths; - before the first record of a CPU-path indirect draw; - in the dispatch loop; - right before a draw or dispatch item goes to the draw pipeline. - **How it reads:** the pages are read as `AddSnapshot` reads them, with no flush and no sync. - **On a difference:** the GPU lock is released and the packet is prepared again. The second pass records as before. - **Counter:** the `[labels]` line counts the packets prepared again "for captured memory that changed before recording". **Related:** - **#1864** fixed the compute twin (#1787) by landing a cross-queue wait before the dispatch reads memory. The graphics queue is exempt from that landing, as its `libSceAgcDriver` debt entry says. This PR updates that entry. - **#6911** fixes a different source of the same warning: an ahead-resolved compute dispatch comparing freed words. This check skips ahead-resolved dispatches, so the two compose. **What it doesn't cover:** - a write that lands after the draw is handed to the committer and before it's recorded. `AddSnapshot` still only warns there; - writes between the records of one CPU-path indirect packet; - a second change after the one retry; - GPU writes that the CPU-visible pages don't show yet; - a draw finished on the draw finisher thread (`APS5_DRAW_PIPELINE`, off by default): it isn't prepared again, and commits as on `main`. **Cost**, on a synthetic draw harness modeled on Resident Evil Village (PPSA01556)'s draw stream (not in the tree; Linux, lavapipe, 100 frames of 1,000 draws). Each draw compares 9.5 regions, 978 bytes. | where the captured memory lives | compare per draw | |---|---| | the guest arena, where a title's direct, flexible and heap memory is, answered from the arena's page table | 742–787 ns (about 80 ns per region) | | a plain `memcmp` of the same bytes, for scale | 286 ns | | host memory outside the arena, where each region asks the kernel for its pages | about 5 µs | ### Tested - **GitHub's Linux (lavapipe, Mesa 25.2.8) and Windows runners** ([verify run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39103551024)): - **Red:** with only the five check blocks removed (the seam, the counter and the tests kept), the four tests fail 3 of 3 runs on Linux. - **Green:** with them, all four pass 20 of 20 runs. - **Windows:** they build and skip there, as GitHub's Windows runner has no Vulkan device. - **Suites:** libc and libkernel pass on both. - **Windows, the full CI build** ([fork Build](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39103475987)): none of the 1438 tests fails: 895 pass and 543 skip, the four new ones among the skips, and `check_skips` passes. - **Linux, a run that mirrors CI's Linux job** (a cloud machine, Ubuntu 24.04, GCC 13.3, Mesa lavapipe 25.2.8 with LLVM 20.1.2): - 1411 tests, against 1407 on `main` f1af6c5915. The only status changes are the four new tests. The 5 failures on both are that machine's IPv6 tests. - The new tests pass 80 of 80 runs (20 each). - **New tests:** - **`agc_driver_draw_recapture_on_change`** (pipelined, and `_inline` with `APS5_PIPELINED_DRAWS=0`): a draw through a descriptor table whose V# changes from zero to valid after the capture must bind the valid V# and be prepared again once. An unchanged table is not prepared again. Red: "the draw bound the zero V# captured before the table changed". - **`agc_driver_dispatch_recapture_on_change`** (and `_items` with `APS5_PIPELINE_DISPATCH=1`): the same for a dispatch whose table's V# moves to another buffer. - **How the change is made:** both tests change memory at the same point every run, through `Driver::SetCaptureCheckHook`, with no second thread. - **Onimusha: Way of the Sword (PPSA27836, 01.000.001)**, run by cadenasynyster on Windows 11 26200 with an NVIDIA GeForce RTX 5070 Ti (driver 617.42), WinLibs GCC 15.2.0, Release, `APS5_GPU_CHECKPOINTS=1` ([comment](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6249109549)). The tree is `main` b51c65d plus #7506, a libc export the title needs to load, with and without this PR, one run each, from the menus to the first story-mode load: - captures of 0x20 bytes in `0x2112c00000+0x10000` that differ from registered memory: 2 without this PR and 0 with it; with `APS5_NO_HOST_IMPORT=1`, 4 without and 1 with; - with host imports off, the run with this PR also logged four warnings the run without it didn't, 0x38 bytes at +0x158 of four 2 MiB regions. They didn't come back in the reruns below; - both stop where `main` stops: #6374's device loss with host imports, and a `register 0x203` refusal without them. - **Reruns** with host imports off and `APS5_PROFILE_DRAW=1`, two runs of each build, alternated, on the same tree and route ([comment](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6252668221)): | run | build | last "(N mismatches so far)" | packets prepared again for captured memory that changed | 0x38-byte warnings at +0x158 | |---|---|---|---|---| | 1 | without | 61 | – | 0 | | 2 | with | 5 | 2 | 0 | | 3 | without | 52 | – | 0 | | 4 | with | 11 | 2 | 0 | All four stop at the same `register 0x203 = 0x00000045` refusal. The single runs above with host imports off had totals of 38 without this PR and 17 with it. The prepared-again count is the last one the `[labels]` line printed (about every 10 s). - **Onimusha: Way of the Sword (PPSA27836)**, run by frankea on Windows 11 26200 with an NVIDIA GeForce RTX 4090 (driver 616.92), WinLibs GCC 15.2.0, Release, with no input and a 240 s cap in the boot and front-end load ([comment](https://github.com/boykopovar/AnyPS5/discussions/5769#discussioncomment-19021975)). `main` c3591adf9 with and without this PR (3fd9a62aed), two runs each, one of each with `APS5_PROFILE_DRAW=1`: - without this PR, both runs print one `guest snapshot differs from registered memory` warning (snapshot 0x2112c002e0+0x20); - with it, neither does. The profiled run's `[labels]` line counts one packet redone for captured memory that changed before recording, from its first report on, in the same window; - the unprofiled run with this PR started from a cold shader cache and may not have reached that draw within the cap, so frankea rests the result on the warm run and the two controls; - `WAIT_REG_MEM_64` timeouts and "still pinned" lines vary from run to run on plain `main` too, so frankea reads nothing into them. - **AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300**, WinLibs GCC 15.2.0 r7, Release, run by LeandroLP23 at 3fd9a62aed on `main` 6efb7261b with 13 other open PRs, built once as one tree ([comment](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6252348044)): - `agc_driver_dispatch_recapture_on_change` and `agc_driver_draw_recapture_on_change` pass 3 of 3 runs; - of all the `agc_*` tests, 713 of 716 pass. LeandroLP23 reports that the 3 that fail (`agc_driver_host_import_lifetime`, `agc_driver_quad_pixel_mask` and `agc_driver_layered_volume_vertex_no_gpl`) fail the same way on unchanged `main` there. - **cc60990a43, a merge of `main` 0db47b263d.** The only conflict was in `Draw.cpp`: `main`'s #6946 moved the second half of `draw()` into `finishDraw`, which runs inline by default, or on a draw finisher thread with `APS5_DRAW_PIPELINE` set. This PR's checks moved into `finishDraw` with it, and prepare the draw again through its queue and packet, as `main`'s own label recapture does. A draw finished on the finisher thread has no queue to prepare from, so it isn't checked (see What it doesn't cover). On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39931496173)), the four tests pass 10 runs in a row on Linux, none skipped. On Windows they build and skip, as the runner has no Vulkan device. The libc and libkernel suites pass on both, run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **An `^agc` sweep on Linux** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39908133365)): 856 of 920 pass, 62 skip and 2 fail: - `agc_driver_sgpr_pattern_fill_keys`, `main`'s #8715 test, under the sweep's parallel load ("the dispatch completed 17 times without a pending write over the keys"), as on `main`; - `agc_driver_queued_index_read_order`, `main`'s #6914 test ("the queued draw's commit stored the image's results over its index buffer"). Run alone with up to 20 repeats, it fails on its first run with "the image write left no pending result to order against": on this merge ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39920257511)), on #9129's merge of the same `main` ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39920295249)), whose diff doesn't touch the draw path, and on `main` 0db47b263d itself ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39936971416)). - **The same sweep on Windows:** 261 of 936 pass and 673 skip without a Vulkan device. `main`'s `agc_driver_pipelined_metadata_pass` and `agc_driver_pipelined_metadata_pass_draw_pipeline` (from #6946) fail at `vkCreateInstance` (-9) on GitHub's device-less runner, before this PR's code; upstream's Windows job builds them as skipped stubs. - **Windows with host imports on, at cc60990a43**, on an NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11 10.0.26300, WinLibs GCC 15.2.0, Release, the case wachi35676 reported and GitHub's Windows runner can't run. Each run makes 3 host imports. - **The head:** the four tests pass 10 of 10 each, none skipped. - **With #7476's fix (0623263512) reverted on the same head:** `agc_driver_draw_recapture_on_change` fails on its 4th run and `_inline` on its 9th, with wachi35676's message ("brightest color byte 0 (the zero V# captured before the change was bound), 1 packet(s) prepared again"); the two dispatch tests pass 10 of 10. That matches LeandroLP23's bisect on AMD. - **Why:** diagnostic logging in that reverted build shows the draw prepared again in every run. In the runs that pass, the colour target's results are written back before the target's host import is rewatched. In the runs that fail, the import is rewatched first, and the target's results are never written back before the test reads it, so it reads the untouched zeros, which the test reports as the zero V#. #7476 keeps a settled import compared while a storage image overlaps it, so that rewatch doesn't happen under the colour target. - **Not tested:** Intel hardware; a title on AMD hardware; more than two title runs of each build; host imports on with `APS5_PROFILE_DRAW=1`. - **1d6d1ff5a5, a merge of `main` 19cb822f84, after adriadam10's approval at cc60990a43.** The only conflict was in `docs/dev/debt/libSceAgcDriver.md`. `main` (#8281) rewrote the shader float mode entry, and this PR changes the WAIT_REG_MEM entry under it; the merge keeps `main`'s float mode entry and this PR's WAIT_REG_MEM entry. `main`'s changes to `Driver::dispatch` and `Driver::finishDraw` are away from this PR's checks. This PR's added and removed lines are unchanged. - On GitHub's runners, ×10 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40081981473)): on Linux, `agc_driver_draw_recapture_on_change` and `agc_driver_dispatch_recapture_on_change` pass: 2 run, 2 pass, 0 skip, 0 fail. On Windows both skip, since the runner has no Vulkan device: 2 run, 0 pass, 2 skip, 0 fail. - The libc and libkernel suites pass on both runners, run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **NVIDIA GeForce RTX 5070 Ti (`0x10de:0x2c05`) and an AMD Radeon RDNA2 iGPU (`0x1002:0x13c0`), Windows 11, by @wachi35676** ([comment](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6404834825)): 1d6d1ff5a5 merged onto `main` b90d009d9f with the four `draw` calls taking `tail.packetOffset` (see the next bullet), WinLibs GCC 15.2.0, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, host imports on. `agc_driver_draw_recapture_on_change`, `_inline`, `agc_driver_dispatch_recapture_on_change` and `_items` pass 3 of 3 on both GPUs, none skipped. The draw case reports `brightest color byte 255 (the valid V# was bound), 1 packet(s) prepared again`, so the failure they reported at 3fd9a62ae is gone. - **a4a99c3afc, a merge of `main` 47f9cee2cd** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40245390028)). The textual merge is clean, but `main`'s ea65a95401 (#5431) gives `Driver::draw` a `packetOffset` parameter, and this PR's four redraw calls in `Draw.cpp` didn't compile against it, as wachi35676 found. The merge passes `tail.packetOffset` there, as `main`'s own redraw after captured labels does. This PR's other changed lines are the same as before. The four recapture tests pass 10 runs in a row on Linux: 4 run, 4 pass, 0 skip, 0 fail. Windows builds them and skips all 4, since that runner has no Vulkan device. Suites: libc and libkernel pass on Linux (144 and 209), and libc passes on Windows (171). Windows' libkernel suite runs 227 tests and fails `guest_timed_join_import_libkernel_sys` and `guest_timed_join_import_libkernel_web`, which this PR doesn't touch; `main` 88f99678bf fails the same two in this verify's Windows job ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40238050809)), and `main`'s own Windows CI passes them. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **a4a99c3afc on `main` 898a7fef4, rechecked by @wachi35676** ([comment](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6407737599)): the pushed head merges cleanly and builds without changes. On the RTX 5070 Ti and the AMD RDNA2 iGPU, with host imports on, `agc_driver_draw_recapture_on_change`, `_inline`, `agc_driver_dispatch_recapture_on_change` and `_items` pass 3 of 3. The changed-table draw reports `brightest color byte 255 (the valid V# was bound), 1 packet(s) prepared again`. - **0b272314cc, a merge of `main` 0836dfdf4f** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41240368985)). #12862 moved `libSceAgcDriver`'s test registrations into `tests/cmake/`; the conflict in `CMakeLists.txt` is resolved with `tools/agc_test_split.py resolve`, which moves this PR's registrations into a new `tests/cmake/agc_driver_draw_recapture_on_change_tests.cmake` (+10 lines). Nothing else conflicted. Apart from the move, this PR's diff is unchanged. With `-DBUILD_TESTING=ON`, `ctest -N` gives 3079 tests: `main`'s 3075 plus its 4 tests, each listed once. `agc_driver_dispatch_recapture_on_change`, `agc_driver_dispatch_recapture_on_change_items`, `agc_driver_draw_recapture_on_change`, `agc_driver_draw_recapture_on_change_inline` pass 10 runs in a row. Linux: 4 run, 4 pass, 0 skip, 0 fail. Windows: 4 run, 0 pass, 4 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (199 and 308) and on Windows (226 and 330). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. ### Checklist - [x] Based on `main` f1af6c5915, with `main` 0db47b263d merged in at cc60990a43 and `main` 19cb822f84 at 1d6d1ff5a5 (merges cleanly with current `main`); no other open PR implements the same functions. Overlaps (`git merge-tree` with each PR merged into `main` 1c523bdb48), each in adjacent lines where both sides stay: - `Draw.cpp`: #1896 (indirect draws pipelined behind the packet worker, draft) widens the pipelined branch to indirect draws where this PR adds its check; keep #1896's condition with the check in the branch. #6612 (tessellation followed by an NGG geometry stage) and #6679 (merged hull programs) look up the indirect user-data words with `UserDataWords` next to this PR's `recordedOne`; keep their lookups and add `recordedOne`. - `Dispatch.cpp`: #5497 (DCC keys read behind a pattern fill kernel's fast clear) adds its pattern match where this PR adds `captureChecked`; keep both. - `Driver.hpp`: #7275 (opt-in render-state overrides) declares `HotReloadShaders` next to `SetCaptureCheckHook`; keep both. - `GuestBufferMemory.cpp`: #6636 (ours, reused address-based draw builds) moves the live-snapshot condition into `liveSnapshotCompared`, where this PR adds `snapshot.compared`; the merge reads `live && (snapshot.compared || !liveSnapshotCompared(snapshot.address, snapshot.bytes.size()))`. - The `libSceAgcDriver` debt file: #6760 (f64 min and max input denormal mode) edits the shader float mode entry, the line before the WAIT_REG_MEM entry this PR edits; keep both. - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none (wrong descriptors in PPSA27836 #5769, not a stop) - [x] GPUs tested: Mesa lavapipe 25.2.8 (llvmpipe, LLVM 20.1.2), Linux (GitHub's runner and a cloud machine); NVIDIA GeForce RTX 5070 Ti (driver 617.42), Windows 11, for Onimusha: Way of the Sword (cadenasynyster); NVIDIA GeForce RTX 4090 (driver 616.92), Windows 11, for Onimusha: Way of the Sword (frankea); AMD Radeon 860M (driver 32.0.13058.8001), Windows 11, the tests only (LeandroLP23); NVIDIA GeForce RTX 3070 Laptop GPU (617.42), Windows 11, the four tests with host imports on, and with #7476's fix reverted; NVIDIA GeForce RTX 5070 Ti and an AMD Radeon RDNA2 iGPU, Windows 11, the four tests with host imports on (wachi35676) - [x] AI-assisted: yes
cadenasynyster commented 2026-10-18 11:06:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-18T11:06:47Z.


Tested on the title and on NVIDIA, the two items under "Not tested".

Tree: main b51c65d + #7506 (the title needs that libc export to load) + this PR (3fd9a62). Windows 11 26200, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release, APS5_GPU_CHECKPOINTS=1. Dump 01.000.001. Same path every run: menus, New Game, difficulty, layout, then the first story-mode load. One run per row; "without" is the same tree minus this PR.

0x20 captures in 0x2112c00000+0x10000 other snapshot warnings running total at the last printed warning where the run stops
host imports on, without 2 0 2 #6374 device loss, read invalid at 0x4840000
host imports on, with 0 0 – same, read invalid at 0x4840000
APS5_NO_HOST_IMPORT=1, without 4 0 38 register 0x203 = 0x00000045 refusal
APS5_NO_HOST_IMPORT=1, with 1 4 17 same refusal

The running total is main's "N mismatches so far"; the log prints only some of the warnings.

  • The 0x20 captures in 0x2112c00000+0x10000 are the ones in your description. They go from 2 to 0 and from 4 to 1. The one left with the PR:
    [gpu] guest snapshot differs from registered memory: snapshot 0x2112c02830+0x20 (live region 0x2112c00000+0x10000, writable, mirrored)
    differs first at +0x0; the live region serves the GPU (17 mismatches so far; APS5_SNAPSHOT_CHECK_FATAL=1 fails the dispatch instead)
    
  • The host-imports-off run with the PR also has four warnings its baseline doesn't: 0x38 bytes at +0x158 of four 2 MiB regions (0x2111000000, 0x210d800000, 0x210e800000, 0x2110c00000). The first is differs first at +0x0 and is the run's first mismatch. With one run each, I can't tell whether they come from the PR or just didn't show in the baseline run.
  • The stops don't change: the PR doesn't avoid #6374 or the 0x203 refusal, so whether those draws show anything wrong is still open.
  • None of my logs has a [labels] line, so I couldn't read the "prepared again" count. If it needs a switch, say which and I'll rerun.

Not run: repeated runs, AMD, Intel.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6249109549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6249109549). Originally posted by [cadenasynyster](https://github.com/cadenasynyster) on 2026-10-18T11:06:47Z. --- Tested on the title and on NVIDIA, the two items under "Not tested". Tree: main b51c65d + #7506 (the title needs that libc export to load) + this PR (3fd9a62). Windows 11 26200, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release, `APS5_GPU_CHECKPOINTS=1`. Dump 01.000.001. Same path every run: menus, New Game, difficulty, layout, then the first story-mode load. One run per row; "without" is the same tree minus this PR. | | 0x20 captures in `0x2112c00000+0x10000` | other snapshot warnings | running total at the last printed warning | where the run stops | |---|---|---|---|---| | host imports on, without | 2 | 0 | 2 | #6374 device loss, `read invalid at 0x4840000` | | host imports on, with | 0 | 0 | – | same, `read invalid at 0x4840000` | | `APS5_NO_HOST_IMPORT=1`, without | 4 | 0 | 38 | `register 0x203 = 0x00000045` refusal | | `APS5_NO_HOST_IMPORT=1`, with | 1 | 4 | 17 | same refusal | The running total is main's "N mismatches so far"; the log prints only some of the warnings. - The 0x20 captures in `0x2112c00000+0x10000` are the ones in your description. They go from 2 to 0 and from 4 to 1. The one left with the PR: ``` [gpu] guest snapshot differs from registered memory: snapshot 0x2112c02830+0x20 (live region 0x2112c00000+0x10000, writable, mirrored) differs first at +0x0; the live region serves the GPU (17 mismatches so far; APS5_SNAPSHOT_CHECK_FATAL=1 fails the dispatch instead) ``` - The host-imports-off run with the PR also has four warnings its baseline doesn't: 0x38 bytes at `+0x158` of four 2 MiB regions (`0x2111000000`, `0x210d800000`, `0x210e800000`, `0x2110c00000`). The first is `differs first at +0x0` and is the run's first mismatch. With one run each, I can't tell whether they come from the PR or just didn't show in the baseline run. - The stops don't change: the PR doesn't avoid #6374 or the 0x203 refusal, so whether those draws show anything wrong is still open. - None of my logs has a `[labels]` line, so I couldn't read the "prepared again" count. If it needs a switch, say which and I'll rerun. Not run: repeated runs, AMD, Intel. AI-assisted: yes
EagleBearerYS commented 2026-10-18 11:13:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T11:13:42Z.


@cadenasynyster thank you, that covers both open items. The [labels] line needs APS5_PROFILE_DRAW=1 (any value), and it prints about every 10 s. If you have time for a rerun, the host-imports-off pair two or three times each with that switch would show whether the four 0x38-byte warnings at +0x158 follow this PR, and how many packets it prepared again in those runs.

The four lines may only be sampling: the warning prints at most one mismatch every 10 s, with a running count. With the 0x2112c00000 captures gone, other mismatches get the printed lines instead, and your totals (38 without this PR, 17 with it) point that way. So the last "(N mismatches so far)" of each rerun, with and without this PR, is the number to compare.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6249205542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6249205542). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-18T11:13:42Z. --- @cadenasynyster thank you, that covers both open items. The `[labels]` line needs `APS5_PROFILE_DRAW=1` (any value), and it prints about every 10 s. If you have time for a rerun, the host-imports-off pair two or three times each with that switch would show whether the four 0x38-byte warnings at +0x158 follow this PR, and how many packets it prepared again in those runs. The four lines may only be sampling: the warning prints at most one mismatch every 10 s, with a running count. With the 0x2112c00000 captures gone, other mismatches get the printed lines instead, and your totals (38 without this PR, 17 with it) point that way. So the last "(N mismatches so far)" of each rerun, with and without this PR, is the number to compare.
LeandroLP23 commented 2026-10-18 16:33:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T16:33:32Z.


AMD on Windows: the tests this PR names pass on an RDNA 3.5 GPU.

Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release. main 6efb7261b with this PR (3fd9a62ae) merged, together with #7296, #7377, #7445, #6708, #6748, #6785, #6706, #6613, #7449, #7391, #7489, #7484, #7514. They were built once, so the result is for the combination; each merge was clean.

  • agc_driver_dispatch_recapture_on_change, agc_driver_draw_recapture_on_change: pass, 3 runs of 3.
  • Every agc_* test on the combined build: 713 of 716 pass. The 3 that fail, agc_driver_host_import_lifetime, agc_driver_quad_pixel_mask and agc_driver_layered_volume_vertex_no_gpl, fail the same way on unchanged main here, so none comes from these PRs.

AI-assisted

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252348044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6252348044). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-18T16:33:32Z. --- AMD on Windows: the tests this PR names pass on an RDNA 3.5 GPU. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release. `main` `6efb7261b` with this PR (`3fd9a62ae`) merged, together with #7296, #7377, #7445, #6708, #6748, #6785, #6706, #6613, #7449, #7391, #7489, #7484, #7514. They were built once, so the result is for the combination; each merge was clean. - `agc_driver_dispatch_recapture_on_change`, `agc_driver_draw_recapture_on_change`: pass, 3 runs of 3. - Every `agc_*` test on the combined build: 713 of 716 pass. The 3 that fail, `agc_driver_host_import_lifetime`, `agc_driver_quad_pixel_mask` and `agc_driver_layered_volume_vertex_no_gpl`, fail the same way on unchanged `main` here, so none comes from these PRs. AI-assisted
EagleBearerYS commented 2026-10-18 16:39:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T16:39:28Z.


@LeandroLP23 thanks for running them on the Radeon 860M. Your run is now in the Tested section, with your note that the three agc_* failures fail the same way on unchanged main there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252409488 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6252409488). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-18T16:39:28Z. --- @LeandroLP23 thanks for running them on the Radeon 860M. Your run is now in the Tested section, with your note that the three `agc_*` failures fail the same way on unchanged `main` there.
cadenasynyster commented 2026-10-18 17:04:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-18T17:04:41Z.


Reruns as you asked: host imports off (APS5_NO_HOST_IMPORT=1), APS5_PROFILE_DRAW=1, two runs of each build, alternated (without, with, without, with). Same tree as before: main b51c65d + #7506, with or without this PR (3fd9a62). Windows 11 26200, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. Same route every run, until the title stops on its own.

run build last "(N mismatches so far)" packets prepared again for captured memory that changed before recording 0x38-byte warnings at +0x158 where it stops
1 without 61 n/a 0 register 0x203 = 0x00000045 refusal
2 with 5 2 0 same
3 without 52 n/a 0 same
4 with 11 2 0 same
  • The last mismatch total is 61 and 52 without the PR, 5 and 11 with it. The earlier single runs (38 without, 17 with) point the same way.
  • The four 0x38-byte warnings did not come back in either run with the PR, which fits your sampling explanation.
  • The prepared-again count is the last one printed. The [labels] line wraps, so the number is on the line before the words "captured memory that changed before recording" ("…, 2 for captured memory that changed before recording"). It was 2 in both runs, as of the last report; the log prints it about every 10 s.
  • Where the runs stop doesn't change: the same 0x203 refusal in all four.

Not run: host imports on with the switch, more than two runs of each, AMD, Intel.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252668221 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6252668221). Originally posted by [cadenasynyster](https://github.com/cadenasynyster) on 2026-10-18T17:04:41Z. --- Reruns as you asked: host imports off (`APS5_NO_HOST_IMPORT=1`), `APS5_PROFILE_DRAW=1`, two runs of each build, alternated (without, with, without, with). Same tree as before: main b51c65d + #7506, with or without this PR (3fd9a62). Windows 11 26200, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. Same route every run, until the title stops on its own. | run | build | last "(N mismatches so far)" | packets prepared again for captured memory that changed before recording | 0x38-byte warnings at +0x158 | where it stops | |---|---|---|---|---|---| | 1 | without | 61 | n/a | 0 | `register 0x203 = 0x00000045` refusal | | 2 | with | 5 | 2 | 0 | same | | 3 | without | 52 | n/a | 0 | same | | 4 | with | 11 | 2 | 0 | same | - The last mismatch total is 61 and 52 without the PR, 5 and 11 with it. The earlier single runs (38 without, 17 with) point the same way. - The four 0x38-byte warnings did not come back in either run with the PR, which fits your sampling explanation. - The prepared-again count is the last one printed. The `[labels]` line wraps, so the number is on the line before the words "captured memory that changed before recording" ("…, 2 for captured memory that changed before recording"). It was 2 in both runs, as of the last report; the log prints it about every 10 s. - Where the runs stop doesn't change: the same `0x203` refusal in all four. Not run: host imports on with the switch, more than two runs of each, AMD, Intel. AI-assisted: yes (Claude Code).
EagleBearerYS commented 2026-10-18 17:12:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T17:12:35Z.


@cadenasynyster thanks for the reruns. With host imports off, the last mismatch total is 61 and 52 without this PR and 5 and 11 with it, the four 0x38-byte warnings didn't come back, and all four runs stop at the same register 0x203 refusal. Both pairs are now in the Tested section, next to your first runs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252749202 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6252749202). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-18T17:12:35Z. --- @cadenasynyster thanks for the reruns. With host imports off, the last mismatch total is 61 and 52 without this PR and 5 and 11 with it, the four 0x38-byte warnings didn't come back, and all four runs stop at the same `register 0x203` refusal. Both pairs are now in the Tested section, next to your first runs.
wachi35676 commented 2026-10-19 00:13:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T00:13:18Z.


Tested at 3fd9a62ae on Windows 11 (GCC 15.2.0, Release), merged onto main 9f25d0bf5, on an RTX 5070 Ti (617.42) and an AMD Radeon iGPU, RDNA2 (1002:13c0, 32.0.21042.62, ANYPS5_GPU=AMD). agc_driver_draw_recapture_on_change and agc_driver_draw_recapture_on_change_inline fail on both GPUs, 3 of 3 runs each:

a draw whose descriptor table changed from a zero V# to a valid one after its capture: the table changed 1 time(s), brightest color byte 0 (the zero V# captured before the change was bound), 1 packet(s) prepared again
draw recapture: the draw bound the zero V# captured before the table changed, not the valid V# in memory when it was recorded

With APS5_NO_HOST_IMPORT=1, both pass 3 of 3 on both GPUs. So on Windows with host imports, the packet is prepared again but the draw still binds the stale V#. The Windows CI runner skipped these tests (no Vulkan device), so this path hadn't been run before.

agc_driver_dispatch_recapture_on_change and _items pass on both GPUs, and the rest of the 719-test agc_|shader|recompiler set shows no change against main.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6256920148 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6256920148). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-19T00:13:18Z. --- Tested at `3fd9a62ae` on Windows 11 (GCC 15.2.0, Release), merged onto `main` `9f25d0bf5`, on an RTX 5070 Ti (617.42) and an AMD Radeon iGPU, RDNA2 (`1002:13c0`, 32.0.21042.62, `ANYPS5_GPU=AMD`). `agc_driver_draw_recapture_on_change` and `agc_driver_draw_recapture_on_change_inline` fail on both GPUs, 3 of 3 runs each: ``` a draw whose descriptor table changed from a zero V# to a valid one after its capture: the table changed 1 time(s), brightest color byte 0 (the zero V# captured before the change was bound), 1 packet(s) prepared again draw recapture: the draw bound the zero V# captured before the table changed, not the valid V# in memory when it was recorded ``` With `APS5_NO_HOST_IMPORT=1`, both pass 3 of 3 on both GPUs. So on Windows with host imports, the packet is prepared again but the draw still binds the stale V#. The Windows CI runner skipped these tests (no Vulkan device), so this path hadn't been run before. `agc_driver_dispatch_recapture_on_change` and `_items` pass on both GPUs, and the rest of the 719-test `agc_|shader|recompiler` set shows no change against `main`. AI-assisted: yes (Claude Code); results above were run on this machine.
adriadam10 commented 2026-10-19 15:19:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T15:19:38Z.

Review: CHANGES_REQUESTED


Thanks for the thorough testing. Two things block this:

  • @wachi35676 reports at 3fd9a62ae (Windows, RTX 5070 Ti and Radeon RDNA2) that agc_driver_draw_recapture_on_change and agc_driver_draw_recapture_on_change_inline fail 3 of 3 with host imports: the packet is prepared again ("1 packet(s) prepared again") but the draw still binds the zero V#. With APS5_NO_HOST_IMPORT=1 both pass. Host imports are the default path on Windows, so the recapture does not do its job there, and the Windows CI runner skips these tests, so nothing covers it. Please find why the second pass still reads stale bytes for a host-imported region (the import window or a cached mirror serving the old content) and fix it, or show that the test setup is what differs.
  • The branch conflicts with main: Draw.cpp (the surrounding code changed, so the check placement needs another look) and docs/dev/debt/libSceAgcDriver.md. Please rebase and rerun the four tests.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5573776207 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#pullrequestreview-5573776207). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T15:19:38Z. **Review:** CHANGES_REQUESTED --- Thanks for the thorough testing. Two things block this: - @wachi35676 reports at `3fd9a62ae` (Windows, RTX 5070 Ti and Radeon RDNA2) that `agc_driver_draw_recapture_on_change` and `agc_driver_draw_recapture_on_change_inline` fail 3 of 3 with host imports: the packet is prepared again ("1 packet(s) prepared again") but the draw still binds the zero V#. With `APS5_NO_HOST_IMPORT=1` both pass. Host imports are the default path on Windows, so the recapture does not do its job there, and the Windows CI runner skips these tests, so nothing covers it. Please find why the second pass still reads stale bytes for a host-imported region (the import window or a cached mirror serving the old content) and fix it, or show that the test setup is what differs. - The branch conflicts with `main`: `Draw.cpp` (the surrounding code changed, so the check placement needs another look) and `docs/dev/debt/libSceAgcDriver.md`. Please rebase and rerun the four tests.
LeandroLP23 commented 2026-10-19 15:41:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-19T15:41:12Z.


@adriadam10 @wachi35676 the host-import failure depends on the main the head is merged into, and #7476 (7a2e4a4e7) is what makes it pass. Radeon 860M (RDNA 3.5), driver 32.0.13058.8001, Windows 11, WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1, head 3fd9a62ae merged into each base, only this PR:

main base draw_recapture_on_change and _inline, host imports on (default) APS5_NO_HOST_IMPORT=1
9f25d0bf5 (wachi's base) fail 3 of 3 each: brightest color byte 0 (the zero V# captured before the change was bound), 1 packet(s) prepared again pass 3 of 3
7a2e4a4e7^1, just before #7476 fails 2 of 2
7a2e4a4e7, #7476 merged passes 2 of 2
6efb7261b (my earlier base) pass 3 of 3 each pass 3 of 3

So I can reproduce wachi's failure on AMD's driver too, and my earlier pass came from a base that already had #7476. Only 7 merges separate the two bases, and #7476 is the only one that touches the write watch. Host imports were active in my runs: the log shows [write-watch] host imports of write-watched memory keep the write watch: yes.

I couldn't check the current head against today's main, since it conflicts. Rebased onto a main with #7476, it should no longer fail with host imports. If #7446 needs #7476's re-watch for this case, it could list it under "Depends on".

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271148061 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6271148061). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-19T15:41:12Z. --- @adriadam10 @wachi35676 the host-import failure depends on the `main` the head is merged into, and #7476 (`7a2e4a4e7`) is what makes it pass. Radeon 860M (RDNA 3.5), driver 32.0.13058.8001, Windows 11, WinLibs GCC 15.2.0, Release, `ANYPS5_NO_SHADER_CACHE=1`, head 3fd9a62ae merged into each base, only this PR: | `main` base | `draw_recapture_on_change` and `_inline`, host imports on (default) | `APS5_NO_HOST_IMPORT=1` | |---|---|---| | `9f25d0bf5` (wachi's base) | fail 3 of 3 each: `brightest color byte 0 (the zero V# captured before the change was bound), 1 packet(s) prepared again` | pass 3 of 3 | | `7a2e4a4e7^1`, just before #7476 | fails 2 of 2 | | | `7a2e4a4e7`, #7476 merged | passes 2 of 2 | | | `6efb7261b` (my earlier base) | pass 3 of 3 each | pass 3 of 3 | So I can reproduce wachi's failure on AMD's driver too, and my earlier pass came from a base that already had #7476. Only 7 merges separate the two bases, and #7476 is the only one that touches the write watch. Host imports were active in my runs: the log shows `[write-watch] host imports of write-watched memory keep the write watch: yes`. I couldn't check the current head against today's `main`, since it conflicts. Rebased onto a `main` with #7476, it should no longer fail with host imports. If #7446 needs #7476's re-watch for this case, it could list it under "Depends on". AI-assisted: yes (Claude Code)
EagleBearerYS commented 2026-10-21 03:40:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T03:40:03Z.


@adriadam10 The branch now merges main (94d5a26066), which resolves the conflicts in Draw.cpp and the debt entry, and brings in #7476.

  • The host-import failure: @LeandroLP23's bisect shows wachi35676's failure at 3fd9a62ae came from the base the head was merged into. Both draw tests fail on a main just before #7476 and pass once #7476 is in (Radeon 860M, AMD's Windows driver). Now that the branch carries #7476, the case it fixes is covered.
  • A path main added since: main's 73983f1c29 queues the last drawable record of a CPU-path indirect draw on the draw pipeline when no earlier record was drawn inline. That path skipped the check this PR runs before the first record is recorded, so the merge adds it there: the captured memory is compared before enqueuing, as the direct pipelined path does.
  • On GitHub's runners, the four tests pass 5 runs each on Linux (lavapipe). Windows builds them, and they skip there without a Vulkan device (run).

@wachi35676, @LeandroLP23: could one of you rerun agc_driver_draw_recapture_on_change, agc_driver_draw_recapture_on_change_inline and the two dispatch tests on Windows with host imports on, at 94d5a26066? That's the case the Windows runner can't cover.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307450701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7446#issuecomment-6307450701). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-21T03:40:03Z. --- @adriadam10 The branch now merges `main` (94d5a26066), which resolves the conflicts in `Draw.cpp` and the debt entry, and brings in #7476. - **The host-import failure:** @LeandroLP23's bisect shows wachi35676's failure at 3fd9a62ae came from the base the head was merged into. Both draw tests fail on a `main` just before #7476 and pass once #7476 is in (Radeon 860M, AMD's Windows driver). Now that the branch carries #7476, the case it fixes is covered. - **A path main added since:** main's 73983f1c29 queues the last drawable record of a CPU-path indirect draw on the draw pipeline when no earlier record was drawn inline. That path skipped the check this PR runs before the first record is recorded, so the merge adds it there: the captured memory is compared before enqueuing, as the direct pipelined path does. - **On GitHub's runners,** the four tests pass 5 runs each on Linux (lavapipe). Windows builds them, and they skip there without a Vulkan device ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39539904067)). @wachi35676, @LeandroLP23: could one of you rerun `agc_driver_draw_recapture_on_change`, `agc_driver_draw_recapture_on_change_inline` and the two dispatch tests on Windows with host imports on, at 94d5a26066? That's the case the Windows runner can't cover.
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!7446
No description provided.