Skip to content

fix(agc): store resident linear color targets at completion points, limited to their drawn rectangles - #9685

Merged
oneandonlydean merged 15 commits into
boykopovar:mainfrom
thuanquang:fix/linear-target-completion-stores
Oct 25, 2026
Merged

oneandonlydean merged 15 commits into
boykopovar:mainfrom
thuanquang:fix/linear-target-completion-stores

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

A recorded draw into a resident linear color target stored the whole image to guest memory right after the draw (keepRecordedDraw's FlushPending(..., "linear target")). Every draw copied the full surface and waited for the previous draw's store in the open batch (the pending-writer check of FlushPending). The recorded copy also landed over CPU stores made after Draw returned (#8152).

A draw now records its scissor, clipped to the image, in the target, and lists the target as drawn. The target keeps the rectangles themselves; two merge only when their union is a rectangle. The listed targets are stored before each point where the guest can first observe that the draws completed:

  • a flip, inside its locked block and before the flip's submit, so the flip's end-of-pipe interrupt and the presenter follow the store;
  • a drain, which covers APS5_SYNC_FLIP=1;
  • VulkanDevice::WaitIdle;
  • a label the GPU writes for the graphics queue (WriteLabelOnGpu);
  • an interrupt-only RELEASE_MEM in preparePacketMemory and in commitLabel, which submit the store's batch before the interrupt can be delivered.

The idle store, the access hooks and the eviction store run as before, and they also store by rectangles. The CPU-kept access hook no longer skips or evicts a drawn target, because that target's store writes CPU-written blocks inside its rectangles. This is the synchronization contract with regression coverage that @MarcZX10 asked for on #9217 (proposal).

A store of a drawn target copies the rectangles' bounding box out of the image and writes, row by row at the guest pitch, only the union of the rectangles' column runs on each row into the host import. Each run of 64 KiB blocks gets one MarkWritten.

  • A block that only other driver stores wrote since the target's generation keeps the old rule.
  • In a block the CPU wrote, or that changed outside the write watch, only those row spans are stored. CPU stores outside the rectangles stay, and the target re-uploads at its next use.
  • At most 16 rectangles wait for a completion point: the draw that brings a 17th stores the target right after it, with all of them.
  • A target with an attachment proxy, several mips or layers, a 3D or DCC surface, or results of a dispatch, fill or copy is stored after each draw, as before. One that a fill or copy writes after its draws is stored whole at the next completion point and keeps main's rule that CPU-written 64 KiB blocks stay the CPU's.

A store no longer waits for the same target's previous store: when the target has a host import, the pending-writer check skips the write notes of the target's own stores. APS5_PROFILE_DRAW adds the drawn targets' stores by reason, and the pending drawn targets (count, MiB, oldest), to the [storage] line.

With stores at completion points, #8126's rule that keeps newer image results over a direct write's completion stamp (StampKeepingNewerResults) also covers targets with drawn results and images that are already being flushed. A dispatch that writes a drawn target's memory through its host import and has completion work can complete inside that target's store, and its second stamp made the draws recorded after it look older than the dispatch, so the store dropped them all. A drawn target is tracked as one unit, so after a change anywhere else in it (a CPU store into another 64 KiB block) the whole-image check fails; the stamped 64 KiB blocks are then checked one by one. A block with no change since the image's generation keeps its draws past the stamp (completionKept, which writeBackLayers reads), and a block the CPU wrote keeps the CPU's bytes outside the drawn rectangles. Whole-image keeps of drawn targets are rechecked for CPU stores after the stamp.

Why

PPSA14363 (METAL GEAR SOLID - Master Collection Version, own dump) draws its PS1 game into three linear 3072x2048 RGBA8 color targets. With them resident (#1191's import-creating case, applied locally for these runs), main's per-draw store copies up to 69.7 GB per 10 s out of the images, and the PS1 part runs slower than on the synchronous path. In MGS1's PS1 part every store of these targets covers one rectangle (a local counter over a 300 s run: no fallback to a whole or per-draw store). Bring-up thread: #9615.

Tested

Windows 11 26200, Radeon RX 6700 XT (gfx1031), AMD driver 32.0.21045.16010, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON.

Current head d6d8966bba: main b930da950d merged in, for @oneandonlydean (comment). Only core/libs/prx/libSceAgcDriver/CMakeLists.txt conflicted: main's new agc_submit_progress tests and this PR's completion-point tests went into the same if(BUILD_TESTING) block, and both are kept. It still merges cleanly with main f595326943. On this head, on the RX 6700 XT, the build is clean. The focused set plus agc_driver_bda_* (54 ctest entries) passes 3 of 3. With the Khronos validation layer, 54 of 54 pass with 0 VUID- lines (the layer was inserted 73 times, no "was not found" line). ctest -R "^(agc|shader)_" passes 1011 of 1014; the 3 failures are the sample_order tests main fails on this GPU.

Earlier head d36311d661: the per-block keep at the end of What, for @oneandonlydean's review (comment). agc_driver_linear_target_direct_write_completion gains that ordering as a third case, on write-watched and on unwatched memory: a fill over block 0 with completion work, a draw into block 0, a CPU store into block 1 made under the GPU mutex while the fill's completion is still pending (the test reads the fill's copied buffer in the same hold, and again at the label, so each run reports whether the completion was pending at the store and had run by the label), then the label. Red on 5b5dcaeaff: the write-watched case fails, with 9984 of the 9984 pixels the draw covered holding the fill's pattern, the completion pending at the store and run by the label; the other three cases pass. Green on this head: 20 of 20, and 10 of 10 with the output kept, each write-watched run with the completion pending at the CPU store and run by the label. On unwatched memory the keep rule does not apply and the fill's completion had already run when the CPU store landed, so that variant passes before and after the change. The same test on main 8a85a5c848 fails as well: the fill-then-draws case loses 9856 of the 19712 drawn pixels (the first draw), and in the third case the draw's own store on main runs the fill's completion first, drops the draw's 9984 pixels, and its whole-target store writes the target's old bytes (0x5a5a5a5a) over the block-1 CPU store. Also on this head: the focused set above plus agc_driver_bda_* (53 ctest entries) 3 of 3; with the Khronos validation layer 53 of 53, 0 VUID- lines, the layer inserted 70 times; ctest -R "^(agc|shader)_" 997 of 1000, with the same 3 sample_order failures as main.

Earlier head 5b5dcaeaff: main 11d6efa06c merged in (eefe6d1380; only core/libs/prx/libSceAgcDriver/CMakeLists.txt conflicted, resolved as in @oneandonlydean's merge on #9879), then 5b5dcaeaff, the keep-rule change at the end of What, with a new test. A review of the merge against #8126 found the dropped draws. agc_driver_linear_target_direct_write_completion has two cases: a direct fill with completion work and then two draws, and the reverse order. It skips without a host import, and when the device does not keep the import write-watched. With the new test on 7ad5d33a66 (the same commits rebased onto 11d6efa06c, without the change), the first case fails: at the label after the draws, 19712 of the 19712 pixels the draws covered hold the fill's pattern. With it, the test passes 20 of 20. The runs below are on 605de8157c, the same change rebased onto 11d6efa06c. Its tree differs from this head only in the position of one add_test block in CMakeLists.txt and in the debt entry on this gap:

  • the focused set plus fix(agc): keep storage image results recorded after a direct write when its completion stamps it again #8126's agc_driver_direct_write_completion, main's agc_driver_copied_writer_*, agc_driver_draw_cache_* and label-order entries: 46 ctest entries, 3 of 3. agc_driver_copied_writer_label_order and its _drain entry skip on this GPU (minStorageBufferOffsetAlignment 4), as on main;
  • with the Khronos validation layer: 46 of 46, 0 VUID- lines, the layer inserted 64 times, no "was not found" line;
  • ctest -R "^(agc|shader)_": 997 of 1000 pass; the 3 failures are main's agc_driver_sample_order, _grid_reference and _recipe_depth_locations on this GPU.

Other devices, on cee2512ef8: @Dextroid17 on lavapipe (comment), and @BKlaasWerkman on Intel Arc with the validation layer (comment).

Previous head cee2512ef8, rebased onto main ff191e29d1 because #6948 and #6682 made it conflict; it still merges cleanly with 513ca7e558. RX 6700 XT, AMD driver 32.0.21045.16010: the focused set plus main's agc_driver_linear_readback_label and agc_recorder_* entries, 25 ctest entries, pass 3 of 3. With the Khronos validation layer on the same set, main 513ca7e558 passes 16 of 16 (the entries that exist there; layer inserted 19 times) and this head 25 of 25 (32 times), with 0 VUID- lines and no "was not found" line on either. The rebase keeps #6948's StoreReadbackBeforeLabel next to this PR's StoreDrawnLinear at labels and end-of-pipe interrupts, this PR's first, so its stored count still sets workOpen for the interrupt submit; the readback store then finds queue 0's drawn targets already stored, and on other queues it stores them limited to their drawn rectangles. e5edf0cd4a fixed agc_driver_linear_target_draw_bindings for memory outside the write watch (llvmpipe CI): the test runs its scenario watched and with the block taken out of the write watch, and expects no submission from the second copying draw in the first case and exactly one in the second. The older results below are from the commits they name.

New tests (4 executables, 6 ctest entries), on this branch on main d6eafa54d0:

  • agc_driver_linear_target_completion_points (with _sync_flip and _unpipelined variants): a flip, a drain, a label and an interrupt-only RELEASE_MEM through AgcDriver::Submit, with the queue held by a WAIT_REG_MEM, inside and outside the write watch. They pass on main too, because main stores after every draw. They pin the contract, so a label-only policy would fail them. They skip on a device without host import, where the target is never resident.
  • agc_driver_linear_target_completion_stores: a target stays pending across draws and labels until WaitIdle, without a submission.
  • agc_driver_linear_target_cpu_writes: AGC: a recorded draw into a resident linear color target stores the whole target back over CPU stores made after the draw #8152's CPU stores after Draw, seeded and unseeded, inside and outside the write watch, each also with a driver read of the target (GuestMemory::Read) between the CPU stores and the store. Ported from @MarcZX10's LinearTargetCpuWrites in fix(agc): preserve CPU writes after resident linear target draws #8246.
  • agc_driver_linear_target_rectangle_bound: after one seeding draw and wait, two draws with different scissors, then CPU stores outside both rectangles, between them inside their bounding box, and in the gap before a target that starts past a 64 KiB boundary; and a second case with 17 one-row scissors and a CPU store between two of them.
  • agc_driver_linear_target_draw_bindings, agc_driver_linear_target_dispatch_access and the agc_driver_address_passes_draw_transitions entry (with AddressPasses --synchronous-target-read) come with the last three commits: a draw's snapshot bindings prepared after its drawn-target store, the store before an address-based dispatch, and the store before a synchronous draw that reads a drawn target.
  • Green: all of them pass 3 of 3, and so do the other tests of the focused set below (18 ctest entries on 10a8319a94).
  • Red: with main's production files (at d6eafa54d0) and the new tests, completion_stores, cpu_writes and rectangle_bound fail; the three completion_points entries pass, as above. Without the AccessKeptByCpu check, cpu_writes fails at the driver read. With the bounding box of the third commit, rectangle_bound fails with both sentinels between the rectangles lost.

Khronos validation layer, ctest -V on the focused set (15 tests at e430b0d07a; on 10a8319a94 the 18 entries pass with 0 VUID- lines and the layer inserted 29 times) (the 6 above, agc_driver_linear_target_resident, agc_driver_address_passes and _targets_split, agc_driver_clamped_global_fill, agc_driver_flip_stores_small_results, agc_driver_storage_flush_ordering, agc_driver_storage_read_during_idle_store, agc_driver_store_idle_results and agc_driver_store_over_untracked): 15 of 15 pass on this branch, and 12 of 15 with main's production files at d6eafa54d0 (the three red tests above). Both sides have 0 VUID- lines; VK_LOADER_DEBUG=layer shows the layer inserted 25 times, with no "was not found" line.

ctest -R "^agc_" (896 tests, -j 1) on e430b0d07a: 891 pass; on 10a8319a94 (899 tests, run by huy): 894 pass. The 5 failures are the ones main d6eafa54d0 has on this GPU and toolchain:

agc_driver_address_passes and its _targets_split variant failed on the first commit: the linear-target case reads, through the address table, the target the previous draw rendered in the same submission, and with the store deferred that read saw the bytes from before the draw. The second commit stores drawn targets before a draw or dispatch that reads their memory in place or writes it, and all of them for address-based work.

PPSA14363, MGS1's PS1 part, with the targets resident through #1191's import line, applied locally on both sides (so both summary lines show dirty): main d6eafa54d0 against e430b0d07a, only libSceAgcDriver.prx swapped, both with #9115's trophy fix. Same scripted route, 300 s, APS5_TRACE_SUMMARY_EVERY=10, frame dumps only in the first 50 s, a trace window at 200 s, GPU and build locks held. Per 10 s window from 80 s, when the PS1 part starts, without the window that ends with the trace write:

MGS1's PS1 part, 20 windows main + import line this change + import line
presents per 10 s 46 to 169 600
frame p99 127.7 to 574.4 ms 17.2 to 17.4 ms
frame max 132.4 to 574.4 ms 17.3 to 18.9 ms

Summary lines of the trace window (200 to 220 s), main first:

{"commit":"d6eafa54d046","dirty":true,"env":{"APS5_DUMP_FRAMES":"100","APS5_DUMP_FRAMES_EVERY":"30","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"200:20","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 200:20","first_present":5724,"ms":20187.184},"presents":170,"frame_ms":{"p50":17.361,"p90":286.919,"p99":338.727,"max":339.723},"gpu_busy_ms_per_present":95.308,"worker_busy_pct":{"queue worker 0x0":90.450},"top_phases_ms_per_frame":{"Driver.Packet":107.404,"Graphics.Draw":106.712,"Graphics.Draw.draw_and_resource_release":106.333,"Recorder.Sync":102.637,"Driver.Packet.draw":100.244,"Driver.Draw":100.203,"Driver.Draw.draw_enqueued":98.609,"VideoOut.Flip":5.066},"trace_dropped":false,"trace":"aps5-trace-d6eafa54d046-7736.json.gz"}
{"commit":"e430b0d07ab2","dirty":true,"env":{"APS5_DUMP_FRAMES":"100","APS5_DUMP_FRAMES_EVERY":"30","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"200:20","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 200:20","first_present":11855,"ms":20003.149},"presents":1199,"frame_ms":{"p50":16.684,"p90":16.920,"p99":17.372,"max":17.645},"gpu_busy_ms_per_present":1.676,"worker_busy_pct":{"queue worker 0x0":6.284},"top_phases_ms_per_frame":{"VideoOut.Flip":13.315,"VideoOut.Flip.vblank_wait":12.638,"Driver.Packet":1.046,"Driver.Packet.draw":0.705,"Driver.Draw":0.691,"Graphics.Draw":0.618,"VideoOut.Flip.present":0.594,"Driver.Present":0.591},"trace_dropped":false,"trace":"aps5-trace-e430b0d07ab2-1592.json.gz"}

In that window main spends 102.6 ms per frame in Recorder.Sync, behind the whole-target stores, and the GPU is busy 95.3 ms per present against 1.68 ms with this change. tools/performance_compare.py on these lines and the tools/trace_digest.py tables of both runs are in this comment. Traces are not attached, because these runs come from a commercial title. An earlier 600 s run of the first commit on main 6ef5a1c4c9 + #9115, #9188, #9202 and #9373, with the same import line, reached Dock gameplay with no stop at 591 to 600 presents per 10 s.

Overlap:

Left for a follow-up, with a debt entry: a CPU store into a 64 KiB block of a drawn target that lands in the window while the direct write's completion checks and stamps that same block drops the draws in that block (the stamp's own collect records the store per page only, so the block reads as written by the driver). The CPU store itself survives.

Not tested: GPUs other than the RX 6700 XT, Linux, a title whose linear targets are resident on main without the import case.

Checklist

🤖 Generated with Claude Code

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The focused code review found a correctness gap in rectangle tracking. I ran python3 tools/check_conventions.py --base upstream/main --head refs/review/9685 with the PR title/body; it passed. GitHub’s product build/test jobs are skipped for this draft. I could not run the new AGC runtime tests in this checkout: there is no build configured for this head, and this host is the Xeon E5-1620 v2 used in prior Vulkan attempts that lacks the required CPU features. I did not treat the author’s Windows/Radeon runs as locally reproduced.

Please preserve the exact union of drawn row spans (or otherwise ensure the store cannot cover pixels between disjoint scissors), and add a regression that CPU-writes into such an internal gap after both draws. The present test’s two scissors have a bounding-box gap, but its sentinels are outside the bounding box; it therefore does not check that case. The repository performance-report rule also calls for the actual matching main and change summary lines with traces attached; the table is useful, but the traces/raw report are not attached here.

}
drawnLeft = std::min(drawnLeft, left);
drawnTop = std::min(drawnTop, top);
drawnRight = std::max(drawnRight, right);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These min/max updates turn multiple scissor rectangles into their bounding box. With the test's first and second rectangles, e.g. pixels around (30, 6) lie inside that box but outside both draws. drawnSpans() then includes those pixels, so a CPU write there in the same write-watch block can be overwritten by writeback. Please track the union of row spans (or prove a safe alternative) and add a CPU sentinel in this internal gap; the current test only places sentinels outside the bounding box.

@github-actions github-actions Bot added the fix error Closes an issue (Fixes #N) label Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

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 6926 docs/dev/debt/libSceAgcDriver.md L126
PR 8707 docs/dev/debt/libSceAgcDriver.md L125-126
PR 8887 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp L185
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L3136
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L3988, L3990-3995
PR 9176 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L5023
PR 9287 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L5023
PR 9289 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L5023
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt L2183
PR 10026 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L3806-3807, L4097-4110, L5549
PR 10159 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L160
PR 10940 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L2470
docs/dev/debt/libSceAgcDriver.md L126

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 1191 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5115 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5441 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6498 docs/dev/debt/libSceAgcDriver.md
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6743 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6959 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6960 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6971 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6973 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6987 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6989 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6995 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7002 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
docs/dev/debt/libSceAgcDriver.md
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7505 docs/dev/debt/libSceAgcDriver.md
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/execution/AddressPasses.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7677 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 7978 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8004 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8223 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 8520 docs/dev/debt/libSceAgcDriver.md
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8874 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8930 docs/dev/debt/libSceAgcDriver.md
PR 8998 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9248 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9356 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9385 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9393 docs/dev/debt/libSceAgcDriver.md
PR 9400 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 9431 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9432 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9489 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9672 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9673 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9674 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9675 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9676 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9700 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9748 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9842 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9891 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9892 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9893 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9895 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9898 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9904 docs/dev/debt/libSceAgcDriver.md
PR 9905 docs/dev/debt/libSceAgcDriver.md
PR 9906 docs/dev/debt/libSceAgcDriver.md
PR 9950 docs/dev/debt/libSceAgcDriver.md
PR 9989 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10049 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/execution/AddressPasses.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 10435 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 10547 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this on NVIDIA and lavapipe on Linux, which the PR lists as not tested. One part of the new coverage only runs on the NVIDIA card here, so CI's lavapipe doesn't guard it.

Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON, head c95a0fd31 (base d6eafa54d). The green and mutation rows were run on both 9d5263767 and c95a0fd31 with the same result; the red row on 9d5263767, whose tests c95a0fd31 does not change, ANYPS5_REQUIRE_VULKAN=1. GPUs: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), each picked with ANYPS5_GPU and checked in the Selected GPU line.

RTX 3070 lavapipe
the 6 new agc_driver_linear_target_* entries, this PR 3/3 3/3
9 related (agc_driver_linear_target*, agc_driver_address_passes*), this PR 3/3 3/3
red: d6eafa54d production files + the new tests completion_stores, cpu_writes, rectangle_bound fail; the 3 completion_points pass same
mutation: ownNotes.clear() right before the PendingWriterSerial check in StorageTexture::FlushPending completion_stores fails 6/6 pass

The two devices take different branches of the tests:

  • lavapipe: [write-watch] host imports resolve write protection: yes, so the target is not write-watched. completion_stores prints the target is outside the write watch ... the submission checks are skipped, and the flip, write-watched memory case of completion_points runs with watched at the store: 0.
  • RTX 3070: host imports resolve write protection: no ... imported ranges stay watched, so the target stays watched, the watched at the store: 1 case runs, and completion_stores makes its recorder->Submissions() checks.

With the mutation, a store waits for the target's previous store again, which is the "a store no longer waits for the same target's previous store" part of this PR. On the 3070 completion_stores catches it with the second label: storing the drawn linear target before the label waited for recorded work (1 submissions). On lavapipe all six pass, because those checks are skipped there. So a regression of that part would pass CI.

ctest -R "^agc" -j1 on the 3070 (867 tests, without the flip, DCC display and 64-bit LDS atomics tests): everything passes except agc_driver_sample_order, _grid_reference and _recipe_depth_locations, which fail the same way on d6eafa54d here (#9313).

GPUs tested: NVIDIA GeForce RTX 3070, driver 595.99.02, Ubuntu 26.04; lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04

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

@thuanquang

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks, both points hold.

Bounding box replaced by the exact union (e430b0d07a). A target now keeps the clipped scissor rectangles of its draws instead of their bounding box. Two rectangles merge only when their union is itself a rectangle: one inside the other, or the same columns that overlap or touch in rows, or the same rows that overlap or touch in columns. The store copies the rectangles' bounding box out of the image into its scratch buffer, as before, but writes to guest memory only, for each row, the union of the column runs of the rectangles that cover that row. So no pixel between two disjoint scissors is stored. At most 16 rectangles wait for a completion point: a draw that brings a 17th stores the target right after it, with all 17, and the next draw starts a new list. A target that the rectangle store does not cover (an attachment proxy, several mips or layers, a 3D or DCC surface, or results of a dispatch, fill or copy) is now stored after each draw, as on main, instead of whole at the next completion point.

The regression is in agc_driver_linear_target_rectangle_bound: CPU sentinels at (30, 6) and (10, 25), inside the bounding box of the two scissors but outside both, written after both draws, and a second case with 17 one-row scissors and a CPU store between two of them. On a27273ab06 (still the bounding box) it fails with "a drawn linear target's store overwrote CPU stores between two draws' scissor rectangles" (2 of the 2 sentinels lost); on e430b0d07a it passes. The case draws and waits once before its draws: without that, the target's upload ran in the same batch as the draws, after the CPU stores, so the bounding-box store wrote the CPU's own bytes back and the old test could not see it.

Review fixes since your review. Two independent reviews of the first commit (huy's, and a four-dimension review on my side with an adversarial check of each finding) agree on these. c95a0fd316:

  • A flush racing a completion point. A flush from a thread that does not hold the GPU lock, such as the flush hook behind an HLE read, moved a drawn target out of the pending set before taking the lock. A flip, label or interrupt on the queue worker could then run in between: it found no pending target and recorded its signal ahead of the store. That flush now takes the GPU lock before it takes a drawn target out of the pending set. When nothing overlaps, the lock is released before the existing wait for other threads' flushes, so that wait is unchanged.
  • An EOP interrupt with a label. workOpen was computed before the label's store, so the interrupt could wait in an unsubmitted batch until a later submission. Both label paths, preparePacketMemory and commitLabel, now store the drawn targets before WriteLabelOnGpu and submit that store with the label, as the interrupt-only branch already does.
  • The own-store exception. The pending-writer check skips a target's own earlier stores only when the flush stores that target alone. With two pending images over the same bytes, the second still waits for the first's store.
  • Debt entry. Every store the draw pipeline's committer makes (for a label, an end-of-pipe interrupt or a device wait) skips a target whose range a queued draw still reads (DrawPipeline::HeldReads). The entry named labels only.

a27273ab06:

  • A draw's scissor lost to a concurrent flush. MarkDrawn checked dirty in a second critical section after MarkSliceDirty. A flush on another thread could take the image out of the pending set in between, and the draw's scissor was then never added, so its pixels outside the earlier area were neither stored nor pending. It now checks layerPending, which changes only under the GPU lock; the flusher reads the drawn area after taking that lock, so it stores the widened area.
  • The CPU-kept hook. AccessKeptByCpu and its eviction still assumed that a store leaves CPU-written blocks alone, but a drawn target's store writes CPU-stamped blocks inside its rectangles. A hooked read of up to 1 MiB after the CPU wrote every block of the target dropped the draw's results. The hook no longer skips or evicts a drawn target; the access flushes it instead. agc_driver_linear_target_cpu_writes adds a GuestMemory::Read of row 0 between the CPU stores and the store, which returns the drawn pixels only with the fix.
  • A target no longer cached is stored after its draw, as on main, because the pending registry holds raw pointers.
  • agc_driver_linear_target_completion_points skips on a device without host import, where the target is never resident, instead of passing without testing anything.

Left as they are:

  • CPU store between the collect and the stamp. A CPU store that lands in a stamped block, outside the rectangles, between the store's write-watch collect and its MarkWritten can later be overwritten by a stale texel. That is the same collect-to-stamp window main's whole-target store has.
  • A fill or copy after the draws. Draws and dispatches that touch a drawn target's memory store it first (9d52637676); a fill or copy does not. A target that a fill or copy writes after its draws were listed is stored whole at the next completion point and keeps main's rule that CPU-written 64 KiB blocks stay the CPU's. The debt entry says so.

Summary lines. PPSA14363, MGS1's PS1 part, with the targets resident through #1191's import line, applied locally on both sides (so both lines show dirty): main d6eafa54d0, this PR's base, against this head e430b0d07a. Only libSceAgcDriver.prx is swapped, both sides have #9115's trophy fix, and both runs use the same scripted route, 300 s, APS5_TRACE_SUMMARY_EVERY=10, frame dumps only in the first 50 s and a trace window at 200 s, with the GPU and build locks held. Per 10 s window from 80 s, when the PS1 part starts, leaving out the window that ends with the trace write:

MGS1's PS1 part, 20 windows main d6eafa54d0 + import line this PR e430b0d07a + import line
presents per 10 s 46 to 169 600
frame p99 127.7 to 574.4 ms 17.2 to 17.4 ms
frame max 132.4 to 574.4 ms 17.3 to 18.9 ms

The summary lines of the trace window (200 to 220 s), main first:

{"commit":"d6eafa54d046","dirty":true,"env":{"APS5_DUMP_FRAMES":"100","APS5_DUMP_FRAMES_EVERY":"30","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"200:20","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 200:20","first_present":5724,"ms":20187.184},"presents":170,"frame_ms":{"p50":17.361,"p90":286.919,"p99":338.727,"max":339.723},"gpu_busy_ms_per_present":95.308,"worker_busy_pct":{"queue worker 0x0":90.450},"top_phases_ms_per_frame":{"Driver.Packet":107.404,"Graphics.Draw":106.712,"Graphics.Draw.draw_and_resource_release":106.333,"Recorder.Sync":102.637,"Driver.Packet.draw":100.244,"Driver.Draw":100.203,"Driver.Draw.draw_enqueued":98.609,"VideoOut.Flip":5.066},"trace_dropped":false,"trace":"aps5-trace-d6eafa54d046-7736.json.gz"}
{"commit":"e430b0d07ab2","dirty":true,"env":{"APS5_DUMP_FRAMES":"100","APS5_DUMP_FRAMES_EVERY":"30","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"200:20","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 200:20","first_present":11855,"ms":20003.149},"presents":1199,"frame_ms":{"p50":16.684,"p90":16.920,"p99":17.372,"max":17.645},"gpu_busy_ms_per_present":1.676,"worker_busy_pct":{"queue worker 0x0":6.284},"top_phases_ms_per_frame":{"VideoOut.Flip":13.315,"VideoOut.Flip.vblank_wait":12.638,"Driver.Packet":1.046,"Driver.Packet.draw":0.705,"Driver.Draw":0.691,"Graphics.Draw":0.618,"VideoOut.Flip.present":0.594,"Driver.Present":0.591},"trace_dropped":false,"trace":"aps5-trace-e430b0d07ab2-1592.json.gz"}

tools/performance_compare.py on these two lines: mean frame 118.748 to 16.683 ms, p99 338.727 to 17.372 ms, GPU busy per present 95.308 to 1.676 ms. Driver.Draw goes from 100.2 to 0.69 ms per frame; on main, 102.6 ms per frame is Recorder.Sync, the wait behind every draw's whole-target store.

tools/trace_digest.py on both runs' summary files

main d6eafa54d0 + import line:

29 intervals, 0.0 to 292.6 s, 6556 presents
AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit d6eafa5 (dirty)

# seconds presents p50 p90 p99 max GPU busy busiest worker largest phase
1 0-10 502 16.7 17.1 40.4 841.9 1.3 2 % VideoOut.Flip 12.1
2 10-20 594 16.7 17.0 19.6 80.3 1.5 3 % VideoOut.Flip 5.4
3 20-30 576 16.7 16.9 20.2 304.6 5.2 8 % VideoOut.Flip 13.7
4 30-40 600 16.7 17.0 23.8 24.6 3.3 9 % VideoOut.Flip 10.5
5 40-50 600 16.7 16.9 23.4 24.1 3.6 13 % VideoOut.Flip 11.0
6 50-60 509 16.7 41.3 41.8 42.3 6.2 27 % VideoOut.Flip 10.0
7 60-70 436 20.1 43.9 44.6 44.7 11.1 47 % Driver.Packet 10.8
8 70-80 562 16.7 21.1 47.7 48.2 6.3 32 % VideoOut.Flip 10.2
9 80-90 169 17.0 128.6 225.0 230.4 44.6 82 % Driver.Packet 48.8
10 90-100 168 68.0 120.5 127.7 132.4 44.8 82 % Driver.Packet 49.0
11 100-110 138 98.7 127.3 461.5 480.0 53.8 85 % Driver.Packet 61.6
12 110-120 70 186.1 342.8 435.4 435.4 121.0 91 % Driver.Packet 132.4
13 120-130 153 16.3 162.8 202.7 205.8 49.6 82 % Driver.Packet 53.8
14 130-140 129 88.8 168.6 182.6 183.0 61.1 85 % Driver.Packet 67.0
15 140-151 108 147.7 188.9 204.0 206.1 73.1 88 % Driver.Packet 81.8
16 151-161 126 16.8 184.4 542.9 567.7 61.0 87 % Driver.Packet 69.7
17 161-171 46 366.7 481.7 520.1 520.1 189.0 94 % Driver.Packet 210.8
18 171-181 50 362.6 421.5 444.9 444.9 174.3 94 % Driver.Packet 194.0
19 181-191 74 207.8 297.5 367.2 367.2 114.0 91 % Driver.Packet 124.8
20 191-202 134 82.2 167.0 193.2 201.2 58.7 86 % Driver.Packet 64.7
21 202-212 88 17.4 249.6 286.9 286.9 92.0 90 % Driver.Packet 103.9
22 212-222 70 214.0 314.9 339.7 339.7 115.7 90 % Driver.Packet 130.2
23 222-232 60 283.8 345.4 370.2 370.2 139.6 93 % Driver.Packet 156.2
24 232-242 74 195.6 313.6 329.6 329.6 113.8 91 % Driver.Packet 124.6
25 242-252 82 16.8 276.7 300.8 300.8 99.5 90 % Driver.Packet 110.9
26 252-262 83 16.9 273.7 300.3 300.3 98.8 90 % Driver.Packet 108.4
27 262-272 156 85.0 137.3 143.3 145.2 48.5 82 % Driver.Packet 53.0
28 272-282 145 16.8 112.3 546.6 559.0 51.4 84 % Driver.Packet 59.2
29 282-293 54 16.7 556.9 574.4 574.4 155.0 92 % Driver.Packet 174.4
p99 ms  _....___=:##---@%#*-=+*+++:@@  0-574.4
gpu ms  ......_.::-*:---@%+-=*#+++::#  0-189.0

This PR e430b0d07a + import line:

29 intervals, 0.0 to 290.3 s, 17255 presents
AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit e430b0d (dirty)

# seconds presents p50 p90 p99 max GPU busy busiest worker largest phase
1 0-10 503 16.7 17.0 30.5 801.0 1.3 2 % VideoOut.Flip 12.6
2 10-20 594 16.7 17.0 22.4 77.9 1.8 3 % VideoOut.Flip 3.3
3 20-30 574 16.7 16.9 24.4 304.1 4.9 8 % VideoOut.Flip 12.6
4 30-40 598 16.7 17.3 19.0 40.3 1.4 2 % VideoOut.Flip 4.0
5 40-50 598 16.7 17.3 18.3 36.4 1.4 2 % VideoOut.Flip 2.5
6 50-60 600 16.7 17.7 18.2 18.9 1.5 2 % VideoOut.Flip 2.3
7 60-70 600 16.8 17.6 18.0 18.7 1.7 3 % VideoOut.Flip 2.3
8 70-80 600 16.7 17.3 18.1 19.6 2.4 2 % VideoOut.Flip 7.4
9 80-90 600 16.7 16.9 17.3 17.4 3.4 6 % VideoOut.Flip 13.7
10 90-100 600 16.7 16.9 17.2 17.3 1.9 8 % VideoOut.Flip 12.8
11 100-110 600 16.7 16.9 17.4 17.6 1.7 9 % VideoOut.Flip 12.3
12 110-120 600 16.7 16.9 17.2 18.9 1.7 6 % VideoOut.Flip 13.2
13 120-130 600 16.7 16.9 17.2 17.4 1.7 5 % VideoOut.Flip 13.8
14 130-140 600 16.7 16.9 17.2 17.3 1.6 3 % VideoOut.Flip 14.7
15 140-150 600 16.7 16.9 17.4 17.6 3.0 3 % VideoOut.Flip 15.0
16 150-160 600 16.7 16.9 17.2 17.8 5.4 4 % VideoOut.Flip 14.5
17 160-170 600 16.7 16.9 17.2 17.5 5.4 4 % VideoOut.Flip 14.6
18 170-180 600 16.7 16.9 17.2 17.5 5.4 4 % VideoOut.Flip 14.5
19 180-190 600 16.7 16.9 17.3 17.6 5.3 4 % VideoOut.Flip 14.6
20 190-200 600 16.7 16.9 17.2 17.4 1.6 6 % VideoOut.Flip 13.5
21 200-210 600 16.7 16.9 17.4 17.6 1.7 6 % VideoOut.Flip 13.3
22 210-220 588 16.7 16.9 17.4 217.1 1.7 6 % VideoOut.Flip 13.7
23 220-230 600 16.7 16.9 17.2 17.4 1.7 6 % VideoOut.Flip 13.3
24 230-240 600 16.7 16.9 17.2 17.7 1.7 6 % VideoOut.Flip 13.4
25 240-250 600 16.7 16.9 17.3 17.4 1.7 6 % VideoOut.Flip 13.4
26 250-260 600 16.7 16.9 17.3 17.7 1.7 6 % VideoOut.Flip 13.3
27 260-270 600 16.7 16.9 17.3 17.8 1.7 6 % VideoOut.Flip 13.4
28 270-280 600 16.7 16.9 17.3 17.4 1.7 6 % VideoOut.Flip 13.3
29 280-290 600 16.7 16.9 17.3 17.4 1.7 6 % VideoOut.Flip 13.4
p99 ms  @##*+++++++++++++++++++++++++  0-30.5
gpu ms  :-%::--=*-----+@@@@----------  0-5.4

The trace files stay local, because the runs come from a commercial title; I asked on #9373 whether summary lines plus the tools' output are enough for such a title (comment).

A local counter over a 300 s run of the PS1 part (not committed) shows every store of these targets covering one rectangle, with no store at a draw and no fallback, so the 16-rectangle limit costs this title nothing.

Tested on e430b0d07a, RX 6700 XT, AMD Windows driver 32.0.21045.16010:

  • The focused set of 15 tests passes 3 of 3: the 4 new executables (6 ctest entries), agc_driver_linear_target_resident, agc_driver_address_passes and _targets_split, agc_driver_clamped_global_fill, agc_driver_flip_stores_small_results, agc_driver_storage_flush_ordering, agc_driver_storage_read_during_idle_store, agc_driver_store_idle_results and agc_driver_store_over_untracked.
  • Khronos validation layer, the same 15 tests: 15 of 15 pass on e430b0d07a. With main's production files at d6eafa54d0 and these tests, 12 of 15 pass: completion_stores, cpu_writes and rectangle_bound fail, the last with all 3 outside sentinels and both sentinels between the rectangles lost. Both sides have 0 VUID- lines, and VK_LOADER_DEBUG=layer shows the layer inserted 25 times with no "was not found".
  • Red, one fix at a time: without the AccessKeptByCpu check, cpu_writes fails at the new driver read ("a driver read of row 0 before the store: pixel (0, 0) holds (0.000000, 0.000000, 0.000000, 1.000000), not the second draw's"). With a27273ab06's bounding box, rectangle_bound fails as above.
  • ctest -R "^agc_" (896 tests): 891 pass. The 5 failures are the ones main d6eafa54d0 has on this GPU and toolchain: agc_driver_sample_order, _grid_reference, _recipe_depth_locations, agc_driver_tessellation and agc_driver_image_array_window_past_layer_limit.
  • tools/check_conventions.py passes.

The description is updated to match.

@thuanquang thuanquang changed the title fix(agc): store resident linear color targets at completion points, limited to their drawn rectangle fix(agc): store resident linear color targets at completion points, limited to their drawn rectangles Oct 22, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor

The current overlap report flags #8246 for the shared LinearTargetCpuWrites.cpp test. The description says this PR handles stores outside the drawn rectangles while #8246 handles byte-exact merging inside them, but the checklist still says Depends on: none. The repository contribution rule asks overlapping authors to agree on merge order and record any dependency.

I author #8246 and am available to coordinate. Could you clarify whether both PRs are intended to land as complementary changes, and if so which should merge first? If #9685 is instead intended to supersede #8246, please make that scope explicit for maintainers. I’m not asking for either PR to be preferred; the goal is a clear, non-conflicting sequence.

@adriadam10 adriadam10 self-assigned this Oct 22, 2026
@thuanquang

Copy link
Copy Markdown
Contributor Author

Three more commits, from an independent review of e430b0d07a by huy (5 dimensions, each high or medium finding checked by two lenses, then an independent red/green reproduction). The head is now 10a8319a94:

  • c3db832fd0 prepares a draw's snapshot bindings after its drawn-target store. The store of the drawn linear targets before a recorded draw ran after PrepareDrawBindings, which keeps the draw's snapshot descriptor sets in the batch that is open at that moment. When the store synced or submitted that batch, the draw was bound in the next batch with nothing keeping its sets, so they could be recycled and rewritten by the next draw with the same set layout before the first draw ran. The bindings are now prepared after the store, in the batch the draw is recorded in. agc_driver_linear_target_draw_bindings covers it: an address-based draw renders a linear target, then two draws each copy a snapshotted buffer, and the first one's store syncs the batch.
  • 9be36b8389 adds agc_driver_linear_target_dispatch_access. An address-based dispatch that loads a drawn texel through a pointer, with no completion point after the draw, must read the drawn value. That path relies on recordDispatch's store of the drawn targets the dispatch touches.
  • 10a8319a94 stores drawn linear targets before a synchronous draw that touches them. Only a lean recorded draw made that store, so a synchronous draw (a non-resident color target, a stencil-replay build, APS5_SYNC_COMPLETION_DRAWS=1, or APS5_DRAW_TRANSITIONS=1) that read a drawn target through the address table got the bytes from before the draw. AddressPasses --synchronous-target-read covers it, and the new agc_driver_address_passes_draw_transitions entry runs the --targets cases with APS5_DRAW_TRANSITIONS=1.

Tested on 10a8319a94, RX 6700 XT, AMD Windows driver 32.0.21045.16010:

  • The focused set, now 18 ctest entries (the 15 from before plus linear_target_dispatch_access, linear_target_draw_bindings and address_passes_draw_transitions): 18 of 18 pass, 3 of 3.
  • Khronos validation layer on the same set: 18 of 18 pass with 0 VUID- lines; VK_LOADER_DEBUG=layer shows the layer inserted 29 times, with no "was not found" line.
  • Full ctest -R "^agc_" on the three commits (huy's run): 894 of 899 pass; the 5 failures are the ones main has on this GPU and toolchain.

@thuanquang

Copy link
Copy Markdown
Contributor Author

@MarcZX10, sorry, my comment of 19:03Z went out without an answer to this one.

Complementary, not a replacement. #9685 does not supersede #8246. The two split #8152 by ownership:

Proposed order: #9685 first, then #8246 with Depends on: #9685.

Conflicts between the two heads (10a8319a94 and 0b190266c6, git merge-tree):

The shared file. LinearTargetCpuWrites.cpp in #9685 is a port of yours, credited in the description. It keeps your sequence of a draw followed by CPU stores, and checks only CPU stores outside the drawn rectangle. On the rebase, #8246 can add its cases inside the drawn rectangle to that file. If you'd rather keep your file whole, I'll rename mine.

If you agree, I'll write the order into #9685's checklist and Overlap section; #9685 stays Depends on: none, since it doesn't need #8246. I can also run #8246's rebased head on the RX 6700 XT through PPSA14363's PS1 part, the workload that @CnRJay and @adriadam10 asked numbers for.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full Linux Build (llvmpipe, run 39837492452) fails on the new test at 10a8319a94:

  • agc_driver_linear_target_draw_bindings: AGC graphics: the second copying draw submitted recorded work (LinearTargetDrawBindings.cpp:299, recorder->Submissions() == submitted + 1). main does not have this test, so it is not a pre-existing failure.
  • The runner has no /dev/udmabuf (shared direct memory is copied instead of imported, dma-buf imports keep write protection: unknown), and the test passes HostImportFor(...) anyway, so the import here is not write-watched. With that, the second copying draw ends up submitting an extra batch.

Please decide whether that extra submit is correct for an unwatched import (then the test should assert what holds in both cases), or whether the store before a synchronous draw (10a8319a94) should not submit there. Either way the test has to pass on the CI runner, which cannot import dma-bufs; the earlier lavapipe runs from @jotitadev predate this test.

The rest of the diff is unchanged from the previous review.

@Dextroid17

Copy link
Copy Markdown
Contributor

Linux data point on @MarcZX10's CI question, since the runner's failure is the one thing left: llvmpipe (LLVM 23.1.1, 256 bits) via lavapipe, Mesa 26.2.4 (CI has 25.2.8), GALLIUM_OVERRIDE_CPU_CAPS=avx, i9-11900K, CachyOS, GCC 16.2.1, CMake 4.4.3, Release, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, -j1; 10a8319a9 merged clean onto main eb8dcfeba (local merge 0ed9d87d6). The 12 ctest entries the 8 tests/execution/LinearTarget* and AddressPasses* sources register here: 11 of 12 pass 3 of 3, agc_driver_linear_target_draw_bindings fails 3 of 3 with CI's line, AGC graphics: the second copying draw submitted recorded work.

It is not the missing /dev/udmabuf. This box has the node (the probe logs dma-buf imports keep write protection: yes), and the test fails the same way with it. Running the same binary with /dev/udmabuf absent (a mount namespace, so the probe logs CI's unknown (probe failed at open /dev/udmabuf, -1000072003)) fails identically, 3 of 3. The import the test's block gets is a plain host import either way ([gpu] host import of ...+0x100000 ok ... by access, one live import, no dma-buf), and on Linux the host-import probe decides it: host imports resolve write protection: yes (0 of 4 scratch pages written after a GPU read, 4 after a GPU write, 0 after the import); imported ranges are compared. So the block is unwatched wherever that probe resolves on a GPU write, which both llvmpipe runs (CI's and mine) do; udmabuf never enters it.

What submits. Breaking on Recorder::Submit under gdb, the extra submission (the third of the run) comes from the second copying draw's own Draw, in two steps on the same texture. First the StoreDrawnLinearTouching("draw access", ...) this PR adds at core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:2679 → FlushPending → writeBack stores the copied target and clears its pending layers (writeBackLayers), without submitting. Then the MarkDrawn this PR adds in keepRecordedDraw (Draw.cpp:1704; upstream Draw.cpp has no MarkDrawn call) runs on that same target: the submit's backtrace is recordDraw → keepRecordedDraw → MarkDrawn → markLayersPending → captureGuestBytes → FlushForAccess → SyncThrough → Recorder::Submit. The texture is the copied target itself (same this as the first copy's MarkDrawn and as the writeBack hit just before), not the address-based draw's source. With the block unwatched, markLayersPending sees the layers stored-but-unwatched and takes its anyUnsaved && !GuestMemory::Watched(...) branch, and the capture syncs through the open batch. The diff adds a drawingTarget/pendingFromOthers bookkeeping block to markLayersPending but leaves that capture branch and captureGuestBytes unchanged; the new MarkDrawn call is what reaches them on the second draw.

A/B on the same binary and device. APS5_WRITE_WATCH_IMPORTS=watch (import kept watched): agc_driver_linear_target_draw_bindings passes 3 of 3 and the 12-entry set passes 12 of 12. APS5_WRITE_WATCH_IMPORTS=unwatch: fails 3 of 3 with the same line. Default (probe) resolves to unwatched here, as on CI. So the assert at core/libs/prx/libSceAgcDriver/tests/execution/LinearTargetDrawBindings.cpp:299 holds only on a watched import, and the unwatched case is the llvmpipe one (CI's and mine), not a missing-udmabuf quirk. The test needs either a watched-only expectation (check GuestMemory::Watched on the block after the first draw has imported it by access; the existing check at LinearTargetDrawBindings.cpp:112 runs before the import; then skip or assert the weaker invariant when it is not, since accepting submitted + 2 would make line 299 vacuous exactly on CI) or the store pass to skip the draw's own color target (the second copy stores copied and then redraws it, which is what turns its layers into stored-but-unwatched ones). I have not tried either. On Windows the import watch is decided differently: direct host imports are always compared (unwatchImports = true), a writable ≥1 MiB import stays watched only when the settle probe sets watchPrivateImports, and APS5_WRITE_WATCH_IMPORTS is inside #ifndef _WIN32, so I cannot hand you a one-line A/B. The [write-watch] host imports of write-watched memory keep the write watch: ... line from your RX 6700 XT run's stderr would say which branch it took.

AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. The PR now addresses the previously identified rectangle-union gap and reports the new completion-point / CPU-write coverage. However, the current exact head still has an unresolved CI-specific failure from the latest independent review: agc_driver_linear_target_draw_bindings fails 3/3 on the unwatched import path (the default and llvmpipe/CI path) because the second copying draw submits an extra batch. Please resolve that expectation/behavior and rerun the focused test on the CI-relevant path; the current hosted product jobs are skipped. I have not rerun locally because this host cannot execute the required Vulkan path.

@thuanquang
thuanquang force-pushed the fix/linear-target-completion-stores branch from 10a8319 to e5edf0c Compare October 23, 2026 06:03
@thuanquang

Copy link
Copy Markdown
Contributor Author

@adriadam10 @MarcZX10, thanks, and thanks @Dextroid17 for the backtrace: it was exactly right.

The extra submit is correct for memory outside the write watch. The second copying draw reads its source through an address, so its own store of the drawn linear targets also stores copied, the target it then draws into again. When copied's memory is write-watched, marking it drawn again adds a rectangle and nothing else. When it isn't (a host import that is compared, as on llvmpipe), markLayersPending has to capture the target's guest bytes first, and that capture syncs through the open batch: one submission, after the draw is recorded, so the draw's descriptor sets go out with it. The test asserted the watched case only.

e5edf0cd4a makes the test assert both. It runs the scenario twice: once as the device sets it up, then with the block taken out of the write watch after the first two draws, which is the llvmpipe state on any device. A watched target must not submit; an unwatched one must submit exactly once. The output and descriptor-set checks run in both. On the RX 6700 XT, the second copying draw over the unwatched block submits once (measured), so the old assertion fails there as it does on CI; the new test passes 3 of 3, and so does the focused set (17 entries, 3 of 3; 0 VUID- lines with the validation layer).

Rebased onto main 9d6adeb550 (clean, no conflicts), with #9879 restacked on it. #9879 follows with its own update once its timing runs are done.

The order with #8246 stays as proposed above: this PR first.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
thuanquang and others added 4 commits October 23, 2026 16:51
…imited to their drawn rectangle

A recorded draw into a resident linear color target stored the whole
image to guest memory right after the draw. Every draw copied the full
surface, waited for the previous draw's store in the open batch (the
pending-writer check of FlushPending), and the recorded copy landed over
CPU stores made after Draw returned (boykopovar#8152).

A draw now records its scissor, clipped to the image, as a union
rectangle in the target and lists the target as drawn. The listed
targets are stored before each point where the guest can first observe
the draws' completion: a flip (inside its locked block, before the
flip's submit, so the flip's end-of-pipe interrupt and the presenter
follow the store), a drain (which covers APS5_SYNC_FLIP=1),
VulkanDevice::WaitIdle, a label the GPU writes for the graphics queue
(WriteLabelOnGpu), and an interrupt-only RELEASE_MEM in
preparePacketMemory and in commitLabel, which submit the store's batch
before the interrupt can be delivered. The idle store, the access hooks
and the eviction store are unchanged and also store by rectangle.

A store of a drawn target copies the rectangle out of the image and
writes it row by row at the guest pitch into the host import, stamped
with one MarkWritten per run of 64 KiB blocks. A block that only other
driver stores wrote since the target's generation keeps the old rule.
In a block the CPU wrote, or that changed outside the write watch, only
the rectangle's rows are stored, so CPU stores outside the rectangle
stay, and the target re-uploads at its next use. A target with an
attachment proxy, several mips or layers, a 3D or DCC surface, or
results of a dispatch, fill or copy is stored whole at the same points.
A store no longer waits for the same target's previous store: the
pending-writer check skips the write notes of the target's own stores
when it has a host import.

APS5_PROFILE_DRAW adds the drawn targets' stores by reason and the
pending drawn targets (count, MiB, oldest) to the [storage] line.

The tests cover a target that stays pending across draws and labels
until WaitIdle without a submission, boykopovar#8152's CPU stores after Draw
(ported from boykopovar#8246, seeded and unseeded, inside and outside the write
watch), CPU stores outside the drawn rectangle and in the gap before a
target that starts past a 64 KiB boundary, and a flip, a drain, a label
and an interrupt-only RELEASE_MEM through AgcDriver::Submit with the
queue held by a WAIT_REG_MEM, inside and outside the write watch.

Co-Authored-By: Claude <noreply@anthropic.com>
…ouches their memory

With the store deferred to completion points, a draw or dispatch that
reads a drawn linear target's guest memory through an address, or
writes it through a buffer, saw the bytes from before the draw that
rendered it, and the later rectangle store would land over its writes.
agc_driver_address_passes caught the read: a draw reading through the
address table the linear target the previous draw rendered read the
bytes before it, where the per-draw store had stored them first.

Before a recorded draw and a dispatch, the drawn targets whose memory
the work reads in place or writes are stored, and all of them for
address-based work, whose memory is unknown.

Co-Authored-By: Claude <noreply@anthropic.com>
- A flush from a thread without the GPU lock takes the lock before it takes a drawn target out of the pending set, so a flip, label or interrupt on the queue worker cannot run between the two and get ahead of the target's store.
- A label written on the GPU stores the drawn targets first and submits that store with the label, so the label's end-of-pipe interrupt is not held back to a later submission.
- The pending-writer check skips the target's own earlier stores only when the flush stores that target alone.

Co-Authored-By: Claude <noreply@anthropic.com>
…U-kept hooks

- MarkDrawn registers the scissor while any layer is pending instead of
  while the image is dirty. A flush on another thread can take the image
  out of the pending set between MarkSliceDirty and the registration;
  layerPending changes only under the GPU lock, so the flusher, which
  reads the drawn area after taking that lock, stores the widened area.
- AccessKeptByCpu no longer skips or evicts a drawn target. Its store
  writes CPU-stamped blocks inside the drawn rectangle, so the hook's
  CPU-kept rule would drop the draw's results.
- A drawn target that is stored whole keeps main's rule that CPU-written
  64 KiB blocks stay the CPU's.
- A linear target that is no longer cached is stored after its draw, as
  before: the pending registry holds raw pointers.
- LinearTargetCompletionPoints skips without host import, where the
  target is never resident. LinearTargetCpuWrites adds a driver read of
  the target between the CPU stores and the store.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@thuanquang I checked d6d8966. The merge retains the reviewed per-block fix and preserves both sides of the CMake test registrations. Thanks for the focused and validation reports. My source verdict carries; full final-head CI and the required game gate remain, including the direct-write test’s watched held-order output.

@Meh7an

Meh7an commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@thuanquang the overlap check pairs this stack (#9685, #9879, #10656) with #10886, which keeps layerPending and borrowedUnits in 64-bit words and skips markLayersPending's scan and fill when every unit of the range is already pending. Your per-unit work there is for units that become pending, so it stays inside that guard.

Proposal: your stack goes first, and #10886 rebases onto each PR as it merges (it declares them in Depends on). UnitFlags keeps operator[], so your other uses compile unchanged. Does that order work for you?

@thuanquang

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Results for the final composition: main 61fc572cee with this head dacc812a25 and #9879's head 33a1577f84 merged on top, both merges clean (4fca89a339). Tested on an RX 6700 XT (Windows 11 26200, AMD driver 32.0.21045.16010). Both heads, and the composition, also merge cleanly with today's main e5f23554c9. Since 61fc572cee, main has changed libSceAgcDriver only through #10795 (a test) and #10632 (the pipeline journal replay's thread priority).

Direct-write test, held-order output (ctest -V -R ^agc_driver_linear_target_direct_write_completion$):

linear target direct write completion, fill, then draws: the later writer's values
linear target direct write completion, draws, then fill: the later writer's values
linear target direct write completion, fill, draw in block 0, CPU store in block 1, write-watched memory (watched at the label: 1, completion pending at the CPU store: 1, run by the label: 1): the draw's color and the CPU store
linear target direct write completion, fill, draw in block 0, CPU store in block 1, unwatched memory (watched at the label: 0, completion pending at the CPU store: 0, run by the label: 1): the draw's color and the CPU store
linear target direct write completion tests passed

Import creation (#9879's test, same build, no "only the compared cases run" line):

linear target import reuse passed
linear target import of armed direct memory passed
linear target import gate over armed and read-only private memory passed
linear target import creation tests passed

Focused set: the PRs' focused set plus agc_driver_bda_*, agc_driver_copied_writer_*, agc_driver_draw_cache_* and the label-order entries, 57 ctest entries, 3 rounds. In rounds 1 and 2, 55 pass, and agc_driver_copied_writer_label_order and its _drain entry skip on this GPU, as on main. Round 3 was the same, except that agc_driver_host_import_windows failed. After its range was mapped again, the re-import of a 64 MiB window failed at vkAllocateMemory (-1000072003). The driver reported a host-heap budget of 76 MiB at that moment, most likely because game runs elsewhere on the PC held most of its memory. In 10 alternating runs each afterwards, on main 61fc572cee and on the composition, the test passed every time and never skipped.

Validation layer, same 57 entries, VK_LOADER_DEBUG=layer: 55 pass and the same 2 skip, with 0 VUID- lines (the layer was inserted 78 times). main 61fc572cee, on the 46 of these entries that exist there: 44 pass, the same 2 skip, and 0 VUID- lines (62 insertions). Neither log has a "was not found" line.

ctest -R "^(agc|shader)_", --parallel 4: the composition passes 1036 of 1045, main 61fc572cee passes 1025 of 1034, and 6 skip on each. The same 3 tests fail on both: agc_host_import_cut_lifetime (#10746), agc_driver_depth_plane_partial_store (#10664) and agc_driver_sample_order_grid_reference.

Watched-import game check, PPSA14363 (own dump), with the composition's libraries (the summary lines carry commit 4fca89a339eb, dirty: false). This was a shared-GPU run, so it makes no speed claim. A scripted route goes from the launcher through MGS1's title, the opening Codec call and the intro into Dock gameplay, with APS5_TRACE_SUMMARY_EVERY=10, over 37 summary windows (370 s). The run's log has the import-watch line:

[write-watch] host imports of write-watched memory keep the write watch: yes (4096 of 4096 scratch pages reported written at the import, 0 by its 4-byte settle read, 0 after it, 0 after a full GPU read, 0 after a second, 0 after a GPU write, 1 after a CPU store); direct host imports of private memory are settled and stay watched, separate shared aliases retain guest write tracking

Neither ColorTarget.Write nor Graphics.Wait is among the top phases of any window. That indicates the draws into the PS1 part's three linear targets are recorded, not synchronous. On main 61fc572cee, a run on a different scripted route through the same opening Codec call into the Dock intro has both phases among the top phases in all 50 windows from 80 s. The composition's frame dumps show the title, the Codec screen and the Dock with its HUD and radar drawn correctly, and the run had no stop.

Not run here: Linux, and your full CI on both heads (on dacc812a25 and 33a1577f84 the linux, windows, write-watch, relinker, relinker-asan and register-context jobs show as skipped).

@thuanquang

Copy link
Copy Markdown
Contributor Author

@Meh7an Yes, that order works for us: #9685 first, then #9879 and #10656, which are stacked on it, with #10886 rebasing as each one merges. Thanks for checking where our per-unit work sits relative to your guard.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@thuanquang The reported vkAllocateMemory result -1000072003 is VK_ERROR_INVALID_EXTERNAL_HANDLE; the out-of-host/device-memory results are -1 and -2. The 76 MiB heap budget alone does not explain that error. Please preserve and attach the failed host_import_windows log and the import/allocation parameters around the remapped range, including its mapping generation, so the cause can be checked. The later alternating passes are useful, but do not identify the cause of the failed re-import. Please keep that failure distinct from the three failures shared with main.

@thuanquang

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Here is what we have on that failure, kept apart from the three that main shares.

Log. The whole output of the failing agc_driver_host_import_windows entry is in the details below: round 3 of the focused set, 2026-10-25 13:54:31 UTC+7, the final composition 4fca89a339, RX 6700 XT, AMD driver 32.0.21045.16010. That round ran without APS5_TRACE_HOST_IMPORT, so the imports that succeeded before the failure are not logged. The lines that matter:

[gpu] host import budget: host heap 0 reports a VK_EXT_memory_budget budget of 76 MiB and a usage of 6 MiB with 0 MiB of imports live, which leaves imports 0 MiB of the 8172 MiB of the default; the default stays until an import's vkAllocateMemory fails
[gpu] host import of 0x20b104e0000+0x4000000 failed at vkAllocateMemory (-1000072003); falling back to copies, requested by access
AGC graphics: host import windows: the window at 0x20b124e0000 cannot be filled after its range was mapped again

Parameters and the remapped range.

  • WindowsFollowTheirRange fills at the test block's base plus 96 MiB (the base was 0x20b0c4e0000), so the window is the block's second 64 MiB window, 0x20b104e0000+0x4000000. FillBuffer requests it by access. The memory is the test's private read-write block, so the import is a plain host-pointer import.
  • Remove and Add (HostImportWindows.cpp:128-129) each bump the registry generation once (GuestAllocations.cpp:154). Add creates a new range with a fresh backing serial.
  • The window's first import is already gone when the re-import runs. Remove cannot return while that import still holds the range: RequireUnpinned (GuestAllocations.cpp:387-428) calls the pin waiter WaitForLeasesAndImports, which retires the import with hold=false (GuestBufferMemory.cpp:3135). After Fill's WaitIdle the recorder is idle, so ~RetiredImport frees the memory (:363-370) before Remove returns. That is also why this test never prints retired: the range was mapped again.
  • So the call that failed was a plain first import of those 64 MiB, and no other import of the same pages was alive. Neither this PR nor perf(agc): create the host import of a linear color target in registered memory #9879 changes any of that path.

What we could and could not reproduce. On a build whose AGC driver is main's, the test passed all 15 runs. In none of them did it report a low budget:

  • 1 run with no limit;
  • 4 runs with a hard working-set cap on the test process: 160, 120, 96 and 72 MiB (its normal peak is 231 MiB);
  • 4 runs with a per-process commit cap: 400, 300, 270 and 255 MiB (its normal peak is 247 MiB);
  • 6 runs while another process held 15.5 GB of host-pointer imports. That process reported only 40 MiB of heap-0 headroom, and the system had 3.2 GB of physical memory available.

So neither pinned memory in another process nor a per-process limit lowers the test's budget or makes the import fail.

At 13:54:31 the PC itself was out of commit. Windows had logged "Virtual Memory Minimum Too Low" at 13:33. A hung process held 16 GB of commit. Two other processes aborted at 13:54:50, 19 s after this test, on allocation failures. The most likely reading is that AMD's Windows driver reports a host-pointer import that fails under system-wide commit exhaustion as VK_ERROR_INVALID_EXTERNAL_HANDLE, not as -1 or -2. We have not proven this: exhausting system commit on purpose would fail every other process on this shared PC. The PC now has a larger fixed page file, and the failure has not come back.

Full output of the failing entry (round 3)
      Start  858: agc_driver_host_import_windows
26/57 Test  #858: agc_driver_host_import_windows ..............................***Failed    1.48 sec
[time] scheduler tick raised to 0.5 ms (was 0.50 ms, now 0.50 ms, timed waits fine)
[src\HostCpu.cpp:193 operator()] host CPU AMD Ryzen 5 5600X 6-Core Processor: has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEOPT, XSAVEC, SSE4A, PREFETCHW, CLZERO, OS AVX state (XCR0); lacks none
[src\VulkanDevice.cpp:1106 VulkanDevice] VulkanDevice constructor window=0000000000000000
[src\VulkanDevice.cpp:1115 VulkanDevice] Vulkan loader loaded library=00007ff9f78f0000
[src\VulkanDevice.cpp:1153 VulkanDevice] Vulkan instance created instance=0000020b5ffecd10
[src\VulkanDevice.cpp:1164 VulkanDevice] Physical device count=1
[src\VulkanDevice.cpp:1197 VulkanDevice] Physical device candidate=0000020b065b71c0 name=AMD Radeon RX 6700 XT api=0x40413b type=2
[src\VulkanDevice.cpp:1244 VulkanDevice] Physical device selected physical=0000020b065b71c0 queueFamily=0
[src\VulkanDevice.cpp:1258 VulkanDevice] Selected GPU name=AMD Radeon RX 6700 XT vendor=0x1002 device=0x73df subgroup=64
[src\VulkanDevice.cpp:1260 VulkanDevice] Memory heap 0 size=16345.1 MiB flags=0x0
[src\VulkanDevice.cpp:1260 VulkanDevice] Memory heap 1 size=12272.0 MiB flags=0x3
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 0 heap=1 flags=0x1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 1 heap=0 flags=0x6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 2 heap=1 flags=0x7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 3 heap=0 flags=0xe
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 4 heap=1 flags=0xc1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 5 heap=0 flags=0xc6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 6 heap=1 flags=0xc7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 7 heap=0 flags=0xce
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 8 heap=1 flags=0x1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 9 heap=0 flags=0x6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 10 heap=1 flags=0x7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 11 heap=0 flags=0xe
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 12 heap=1 flags=0xc1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 13 heap=0 flags=0xc6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 14 heap=1 flags=0xc7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 15 heap=0 flags=0xce
[src\VulkanDevice.cpp:1348 VulkanDevice] Shader clock driver=1 narrowSubgroupClock=0
[gpu] largest sample location grids (vkGetPhysicalDeviceMultisamplePropertiesEXT): 1 samples 2x2, 2 samples 2x2, 4 samples 2x2, 8 samples 2x2; maxSampleLocationGridSize for every count 2x2
[src\VulkanDevice.cpp:1725 VulkanDevice] Vulkan features tessellationAvailable=1 mesh=1 depthClip=1 depthRangeUnrestricted=1 pipelineLibrary=1
[src\VulkanDevice.cpp:1985 VulkanDevice] Wave32 programs run on subgroups of 32: compute 1, mesh 0
[src\VulkanDevice.cpp:2127 VulkanDevice] Vulkan device ready device=0000020b065eecd0 queue=0000020b065d66b0 family=0
[write-watch] host imports of write-watched memory keep the write watch: yes (4096 of 4096 scratch pages reported written at the import, 0 by its 4-byte settle read, 0 after it, 0 after a full GPU read, 0 after a second, 0 after a GPU write, 1 after a CPU store); direct host imports of private memory are settled and stay watched, separate shared aliases retain guest write tracking
[gpu] host import budget: host heap 0 reports a VK_EXT_memory_budget budget of 76 MiB and a usage of 6 MiB with 0 MiB of imports live, which leaves imports 0 MiB of the 8172 MiB of the default; the default stays until an import's vkAllocateMemory fails
[float-controls] f32 denormal flush: hardware (0 of 5472 probe results differ from the emulated flush, 91 ms)
[src\VulkanDevice.cpp:1106 VulkanDevice] VulkanDevice constructor window=0000000000000000
[src\VulkanDevice.cpp:1115 VulkanDevice] Vulkan loader loaded library=00007ff9f78f0000
[src\VulkanDevice.cpp:1153 VulkanDevice] Vulkan instance created instance=0000020b5ffecd10
[src\VulkanDevice.cpp:1164 VulkanDevice] Physical device count=1
[src\VulkanDevice.cpp:1197 VulkanDevice] Physical device candidate=0000020b0923f7c0 name=AMD Radeon RX 6700 XT api=0x40413b type=2
[src\VulkanDevice.cpp:1244 VulkanDevice] Physical device selected physical=0000020b0923f7c0 queueFamily=0
[src\VulkanDevice.cpp:1258 VulkanDevice] Selected GPU name=AMD Radeon RX 6700 XT vendor=0x1002 device=0x73df subgroup=64
[src\VulkanDevice.cpp:1260 VulkanDevice] Memory heap 0 size=16345.1 MiB flags=0x0
[src\VulkanDevice.cpp:1260 VulkanDevice] Memory heap 1 size=12272.0 MiB flags=0x3
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 0 heap=1 flags=0x1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 1 heap=0 flags=0x6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 2 heap=1 flags=0x7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 3 heap=0 flags=0xe
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 4 heap=1 flags=0xc1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 5 heap=0 flags=0xc6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 6 heap=1 flags=0xc7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 7 heap=0 flags=0xce
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 8 heap=1 flags=0x1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 9 heap=0 flags=0x6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 10 heap=1 flags=0x7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 11 heap=0 flags=0xe
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 12 heap=1 flags=0xc1
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 13 heap=0 flags=0xc6
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 14 heap=1 flags=0xc7
[src\VulkanDevice.cpp:1261 VulkanDevice] Memory type 15 heap=0 flags=0xce
[src\VulkanDevice.cpp:1348 VulkanDevice] Shader clock driver=1 narrowSubgroupClock=0
[gpu] largest sample location grids (vkGetPhysicalDeviceMultisamplePropertiesEXT): 1 samples 2x2, 2 samples 2x2, 4 samples 2x2, 8 samples 2x2; maxSampleLocationGridSize for every count 2x2
[src\VulkanDevice.cpp:1725 VulkanDevice] Vulkan features tessellationAvailable=1 mesh=1 depthClip=1 depthRangeUnrestricted=1 pipelineLibrary=1
[src\VulkanDevice.cpp:1985 VulkanDevice] Wave32 programs run on subgroups of 32: compute 1, mesh 0
[src\VulkanDevice.cpp:2127 VulkanDevice] Vulkan device ready device=0000020b090a0390 queue=0000020b090ab2e0 family=0
[write-watch] host imports of write-watched memory keep the write watch: yes (4096 of 4096 scratch pages reported written at the import, 0 by its 4-byte settle read, 0 after it, 0 after a full GPU read, 0 after a second, 0 after a GPU write, 1 after a CPU store); direct host imports of private memory are settled and stay watched, separate shared aliases retain guest write tracking
[gpu] host import budget: host heap 0 reports a VK_EXT_memory_budget budget of 76 MiB and a usage of 6 MiB with 0 MiB of imports live, which leaves imports 0 MiB of the 8172 MiB of the default; the default stays until an import's vkAllocateMemory fails
[float-controls] f32 denormal flush: hardware (0 of 5472 probe results differ from the emulated flush, 96 ms)
[gpu] host import of 0x20b104e0000+0x4000000 failed at vkAllocateMemory (-1000072003); falling back to copies, requested by access
AGC graphics: host import windows: the window at 0x20b124e0000 cannot be filled after its range was mapped again

@oneandonlydean
oneandonlydean merged commit 79f061b into boykopovar:main Oct 25, 2026
10 checks passed
imellag added a commit to imellag/AnyPS5 that referenced this pull request Oct 27, 2026
The stamped-write skip now applies under the same condition as the own-store
skip of boykopovar#9685: the flush stores a single image and that image has a host
import. A flush of several images, or of an image without an import, waits for
stamped writes as before.

StorageFlushOrdering checks a single image stored again (the flush must not
wait when the image has an import, and must wait without one) and two adjacent
images stored again together (the flush must wait). A second registration runs
the stored-again cases with APS5_NO_HOST_IMPORT=1.
imellag added a commit to imellag/AnyPS5 that referenced this pull request Oct 30, 2026
The stamped-write skip now applies under the same condition as the own-store
skip of boykopovar#9685: the flush stores a single image and that image has a host
import. A flush of several images, or of an image without an import, waits for
stamped writes as before.

StorageFlushOrdering checks a single image stored again (the flush must not
wait when the image has an import, and must wait without one) and two adjacent
images stored again together (the flush must wait). A second registration runs
the stored-again cases with APS5_NO_HOST_IMPORT=1.
oneandonlydean pushed a commit that referenced this pull request Nov 3, 2026
Main's #9685 adds its drawn linear target figures to the end of the
[storage] profile line, where this branch adds its refresh-proof counts;
the merge keeps both, this branch's counts first.
adriadam10 pushed a commit that referenced this pull request Nov 8, 2026
Main's #9685 excepts drawn resident linear targets from the pending
storage-image results entry and adds two entries after it; this branch
rewrites the rest of that entry and adds its host-write entry. The merge
keeps both: main's opening, this branch's text, main's two entries, then
this branch's entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs fix error Closes an issue (Fixes #N) unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: a recorded draw into a resident linear color target stores the whole target back over CPU stores made after the draw

8 participants