Skip to content

fix(agc): preserve CPU stores that restore texture baselines - #5088

Closed
Dripl1x wants to merge 1 commit into
boykopovar:mainfrom
Dripl1x:codex/storage-cpu-write-order
Closed

Dripl1x wants to merge 1 commit into
boykopovar:mainfrom
Dripl1x:codex/storage-cpu-write-order

Conversation

@Dripl1x

@Dripl1x Dripl1x commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

A CPU store into write-watched image memory can restore the bytes saved at upload after the GPU has produced different texels. writeBackLayers previously treated equality with that baseline as permission to store the GPU result over the CPU's newer write.

Keep a matching-baseline block for the CPU when the existing GuestMemory::UnchangedSinceCollected query reports a CPU store since the layer generation. The production change is one predicate in Texture.cpp; it adds no API, dependency or setting. Existing baseline handling for driver-only stamps and writes outside the image is retained.

The regression waits for the GPU clear to complete before each later store and checks six cases: no store, a CPU store restoring baseline bytes, a CPU store changing bytes, a driver store restoring baseline bytes, a CPU store in a different page of the same 64 KiB block before the image, and a baseline-restoring CPU store in an interior full block. It verifies CPU-write classification and every resulting texel. Technical debt records page-granularity retention and the remaining ambiguity of same-value stores in unwatched memory.

Tested

Windows 11, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, NVIDIA GeForce RTX 3070 Laptop GPU, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF.

  • Exact published head: d18e5e7266590fa17b535379d66a3ff373b88e10, based on main c8eb1f52d33f70b6091f9efd7a2a1de8528d8da4. Built agc_driver_recorder_tests and agc_write_tracking_tests with their production runtime dependencies.
  • Six focused CTest checks pass in 3.43 s, with Vulkan required, application shader caching disabled and a 30 s bound: agc_unchanged_cpu_stamps (all six watched-memory cases, 0.63 s), agc_write_tracking, agc_storage_integer_clear, agc_storage_upload_lifetime, agc_storage_upload_failure, and agc_storage_written_buffer_order. No selected test or watched-memory case was skipped.
  • Before the fix, keeping the regression on main c2565f014912f1f43f7b289fbad02cbf8fab1d93 fails in 1.29 s: a CPU store restoring the baseline over watched memory: write-back overwrote a CPU store with GPU results. The no-CPU-store control passes. The same six checks pass before and after rebasing the fix.
  • tools/check_conventions.py --base upstream/main and patch whitespace checks pass.

Linux/macOS runtime execution, the Linux-only watched-host-import subcases, the full test suite and title runs were not completed. No FPS improvement or title unblock is claimed.

Dependencies and related work

#5024 is merged and included through the main baseline; its per-unit snapshots and untracked-memory write protection are retained. This fixes the separate watched-memory, same-value CPU-store case.

#3991 changes snapshot allocation and #4663 changes generation settling in other hunks. Neither supplies a runtime prerequisite for this fix. Searches and inspection of their current patches found no equivalent CPU-store predicate.

Checklist

  • Based on current main; no equivalent open fix found
  • One topic per PR; follow-ups go in a new PR
  • No new code comments
  • Unsupported paths still throw; no silent stubs added
  • No investigation files, logs, screenshots or title data committed
  • No new third-party code or dependencies
  • Generic behaviour, not specific to one title
  • Depends on: none (fix(agc): keep CPU writes when a pending storage result is stored over untracked memory #5024 is merged into the baseline)
  • Unblocks: none confirmed
  • GPUs tested: NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11
  • AI-assisted: yes (Codex)

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 13, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants