Skip to content

perf(agc): keep unchanged guest layers of a depth plane copy - #2490

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:up639/depth-plane-guest-layers-on-425
Oct 13, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:up639/depth-plane-guest-layers-on-425

Conversation

@oneandonlydean

@oneandonlydean oneandonlydean commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

What

Follow-up to #425, as asked in its review.

DepthPlaneCopy (sampling a depth surface as a 2D array, a cube or its integer bits) keeps each slice it read from guest memory in its staging buffer, together with the write generation it was read at. The next use reads and detiles that slice again only when:

  • its address, size or tiling changed;
  • the write tracker reports a write since (UnchangedSince);
  • recorded GPU work writes the range (Recorder::SnapshotWriteOverlaps); or
  • a depth surface held that slice in between.

Without write watching, every use reads, as before.

#425 is merged, so this head is rebased onto main 1c5e628 and holds only its own commit. It applied without conflicts and the change is the same.

Why

Every use read and detiled every slice no depth surface holds, even when nothing had written it.

The rule is the one a cached sampled snapshot already uses for a hit (cachedTexture: collect, then UnchangedSince), plus the pending-write check, so it is no looser than the existing texture path.

Tested

Linux (CachyOS, GCC 16.2.1, Release with CI's configure flags and ANYPS5_ENABLE_SPIRV_TOOLS=ON, full build and libs), RTX 4090, NVIDIA 610.57.04.

Not run on this head: the 2D title we test with (it ran on #2491's head, which contains this commit). Not tested on Windows or on AMD.

Checklist

This was referenced Oct 9, 2026
@github-actions github-actions Bot added docs agc libSceAgc* needs rebase Conflicts with main, rebase needed labels Oct 9, 2026
@Mouhand-Kaddo

Copy link
Copy Markdown
Contributor

Additional platform validation on standalone PR head 5f0e7304189174bbfc033f37138b06ed15e4e77a:

Windows: passed — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja.

Release / BUILD_TESTING=ON: built the selected test targets; 2 CTest cases, 0 failures, 0 CTest skips.

Tests: agc_driver_graphics, agc_driver_depth_plane_guest_layers.

Reproduce after building the test targets: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_(depth_plane_guest_layers|graphics)$".

Vulkan: native AMD RX 6900 XT, driver 32.0.21045.5002.

Integration limitation: a local merge against main 948a526c2 has source conflicts; these results validate the standalone PR head, not a resolved merge.

oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 11, 2026
…kopovar#290 and two new topics

The tree is astro-main/stack-425b c21155b: upstream main a11c8f7,
boykopovar#425's new head 6d59983 in place of the hand-resolved merge of its
older head, boykopovar#454, boykopovar#2490 and boykopovar#2491, draw-key admission, the depth test
plane rule and the import window compare as before, then boykopovar#290 (host
import windows, budget from physical memory), the highest index of an
in-place index buffer kept for indirect draws, and the depth surface
that takes the storage image written over it while it was retired.
@oneandonlydean
oneandonlydean force-pushed the up639/depth-plane-guest-layers-on-425 branch from 5f0e730 to 4a4cebc Compare October 11, 2026 18:32
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 11, 2026
@oneandonlydean
oneandonlydean force-pushed the up639/depth-plane-guest-layers-on-425 branch from 4a4cebc to 35af446 Compare October 11, 2026 23:32
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 11, 2026
snowzhangy pushed a commit to snowzhangy/AnyPS5 that referenced this pull request Oct 12, 2026
…opies only for changed layers and slices) into integ/head

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean oneandonlydean self-assigned this Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@oneandonlydean
oneandonlydean force-pushed the up639/depth-plane-guest-layers-on-425 branch from 35af446 to 8d7ef97 Compare October 12, 2026 19:29
Sampling a depth surface as a 2D array, a cube or its integer bits
copies its planes into a per-use image. Each use read every slice no
depth surface holds from guest memory and detiled it again, even when
nothing had written it since: in one level of a heavier title that was
about 165,000 layer reads, about 650 GiB, in a five-minute run.

A slice read from guest memory now stays in the copy's staging buffer
with the write generation it was read at. The next use reads and
detiles it again only when its address, size or tiling changed, the
write tracker reports a write since, or recorded GPU work writes the
range; a slice a depth surface held in between is read again. Without
write watching every use reads, as before.
@oneandonlydean
oneandonlydean force-pushed the up639/depth-plane-guest-layers-on-425 branch from 8d7ef97 to af71604 Compare October 13, 2026 00:25
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
@oneandonlydean
oneandonlydean merged commit 26f8047 into boykopovar:main Oct 13, 2026
9 checks passed
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