perf(agc): copy moved draw words into the draw upload ring #11142

Merged
imellag merged 2 commits from upstream-pr/11142 into main 2026-10-27 08:19:13 +00:00
imellag commented 2026-10-25 19:30:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-25T19:30:46Z.


What

ShaderResources::PrepareDrawBindings copies a draw's moved words into a slice of the recorder's draw upload ring (Recorder::DrawUpload) instead of a Buffer of their own.

  • Before, each moved-word allocation that missed the 8-entry movedWordBuffers cache made a new Buffer (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT). The buffer pool usually hands back a slot whose VkBuffer has another size, so the constructor destroys it and binds a new one (BindExactBuffer), and the buffer is destroyed again when the draw retires.
  • The slice is filled the same way (words, then the data patches) and the descriptor gets the slice's offset. The guest-memory snapshots of up to 4096 bytes already go through this ring.
  • The movedWordBuffers cache goes away: a ring slice is only written once, but caching it per ShaderResources would keep its 1 MiB chunk alive for as long as the entry lives.
  • agc_driver_graphics checked that a moved-word descriptor starts at offset 0; it now checks the snapshot's offset and reads the words from there.

Why: with #11130's mimalloc on, the draw committer paces Planet of Lana on macOS. In a 15 s Time Profiler capture it spends 626 samples in Buffer::Buffer and 471 in vkDestroyBuffer called from it, out of 10,921, all from this call site.

Tested

macOS 27, M4 Pro, Rosetta 2, MoltenVK 1.4.2. main does not boot a title on macOS yet, so both sides are main 61fc572cee plus the macOS changes needed to build and boot one: open macOS PRs (among them #10366, #10552, #7631, #7804, #10889, #10898, #11047, #11048 and #11049) and, for the AGC driver files and a few tests that no open PR covers yet, local patches taken from #8658's branch. #11130 is on both sides, with APS5_MIMALLOC=1; the change side adds this PR. The base commit below is that whole tree, so its exact diff against main is public.

Planet of Lana (PPSA19450), village gameplay from New Game with the same scripted pad input, 120 s per run, fps from 85 s, runs alternated in one session. These fps runs were on the same PRs uncommitted, plus a local experiment active on both sides (a DrawTail pool, neutral when measured), which the clean commits below leave out:

fps mean
base 33.04, 33.82, 33.73, 33.04, 33.56, 33.69, 33.46, 33.63 33.50
this PR 34.01, 34.07, 34.05 34.04 (+1.6%)

Every run with this PR is above every base run. Driver.Packet goes from 21 to 22 ms per frame to 19 ms.

tools/trace_digest.py of APS5_TRACE_SECONDS=95:10 APS5_TRACE_EVENTS=1048576 captures, same machine and scene, from two clean commits:

base:     seconds 95:10 from present 4314: 335 presents, frame p50 29.7 / p90 31.5 / p99 35.0 / max 49.6 ms, GPU busy 20.2 ms per present
this PR:  seconds 95:10 from present 4348: 343 presents, frame p50 28.9 / p90 31.0 / p99 37.2 / max 46.9 ms, GPU busy 19.4 ms per present
Trace Summary Digest
base lana-moved-words-clean-base.json.gz lana-moved-words-clean-base-summary.json lana-moved-words-clean-base-digest.md
this PR lana-moved-words-clean-change.json.gz lana-moved-words-clean-change-summary.json lana-moved-words-clean-change-digest.md
aps5-summary.jsonl lines

base:

{"commit":"7f2e300c68dc","dirty":false,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_MIMALLOC":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"95:10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"Apple M4 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.0.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":12,"memory_mib":24576,"title_id":"PPSA19450","title":"Planet of Lana","content_version":"01.010.000","resolution":"3840x2160","window":{"spec":"seconds 95:10","first_present":4314,"ms":10006.822},"presents":335,"frame_ms":{"p50":29.699,"p90":31.546,"p99":35.005,"max":49.648},"gpu_busy_ms_per_present":20.229,"worker_busy_pct":{"queue worker 0x0":74.217},"top_phases_ms_per_frame":{"Driver.Packet":21.741,"Driver.Packet.draw":16.331,"Driver.Draw":16.173,"Graphics.Draw":16.158,"Graphics.Draw.draw_and_resource_release":12.321,"Driver.Draw.shader_compile_and_link":9.298,"VideoOut.Flip":7.205,"Driver.Present":6.389},"trace_dropped":false,"trace":"aps5-trace-7f2e300c68dc-24308.json.gz"}

this PR:

{"commit":"84cf9d0f359e","dirty":false,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_MIMALLOC":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"95:10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"Apple M4 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.0.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":12,"memory_mib":24576,"title_id":"PPSA19450","title":"Planet of Lana","content_version":"01.010.000","resolution":"3840x2160","window":{"spec":"seconds 95:10","first_present":4348,"ms":10010.079},"presents":343,"frame_ms":{"p50":28.891,"p90":31.006,"p99":37.188,"max":46.898},"gpu_busy_ms_per_present":19.400,"worker_busy_pct":{"queue worker 0x0":66.822},"top_phases_ms_per_frame":{"Driver.Packet":19.199,"Driver.Packet.draw":14.585,"Driver.Draw":14.437,"Graphics.Draw":13.030,"Graphics.Draw.draw_and_resource_release":9.421,"VideoOut.Flip":9.220,"Driver.Draw.shader_compile_and_link":8.939,"Driver.Present":8.414},"trace_dropped":false,"trace":"aps5-trace-84cf9d0f359e-27576.json.gz"}

Driver.Packet goes from 21.7 to 19.2 ms per frame and Graphics.Draw from 16.2 to 13.0; the draw committer's busy time goes from 9.4 to 5.3 ms, and VideoOut.Flip grows from 7.2 to 9.2 ms, since the frame now waits on the GPU. A second capture of this PR's commit gave 342 presents and p50 29.0 ms; the base capture before it was not written because Rosetta was still translating the new libraries when the window opened.

AGC tests, same machine and GPU, base and this PR, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363), ctest -R 'agc_draw_snapshot|agc_driver_graphics$|agc_recorder|agc_pending_write_snapshot|agc_shader_table_snapshot|agc_driver_partially_resident_snapshot|agc_snapshot|agc_driver_prepared_graphics' -V:

  • 19 tests, 16 pass and 3 skip on both sides (agc_driver_prepared_graphics_prebuild_*).
  • Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS.
  • Both logs have the same validation output: 18 VUID-VkDeviceCreateInfo-pProperties-04451 (MoltenVK's portability subset at device creation) and no other VUID-.
  • Without the test change, agc_driver_graphics fails at the offset check described above.

Full ctest -R '^agc_' -j6 with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and the validation layer, on the base and on this PR with 44c6919b64: the same 44 of 992 fail on both sides and the same 80 skip; no test fails only with this PR. An earlier run without ANYPS5_REQUIRE_VULKAN=1 had skipped agc_draw_descriptors, which SeaSunPT found failing on Windows; 44c6919b64 fixes its expectation.

Not built on Linux or Windows.

pr_overlap.py reports #8963 and #9508, which edit lines next to the removed movedWordBuffers members in ShaderResources.hpp. #8913 changes how the buffer pool picks a slot and helps the old path (33.91 fps on the same bench); after this PR that call site no longer makes buffers, and #8913 still applies to the other callers.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Apple M4 Pro, MoltenVK 1.4.2, macOS 27 (x86_64 build under Rosetta 2)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5007949140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11142). Originally posted by [imellag](https://github.com/imellag) on 2026-10-25T19:30:46Z. --- ### What `ShaderResources::PrepareDrawBindings` copies a draw's moved words into a slice of the recorder's draw upload ring (`Recorder::DrawUpload`) instead of a `Buffer` of their own. - Before, each moved-word allocation that missed the 8-entry `movedWordBuffers` cache made a new `Buffer` (`VK_BUFFER_USAGE_STORAGE_BUFFER_BIT`). The buffer pool usually hands back a slot whose `VkBuffer` has another size, so the constructor destroys it and binds a new one (`BindExactBuffer`), and the buffer is destroyed again when the draw retires. - The slice is filled the same way (words, then the data patches) and the descriptor gets the slice's offset. The guest-memory snapshots of up to 4096 bytes already go through this ring. - The `movedWordBuffers` cache goes away: a ring slice is only written once, but caching it per `ShaderResources` would keep its 1 MiB chunk alive for as long as the entry lives. - `agc_driver_graphics` checked that a moved-word descriptor starts at offset 0; it now checks the snapshot's offset and reads the words from there. Why: with #11130's mimalloc on, the draw committer paces Planet of Lana on macOS. In a 15 s Time Profiler capture it spends 626 samples in `Buffer::Buffer` and 471 in `vkDestroyBuffer` called from it, out of 10,921, all from this call site. ### Tested macOS 27, M4 Pro, Rosetta 2, MoltenVK 1.4.2. `main` does not boot a title on macOS yet, so both sides are `main` 61fc572cee plus the macOS changes needed to build and boot one: open macOS PRs (among them #10366, #10552, #7631, #7804, #10889, #10898, #11047, #11048 and #11049) and, for the AGC driver files and a few tests that no open PR covers yet, local patches taken from #8658's branch. #11130 is on both sides, with `APS5_MIMALLOC=1`; the change side adds this PR. The base commit below is that whole tree, so its exact diff against `main` is public. Planet of Lana (PPSA19450), village gameplay from New Game with the same scripted pad input, 120 s per run, fps from 85 s, runs alternated in one session. These fps runs were on the same PRs uncommitted, plus a local experiment active on both sides (a `DrawTail` pool, neutral when measured), which the clean commits below leave out: | | fps | mean | |---|---|---| | base | 33.04, 33.82, 33.73, 33.04, 33.56, 33.69, 33.46, 33.63 | 33.50 | | this PR | 34.01, 34.07, 34.05 | 34.04 (+1.6%) | Every run with this PR is above every base run. `Driver.Packet` goes from 21 to 22 ms per frame to 19 ms. `tools/trace_digest.py` of `APS5_TRACE_SECONDS=95:10 APS5_TRACE_EVENTS=1048576` captures, same machine and scene, from two clean commits: - base [`7f2e300c68dc`](https://github.com/imellag/AnyPS5/commits/bench/lana-base): `main` 61fc572cee with the macOS changes described above and #11130, committed as one tree; - this PR [`84cf9d0f359e`](https://github.com/imellag/AnyPS5/commits/bench/lana-11142): that commit plus this PR's diff. ``` base: seconds 95:10 from present 4314: 335 presents, frame p50 29.7 / p90 31.5 / p99 35.0 / max 49.6 ms, GPU busy 20.2 ms per present this PR: seconds 95:10 from present 4348: 343 presents, frame p50 28.9 / p90 31.0 / p99 37.2 / max 46.9 ms, GPU busy 19.4 ms per present ``` | | Trace | Summary | Digest | |---|---|---|---| | base | [lana-moved-words-clean-base.json.gz](https://github.com/user-attachments/files/33937716/lana-moved-words-clean-base.json.gz) | [lana-moved-words-clean-base-summary.json](https://github.com/user-attachments/files/33937715/lana-moved-words-clean-base-summary.json) | [lana-moved-words-clean-base-digest.md](https://github.com/user-attachments/files/33937713/lana-moved-words-clean-base-digest.md) | | this PR | [lana-moved-words-clean-change.json.gz](https://github.com/user-attachments/files/33937721/lana-moved-words-clean-change.json.gz) | [lana-moved-words-clean-change-summary.json](https://github.com/user-attachments/files/33937718/lana-moved-words-clean-change-summary.json) | [lana-moved-words-clean-change-digest.md](https://github.com/user-attachments/files/33937717/lana-moved-words-clean-change-digest.md) | <details><summary><code>aps5-summary.jsonl</code> lines</summary> base: ```json {"commit":"7f2e300c68dc","dirty":false,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_MIMALLOC":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"95:10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"Apple M4 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.0.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":12,"memory_mib":24576,"title_id":"PPSA19450","title":"Planet of Lana","content_version":"01.010.000","resolution":"3840x2160","window":{"spec":"seconds 95:10","first_present":4314,"ms":10006.822},"presents":335,"frame_ms":{"p50":29.699,"p90":31.546,"p99":35.005,"max":49.648},"gpu_busy_ms_per_present":20.229,"worker_busy_pct":{"queue worker 0x0":74.217},"top_phases_ms_per_frame":{"Driver.Packet":21.741,"Driver.Packet.draw":16.331,"Driver.Draw":16.173,"Graphics.Draw":16.158,"Graphics.Draw.draw_and_resource_release":12.321,"Driver.Draw.shader_compile_and_link":9.298,"VideoOut.Flip":7.205,"Driver.Present":6.389},"trace_dropped":false,"trace":"aps5-trace-7f2e300c68dc-24308.json.gz"} ``` this PR: ```json {"commit":"84cf9d0f359e","dirty":false,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_MIMALLOC":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"95:10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"Apple M4 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.0.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":12,"memory_mib":24576,"title_id":"PPSA19450","title":"Planet of Lana","content_version":"01.010.000","resolution":"3840x2160","window":{"spec":"seconds 95:10","first_present":4348,"ms":10010.079},"presents":343,"frame_ms":{"p50":28.891,"p90":31.006,"p99":37.188,"max":46.898},"gpu_busy_ms_per_present":19.400,"worker_busy_pct":{"queue worker 0x0":66.822},"top_phases_ms_per_frame":{"Driver.Packet":19.199,"Driver.Packet.draw":14.585,"Driver.Draw":14.437,"Graphics.Draw":13.030,"Graphics.Draw.draw_and_resource_release":9.421,"VideoOut.Flip":9.220,"Driver.Draw.shader_compile_and_link":8.939,"Driver.Present":8.414},"trace_dropped":false,"trace":"aps5-trace-84cf9d0f359e-27576.json.gz"} ``` </details> `Driver.Packet` goes from 21.7 to 19.2 ms per frame and `Graphics.Draw` from 16.2 to 13.0; the draw committer's busy time goes from 9.4 to 5.3 ms, and `VideoOut.Flip` grows from 7.2 to 9.2 ms, since the frame now waits on the GPU. A second capture of this PR's commit gave 342 presents and p50 29.0 ms; the base capture before it was not written because Rosetta was still translating the new libraries when the window opened. AGC tests, same machine and GPU, base and this PR, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363), `ctest -R 'agc_draw_snapshot|agc_driver_graphics$|agc_recorder|agc_pending_write_snapshot|agc_shader_table_snapshot|agc_driver_partially_resident_snapshot|agc_snapshot|agc_driver_prepared_graphics' -V`: - 19 tests, 16 pass and 3 skip on both sides (`agc_driver_prepared_graphics_prebuild_*`). - Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. - Both logs have the same validation output: 18 `VUID-VkDeviceCreateInfo-pProperties-04451` (MoltenVK's portability subset at device creation) and no other `VUID-`. - Without the test change, `agc_driver_graphics` fails at the offset check described above. Full `ctest -R '^agc_' -j6` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and the validation layer, on the base and on this PR with `44c6919b64`: the same 44 of 992 fail on both sides and the same 80 skip; no test fails only with this PR. An earlier run without `ANYPS5_REQUIRE_VULKAN=1` had skipped `agc_draw_descriptors`, which SeaSunPT found failing on Windows; `44c6919b64` fixes its expectation. Not built on Linux or Windows. `pr_overlap.py` reports #8963 and #9508, which edit lines next to the removed `movedWordBuffers` members in `ShaderResources.hpp`. #8913 changes how the buffer pool picks a slot and helps the old path (33.91 fps on the same bench); after this PR that call site no longer makes buffers, and #8913 still applies to the other callers. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: Apple M4 Pro, MoltenVK 1.4.2, macOS 27 (x86_64 build under Rosetta 2) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 19:34:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T19:34:56Z.

Review: DISMISSED


The ring-slice change and descriptor offset handling look consistent in the PR-specific diff. I am requesting changes only for the required performance-report provenance.

Both pasted aps5-summary.jsonl records identify commit 61fc572ceef8 and set dirty:true; only their trace filenames/window values differ. CONTRIBUTING.md requires two valid summary lines from different commits, one on main and one with the change. As written, these records do not identify a clean base commit and a clean commit containing this PR, so the automated perf numbers missing label is correct even though the traces compare two configurations.

Please provide clean, different base/change commit summaries and the associated traces/digests, or ask maintainers to decide whether this dependency-stack/toggle comparison is an accepted exception and update the classification accordingly. I did not rerun the reported hardware Vulkan suite because this host has no matching macOS/MoltenVK GPU setup; the PR reports the required same-machine base/change validation runs.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644897033 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11142#pullrequestreview-5644897033). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T19:34:56Z. **Review:** DISMISSED --- The ring-slice change and descriptor offset handling look consistent in the PR-specific diff. I am requesting changes only for the required performance-report provenance. Both pasted `aps5-summary.jsonl` records identify commit `61fc572ceef8` and set `dirty:true`; only their trace filenames/window values differ. `CONTRIBUTING.md` requires two valid summary lines from different commits, one on `main` and one with the change. As written, these records do not identify a clean base commit and a clean commit containing this PR, so the automated `perf numbers missing` label is correct even though the traces compare two configurations. Please provide clean, different base/change commit summaries and the associated traces/digests, or ask maintainers to decide whether this dependency-stack/toggle comparison is an accepted exception and update the classification accordingly. I did not rerun the reported hardware Vulkan suite because this host has no matching macOS/MoltenVK GPU setup; the PR reports the required same-machine base/change validation runs.
klosixgaming-arch commented 2026-10-25 21:45:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-25T21:45:38Z.

Review: COMMENTED


Reviewed head 159007bd43 by reading the diff and the existing review thread. I did not build or run this, so everything below is from the code, not from a test of mine.

What it does. Moved-word snapshots no longer go through the per-ShaderResources 8-slot movedWordBuffers cache. They are copied into the recorder's draw upload ring with recorder.DrawUpload(size), and the descriptor uses the slice's own buffer and offset. The tests are adjusted for a non-zero offset (item.offset, .subspan(offset)), which is the right place to touch them.

What I checked. DrawUpload aligns to max(minStorageBufferOffsetAlignment, 16), so a storage-buffer descriptor at that offset is legal, and the std::shared_ptr<Buffer> in the slice keeps the ring buffer alive for the draw. Removing the mutable cache from ShaderResources also removes shared mutable state from a const method, which is a good thing independent of speed.

Concerns:

  1. No size bound on this path. The other DrawUpload call site is guarded by DrawUploadLimit() (4096 bytes by default). The moved-word path has no such limit, and DrawUpload allocates a fresh max(1 MiB, bytes) buffer whenever the ring is full or the request does not fit. The old code bounded this to 8 retained buffers. If override->size can be large, one draw per frame can now allocate a dedicated buffer where it used to reuse one. Please state the maximum override->size or add the same limit and fallback.
  2. Dedup is gone. The old cache returned the same buffer when allocation, size and words were equal, so a repeated draw with identical moved data created no new buffer. Now every such draw copies the words again. The perf numbers in the thread are what justifies that trade, and I can't verify them. They come from the author's captures and MarcZX10 has asked for clean base and change commits, which the author supplied. I take them as given.
  3. patch.adjustment is still written as a single byte (static_cast<std::byte>). That is carried over unchanged, so I'm not blaming this PR.

Leaving a comment: point 1 is a question I'd like answered; the rest is fine.

AI-assisted: yes. Written with AI assistance and reviewed by me.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5645479207 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11142#pullrequestreview-5645479207). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-25T21:45:38Z. **Review:** COMMENTED --- Reviewed head `159007bd43` by reading the diff and the existing review thread. I did not build or run this, so everything below is from the code, not from a test of mine. **What it does.** Moved-word snapshots no longer go through the per-`ShaderResources` 8-slot `movedWordBuffers` cache. They are copied into the recorder's draw upload ring with `recorder.DrawUpload(size)`, and the descriptor uses the slice's own buffer and offset. The tests are adjusted for a non-zero offset (`item.offset`, `.subspan(offset)`), which is the right place to touch them. **What I checked.** `DrawUpload` aligns to `max(minStorageBufferOffsetAlignment, 16)`, so a storage-buffer descriptor at that offset is legal, and the `std::shared_ptr<Buffer>` in the slice keeps the ring buffer alive for the draw. Removing the mutable cache from `ShaderResources` also removes shared mutable state from a `const` method, which is a good thing independent of speed. **Concerns:** 1. **No size bound on this path.** The other `DrawUpload` call site is guarded by `DrawUploadLimit()` (4096 bytes by default). The moved-word path has no such limit, and `DrawUpload` allocates a fresh `max(1 MiB, bytes)` buffer whenever the ring is full or the request does not fit. The old code bounded this to 8 retained buffers. If `override->size` can be large, one draw per frame can now allocate a dedicated buffer where it used to reuse one. Please state the maximum `override->size` or add the same limit and fallback. 2. **Dedup is gone.** The old cache returned the same buffer when `allocation`, `size` and words were equal, so a repeated draw with identical moved data created no new buffer. Now every such draw copies the words again. The perf numbers in the thread are what justifies that trade, and I can't verify them. They come from the author's captures and MarcZX10 has asked for clean base and change commits, which the author supplied. I take them as given. 3. `patch.adjustment` is still written as a single byte (`static_cast<std::byte>`). That is carried over unchanged, so I'm not blaming this PR. Leaving a comment: point 1 is a question I'd like answered; the rest is fine. AI-assisted: yes. Written with AI assistance and reviewed by me.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11142
No description provided.