perf(agc): linear color targets over imported memory get a resident image #6892

Merged
tibzejoker merged 1 commit from upstream-pr/6892 into main 2026-10-17 07:52:25 +00:00
tibzejoker commented 2026-10-16 16:53:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-16T16:53:08Z.


What

A linear color target took a synchronous draw every time it was drawn to: copy in, draw, copy out, then a CPU wait for the GPU. Tiled targets have a resident image instead, so their draws are recorded and continue the open batch.

With this change, a linear target whose memory already has a host import gets a resident image like a tiled target:

  • keepRecordedDraw stores its results back to guest memory right after the draw, with a recorded store (StorageTexture::FlushPending). CPU readers still see them, without the wait.
  • No import is created for it: the new ExistingHostImportFor is a lookup only. Memory without an import keeps the synchronous path, so nothing changes for it.
  • APS5_NO_RESIDENT_LINEAR=1 restores the old path for every linear target.

Why lookup only: a first version created the import, and that broke agc_driver_pixel_ancillary_word and agc_driver_pixel_fixed_point_position. An import made over a short-lived block left the next block allocated at the same address unwatched.

Overlap: #1191 (MichonGoddijn231849) implements the same idea. It is ~6,000 commits behind main and conflicts in 10 files. This PR is a narrower take on current main. I asked on #6754 whether Michon prefers to fold it into #1191 or rebase #1191 instead, and I'm happy to close this one if so.

Tested

Windows 11, MinGW (WinLibs GCC 15.2), RTX 4090 (driver 616.92).

  • New test agc_driver_linear_target_resident: a draw into a linear R32G32B32A32 target over imported memory must leave the recorder busy (recorded, not waited), and the pixels must be in guest memory after WaitIdle, without a flush. It passes with the change and fails with APS5_NO_RESIDENT_LINEAR=1, which is main's path: the draw into an imported linear target waited for the GPU instead of being recorded.

  • ctest -R "agc_driver|agc_masked": 473/474. The one failure is agc_driver_gpu_indirect_arguments_misaligned_writer_ahead, which does not build with MinGW on main (alignas(65536), fixed by #6452).

  • GTA V (PPSA04264), Story, same scene, on main eb901bcf4 + #6488 (needed to drive the game): 14.64 → 16.47 FPS (frame counter over 150 s), rendering checked.

  • The new test also passes on an Intel UHD Graphics 770 (Windows 11), and fails there with APS5_NO_RESIDENT_LINEAR=1.

Performance report (same machine, same scene, APS5_TRACE_SECONDS=240:60, 3840x2160). Base is the same build with APS5_NO_RESIDENT_LINEAR=1, which is main's path:

presents in 60 s frame p50 p90 p99
base 785 76.4 ms 78.5 ms 80.7 ms
this PR 883 67.9 ms 69.7 ms 71.8 ms

GPU busy per present is unchanged (39.3 vs 39.5 ms); the time saved is the CPU wait of each synchronous draw.

Traces and summary lines: https://github.com/tibzejoker/AnyPS5/releases/tag/perf-resident-linear-20261016

Checklist

  • Based on current main; no other open PR implements the same functions. Exception: #1191 (see What).
  • 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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (performance; GTA V PPSA04264, #6754)
  • GPUs tested: NVIDIA GeForce RTX 4090 (driver 616.92) and Intel UHD Graphics 770, Windows 11
  • AI-assisted: yes (Claude Code), reviewed and measured by me

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4891561018 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-16T16:53:08Z. --- ### What A linear color target took a synchronous draw every time it was drawn to: copy in, draw, copy out, then a CPU wait for the GPU. Tiled targets have a resident image instead, so their draws are recorded and continue the open batch. With this change, a linear target whose memory **already has a host import** gets a resident image like a tiled target: - `keepRecordedDraw` stores its results back to guest memory right after the draw, with a recorded store (`StorageTexture::FlushPending`). CPU readers still see them, without the wait. - No import is created for it: the new `ExistingHostImportFor` is a lookup only. Memory without an import keeps the synchronous path, so nothing changes for it. - `APS5_NO_RESIDENT_LINEAR=1` restores the old path for every linear target. Why lookup only: a first version created the import, and that broke `agc_driver_pixel_ancillary_word` and `agc_driver_pixel_fixed_point_position`. An import made over a short-lived block left the next block allocated at the same address unwatched. Overlap: #1191 (MichonGoddijn231849) implements the same idea. It is ~6,000 commits behind main and conflicts in 10 files. This PR is a narrower take on current main. I asked on #6754 whether Michon prefers to fold it into #1191 or rebase #1191 instead, and I'm happy to close this one if so. ### Tested Windows 11, MinGW (WinLibs GCC 15.2), RTX 4090 (driver 616.92). - New test `agc_driver_linear_target_resident`: a draw into a linear R32G32B32A32 target over imported memory must leave the recorder busy (recorded, not waited), and the pixels must be in guest memory after `WaitIdle`, without a flush. It passes with the change and fails with `APS5_NO_RESIDENT_LINEAR=1`, which is main's path: `the draw into an imported linear target waited for the GPU instead of being recorded`. - `ctest -R "agc_driver|agc_masked"`: 473/474. The one failure is `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead`, which does not build with MinGW on main (`alignas(65536)`, fixed by #6452). - GTA V (PPSA04264), Story, same scene, on main eb901bcf4 + #6488 (needed to drive the game): 14.64 → 16.47 FPS (frame counter over 150 s), rendering checked. - The new test also passes on an Intel UHD Graphics 770 (Windows 11), and fails there with `APS5_NO_RESIDENT_LINEAR=1`. **Performance report** (same machine, same scene, `APS5_TRACE_SECONDS=240:60`, 3840x2160). Base is the same build with `APS5_NO_RESIDENT_LINEAR=1`, which is main's path: | | presents in 60 s | frame p50 | p90 | p99 | |---|---|---|---|---| | base | 785 | 76.4 ms | 78.5 ms | 80.7 ms | | this PR | 883 | 67.9 ms | 69.7 ms | 71.8 ms | GPU busy per present is unchanged (39.3 vs 39.5 ms); the time saved is the CPU wait of each synchronous draw. Traces and summary lines: https://github.com/tibzejoker/AnyPS5/releases/tag/perf-resident-linear-20261016 ### Checklist - [x] Based on current `main`; no other open PR implements the same functions. Exception: #1191 (see What). - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical 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 - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none (performance; GTA V PPSA04264, #6754) - [x] GPUs tested: NVIDIA GeForce RTX 4090 (driver 616.92) and Intel UHD Graphics 770, Windows 11 - [x] AI-assisted: yes (Claude Code), reviewed and measured by me 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-16 17:38:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T17:38:30Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2013
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L1402
PR 2434 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp L68
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L2615
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp L68
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L2615
PR 6457 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp L68
PR 6479 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp L68
PR 6730 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp L68

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1324 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4449 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4650 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5390 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5431 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 5500 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6215 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6222 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6279 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6447 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6529 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6535 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6548 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6718 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6763 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6221208250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6221208250). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T17:38:30Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` [L2013](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L2013)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L1402](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1402) | | | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp` [L68](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp#L68)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L2615](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L2615) | | | | [PR 6197](https://www.github.com/boykopovar/AnyPS5/pull/6197) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp` [L68](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp#L68)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L2615](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L2615) | | | | [PR 6457](https://www.github.com/boykopovar/AnyPS5/pull/6457) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp` [L68](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp#L68) | | | | [PR 6479](https://www.github.com/boykopovar/AnyPS5/pull/6479) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp` [L68](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp#L68) | | | | [PR 6730](https://www.github.com/boykopovar/AnyPS5/pull/6730) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp` [L68](https://github.com/boykopovar/AnyPS5/blob/3b10c7ef0915d50a8bc442b8c0980aa7ec4d00be/core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp#L68) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1324](https://www.github.com/boykopovar/AnyPS5/pull/1324) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 4072](https://www.github.com/boykopovar/AnyPS5/pull/4072) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 4449](https://www.github.com/boykopovar/AnyPS5/pull/4449) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 5390](https://www.github.com/boykopovar/AnyPS5/pull/5390) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6215](https://www.github.com/boykopovar/AnyPS5/pull/6215) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6279](https://www.github.com/boykopovar/AnyPS5/pull/6279) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6529](https://www.github.com/boykopovar/AnyPS5/pull/6529) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6535](https://www.github.com/boykopovar/AnyPS5/pull/6535) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6718](https://www.github.com/boykopovar/AnyPS5/pull/6718) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 6763](https://www.github.com/boykopovar/AnyPS5/pull/6763) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` |
jotitadev commented 2026-10-16 18:30:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T18:30:46Z.

Review: COMMENTED


Linux run of 7b621ddbb, plus one gap in the new test.

Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3). PR merged onto main 93e54cedd. All runs -j1 --timeout 30.

Run RTX 3070 lavapipe
agc_driver_linear_target_resident passes 3/3 passes
same, APS5_NO_RESIDENT_LINEAR=1 fails: the draw into an imported linear target waited for the GPU instead of being recorded same failure
^agc_driver|^agc_masked (466 tests), PR vs main no new failures no new failures

The test passes without the keepRecordedDraw hunk. I removed the new loop that calls StorageTexture::FlushPending for linear residents (the rest of the PR unchanged): agc_driver_linear_target_resident still passes on both devices. The test reads the target with GuestMemory::Read, and Read calls FlushGpuWrites on the range before copying, so the test flushes the image itself. A guest CPU reads the memory directly. With the read changed to a plain copy from the block:

-    AgcDriver::GuestMemory::Read(block.Address(), std::as_writable_bytes(std::span(stored)), 1);
-    Check(stored, "after the recorded draw, without a flush");
+    std::memcpy(stored.data(), block.data, bytes);
+    Check(stored, "after the recorded draw, raw guest read");
Tree RTX 3070 lavapipe
PR + this test change passes 3/3 passes
PR without the FlushPending loop + this test change fails 3/3: pixel (0, 0) holds (-nan, -nan, -nan, -nan) (the 0xff fill) same failure

So with a direct read the test covers the store-back that the description relies on ("CPU readers still see them, without the wait").

I also checked a target switching paths between draws. ExistingHostImportFor returns null after any GuestAllocations mutation until something calls HostImportFor again, so the same linear target can be drawn resident, then synchronously, then resident again. I drew the left half, ended an unrelated Mutation, then drew the right half, and the reverse order with a HostImportFor call in between. The resident/synchronous pattern was as expected (recorded=1 then 0, and 0 then 1), and all 1024 pixels were correct in both orders on both devices.

Not run: Windows, AMD, GTA V or any title.

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5552105137 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#pullrequestreview-5552105137). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T18:30:46Z. **Review:** COMMENTED --- Linux run of `7b621ddbb`, plus one gap in the new test. **Machine:** Ubuntu 26.04, i7-8700, GCC 15.2, Release, `BUILD_TESTING=ON`. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3). PR merged onto `main` `93e54cedd`. All runs `-j1 --timeout 30`. | Run | RTX 3070 | lavapipe | |---|---|---| | `agc_driver_linear_target_resident` | passes 3/3 | passes | | same, `APS5_NO_RESIDENT_LINEAR=1` | fails: `the draw into an imported linear target waited for the GPU instead of being recorded` | same failure | | `^agc_driver\|^agc_masked` (466 tests), PR vs `main` | no new failures | no new failures | **The test passes without the `keepRecordedDraw` hunk.** I removed the new loop that calls `StorageTexture::FlushPending` for linear residents (the rest of the PR unchanged): `agc_driver_linear_target_resident` still passes on both devices. The test reads the target with `GuestMemory::Read`, and `Read` calls `FlushGpuWrites` on the range before copying, so the test flushes the image itself. A guest CPU reads the memory directly. With the read changed to a plain copy from the block: ```diff - AgcDriver::GuestMemory::Read(block.Address(), std::as_writable_bytes(std::span(stored)), 1); - Check(stored, "after the recorded draw, without a flush"); + std::memcpy(stored.data(), block.data, bytes); + Check(stored, "after the recorded draw, raw guest read"); ``` | Tree | RTX 3070 | lavapipe | |---|---|---| | PR + this test change | passes 3/3 | passes | | PR without the `FlushPending` loop + this test change | fails 3/3: `pixel (0, 0) holds (-nan, -nan, -nan, -nan)` (the 0xff fill) | same failure | So with a direct read the test covers the store-back that the description relies on ("CPU readers still see them, without the wait"). I also checked a target switching paths between draws. `ExistingHostImportFor` returns null after any `GuestAllocations` mutation until something calls `HostImportFor` again, so the same linear target can be drawn resident, then synchronously, then resident again. I drew the left half, ended an unrelated `Mutation`, then drew the right half, and the reverse order with a `HostImportFor` call in between. The resident/synchronous pattern was as expected (`recorded=1` then `0`, and `0` then `1`), and all 1024 pixels were correct in both orders on both devices. Not run: Windows, AMD, GTA V or any title. GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
tibzejoker commented 2026-10-16 18:42:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-16T18:42:58Z.


Thanks @jotitadev, good catch: GuestMemory::Read flushed the image itself, so the test didn't cover the store-back.

I took your change: the test now copies the block directly (std::memcpy, "raw guest read"). Pushed as 88ee39183, also rebased on current main.

Rerun on Windows 11:

Tree RTX 4090 Intel UHD 770
PR passes (also with APS5_NO_WRITE_WATCH=1) passes
PR without the FlushPending loop fails: pixel (0, 0) holds (nan, nan, nan, nan) —
PR with APS5_NO_RESIDENT_LINEAR=1 fails: waited for the GPU instead of being recorded —

On the path switching after a GuestAllocations mutation: agreed, that's expected. Until something calls HostImportFor again, the target simply takes the synchronous path, and the results stay correct either way, as your runs show. In a running title the imports are reconciled by the next upload, so it's a short window.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222352853 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6222352853). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-16T18:42:58Z. --- Thanks @jotitadev, good catch: `GuestMemory::Read` flushed the image itself, so the test didn't cover the store-back. I took your change: the test now copies the block directly (`std::memcpy`, "raw guest read"). Pushed as 88ee39183, also rebased on current main. Rerun on Windows 11: | Tree | RTX 4090 | Intel UHD 770 | |---|---|---| | PR | passes (also with `APS5_NO_WRITE_WATCH=1`) | passes | | PR without the `FlushPending` loop | fails: `pixel (0, 0) holds (nan, nan, nan, nan)` | — | | PR with `APS5_NO_RESIDENT_LINEAR=1` | fails: `waited for the GPU instead of being recorded` | — | On the path switching after a `GuestAllocations` mutation: agreed, that's expected. Until something calls `HostImportFor` again, the target simply takes the synchronous path, and the results stay correct either way, as your runs show. In a running title the imports are reconciled by the next upload, so it's a short window.
parl0v commented 2026-10-16 19:52:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T19:52:52Z.


Data point: RTX 3060 12 GB (NVIDIA 617.42), i5-12400F, Windows 10 19045, MinGW GCC Release. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input, 200 s rows, APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1; main c84249186 vs main + this PR, interleaved with three other PRs in one batch, two rounds. FPS is the mean of the last 10 [present] windows, GPU busy and idle gaps per frame over the last 8. This scene is CPU-bound on this machine (45-47 ms of idle gaps per frame).

libs FPS GPU busy idle gaps
main 6.60 / 6.60 105 / 105 ms 46 / 47 ms
+ this PR (88ee39183) 6.70 / 6.59 (+0.7 %) 105 / 106 ms 44 / 46 ms

Neutral on this scene (within the row spread); no regression. 0 fatal.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223503833 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6223503833). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-16T19:52:52Z. --- Data point: RTX 3060 12 GB (NVIDIA 617.42), i5-12400F, Windows 10 19045, MinGW GCC Release. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input, 200 s rows, `APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1`; `main` c84249186 vs `main` + this PR, interleaved with three other PRs in one batch, two rounds. FPS is the mean of the last 10 `[present]` windows, GPU busy and idle gaps per frame over the last 8. This scene is CPU-bound on this machine (45-47 ms of idle gaps per frame). | libs | FPS | GPU busy | idle gaps | |---|---|---|---| | `main` | 6.60 / 6.60 | 105 / 105 ms | 46 / 47 ms | | + this PR (88ee39183) | 6.70 / 6.59 (+0.7 %) | 105 / 106 ms | 44 / 46 ms | Neutral on this scene (within the row spread); no regression. 0 fatal. AI-assisted: yes (Claude Code)
tibzejoker commented 2026-10-16 20:24:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-16T20:24:55Z.


Thanks @parl0v for the run. Neutral there is what I'd expect: the change only touches linear color targets whose memory already has a host import, so a scene that draws to tiled targets keeps the old path. Good to have the no-regression data point on another title and GPU.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6224033096 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6224033096). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-16T20:24:55Z. --- Thanks @parl0v for the run. Neutral there is what I'd expect: the change only touches linear color targets whose memory already has a host import, so a scene that draws to tiled targets keeps the old path. Good to have the no-regression data point on another title and GPU.
akkadbakkad89 commented 2026-10-16 20:33:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-16T20:33:34Z.


Tested on a third GPU family — Windows 11, RTX 3070 (Ampere, driver 617.42), WinLibs GCC 15.2 build of 88ee39183:

  • The new test agc_driver_linear_target_resident passes.
  • Full agc_driver ctest group: 469/469 pass (the only exclusions are agc_driver_gpu_indirect_arguments_misaligned_writer_ahead, which does not compile under MinGW — known #6716 — and the two usual environment skips).

Ampere agrees with your 4090/Intel results: the resident path and the post-draw store behave correctly here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6224173631 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6224173631). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-16T20:33:34Z. --- Tested on a third GPU family — Windows 11, RTX 3070 (Ampere, driver 617.42), WinLibs GCC 15.2 build of 88ee39183: - The new test agc_driver_linear_target_resident passes. - Full agc_driver ctest group: 469/469 pass (the only exclusions are agc_driver_gpu_indirect_arguments_misaligned_writer_ahead, which does not compile under MinGW — known #6716 — and the two usual environment skips). Ampere agrees with your 4090/Intel results: the resident path and the post-draw store behave correctly here.
tibzejoker commented 2026-10-16 20:34:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-16T20:34:44Z.


Thanks @akkadbakkad89, that makes three NVIDIA generations plus Intel and lavapipe with the same result.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6224192464 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6224192464). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-16T20:34:44Z. --- Thanks @akkadbakkad89, that makes three NVIDIA generations plus Intel and lavapipe with the same result.
MarcZX10 commented 2026-10-16 23:59:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T23:59:36Z.


Windows full Build result for PR head 88ee391839405a8194c851e1b917116cf7be4225 (run): compilation completed, but CTest marked agc_driver_linear_target_resident skipped on this runner. The overall Windows CTest run ended 1349/1350, with agc_shader_helpers hitting the configured 120-second timeout; its output says the shader helper preparation assertions passed before CTest timed out. The Linux job passed. This run adds no Windows runtime result for the new test, separate from the hardware results already reported here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226986505 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6226986505). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T23:59:36Z. --- Windows full Build result for PR head `88ee391839405a8194c851e1b917116cf7be4225` ([run](https://github.com/boykopovar/AnyPS5/actions/runs/38981340864)): compilation completed, but CTest marked `agc_driver_linear_target_resident` skipped on this runner. The overall Windows CTest run ended 1349/1350, with `agc_shader_helpers` hitting the configured 120-second timeout; its output says the shader helper preparation assertions passed before CTest timed out. The Linux job passed. This run adds no Windows runtime result for the new test, separate from the hardware results already reported here.
oneandonlydean commented 2026-10-17 01:44:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T01:44:15Z.


@jotitadev's catch (the test read through GuestMemory::Read, which flushes) is fixed in 88ee39183, and the store-back now fails without the FlushPending loop on the RTX 4090. The new test passes on the RTX 4090, the RTX 3070 (@akkadbakkad89, 469/469), the UHD 770 and lavapipe, and @parl0v's Minecraft Dungeons II run is neutral. Windows CI: agc_driver_linear_target_resident was skipped on that runner, so CI adds no Windows runtime result for it; agc_shader_helpers hit the 120 s timeout after its assertions passed, the runner hang class. Linux is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6228100197 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6228100197). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T01:44:15Z. --- @jotitadev's catch (the test read through `GuestMemory::Read`, which flushes) is fixed in `88ee39183`, and the store-back now fails without the `FlushPending` loop on the RTX 4090. The new test passes on the RTX 4090, the RTX 3070 (@akkadbakkad89, 469/469), the UHD 770 and lavapipe, and @parl0v's Minecraft Dungeons II run is neutral. Windows CI: `agc_driver_linear_target_resident` was skipped on that runner, so CI adds no Windows runtime result for it; `agc_shader_helpers` hit the 120 s timeout after its assertions passed, the runner hang class. Linux is green.
fma-rc commented 2026-10-17 04:00:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-17T04:00:51Z.


AMD result, since the thread has only NVIDIA, Intel and lavapipe so far. Linux, main 07e7414819 with 88ee39183 merged: agc_driver_linear_target_resident passes on a Radeon 610M (RADV, Mesa) and on an RTX 5080 (driver 615.78.08). With the four source files reverted to main it fails on both with the draw into an imported linear target waited for the GPU instead of being recorded. It also passes on lavapipe.

Titles on the RTX 5080, main 9bf01db66 against the same plus this PR, one 10 s trace each:

main PR
Astro's Playroom (PPSA01325), first level 112 frames 117 frames
Hades II (PPSA36082), menus and intro 623 frames 617 frames

Neutral on both. A burst of about 700 consecutive Playroom frames per side shows no rendering difference; the largest frame-to-frame changes are cutscene cuts in both.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6229379275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6892#issuecomment-6229379275). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-17T04:00:51Z. --- AMD result, since the thread has only NVIDIA, Intel and lavapipe so far. Linux, `main` 07e7414819 with 88ee39183 merged: `agc_driver_linear_target_resident` passes on a Radeon 610M (RADV, Mesa) and on an RTX 5080 (driver 615.78.08). With the four source files reverted to `main` it fails on both with `the draw into an imported linear target waited for the GPU instead of being recorded`. It also passes on lavapipe. Titles on the RTX 5080, `main` 9bf01db66 against the same plus this PR, one 10 s trace each: | | main | PR | |---|---|---| | Astro's Playroom (PPSA01325), first level | 112 frames | 117 frames | | Hades II (PPSA36082), menus and intro | 623 frames | 617 frames | Neutral on both. A burst of about 700 consecutive Playroom frames per side shows no rendering difference; the largest frame-to-frame changes are cutscene cuts in both.
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!6892
No description provided.