fix(agc): publish a reused native multisample depth target with the guest's undecided bytes, then retire its owner #15941

Merged
EagleBearerYS merged 17 commits from upstream-pr/15941 into main 2026-11-19 09:10:27 +00:00
EagleBearerYS commented 2026-11-05 01:51:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-11-05T01:51:54Z.


What

Since #9533, a multisampled D32S8 target whose stencil has its own plane and whose HTILE is depth-only is imported as a native target. #9533 was merged together with #9717, in a4b76b2c0a.

Four titles that ran before that merge stop on main. JJenkx bisected each one to a4b76b2c0a: Curved Space (PPSA02817, #8691), NINJA GAIDEN: Ragebound (PPSA28002, #8671), Blue Prince (PPSA25009) and New Joe & Mac: Caveman Ninja (PPSA02801, #9091). On main they stop with:

AGC graphics: native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store

What reaches the publication. JJenkx traced it in all four (#8671). Each title reuses the memory of a host-written native target for something new:

  • draw input, in NINJA GAIDEN and Blue Prince;
  • a colour target and a storage texture, in New Joe & Mac;
  • another depth target, in Curved Space.

Why it stops. Building the new resource publishes the old target's planes to the guest (#13021).

  • Guest writes are tracked per 4 KiB page. Once the title has stored into a page the host drew, every byte of that page that still holds its snapshot value is undecided, and the publication refuses.
  • Curved Space and New Joe & Mac also meet a second refusal: a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented.

The change:

  • A cause on each depth read. It's DepthReadCause::Access, the default, or DepthReadCause::Reuse.
    • Reuse marks resources built over the memory: Draw.cpp's vertex and index buffer reads; the two storage-image accesses in ShaderResources.cpp, which also cover the colour-target lookup from refreshResidentTarget; and a new depth surface's three planes.
    • Everything else stays Access: CPU reads, DMA copies, texture reads, shader buffer accesses, dispatch-written ranges and the native sampling path.
  • The undecided bytes. Where main refuses an undecided byte, a Reuse publication takes the guest's byte. Every byte the publication can decide is decided as before:
    • the host's bytes on pages the guest didn't write;
    • the guest's bytes where it changed them;
    • bytes covered by driver stores, as recorded.
  • Retiring the old owner. A Reuse publication that took a guest byte, undecided or stored, retires the old owner: its guards are removed and it is marked inactive. The publication leaves it no longer host-written, so releaseRetired retires and frees it at the next depth-surface creation (#15300).
    • A later bind of its identity imports afresh.
    • A new depth attachment over its planes no longer meets the second refusal.
    • A Reuse publication that took no guest byte keeps the owner, as an Access publication does. A new depth attachment of another identity over a kept owner still meets the second refusal, as on main.
  • The AGC debt entry for the publication now says which accesses take the guest's undecided bytes, that those bytes are inferred, and that only a reuse that took a guest byte retires the owner.

Why the guest's byte. Before #9533 these targets were not native, so a resource built over their memory read the guest's bytes everywhere.

  • This change takes the guest's byte only for the bytes the publication can't decide, and only when the memory is reused.
  • So it is never further from the pre-#9533 result than main is, since main stops. It keeps the host's bytes everywhere the publication can decide them.
  • JJenkx's experiment at that check (#8671): Blue Prince renders its intro only with the guest's byte, and with the host's its screenshots are black. NINJA GAIDEN runs either way.

What isn't proven. The untouched bytes on a page the title wrote are inferred, not proven. The write tracking can't tell a byte the title never touched from one it stored with the same value.

  • Exact store ranges for guarded planes would decide them. That's the exact follow-up, and it's out of scope here.
  • CPU reads and DMA copies keep refusing.

Tested

Linux, on a cloud machine: Ubuntu 24.04, GCC 13.3, CI's configure flags, lavapipe (Mesa 25.2.8, LLVM 20.1.2). The tests ran as an unprivileged user with ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx.

New cases in agc_driver_native_depth_publication (CheckReusePublication):

  • The fixture: a 4-sample D32S8 target with a separate stencil plane and a depth-only HTILE. The host draws depth and stencil, then one CPU store leaves the rest of the stencil plane's first page undecided.

  • Red on main acf7ac208a, green here. On main all four fail with the refusal above.

    • (0) a vertex buffer read over the page, and (1) an index buffer read;
    • (2) a storage-image lookup, the colour-target path;
    • (3) a new depth target of another identity over the planes.

    The checks: the guest's bytes on the undecided page, the host's bytes elsewhere in the plane, every depth sample, and the old owner retired. A rebind of its identity takes a fresh import. In (3) the new surface imports.

  • The same on both:

    • (4) a CPU read and (5) a DMA copy still refuse, and keep the owner and the guest's bytes;
    • (6) a rebind of the same identity publishes nothing;
    • (7) a shader buffer access and (8) a texture read, with nothing undecided, publish the host's bytes, keep the owner and retire nothing.
  • For the review (9452ca6e35): (9) a vertex buffer read marked Reuse, with nothing undecided and no guest store, publishes the host's bytes and keeps the owner: a rebind keeps its view and serial, and a sampled read samples it. It fails on 091068b618's code (below).

The existing tests, 49 in all: the native depth, write-tracking, guest memory and multisample tests (ctest -R 'native_depth|native_multisample|depth_publication|write_track|guest_memory|multisample' --repeat until-fail:3).

  • On main and here: 47 pass and 2 skip, ×3. The skips are agc_driver_multisample_centered_lines and agc_driver_native_depth_bda_clear, which skip themselves on lavapipe.
  • No existing test was changed.

Mutations:

  • Making every publication Reuse fails (4)-(8).
  • Dropping the retirement fails (0)-(3). (3) then stops at the second refusal.
  • On d4583e9ccd, with Reuse never retiring (replaced forced to false), agc_driver_native_depth_publication fails on GitHub's Linux runner with guest writes over native multisample depth are not implemented (run).

Checks: tools/check_test_registration.py build and tools/check_conventions.py --base origin/main pass.

The red/green is from the cloud run (lavapipe, CI flags). The GitHub ×10 runs the branch only, because main lacks DepthReadCause. Case (9)'s red and green are on GitHub's runners, against 091068b618 (below).

On today's main: the four commits were rebased onto 9ab6a281ea with the same lines. GitHub's runners, ×10 on that tree (run), the same tests: on Linux, 52 tests, 50 pass and 2 skip; on Windows, 53 tests, 8 pass and 45 skip. The libc and libkernel suites pass on both.

With #15300, #15301 and #15855: the branch merged with main 9f35c937da and #15855 (since merged), the same tests, ×10 on GitHub's runners (run): on Linux, 52 tests, 50 pass and 2 skip; on Windows, 53 tests, 8 pass and 45 skip. The libc and libkernel suites pass on both.

Merged with main 0747011f67, as a3600e57f7 (run). The one conflict was in NativeMultisampleDepth.cpp, where #15446 (merged) adds CheckStoredRepeatFill at the place this PR adds CheckReusePublication. The merge keeps both, #15446's first, and this PR's own lines are unchanged. The same tests, ×10 on GitHub's runners: on Linux, 53 tests, 51 pass and 2 skip, with agc_driver_native_depth_publication and #15446's new agc_driver_native_depth_stored_repeat_fill among the passes; on Windows, 54 tests, 8 pass and 46 skip. The libc and libkernel suites pass on both.

  • The rebase onto 9ab6a281ea above, and the runs that say "this head", are on 7d377e40ba, the head before these merges. Their results still apply, since a3600e57f7 and ab7598d803 add only main to it, with the conflicts resolved as described.

Merged with main 9e47f0c3ac, as ab7598d803 (run). The one conflict was in Draw.cpp, where #14051 (merged) moved prepareDraw's index-buffer RequireNoMultisampleTarget check into the record-time stage. The merge takes #14051's move and puts this PR's DepthReadCause::Reuse on the moved line. This PR's other lines are unchanged. That main also has #14084 (merged), which changes DepthSurface.cpp and NativeMultisampleDepth.cpp and merged without a conflict.

  • The same tests, ×10 on GitHub's runners: on Linux, 55 tests, 53 pass and 2 skip, with #14084's agc_driver_native_depth_initial_owner among the passes; on Windows, 56 tests, 9 pass and 47 skip. The libc and libkernel suites pass on both.
  • Every agc test, once, on both runners (run), since the merge moved one of this PR's lines. On Windows, 1,456 tests: 426 pass and 1,030 skip. On Linux, 1,417 tests: 1,328 pass, 88 skip and 1 fails, agc_driver_pipeline_journal, at the 120 s timeout (120.06 s).
    • Run alone three times with a 300 s timeout (run), the journal test passed 3 of 3 on Linux, in 81.30, 7.86 and 7.84 s. It skips on Windows.
    • It also hit the 120 s timeout on main's own tree on 11-06 (run).

Merged with main dd7c8de5de, as e2ab111fbf (run). The one conflict was in NativeMultisampleDepth.cpp, where main (#15443 and #15750) adds a blank line at the place this PR adds CheckReusePublication. The merge keeps this PR's lines, which are unchanged. The same tests, ×10 on GitHub's runners: on Linux, 57 tests, 55 pass and 2 skip; on Windows, 58 tests, 9 pass and 49 skip. The libc and libkernel suites pass on both.

For oneandonlydean's and Superseabas's review (review, Superseabas's run), three commits on that merge:

  • 091068b618 drops the pass that retired a reused owner at once. The guard loop already marks it inactive and the publication leaves it no longer host-written, so releaseRetired retires and frees it at the next depth-surface creation. Every owner lookup checks active, and a native multisampled owner has no stale planes for retire to clear: MarkAllStale runs only for mirrorable targets, which have one sample. Alone, ×3 on GitHub's runners (run), the 21 native_depth tests: on Linux, 20 pass and 1 skips (agc_driver_native_depth_bda_clear); on Windows, all 21 skip.
  • 9452ca6e35 retires an owner on Reuse only when its publication took a guest byte, undecided or stored: PublishToGuest returns whether it did, and RequireNoResidentDepthRead_nid_no_patch marks only those owners inactive. It adds case (9).
  • d4583e9ccd says so in the debt entry.
  • Red and green, ×10 on GitHub's runners (run), the tests matching native_depth|write_track|guest_memory|multisample with agc_driver_graphics: with 091068b618's implementation, agc_driver_native_depth_publication fails on Linux at case (9), with a depth read of a host-written native owner retired or re-imported it. With the fix, on Linux, 58 tests, 56 pass and 2 skip; on Windows, 59 tests, 10 pass and 49 skip, since the runner has no Vulkan device. The libc and libkernel suites pass on both.

Merged with main 356bf9296b, as 05cb62a9a6 (run). The conflicts were two, both in DepthSurface.cpp, with #16363 (merged): it adds ProveOverwrite() before PublishToGuest's declaration, and proveOverwrittenPlanes() with a first line in RequireNoResidentDepthRead_nid_no_patch. The merge keeps both, with this PR's signatures, and this PR's own lines are unchanged.

  • The same tests, with #16363's agc_driver_native_depth_overwritten_planes, ×10 on GitHub's runners: on Linux, 62 tests, 60 pass and 2 skip; on Windows, 65 tests, 12 pass and 53 skip. The suites: libc and libkernel run 350 and 349 tests on Linux with 0 failed, and 380 and 376 on Windows, where only the verify harness's guest_kernel_resident_fmem_export and guest_kernel_resident_fmem_export_patched fail.
  • Red on this main: each of cases (0) to (3) alone, with main 356bf9296b's implementation and this PR's test (its three DepthReadCause::Reuse arguments dropped, since main's call sites pass none), fails agc_driver_native_depth_publication on GitHub's Linux runner with the refusal above (0, 1, 2, 3). The Windows runner skips it. The green is the ×10 above.
  • Every agc test, once, on both runners (run). On Windows, 1,568 tests: 473 pass and 1,095 skip. On Linux, 1,525 tests: 1,431 pass, 93 skip and 1 fails, agc_driver_frame_replay_rewind_copy, with no memory delta was read while 1 submissions waited for the CPU. It is intermittent on main too. Repeating the frame-replay tests until a failure, up to 20 times, on GitHub's Linux runner, it failed with the same line on the 3rd run on this merge (run) and on the 4th on an unchanged copy of main 356bf9296b (run). The other 40 frame-replay tests passed every run on both, and this PR doesn't touch frame replay.

Merged with main eb3839d4f3, as 84d53ab953 (run). The conflicts were two. In DepthSurface.cpp, #16365 (merged) adds GuestHoldsSamples() before PublishToGuest's declaration, and the merge keeps it with this PR's bool PublishToGuest(DepthReadCause cause). In the debt file, #16364 (merged) changes the publication entry's "pending storage-image writes" to "pending storage-image units over a plane". The merge keeps this PR's entry, with its "a kept plane holding the host's bytes" shortened to "a kept plane of host bytes", but writes #16364's change as "pending storage writes over a plane". oneandonlydean's docs commit 392f9f30d4, on top of the merge, restores main's "pending storage-image units over a plane" in the entry. This PR's own code and test lines are unchanged. #16375 (merged) also changes DepthSurface.cpp and merges clean, and main adds no call to PublishToGuest or RequireNoResidentDepthRead_nid_no_patch.

  • The same tests, with #16365's agc_driver_native_depth_single_sample_view, #16364's agc_driver_native_depth_pending_units and #16375's agc_driver_raw_pointer_store_pending_inline and agc_driver_raw_pointer_store_pending_items, ×10 on GitHub's runners: on Linux, 66 tests, 64 pass and 2 skip; on Windows, 69 tests, 12 pass and 57 skip. The suites: libc and libkernel run 351 and 349 tests on Linux with 0 failed, and 381 and 376 on Windows, where only the verify harness's guest_kernel_resident_fmem_export and guest_kernel_resident_fmem_export_patched fail.

Merged with main 78ad708701, as 7ce55ad00e (run). The conflicts were three, all with #16301 (merged), which publishes over a colour alias its owner took in and retires that alias after the planes commit. In DepthSurface.cpp, the merge keeps #16301's two RetireMultisampleColorTarget calls at the end of PublishToGuest, before this PR's return of whether the publication took a guest byte. In NativeMultisampleDepth.cpp, it keeps #16301's alias cases and this PR's reuse cases. In the debt file, this PR's publication entry takes #16301's one-word change ("other resident colour aliases") and keeps oneandonlydean's "units" fix from 392f9f30d4, and #16301's new entry follows it unchanged. This PR's own code and test lines are unchanged. #16301's cases publish through CPU reads, whose cause stays Access, so this PR doesn't change what they check. #16116 (merged) also changes DepthSurface.cpp and merges clean.

  • The same tests, ×10 on GitHub's runners, with #16301's new cases, which run inside agc_driver_native_depth_publication: on Linux, 66 tests, 64 pass and 2 skip (agc_driver_multisample_centered_lines and agc_driver_native_depth_bda_clear, as before); on Windows, 69 tests, 12 pass and 57 skip. The suites: libc and libkernel run 354 and 349 tests on Linux with 0 failed, and 384 and 376 on Windows, where only the verify harness's guest_kernel_resident_fmem_export and guest_kernel_resident_fmem_export_patched fail.
  • Every agc test, once (run): Linux: 1,531 run, 1,438 pass, 93 skip, 0 fail. Windows: 1,574 run, 474 pass, 1,100 skip, 0 fail.

Merged with main 0f4538fa02, as 58f6485059 (×10). The conflicts were three. In DepthSurface.cpp, hugodearaujo's #17890 (merged) adds PublishedUnderStorage() before PublishToGuest's declaration, and the merge keeps it with this PR's bool PublishToGuest(DepthReadCause cause). In ShaderResources.cpp, Sam-mon7's #15059 (merged) sizes the two storage-image accesses with SurfaceGuestBytes(viewed) in place of DescribeSurface(viewed).guestBytes, and the merge keeps that line, with this PR's DepthReadCause::Reuse argument on the line after it. This PR's own lines are unchanged.

  • The same tests, with #17890's agc_driver_native_depth_overwritten_published and the agc_shader_memory tests, ×10 on GitHub's runners: on Linux, 70 tests, 68 pass and 2 skip; on Windows, 76 tests, 18 pass and 58 skip (no Vulkan device). #17890's new case calls RequireNoMultisampleTarget without a cause, so it takes this PR's default Access.
  • The suites: libc and libkernel run 381 and 377 tests on Linux and 411 and 405 on Windows, with 0 failed in the rerun of both jobs (attempt 2). In the first attempt (attempt 1), libkernel's guest_freebsd_clocks aborted on Linux after 0.10 s, and guest_timed_wait_cpu exceeded its overshoot limits on Windows (sceKernelUsleep(100 us)'s P99 overshoot at 6,880, 5,211 and 4,399 µs, against a limit of 2,900 µs). This PR changes no libkernel file. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes only precise_wait's median bounds on GitHub's hosted runners.
  • The Windows tree had Sankalp7317's 4-line _putenv_s test fix (#19899) on top, because main's Windows test build breaks without it ("'setenv' was not declared" in UploadCacheReadOnlyFlush.cpp, from #18037); it isn't on this branch.
  • GitHub's Windows check on 58f6485059 (job) has one failure among 4,581 tests: agc_graphics_profile_draw, at 30.17 s, on DepthSurfaceReuse.cpp:743's Require ("a partially resident depth plane with an unmapped page must be refused"), on an AMD EPYC 7763 host. That is the red main's Windows job has had since 14 Nov (for example job 132502166258 on main 3e63c9f68f, also an EPYC 7763, where agc_driver_graphics fails on the same Require). oneandonlydean's #20134, merged as 06b90cc1af, invalidates the guest page cache in those depth fixtures for it. This PR doesn't change DepthSurfaceReuse.cpp.

Merged with main 769d303b59, as 416bc9ad90 (×10). The one conflict was in the debt file's publication entry, where arthur-paraibano's #19846 (merged) changes "D16/D32-only owners" to "D16 and HTILE D32 owners". The merge keeps this PR's entry with #19846's change. This PR's own code and test lines are unchanged.

  • The same tests, ×10 on GitHub's runners: on Linux, 72 tests, 70 pass and 2 skip (agc_driver_multisample_centered_lines and agc_driver_native_depth_bda_clear), with agc_driver_native_depth_publication, which runs this PR's reuse cases, passing 10 of 10; on Windows, 78 tests, 18 pass and 60 skip (no Vulkan device).
  • The suites: libc and libkernel run 391 and 390 tests on Linux and 421 and 417 on Windows. On Windows, 0 failed. On Linux, libkernel's guest_thermal_sensors reached its 20 s timeout. This PR changes no libkernel file, and the same test passed in the suites of #7395's merge with main 328cbf673e (run), whose thermal sensor code is the same as 769d303b59's. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes only precise_wait's median bounds on GitHub's hosted runners.
  • The Windows tree again had #19899's _putenv_s test fix on top; it isn't on this branch.

Merged with main bb95654123, as c71026cc1f (×10). The one conflict was in prepareDrawInputs's vertex range loop in Draw.cpp, where talha-devp's #20368 (merged) adds two arguments to the InPlaceDrawInput call on the line after this PR's RequireNoMultisampleTarget(begin, bytes, "a vertex buffer read", DepthReadCause::Reuse). The merge keeps both lines as each side has them: this PR's check, then #20368's call. This PR's own code and test lines are unchanged.

  • The same tests, with #20368's agc_draw_input tests, ×10 on GitHub's runners: on Linux, 78 tests, 73 pass and 5 skip (agc_driver_multisample_centered_lines and agc_driver_native_depth_bda_clear, and agc_draw_input_mirrors, agc_draw_input_mirrors_off and agc_draw_input_reuse, which skip without /dev/udmabuf), with agc_driver_native_depth_publication and #20368's changed agc_draw_inputs_copied and agc_draw_inputs_in_place_driver passing 10 of 10; on Windows, 84 tests, 19 pass and 65 skip (no Vulkan device).
  • The suites: libc and libkernel run 396 and 397 tests on Linux and 425 and 422 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes only precise_wait's median bounds on GitHub's hosted runners.
  • The Windows tree again had #19899's _putenv_s test fix on top; it isn't on this branch.

Windows with the validation layer, run by Superseabas (comment): ab7598d803 merged onto main ef9ab2ea44 (clean), WinLibs GCC 16.2.0, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, on an NVIDIA GeForce RTX 5070 Ti (driver 621.01) and the Ryzen 7 7700X's integrated AMD Radeon (driver 26.10.2). The full ^agc suite, 1,474 tests, gives 1,473 passes on each GPU with and without this PR; the one failure on each is the same on main (agc_driver_quad_pixel_mask on the RTX, #14341, and agc_driver_sample_order_grid_reference on the Radeon, #9503). No VUID- lines. agc_driver_native_depth_publication passes on both GPUs.

The same machines on d4583e9ccd, run by Superseabas, who approved (review): merged onto main 6541a1f0fc (clean), with the same setup and GPUs, since GitHub's Windows runner skips these tests.

  • The full ^agc suite, 1,527 tests: 1,526 pass on each GPU with and without this PR. The one failure on each is the same as above, and there are no VUID- or missing-layer lines.
  • The native depth tests: agc_driver_native_depth_publication passes 3 of 3 on each GPU, and the 24 agc_driver_native_depth_ tests pass on both, with _driver_queued_fill skipping.
  • DecidedVertexRead, a Reuse read with nothing undecided, keeps the owner on both GPUs: the rebind returns the same view with no new surface, and sampling works.
  • Mutations, one run per GPU, the same on both: the previous head's rule, where Reuse retires every ever-written owner, fails DecidedVertexRead; with Reuse never retiring, the test fails with guest writes over native multisample depth are not implemented.
  • Not run: any title.

7ce55ad00e on Linux and Windows, run by milescoviello (comment): agc_driver_native_multisample_depth, the fixture's default mode, passed 3 of 3 on this head and on its merge base 78ad708701, on Linux (Ubuntu 26.04.1, NVIDIA GeForce RTX 4070 Ti, driver 615.71.09, GCC 15.2, Release) and on a Windows 11 VM (NVIDIA GeForce GT 1030, driver 582.78, WinLibs GCC 15.2 UCRT, Release). That mode doesn't run the publication cases, so this PR's reuse cases aren't among them.

Windows with the validation layer, run by magnub (comment): 7ce55ad00e merged into main c7ac238e7c as CI merges it (98585ec586), against that main, with tools/vulkan_validation_gate.py, on an NVIDIA GeForce RTX 4090 (driver 621.14), Windows 11 Home 26100, WinLibs GCC 15.2.0 r7, Release, VK_LAYER_KHRONOS_validation 1.4.363.

  • The 25 agc_driver_native_depth_* tests of agc_driver_native_multisample_depth_tests, agc_driver_native_depth_publication's reuse cases included, 3 runs per build: all 150 runs pass, the loader inserts the layer in every run, and neither side has a VUID-, SYNC-HAZARD or UNASSIGNED- message.
  • agc_driver_native_depth_driver_queued_fill is left out, since it skips on Windows.

Linux with the validation layer, run by domx4q (comment): this head c71026cc1f merged onto main f0c01bc69d (clean), against that main, on an NVIDIA GeForce RTX 4090 (driver 620.70.06, Vulkan 1.4.357), Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation 1.4.363.1, with the tests matching native_depth|native_multisample|depth_publication|write_track|guest_memory|multisample.

  • 67 tests on each side: all 67 pass on main and with this PR, none skips, and every test selected the RTX 4090. agc_driver_native_depth_publication, which runs this PR's reuse cases, passes, as do agc_driver_native_depth_publication_without_htile and agc_driver_native_multisample_depth.
  • The layer: the loader inserted it 92 times on each side, no run reports it missing, and neither side has a VUID- line. Apart from addresses, the two logs print the same lines.

Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 5080 (driver 610.88) and the Ryzen 7 9800X3D's integrated AMD Radeon Graphics (driver 2026.04.17), run by Lyrnc (comment): this head c71026cc1f merged onto main 6286d36449 (clean), WinLibs GCC 15.2.0, Ninja, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, the GPU picked with ANYPS5_GPU, no validation layer.

  • The 31 tests matching native_depth|native_multisample_depth, agc_driver_native_depth_publication among them: 31 of 31 pass in each of 3 runs on each GPU.
  • ^agc_|^shader|^video_out|^guest_video on the RTX 5080, 2,081 tests: 2 fail, and they report both failing on main on that card too: agc_driver_stencil_plane_memory (#22427, with #22508 open for it) and agc_driver_msaa_dcc_unwatch (#22931, with #22950 open for it).
  • Not run: a title, the validation layer.

GitHub's Linux and Windows runners, ×10, on acf7ac208a (run). The tests matching native_depth|write_track|guest_memory|multisample:

  • Linux: 49 tests, 47 pass and 2 skip, ×10. The skips are the same two lavapipe ones. agc_driver_native_depth_publication passed 10 of 10.
  • Windows: 50 tests, 8 pass and 42 skip, ×10.
    • The runner has no Vulkan device, so the AGC driver tests skip themselves, the new cases included.
    • The five agc_write_tracking tests and three guest_memory tests run and pass.
  • Both: the libc and libkernel suites pass.

Validation layers (CONTRIBUTING's AGC rule; run). VK_LAYER_KHRONOS_validation ran on GitHub's Linux runner, with main's tree and this branch each running the 35 tests matching native_depth|multisample.

  • Each had 33 passes and 2 skips. The layer loaded in both.
  • The only VUID is VUID-VkDeviceCreateInfo-pNext-pNext, on main and here. This change adds none.
  • llvmpipe (LLVM 20.1.2), Mesa 25.2.8, Ubuntu 24.04.5.

The titles, run by JJenkx on this head merged onto main c4469b60da: Linux 7.2.11, AMD Radeon RX 6650 XT (RADV, Mesa 26.2.6), Release, APS5_PLAYGO_UNLISTED_CHUNKS=installed, 125 s with Cross every 15 s from 30 s. On that main each title stops with the refusal above. With this PR each one gets past it and runs to the scheduled close, exit 0:

  • NINJA GAIDEN: Ragebound (PPSA28002) (#8671): stops at 50 s on main. Here it runs 122 s, and the story intro plays at 60 s.
  • Curved Space (PPSA02817) (#8691): stops at 18 s on main. Here it runs 121 s, and the "Keep Going?" campaign screen is rendered at 60 s.
  • New Joe & Mac: Caveman Ninja (PPSA02801) (#9091): stops at 8 s on main. Here it runs 123 s, and at 60 s the "Classic Modes" menu, opened with Cross, is shown.

AMD Radeon RX 570 (RADV POLARIS10, GFX8), run by ryanc2112 (comment): this head merged onto main 7ad9749ed0, Mesa 26.2.5, Release, with VK_LAYER_KHRONOS_validation.

  • The 17 agc_driver_native_depth_* tests, 3 runs each: on GFX8, 11 of them fail on main, agc_driver_native_depth_publication among them, because the sample shadow lacks depth-attachment usage; #15750 fixes that. This PR alone gives the same 6 passes and 11 failures as main. With #15750, all 17 pass on main, and with this PR added all 17 still pass, the new CheckReusePublication cases included. None of these runs reports a VUID- error.
  • The AGC, shader, VideoOut and Vulkan tests, this PR on main, once each: the same results as main, with 1,313 passing, the same 14 failing and 40 skipped, and the same 26 pAttachments-00605 validation errors on both sides (#11990). The 14 failures are known GFX8 or driver issues: the 11 above (#15750), agc_driver_f32_fma_denormal_mode2 (#15316), agc_driver_tessellation (#5444) and agc_driver_sample_order_recipe_depth_locations (#9759).

The same GPU on d4583e9ccd, run by ryanc2112 (comment): merged onto main 0dd2fffe35 (clean), which has #15750 and #15688's two- and three-plane D32S8 layout, SteamOS 3.8.28, GCC 16.2.1, Release, with VK_LAYER_KHRONOS_validation loaded.

  • The 23 agc_driver_native_depth_* tests, 3 runs each: 23 of 23 pass on main and with this PR, the reuse cases included, with no VUID- errors.
  • The 1,499 AGC, shader, VideoOut and Vulkan tests, once each: the same 3 failures and 43 skips as main, with no VUID- errors. The failures are known: agc_driver_f32_fma_denormal_mode2 (#15316), agc_driver_tessellation (#5444) and agc_driver_sample_order_recipe_depth_locations (#9759).

Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 4070 (driver 32.0.16.1692) and AMD Radeon Graphics 1002:13c0 (RDNA 2 integrated, driver 32.0.21043.5001), run by AlfaRojo (comment): this head merged onto main 3cb1cd29ec (clean), WinLibs GCC 15.2.0 r7 UCRT, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, no validation layer.

  • On each GPU: agc_driver_native_depth_publication passed 3 of 3. Of the 18 tests matching native_depth|native_multisample, 17 pass and 1 skips. The skip is CheckDepthTarget's HTILE write-coverage assertion, which main also skips on these GPUs.
  • There is no red run here, since the new cases need this PR's DepthReadCause to build.

Windows 11 (build 26200), NVIDIA GeForce RTX 5090 (driver 617.42), run by klosixgaming-arch (comment): this head merged onto main e88dbd3af7 with #9947 (2a234fd995), which SAMURAI MAIDEN needs to get past a long-path stop 8 s in and which only touches file paths. Both titles were reconverted with this tree's relinker. Each run is 110 s from boot, with no input.

  • SAMURAI MAIDEN (PPSA04132, 01.060.000): without this PR (1 run on 2a234fd995), it stops about 28 s in on native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store. Here, 1 run has no error for the full 110 s. The stop came at the same point in every run before, so they read one clean run as a clear change.
  • Eternights (PPSA08270, 01.004.000), with APS5_PLAYGO_UNLISTED_CHUNKS=absent: 1 of 4 runs on main 1c8c0efc8c stopped about 40 s in with the same message, from a compute shader (details). Here, 4 of 4 runs have no error for the full 110 s. They call this weaker evidence, since the stop showed up in 1 of 4 runs, on an older main.
  • Tests: the agc_driver_native_* tests in the agc_driver_native_multisample_depth_tests target pass (16 passed, agc_driver_native_depth_driver_queued_fill skipped). Three other agc_driver_native_* tests weren't rebuilt in their build, so those results don't count.
  • Not checked: gameplay past the title screens, and whether the bytes taken from the guest are the right ones.

SAMURAI MAIDEN (PPSA04132), further, run by birdmarty on this head 7d377e40ba (#7265): Windows, Intel Core i9-9900K, AMD Radeon RX 6800.

  • On main 56374036ad (#7265), it stops during Unity's asset loading on the refusal above.
  • Here it gets past the asset loading to the main menu, and plays the visual-novel talk-event scenes and the 3D gameplay. Their screenshots show both.
  • Still there: at some later loading screens, between talk events, the same refusal fires from a compute shader (compute shader 0x233579900: AGC graphics: native multisample depth publication cannot distinguish ...). At the same transitions they also see AGC graphics: guest writes over native multisample depth are not implemented. Across their runs, a loading screen gives either line or passes. A Reuse publication takes the guest's undecided bytes instead of refusing, so these refusals come from reads this PR leaves as Access.
  • The furthest stop is a different one, not this PR's refusal: in the first combat, as a tutorial popup appears, an access violation on the title's CRI Server Manager thread (app.exe+0xc96561, a read of address 0).

New Joe & Mac: Caveman Ninja (PPSA02801) on Windows, run by xXPBSXx (comment): d4583e9ccd merged into main 697b66b1e4a, an NVIDIA GeForce RTX 4080 SUPER, one run.

  • It still stops, after about 48 s, on native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store. The second refusal didn't appear.
  • Where it comes from: with this PR, that refusal is raised only for a read this PR leaves as Access (CPU reads, DMA copies, texture reads, shader buffer accesses, dispatch-written ranges and the native sampling path), so on that machine the title reads the old target's memory in one of those ways. The log line doesn't say which.
  • Not run: main on that machine, so whether it stops at the same point there isn't known.

Asterix & Obelix Slap Them All! (PPSA08576) on Windows, run by JJenkx (comment, correction): d4583e9ccd merged onto main 017bd95f5f, an AMD Radeon RX 6700 XT, one 240 s run per build, only core/libs/libs swapped.

  • It stops on the same refusal with and without this PR: at 13.9 s on main and 19.8 s here. A later run with #17956's libraries stopped at 13.4 s, so JJenkx reads these differences as run-to-run variance, not progress.
  • Where it comes from: their later diagnostic run names a texture read with DepthReadCause::Access, one of the reads this PR leaves as Access.

Arcade Game Zone (PPSA19015) on Linux, run by edubox (comment, full report in #8562): main 71ce478956 with #17863, #18037 and #18319, with and without 7ce55ad00e, an NVIDIA GeForce RTX 4080 SUPER (driver 620.70.06), CachyOS, GCC 16.2.1, Release.

  • Without this PR it stops at about 50 s on the refusal above, then a [gpu] driver failure and an abort.
  • Here a 150 s run has no driver failure and reaches the front end and a mini-game, at 54.1 FPS on average over 8,095 frames.

Spirit of the North: Enhanced Edition (PPSA02306) on Windows, run by JJenkx (comment): main 5bc74bb293 and 7ce55ad00e merged onto it (82fab69fa8), an AMD Radeon RX 6700 XT, 3 runs per build, alternated, with only the libraries differing.

  • This PR doesn't change its stop: with each build, 2 of 3 runs stop at about 298 s on guest writes over native multisample depth are not implemented (#18281), and 1 reaches the 330 s cap.
  • The title doesn't hit the refusal this PR changes.

Peppa Pig: World Adventures (PPSA09806) on Windows, run by HabibUrRehmanBhattii (#19981): this head, 58f6485059, an NVIDIA GeForce RTX 4070, one run.

  • On main 3f6cc968ba (report), on a tree with local AGC and shader edits they describe as unrelated, it stopped at 30.8 s on the refusal above, and an earlier run stopped on initial multisample color contents overlap resident native depth.
  • Here the refusal above doesn't stop it. It runs to 44.7 s (272 presents) and stops on initial multisample color contents overlap resident native depth, the refusal of a multisampled colour target's initial import that hugodearaujo's #17956 changes.
  • The log doesn't say which read reached the publication.

Pending: Blue Prince (PPSA25009, #9189) hasn't been run on this branch yet. It's the title whose intro renders only with the guest's byte (above), so a run of it would check the byte this PR takes.

Overlap

  • #13021 (JAB-dev, merged) is the publication this extends. Its structure and its refusals for plain reads are unchanged.
  • #13023 (JAB-dev, merged) had adjacent edits in DepthSurface.hpp, DepthSurface.cpp (prepareDepthSampling) and NativeMultisampleDepth.cpp, and merged with this branch without a conflict.
    • With #13023, a store during the import no longer counts as written, so fewer bytes are undecided. This PR's rule is unchanged.
  • #15688, #15690 and #15707 (hugodearaujo, all merged) are a stack for D32S8 owners without HTILE, from Assassin's Creed Mirage (PPSA13960). This PR's targets have a depth-only HTILE, but its rule is in the publication they share, so it reaches their owners too. This PR's tests don't cover an owner without HTILE.
    • #15688 publishes a written two-plane owner to its guest planes. The two compose: its publication fills the planes, and this PR changes what a reuse publication does with undecided bytes and what happens to the owner afterwards.
    • #15690 attaches a smaller extent with the same Z_X layout to its owner. That bind then creates no new depth surface, so this PR's reuse publication doesn't run for it. This PR still applies to the binds of another identity that #15690 keeps refusing, such as a larger extent, another layout or an owner with HTILE.
    • #15707 releases a published owner whose plane a written storage view covers, after cachedStorageTexture publishes it. With this PR, that storage access is a reuse. If its publication took a guest byte, the owner is already inactive with its guards removed, and #15707's release, which checks active, skips it; if not, the owner stays and #15707 releases it as before. They differ where a storage view overlaps an owner without covering a plane and the publication took a guest byte: #15707 keeps that owner, and this PR retires it.
    • Their new cases and this PR's sit at the same place in NativeMultisampleDepth.cpp, and keeping both sides resolves that file. The rest merges clean.
  • #16363, #16364 and #16365 (hugodearaujo, all merged) are Assassin's Creed Mirage (PPSA13960)'s next changes, and name this PR as the fourth they need to get past native multisample depth plane without HTILE does not hold one depth value in [0, 1].
    • #16363's runs show that with this PR as the fourth change, neither of two runs stops on that message, and that with this PR alone the run stops on it, as without it.
    • #16363 and #16365 add members next to PublishToGuest's declaration, and #16363 adds a helper and a first line to RequireNoResidentDepthRead_nid_no_patch, whose signature this PR extends. #16364 rewords the debt entry. Keeping both sides resolves all three, with this PR's signatures, as the merges of main in 05cb62a9a6 (#16363) and 84d53ab953 (#16364 and #16365) do.
  • #10469 (Ondra97) publishes D32 owners through the same PublishToGuest, and reclaims a D32 owner once its publication has completed and its sampled views are released.
    • At its head df36ea5802, it conflicts with this PR in PublishToGuest's signature, where this PR adds the cause and #10469 adds its format check, and at the end of PublishToGuest, where #10469 makes a published HTILE D32 owner inactive and this PR returns whether the publication took a guest byte. Keeping both sides resolves them, with #10469's lines before the return (git merge-tree on main 9c0d96916c).
    • With both, a reuse publication of an HTILE D32 owner would also take the guest's undecided bytes. #10469 makes that owner inactive after every publication, so this PR's retirement when the publication took a guest byte adds nothing for it: the check after publication skips the inactive owner, and its guards are removed with the other inactive ones. That combination hasn't been run.
    • #10492 and #10497 (Ondra97), from the same stack on #9950, have the same two conflicts at their heads 66a2da10bc and 7a318d5d26, and keeping both sides resolves them too.
  • #9950 (ebarr24) and #16501 (JJenkx, closed) publish written native multisample D32 owners. Both reword the debt entry's first line, and #16501 adds its cases at the same place in NativeMultisampleDepth.cpp. Keeping both sides resolves them. JJenkx's Resident Evil Village (PPSA01556) run in #16501 stops at the same next check with this PR merged as without it.
  • #16880 (muhmuhkuh) reads single-sample views of native multisample depth from guest memory, and publishes D32 owners with HTILE. Since its rebase onto main bb86118e0f, which has #19846's publication of bare D32 owners, it no longer carries #9950's D32 publication (comment). Merge order: either (its thread). Whichever of the two lands second adds the cause below.
    • At #16880's head bd6552b5e9, which still keeps GuestHoldsSamples() for #17890's PublishedUnderStorage(), the two merge without a textual conflict (git merge-tree, 416bc9ad90 with bd6552b5e9). The merged tree still doesn't build until PublishForGuestRead() passes the cause, as below.
    • Its new PublishForGuestRead() calls PublishToGuest(), which takes a cause with this PR and returns whether it took a guest byte, so that call passes DepthReadCause::Access and drops the result. An Access publication leaves the owner resident, as PublishForGuestRead expects. Without the argument the merged tree doesn't build.
  • #16301 (dantdmdarealguy, merged) publishes over a colour alias its owner took in. It adds its cases at the same place in NativeMultisampleDepth.cpp, rewords this PR's debt entry by one word and adds an entry after it, and retires the colour aliases at the end of PublishToGuest, where this PR now returns whether the publication took a guest byte. Keeping both sides resolves them, with #16301's lines before the return, as the merge of main in 7ce55ad00e does.
  • #16116 (Nesyth, merged) ends each guard removal with publishDepthGuards(removed != 0) in place of the anyDepthGuard() store. Since 091068b618, this PR's guard removal at the end of RequireNoResidentDepthRead_nid_no_patch and #16116 merge clean, as the merge of main in 7ce55ad00e shows.
  • #7256 (gjonn) moves the three RequireNoResidentDepthRead_nid_no_patch calls on a new depth surface's planes, which this PR marks Reuse, into its requireNativePlanesFree, called for each new surface and each layered slice. Merge order: this PR goes first, and #7256 then puts DepthReadCause::Reuse on those three calls in their new place, as this PR's merge did on #14051's moved index-buffer line (proposed in its thread, no objection).
  • #10049 (frankea) closed unmerged on 16 Nov, in favour of #13248 (hugodearaujo, merged), which frankea found already covers the case it was opened for (comment). The RequireNoMultisampleTarget merge order agreed in its thread no longer applies.
  • #15443 and #15446 (edubox, both merged) add cases at the same place in NativeMultisampleDepth.cpp. The merges of main in a3600e57f7 (#15446) and e2ab111fbf (#15443) keep both sides.
  • #15300 (Prophet069, merged) lets releaseRetired free a native multisample surface once it's inactive and no longer host-written. Before it, a retired multisample owner stayed listed. After a reuse publication that took a guest byte the old owner is both, so #15300 frees it; since 091068b618 that is where it is retired. #15301 (Prophet069, merged) changes the sampled depth shadow's allocation in DepthSurface.cpp, away from this PR's hunks. The branch merges clean with both and with #15855, and with main acac7c8541.
  • #15404 (JJenkx, merged) retires displaced single-sample surfaces, while this PR's retirement is for multisample native owners after a reuse publication. It merged with this branch without a conflict.
  • #14969 (JJenkx, merged) keeps guest writes over a stale stencil plane, in DepthSurface.cpp and the AGC debt file. Its stencil baseline runs only for surfaces whose stencil plane can be mirrored, which are single-sample, so this PR's multisample reuse path doesn't reach it. It leaves retireStencil unchanged. It merged with this branch without a conflict.
  • #17890 (hugodearaujo, merged) releases a published multisample owner whose planes lie under pending storage units when a draw that overwrites every sample binds it, and imports a new owner from guest memory. Its PublishedUnderStorage() sits before PublishToGuest's declaration, and the merge of main in 58f6485059 keeps both (see Tested). Its release looks only at active owners, so an owner this PR's reuse publication retired isn't one it meets.
  • #15059 (Sam-mon7, merged) sizes surfaces with SurfaceGuestBytes, including the two storage-image accesses this PR marks Reuse. The merge in 58f6485059 keeps both (see Tested).
  • #20368 (talha-devp, merged) binds small, rarely read draw inputs in place. It adds two arguments to the InPlaceDrawInput call in prepareDrawInputs's vertex range loop, the line after the vertex buffer RequireNoMultisampleTarget call this PR marks Reuse. The two lines conflicted as text, and the merge of main in c71026cc1f keeps both (see Tested): the check still runs before the in-place bind, and #20368 adds no depth read of its own.
  • #22062 (ycbuzi) publishes multisample depth over pages only an import window touched: a page whose protection an import resolved without changing its bytes no longer counts as CPU-stored (StoreUnchangedSinceLastCollect), so its host-changed bytes are published where the read threw before. It changes the same else branch of PublishToGuest's byte loop as this PR, and both rewrite the debt entry, so the two conflict in DepthSurface.cpp and the debt file (git merge-tree, c71026cc1f with #22062's 7a78b2aabd).
    • They compose: #22062 decides whether an undecided byte's page was stored, and this PR decides what a stored one does, taking the guest's byte on a reuse and throwing on other reads. Keeping #22062's loop, with this PR's branch in place of its Require, resolves the code:
      if (!pageUnstored) pageUnstored = GuestMemory::StoreUnchangedSinceLastCollect(address, bytes, plane.range.generation);
      if (*pageUnstored || GuestMemory::StoreUnchangedSinceLastCollect(plane.range.address + offset, 1u, plane.range.generation)) continue;
      Require(cause == DepthReadCause::Reuse, "native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store");
      tookGuest[index] = true;
      result[index][offset] = current[index][offset];
      
      In the debt entry, this PR's "A written page's byte" becomes "A CPU-stored page's byte", and #22062's "one inside an import window is overwritten" follows the list of reads that throw. With both, a reuse over a page only an import window touched publishes the host's bytes, as #22062's reads do, since no CPU store reached it.
    • In a dry merge of the two (bd8f8b7465), agc_driver_native_depth_publication, which runs this PR's reuse cases and #22062's ImportSameValue and ImportThenSameDepth, and agc_write_tracking pass 3 of 3 on GitHub's Linux runner (run); on Windows, agc_write_tracking passes 3 of 3 and the publication test skips (no Vulkan device).
    • Merge order: either. If this PR goes first, #22062 takes the block above when it merges main; if #22062 goes first, this PR's merge of main does.
  • #22647 (Nesyth) commits draws from records resolved on the finisher under APS5_DIRECT_DRAWS. It moves prepareDrawInputs's pixel-kill check into requireUncountedKills(state), on the line after the index buffer RequireNoMultisampleTarget call this PR marks Reuse, so the two conflict in that one hunk of Graphics/src/Draw.cpp (git merge-tree on main 291a878fd2, with #22647's 85c9eed5d1). Keeping both lines resolves it.
    • Its new takePreparedInputs adds index and vertex buffer RequireNoMultisampleTarget calls for the same reads. cause defaults to DepthReadCause::Access, so with both PRs they build, but they would treat a multisample depth owner under those ranges as an access where prepareDrawInputs takes it as a reuse. Whichever of the two lands second also passes DepthReadCause::Reuse on those two calls, so both paths treat the reads alike.
    • Merge order: either, as proposed in #22647's thread.
  • I#15600 (oneandonlydean): #13021's commit-time window applies here unchanged.

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 (the four regressions were reported in discussions #8691, #8671 and #9091). Related: #9533, #9717, #13021, #13023, #15600
  • Unblocks: NINJA GAIDEN: Ragebound (PPSA28002, #8671), Curved Space (PPSA02817, #8691) and New Joe & Mac: Caveman Ninja (PPSA02801, #9091) past the publication refusal, each to the close of a 125 s run (JJenkx's runs above), though New Joe & Mac still stops on it after about 48 s, from an Access read, in xXPBSXx's one Windows run; SAMURAI MAIDEN (PPSA04132, #7265) past the refusal during asset loading, to the menu, the talk-event scenes and 3D gameplay, with the same refusal still at some later loading screens (birdmarty's run above); Arcade Game Zone (PPSA19015, #8562) past the refusal, through a 150 s run to the front end and a mini-game (edubox's run above); Peppa Pig: World Adventures (PPSA09806, #19981) past the refusal, to 44.7 s, where it stops on another refusal (HabibUrRehmanBhattii's run above); Blue Prince (PPSA25009, #9189) not run yet
  • GPUs tested: Mesa llvmpipe (LLVM 20.1.2), Ubuntu 24.04, on a cloud Linux machine and GitHub's Linux runner; GitHub's Windows runner has no Vulkan device; AMD Radeon RX 570 (RADV POLARIS10, GFX8; ryanc2112); NVIDIA GeForce RTX 4070 and AMD Radeon Graphics, RDNA 2 integrated (Windows 11; AlfaRojo); NVIDIA GeForce RTX 5090 (Windows 11; klosixgaming-arch); AMD Radeon RX 6650 XT (RADV; JJenkx's title runs); AMD Radeon RX 6800 (Windows; birdmarty's title run); NVIDIA GeForce RTX 5070 Ti and the Ryzen 7 7700X's integrated AMD Radeon (Windows 11, with the validation layer; Superseabas, at ab7598d803 and d4583e9ccd); NVIDIA GeForce RTX 4080 SUPER (Windows; xXPBSXx's title run); NVIDIA GeForce RTX 4070 Ti (Linux) and GeForce GT 1030 (Windows 11 VM; milescoviello, the default native multisample depth test); NVIDIA GeForce RTX 4090 (Windows 11, with the validation layer; magnub); NVIDIA GeForce RTX 4080 SUPER (Linux; edubox's title run); AMD Radeon RX 6700 XT (Windows; JJenkx's title runs); NVIDIA GeForce RTX 4070 (Windows; HabibUrRehmanBhattii's title run); NVIDIA GeForce RTX 4090 (Arch Linux, driver 620.70.06, with the validation layer; domx4q); NVIDIA GeForce RTX 5080 (driver 610.88) and the Ryzen 7 9800X3D's integrated AMD Radeon (Windows 11 Pro; Lyrnc)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5164703990 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15941). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-11-05T01:51:54Z. --- ### What Since #9533, a multisampled D32S8 target whose stencil has its own plane and whose HTILE is depth-only is imported as a native target. #9533 was merged together with #9717, in `a4b76b2c0a`. **Four titles that ran before that merge stop on `main`.** JJenkx bisected each one to `a4b76b2c0a`: Curved Space (PPSA02817, [#8691](https://github.com/boykopovar/AnyPS5/discussions/8691#discussioncomment-19387701)), NINJA GAIDEN: Ragebound (PPSA28002, [#8671](https://github.com/boykopovar/AnyPS5/discussions/8671#discussioncomment-19387702)), Blue Prince (PPSA25009) and New Joe & Mac: Caveman Ninja (PPSA02801, [#9091](https://github.com/boykopovar/AnyPS5/discussions/9091#discussioncomment-19388925)). On `main` they stop with: ``` AGC graphics: native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store ``` **What reaches the publication.** JJenkx traced it in all four ([#8671](https://github.com/boykopovar/AnyPS5/discussions/8671#discussioncomment-19389607)). Each title reuses the memory of a host-written native target for something new: - **draw input,** in NINJA GAIDEN and Blue Prince; - **a colour target and a storage texture,** in New Joe & Mac; - **another depth target,** in Curved Space. **Why it stops.** Building the new resource publishes the old target's planes to the guest (#13021). - Guest writes are tracked per 4 KiB page. Once the title has stored into a page the host drew, every byte of that page that still holds its snapshot value is undecided, and the publication refuses. - Curved Space and New Joe & Mac also meet a second refusal: `a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented`. **The change:** - **A cause on each depth read.** It's `DepthReadCause::Access`, the default, or `DepthReadCause::Reuse`. - **`Reuse` marks resources built over the memory:** `Draw.cpp`'s vertex and index buffer reads; the two storage-image accesses in `ShaderResources.cpp`, which also cover the colour-target lookup from `refreshResidentTarget`; and a new depth surface's three planes. - **Everything else stays `Access`:** CPU reads, DMA copies, texture reads, shader buffer accesses, dispatch-written ranges and the native sampling path. - **The undecided bytes.** Where `main` refuses an undecided byte, a `Reuse` publication takes the guest's byte. Every byte the publication can decide is decided as before: - the host's bytes on pages the guest didn't write; - the guest's bytes where it changed them; - bytes covered by driver stores, as recorded. - **Retiring the old owner.** A `Reuse` publication that took a guest byte, undecided or stored, retires the old owner: its guards are removed and it is marked inactive. The publication leaves it no longer host-written, so `releaseRetired` retires and frees it at the next depth-surface creation (#15300). - A later bind of its identity imports afresh. - A new depth attachment over its planes no longer meets the second refusal. - A `Reuse` publication that took no guest byte keeps the owner, as an `Access` publication does. A new depth attachment of another identity over a kept owner still meets the second refusal, as on `main`. - **The AGC debt entry** for the publication now says which accesses take the guest's undecided bytes, that those bytes are inferred, and that only a reuse that took a guest byte retires the owner. **Why the guest's byte.** Before #9533 these targets were not native, so a resource built over their memory read the guest's bytes everywhere. - This change takes the guest's byte only for the bytes the publication can't decide, and only when the memory is reused. - So it is never further from the pre-#9533 result than `main` is, since `main` stops. It keeps the host's bytes everywhere the publication can decide them. - JJenkx's experiment at that check ([#8671](https://github.com/boykopovar/AnyPS5/discussions/8671#discussioncomment-19389732)): Blue Prince renders its intro only with the guest's byte, and with the host's its screenshots are black. NINJA GAIDEN runs either way. **What isn't proven.** The untouched bytes on a page the title wrote are inferred, not proven. The write tracking can't tell a byte the title never touched from one it stored with the same value. - Exact store ranges for guarded planes would decide them. That's the exact follow-up, and it's out of scope here. - CPU reads and DMA copies keep refusing. ### Tested **Linux, on a cloud machine:** Ubuntu 24.04, GCC 13.3, CI's configure flags, lavapipe (Mesa 25.2.8, LLVM 20.1.2). The tests ran as an unprivileged user with `ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx`. **New cases** in `agc_driver_native_depth_publication` (`CheckReusePublication`): - **The fixture:** a 4-sample D32S8 target with a separate stencil plane and a depth-only HTILE. The host draws depth and stencil, then one CPU store leaves the rest of the stencil plane's first page undecided. - **Red on `main` `acf7ac208a`, green here.** On `main` all four fail with the refusal above. - (0) a vertex buffer read over the page, and (1) an index buffer read; - (2) a storage-image lookup, the colour-target path; - (3) a new depth target of another identity over the planes. The checks: the guest's bytes on the undecided page, the host's bytes elsewhere in the plane, every depth sample, and the old owner retired. A rebind of its identity takes a fresh import. In (3) the new surface imports. - **The same on both:** - (4) a CPU read and (5) a DMA copy still refuse, and keep the owner and the guest's bytes; - (6) a rebind of the same identity publishes nothing; - (7) a shader buffer access and (8) a texture read, with nothing undecided, publish the host's bytes, keep the owner and retire nothing. - **For the review (9452ca6e35):** (9) a vertex buffer read marked `Reuse`, with nothing undecided and no guest store, publishes the host's bytes and keeps the owner: a rebind keeps its view and serial, and a sampled read samples it. It fails on 091068b618's code (below). **The existing tests,** 49 in all: the native depth, write-tracking, guest memory and multisample tests (`ctest -R 'native_depth|native_multisample|depth_publication|write_track|guest_memory|multisample' --repeat until-fail:3`). - On `main` and here: 47 pass and 2 skip, ×3. The skips are `agc_driver_multisample_centered_lines` and `agc_driver_native_depth_bda_clear`, which skip themselves on lavapipe. - No existing test was changed. **Mutations:** - Making every publication `Reuse` fails (4)-(8). - Dropping the retirement fails (0)-(3). (3) then stops at the second refusal. - On d4583e9ccd, with `Reuse` never retiring (`replaced` forced to false), `agc_driver_native_depth_publication` fails on GitHub's Linux runner with `guest writes over native multisample depth are not implemented` ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42512087597)). **Checks:** `tools/check_test_registration.py build` and `tools/check_conventions.py --base origin/main` pass. **The red/green is from the cloud run** (lavapipe, CI flags). The GitHub ×10 runs the branch only, because `main` lacks `DepthReadCause`. Case (9)'s red and green are on GitHub's runners, against 091068b618 (below). **On today's `main`:** the four commits were rebased onto `9ab6a281ea` with the same lines. GitHub's runners, ×10 on that tree ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41888480459)), the same tests: on Linux, 52 tests, 50 pass and 2 skip; on Windows, 53 tests, 8 pass and 45 skip. The libc and libkernel suites pass on both. **With #15300, #15301 and #15855:** the branch merged with `main` `9f35c937da` and #15855 (since merged), the same tests, ×10 on GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41904100032)): on Linux, 52 tests, 50 pass and 2 skip; on Windows, 53 tests, 8 pass and 45 skip. The libc and libkernel suites pass on both. **Merged with `main` `0747011f67`, as `a3600e57f7`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42347215789)). The one conflict was in `NativeMultisampleDepth.cpp`, where #15446 (merged) adds `CheckStoredRepeatFill` at the place this PR adds `CheckReusePublication`. The merge keeps both, #15446's first, and this PR's own lines are unchanged. The same tests, ×10 on GitHub's runners: on Linux, 53 tests, 51 pass and 2 skip, with `agc_driver_native_depth_publication` and #15446's new `agc_driver_native_depth_stored_repeat_fill` among the passes; on Windows, 54 tests, 8 pass and 46 skip. The libc and libkernel suites pass on both. - The rebase onto `9ab6a281ea` above, and the runs that say "this head", are on `7d377e40ba`, the head before these merges. Their results still apply, since `a3600e57f7` and `ab7598d803` add only `main` to it, with the conflicts resolved as described. **Merged with `main` `9e47f0c3ac`, as `ab7598d803`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42424074905)). The one conflict was in `Draw.cpp`, where #14051 (merged) moved `prepareDraw`'s index-buffer `RequireNoMultisampleTarget` check into the record-time stage. The merge takes #14051's move and puts this PR's `DepthReadCause::Reuse` on the moved line. This PR's other lines are unchanged. That `main` also has #14084 (merged), which changes `DepthSurface.cpp` and `NativeMultisampleDepth.cpp` and merged without a conflict. - **The same tests, ×10 on GitHub's runners:** on Linux, 55 tests, 53 pass and 2 skip, with #14084's `agc_driver_native_depth_initial_owner` among the passes; on Windows, 56 tests, 9 pass and 47 skip. The libc and libkernel suites pass on both. - **Every `agc` test, once, on both runners** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42424093333)), since the merge moved one of this PR's lines. On Windows, 1,456 tests: 426 pass and 1,030 skip. On Linux, 1,417 tests: 1,328 pass, 88 skip and 1 fails, `agc_driver_pipeline_journal`, at the 120 s timeout (120.06 s). - Run alone three times with a 300 s timeout ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42431788278)), the journal test passed 3 of 3 on Linux, in 81.30, 7.86 and 7.84 s. It skips on Windows. - It also hit the 120 s timeout on `main`'s own tree on 11-06 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42227849737)). **Merged with `main` `dd7c8de5de`, as `e2ab111fbf`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42510534106)). The one conflict was in `NativeMultisampleDepth.cpp`, where `main` (#15443 and #15750) adds a blank line at the place this PR adds `CheckReusePublication`. The merge keeps this PR's lines, which are unchanged. The same tests, ×10 on GitHub's runners: on Linux, 57 tests, 55 pass and 2 skip; on Windows, 58 tests, 9 pass and 49 skip. The libc and libkernel suites pass on both. **For oneandonlydean's and Superseabas's review** ([review](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6725474155), [Superseabas's run](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6725133794)), three commits on that merge: - **091068b618** drops the pass that retired a reused owner at once. The guard loop already marks it inactive and the publication leaves it no longer host-written, so `releaseRetired` retires and frees it at the next depth-surface creation. Every owner lookup checks `active`, and a native multisampled owner has no stale planes for `retire` to clear: `MarkAllStale` runs only for `mirrorable` targets, which have one sample. Alone, ×3 on GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42512074965)), the 21 `native_depth` tests: on Linux, 20 pass and 1 skips (`agc_driver_native_depth_bda_clear`); on Windows, all 21 skip. - **9452ca6e35** retires an owner on `Reuse` only when its publication took a guest byte, undecided or stored: `PublishToGuest` returns whether it did, and `RequireNoResidentDepthRead_nid_no_patch` marks only those owners inactive. It adds case (9). - **d4583e9ccd** says so in the debt entry. - **Red and green, ×10 on GitHub's runners** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42512062900)), the tests matching `native_depth|write_track|guest_memory|multisample` with `agc_driver_graphics`: with 091068b618's implementation, `agc_driver_native_depth_publication` fails on Linux at case (9), with `a depth read of a host-written native owner retired or re-imported it`. With the fix, on Linux, 58 tests, 56 pass and 2 skip; on Windows, 59 tests, 10 pass and 49 skip, since the runner has no Vulkan device. The libc and libkernel suites pass on both. **Merged with `main` `356bf9296b`, as `05cb62a9a6`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42802459190)). The conflicts were two, both in `DepthSurface.cpp`, with #16363 (merged): it adds `ProveOverwrite()` before `PublishToGuest`'s declaration, and `proveOverwrittenPlanes()` with a first line in `RequireNoResidentDepthRead_nid_no_patch`. The merge keeps both, with this PR's signatures, and this PR's own lines are unchanged. - **The same tests, with #16363's `agc_driver_native_depth_overwritten_planes`, ×10 on GitHub's runners:** on Linux, 62 tests, 60 pass and 2 skip; on Windows, 65 tests, 12 pass and 53 skip. The suites: libc and libkernel run 350 and 349 tests on Linux with 0 failed, and 380 and 376 on Windows, where only the verify harness's `guest_kernel_resident_fmem_export` and `guest_kernel_resident_fmem_export_patched` fail. - **Red on this `main`:** each of cases (0) to (3) alone, with `main` `356bf9296b`'s implementation and this PR's test (its three `DepthReadCause::Reuse` arguments dropped, since `main`'s call sites pass none), fails `agc_driver_native_depth_publication` on GitHub's Linux runner with the refusal above ([0](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42823235340), [1](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42823324080), [2](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42823402918), [3](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42823480370)). The Windows runner skips it. The green is the ×10 above. - **Every `agc` test, once, on both runners** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42802547315)). On Windows, 1,568 tests: 473 pass and 1,095 skip. On Linux, 1,525 tests: 1,431 pass, 93 skip and 1 fails, `agc_driver_frame_replay_rewind_copy`, with `no memory delta was read while 1 submissions waited for the CPU`. It is intermittent on `main` too. Repeating the frame-replay tests until a failure, up to 20 times, on GitHub's Linux runner, it failed with the same line on the 3rd run on this merge ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42818739817)) and on the 4th on an unchanged copy of `main` `356bf9296b` ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42818864785)). The other 40 frame-replay tests passed every run on both, and this PR doesn't touch frame replay. **Merged with `main` `eb3839d4f3`, as `84d53ab953`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42865001207)). The conflicts were two. In `DepthSurface.cpp`, #16365 (merged) adds `GuestHoldsSamples()` before `PublishToGuest`'s declaration, and the merge keeps it with this PR's `bool PublishToGuest(DepthReadCause cause)`. In the debt file, #16364 (merged) changes the publication entry's "pending storage-image writes" to "pending storage-image units over a plane". The merge keeps this PR's entry, with its "a kept plane holding the host's bytes" shortened to "a kept plane of host bytes", but writes #16364's change as "pending storage writes over a plane". oneandonlydean's docs commit `392f9f30d4`, on top of the merge, restores `main`'s "pending storage-image units over a plane" in the entry. This PR's own code and test lines are unchanged. #16375 (merged) also changes `DepthSurface.cpp` and merges clean, and `main` adds no call to `PublishToGuest` or `RequireNoResidentDepthRead_nid_no_patch`. - **The same tests, with #16365's `agc_driver_native_depth_single_sample_view`, #16364's `agc_driver_native_depth_pending_units` and #16375's `agc_driver_raw_pointer_store_pending_inline` and `agc_driver_raw_pointer_store_pending_items`, ×10 on GitHub's runners:** on Linux, 66 tests, 64 pass and 2 skip; on Windows, 69 tests, 12 pass and 57 skip. The suites: libc and libkernel run 351 and 349 tests on Linux with 0 failed, and 381 and 376 on Windows, where only the verify harness's `guest_kernel_resident_fmem_export` and `guest_kernel_resident_fmem_export_patched` fail. **Merged with `main` `78ad708701`, as `7ce55ad00e`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42917443839)). The conflicts were three, all with #16301 (merged), which publishes over a colour alias its owner took in and retires that alias after the planes commit. In `DepthSurface.cpp`, the merge keeps #16301's two `RetireMultisampleColorTarget` calls at the end of `PublishToGuest`, before this PR's `return` of whether the publication took a guest byte. In `NativeMultisampleDepth.cpp`, it keeps #16301's alias cases and this PR's reuse cases. In the debt file, this PR's publication entry takes #16301's one-word change ("other resident colour aliases") and keeps oneandonlydean's "units" fix from `392f9f30d4`, and #16301's new entry follows it unchanged. This PR's own code and test lines are unchanged. #16301's cases publish through CPU reads, whose cause stays `Access`, so this PR doesn't change what they check. #16116 (merged) also changes `DepthSurface.cpp` and merges clean. - **The same tests, ×10 on GitHub's runners, with #16301's new cases, which run inside `agc_driver_native_depth_publication`:** on Linux, 66 tests, 64 pass and 2 skip (`agc_driver_multisample_centered_lines` and `agc_driver_native_depth_bda_clear`, as before); on Windows, 69 tests, 12 pass and 57 skip. The suites: libc and libkernel run 354 and 349 tests on Linux with 0 failed, and 384 and 376 on Windows, where only the verify harness's `guest_kernel_resident_fmem_export` and `guest_kernel_resident_fmem_export_patched` fail. - **Every `agc` test, once** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42922250020)): Linux: 1,531 run, 1,438 pass, 93 skip, 0 fail. Windows: 1,574 run, 474 pass, 1,100 skip, 0 fail. **Merged with `main` `0f4538fa02`, as `58f6485059`** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/43599896869)). The conflicts were three. In `DepthSurface.cpp`, hugodearaujo's #17890 (merged) adds `PublishedUnderStorage()` before `PublishToGuest`'s declaration, and the merge keeps it with this PR's `bool PublishToGuest(DepthReadCause cause)`. In `ShaderResources.cpp`, Sam-mon7's #15059 (merged) sizes the two storage-image accesses with `SurfaceGuestBytes(viewed)` in place of `DescribeSurface(viewed).guestBytes`, and the merge keeps that line, with this PR's `DepthReadCause::Reuse` argument on the line after it. This PR's own lines are unchanged. - **The same tests, with #17890's `agc_driver_native_depth_overwritten_published` and the `agc_shader_memory` tests, ×10 on GitHub's runners:** on Linux, 70 tests, 68 pass and 2 skip; on Windows, 76 tests, 18 pass and 58 skip (no Vulkan device). #17890's new case calls `RequireNoMultisampleTarget` without a cause, so it takes this PR's default `Access`. - **The suites:** libc and libkernel run 381 and 377 tests on Linux and 411 and 405 on Windows, with 0 failed in the rerun of both jobs ([attempt 2](https://github.com/EagleBearerYS/AnyPS5/actions/runs/43599896869/attempts/2)). In the first attempt ([attempt 1](https://github.com/EagleBearerYS/AnyPS5/actions/runs/43599896869/attempts/1)), libkernel's `guest_freebsd_clocks` aborted on Linux after 0.10 s, and `guest_timed_wait_cpu` exceeded its overshoot limits on Windows (`sceKernelUsleep(100 us)`'s P99 overshoot at 6,880, 5,211 and 4,399 µs, against a limit of 2,900 µs). This PR changes no libkernel file. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes only `precise_wait`'s median bounds on GitHub's hosted runners. - **The Windows tree** had Sankalp7317's 4-line `_putenv_s` test fix ([#19899](https://github.com/boykopovar/AnyPS5/pull/19899)) on top, because `main`'s Windows test build breaks without it ("'setenv' was not declared" in `UploadCacheReadOnlyFlush.cpp`, from #18037); it isn't on this branch. - **GitHub's Windows check on `58f6485059`** ([job](https://github.com/boykopovar/AnyPS5/actions/runs/43612400850/job/132500315018)) has one failure among 4,581 tests: `agc_graphics_profile_draw`, at 30.17 s, on `DepthSurfaceReuse.cpp:743`'s Require ("a partially resident depth plane with an unmapped page must be refused"), on an AMD EPYC 7763 host. That is the red `main`'s Windows job has had since 14 Nov (for example [job 132502166258](https://github.com/boykopovar/AnyPS5/actions/runs/43612729960/job/132502166258) on `main` `3e63c9f68f`, also an EPYC 7763, where `agc_driver_graphics` fails on the same Require). oneandonlydean's #20134, merged as `06b90cc1af`, invalidates the guest page cache in those depth fixtures for it. This PR doesn't change `DepthSurfaceReuse.cpp`. **Merged with `main` `769d303b59`, as `416bc9ad90`** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/43817801627)). The one conflict was in the debt file's publication entry, where arthur-paraibano's #19846 (merged) changes "D16/D32-only owners" to "D16 and HTILE D32 owners". The merge keeps this PR's entry with #19846's change. This PR's own code and test lines are unchanged. - **The same tests, ×10 on GitHub's runners:** on Linux, 72 tests, 70 pass and 2 skip (`agc_driver_multisample_centered_lines` and `agc_driver_native_depth_bda_clear`), with `agc_driver_native_depth_publication`, which runs this PR's reuse cases, passing 10 of 10; on Windows, 78 tests, 18 pass and 60 skip (no Vulkan device). - **The suites:** libc and libkernel run 391 and 390 tests on Linux and 421 and 417 on Windows. On Windows, 0 failed. On Linux, libkernel's `guest_thermal_sensors` reached its 20 s timeout. This PR changes no libkernel file, and the same test passed in the suites of #7395's merge with `main` `328cbf673e` ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/43816248082)), whose thermal sensor code is the same as `769d303b59`'s. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes only `precise_wait`'s median bounds on GitHub's hosted runners. - **The Windows tree** again had #19899's `_putenv_s` test fix on top; it isn't on this branch. **Merged with `main` `bb95654123`, as `c71026cc1f`** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/44010904784)). The one conflict was in `prepareDrawInputs`'s vertex range loop in `Draw.cpp`, where talha-devp's #20368 (merged) adds two arguments to the `InPlaceDrawInput` call on the line after this PR's `RequireNoMultisampleTarget(begin, bytes, "a vertex buffer read", DepthReadCause::Reuse)`. The merge keeps both lines as each side has them: this PR's check, then #20368's call. This PR's own code and test lines are unchanged. - **The same tests, with #20368's `agc_draw_input` tests, ×10 on GitHub's runners:** on Linux, 78 tests, 73 pass and 5 skip (`agc_driver_multisample_centered_lines` and `agc_driver_native_depth_bda_clear`, and `agc_draw_input_mirrors`, `agc_draw_input_mirrors_off` and `agc_draw_input_reuse`, which skip without `/dev/udmabuf`), with `agc_driver_native_depth_publication` and #20368's changed `agc_draw_inputs_copied` and `agc_draw_inputs_in_place_driver` passing 10 of 10; on Windows, 84 tests, 19 pass and 65 skip (no Vulkan device). - **The suites:** libc and libkernel run 396 and 397 tests on Linux and 425 and 422 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes only `precise_wait`'s median bounds on GitHub's hosted runners. - **The Windows tree** again had #19899's `_putenv_s` test fix on top; it isn't on this branch. **Windows with the validation layer, run by Superseabas** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6725133794)): `ab7598d803` merged onto `main` `ef9ab2ea44` (clean), WinLibs GCC 16.2.0, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, on an NVIDIA GeForce RTX 5070 Ti (driver 621.01) and the Ryzen 7 7700X's integrated AMD Radeon (driver 26.10.2). The full `^agc` suite, 1,474 tests, gives 1,473 passes on each GPU with and without this PR; the one failure on each is the same on `main` (`agc_driver_quad_pixel_mask` on the RTX, #14341, and `agc_driver_sample_order_grid_reference` on the Radeon, #9503). No `VUID-` lines. `agc_driver_native_depth_publication` passes on both GPUs. **The same machines on `d4583e9ccd`, run by Superseabas, who approved** ([review](https://github.com/boykopovar/AnyPS5/pull/15941#pullrequestreview-5830220933)): merged onto `main` `6541a1f0fc` (clean), with the same setup and GPUs, since GitHub's Windows runner skips these tests. - **The full `^agc` suite,** 1,527 tests: 1,526 pass on each GPU with and without this PR. The one failure on each is the same as above, and there are no `VUID-` or missing-layer lines. - **The native depth tests:** `agc_driver_native_depth_publication` passes 3 of 3 on each GPU, and the 24 `agc_driver_native_depth_` tests pass on both, with `_driver_queued_fill` skipping. - **`DecidedVertexRead`,** a `Reuse` read with nothing undecided, keeps the owner on both GPUs: the rebind returns the same view with no new surface, and sampling works. - **Mutations,** one run per GPU, the same on both: the previous head's rule, where `Reuse` retires every ever-written owner, fails `DecidedVertexRead`; with `Reuse` never retiring, the test fails with `guest writes over native multisample depth are not implemented`. - **Not run:** any title. **`7ce55ad00e` on Linux and Windows, run by milescoviello** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6786270550)): `agc_driver_native_multisample_depth`, the fixture's default mode, passed 3 of 3 on this head and on its merge base `78ad708701`, on Linux (Ubuntu 26.04.1, NVIDIA GeForce RTX 4070 Ti, driver 615.71.09, GCC 15.2, Release) and on a Windows 11 VM (NVIDIA GeForce GT 1030, driver 582.78, WinLibs GCC 15.2 UCRT, Release). That mode doesn't run the publication cases, so this PR's reuse cases aren't among them. **Windows with the validation layer, run by magnub** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6858108148)): `7ce55ad00e` merged into `main` `c7ac238e7c` as CI merges it (`98585ec586`), against that `main`, with `tools/vulkan_validation_gate.py`, on an NVIDIA GeForce RTX 4090 (driver 621.14), Windows 11 Home 26100, WinLibs GCC 15.2.0 r7, Release, `VK_LAYER_KHRONOS_validation` 1.4.363. - **The 25 `agc_driver_native_depth_*` tests** of `agc_driver_native_multisample_depth_tests`, `agc_driver_native_depth_publication`'s reuse cases included, 3 runs per build: all 150 runs pass, the loader inserts the layer in every run, and neither side has a `VUID-`, `SYNC-HAZARD` or `UNASSIGNED-` message. - `agc_driver_native_depth_driver_queued_fill` is left out, since it skips on Windows. **Linux with the validation layer, run by domx4q** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6951971043)): this head `c71026cc1f` merged onto `main` `f0c01bc69d` (clean), against that `main`, on an NVIDIA GeForce RTX 4090 (driver 620.70.06, Vulkan 1.4.357), Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` 1.4.363.1, with the tests matching `native_depth|native_multisample|depth_publication|write_track|guest_memory|multisample`. - **67 tests on each side:** all 67 pass on `main` and with this PR, none skips, and every test selected the RTX 4090. `agc_driver_native_depth_publication`, which runs this PR's reuse cases, passes, as do `agc_driver_native_depth_publication_without_htile` and `agc_driver_native_multisample_depth`. - **The layer:** the loader inserted it 92 times on each side, no run reports it missing, and neither side has a `VUID-` line. Apart from addresses, the two logs print the same lines. **Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 5080 (driver 610.88) and the Ryzen 7 9800X3D's integrated AMD Radeon Graphics (driver 2026.04.17), run by Lyrnc** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6985935805)): this head `c71026cc1f` merged onto `main` `6286d36449` (clean), WinLibs GCC 15.2.0, Ninja, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, the GPU picked with `ANYPS5_GPU`, no validation layer. - **The 31 tests matching `native_depth|native_multisample_depth`,** `agc_driver_native_depth_publication` among them: 31 of 31 pass in each of 3 runs on each GPU. - **`^agc_|^shader|^video_out|^guest_video` on the RTX 5080,** 2,081 tests: 2 fail, and they report both failing on `main` on that card too: `agc_driver_stencil_plane_memory` (#22427, with #22508 open for it) and `agc_driver_msaa_dcc_unwatch` (#22931, with #22950 open for it). - **Not run:** a title, the validation layer. **GitHub's Linux and Windows runners, ×10, on `acf7ac208a`** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41785419912)). The tests matching `native_depth|write_track|guest_memory|multisample`: - **Linux:** 49 tests, 47 pass and 2 skip, ×10. The skips are the same two lavapipe ones. `agc_driver_native_depth_publication` passed 10 of 10. - **Windows:** 50 tests, 8 pass and 42 skip, ×10. - The runner has no Vulkan device, so the AGC driver tests skip themselves, the new cases included. - The five `agc_write_tracking` tests and three `guest_memory` tests run and pass. - **Both:** the libc and libkernel suites pass. **Validation layers** (CONTRIBUTING's AGC rule; [run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41785538812)). `VK_LAYER_KHRONOS_validation` ran on GitHub's Linux runner, with `main`'s tree and this branch each running the 35 tests matching `native_depth|multisample`. - Each had 33 passes and 2 skips. The layer loaded in both. - The only VUID is `VUID-VkDeviceCreateInfo-pNext-pNext`, on `main` and here. This change adds none. - llvmpipe (LLVM 20.1.2), Mesa 25.2.8, Ubuntu 24.04.5. **The titles, run by JJenkx** on this head merged onto `main` `c4469b60da`: Linux 7.2.11, AMD Radeon RX 6650 XT (RADV, Mesa 26.2.6), Release, `APS5_PLAYGO_UNLISTED_CHUNKS=installed`, 125 s with Cross every 15 s from 30 s. On that `main` each title stops with the refusal above. With this PR each one gets past it and runs to the scheduled close, exit 0: - **NINJA GAIDEN: Ragebound (PPSA28002)** ([#8671](https://github.com/boykopovar/AnyPS5/discussions/8671#discussioncomment-19426559)): stops at 50 s on `main`. Here it runs 122 s, and the story intro plays at 60 s. - **Curved Space (PPSA02817)** ([#8691](https://github.com/boykopovar/AnyPS5/discussions/8691#discussioncomment-19426558)): stops at 18 s on `main`. Here it runs 121 s, and the "Keep Going?" campaign screen is rendered at 60 s. - **New Joe & Mac: Caveman Ninja (PPSA02801)** ([#9091](https://github.com/boykopovar/AnyPS5/discussions/9091#discussioncomment-19426561)): stops at 8 s on `main`. Here it runs 123 s, and at 60 s the "Classic Modes" menu, opened with Cross, is shown. **AMD Radeon RX 570 (RADV POLARIS10, GFX8), run by ryanc2112** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6656630311)): this head merged onto `main` `7ad9749ed0`, Mesa 26.2.5, Release, with `VK_LAYER_KHRONOS_validation`. - **The 17 `agc_driver_native_depth_*` tests, 3 runs each:** on GFX8, 11 of them fail on `main`, `agc_driver_native_depth_publication` among them, because the sample shadow lacks depth-attachment usage; #15750 fixes that. This PR alone gives the same 6 passes and 11 failures as `main`. With #15750, all 17 pass on `main`, and with this PR added all 17 still pass, the new `CheckReusePublication` cases included. None of these runs reports a `VUID-` error. - **The AGC, shader, VideoOut and Vulkan tests, this PR on `main`, once each:** the same results as `main`, with 1,313 passing, the same 14 failing and 40 skipped, and the same 26 `pAttachments-00605` validation errors on both sides (#11990). The 14 failures are known GFX8 or driver issues: the 11 above (#15750), `agc_driver_f32_fma_denormal_mode2` (#15316), `agc_driver_tessellation` (#5444) and `agc_driver_sample_order_recipe_depth_locations` (#9759). **The same GPU on `d4583e9ccd`, run by ryanc2112** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6737872950)): merged onto `main` `0dd2fffe35` (clean), which has #15750 and #15688's two- and three-plane D32S8 layout, SteamOS 3.8.28, GCC 16.2.1, Release, with `VK_LAYER_KHRONOS_validation` loaded. - **The 23 `agc_driver_native_depth_*` tests, 3 runs each:** 23 of 23 pass on `main` and with this PR, the reuse cases included, with no `VUID-` errors. - **The 1,499 AGC, shader, VideoOut and Vulkan tests, once each:** the same 3 failures and 43 skips as `main`, with no `VUID-` errors. The failures are known: `agc_driver_f32_fma_denormal_mode2` (#15316), `agc_driver_tessellation` (#5444) and `agc_driver_sample_order_recipe_depth_locations` (#9759). **Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 4070 (driver 32.0.16.1692) and AMD Radeon Graphics `1002:13c0` (RDNA 2 integrated, driver 32.0.21043.5001), run by AlfaRojo** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6676632187)): this head merged onto `main` `3cb1cd29ec` (clean), WinLibs GCC 15.2.0 r7 UCRT, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, no validation layer. - **On each GPU:** `agc_driver_native_depth_publication` passed 3 of 3. Of the 18 tests matching `native_depth|native_multisample`, 17 pass and 1 skips. The skip is `CheckDepthTarget`'s HTILE write-coverage assertion, which `main` also skips on these GPUs. - There is no red run here, since the new cases need this PR's `DepthReadCause` to build. **Windows 11 (build 26200), NVIDIA GeForce RTX 5090 (driver 617.42), run by klosixgaming-arch** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6702957895)): this head merged onto `main` `e88dbd3af7` with #9947 (2a234fd995), which SAMURAI MAIDEN needs to get past a long-path stop 8 s in and which only touches file paths. Both titles were reconverted with this tree's relinker. Each run is 110 s from boot, with no input. - **SAMURAI MAIDEN (PPSA04132, 01.060.000):** without this PR (1 run on 2a234fd995), it stops about 28 s in on `native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store`. Here, 1 run has no error for the full 110 s. The stop came at the same point in every run before, so they read one clean run as a clear change. - **Eternights (PPSA08270, 01.004.000),** with `APS5_PLAYGO_UNLISTED_CHUNKS=absent`: 1 of 4 runs on `main` `1c8c0efc8c` stopped about 40 s in with the same message, from a compute shader ([details](https://github.com/boykopovar/AnyPS5/discussions/6575)). Here, 4 of 4 runs have no error for the full 110 s. They call this weaker evidence, since the stop showed up in 1 of 4 runs, on an older `main`. - **Tests:** the `agc_driver_native_*` tests in the `agc_driver_native_multisample_depth_tests` target pass (16 passed, `agc_driver_native_depth_driver_queued_fill` skipped). Three other `agc_driver_native_*` tests weren't rebuilt in their build, so those results don't count. - **Not checked:** gameplay past the title screens, and whether the bytes taken from the guest are the right ones. **SAMURAI MAIDEN (PPSA04132), further, run by birdmarty** on this head `7d377e40ba` ([#7265](https://github.com/boykopovar/AnyPS5/discussions/7265#discussioncomment-19461852)): Windows, Intel Core i9-9900K, AMD Radeon RX 6800. - **On `main` `56374036ad`** ([#7265](https://github.com/boykopovar/AnyPS5/discussions/7265#discussioncomment-19451610)), it stops during Unity's asset loading on the refusal above. - **Here** it gets past the asset loading to the main menu, and plays the visual-novel talk-event scenes and the 3D gameplay. Their screenshots show both. - **Still there:** at some later loading screens, between talk events, the same refusal fires from a compute shader (`compute shader 0x233579900: AGC graphics: native multisample depth publication cannot distinguish ...`). At the same transitions they also see `AGC graphics: guest writes over native multisample depth are not implemented`. Across their runs, a loading screen gives either line or passes. A `Reuse` publication takes the guest's undecided bytes instead of refusing, so these refusals come from reads this PR leaves as `Access`. - **The furthest stop is a different one, not this PR's refusal:** in the first combat, as a tutorial popup appears, an access violation on the title's `CRI Server Manager` thread (`app.exe+0xc96561`, a read of address 0). **New Joe & Mac: Caveman Ninja (PPSA02801) on Windows, run by xXPBSXx** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6755679439)): `d4583e9ccd` merged into `main` `697b66b1e4a`, an NVIDIA GeForce RTX 4080 SUPER, one run. - **It still stops,** after about 48 s, on `native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store`. The second refusal didn't appear. - **Where it comes from:** with this PR, that refusal is raised only for a read this PR leaves as `Access` (CPU reads, DMA copies, texture reads, shader buffer accesses, dispatch-written ranges and the native sampling path), so on that machine the title reads the old target's memory in one of those ways. The log line doesn't say which. - **Not run:** `main` on that machine, so whether it stops at the same point there isn't known. **Asterix & Obelix Slap Them All! (PPSA08576) on Windows, run by JJenkx** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6758424213), [correction](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6758625146)): `d4583e9ccd` merged onto `main` `017bd95f5f`, an AMD Radeon RX 6700 XT, one 240 s run per build, only `core/libs/libs` swapped. - **It stops on the same refusal with and without this PR:** at 13.9 s on `main` and 19.8 s here. A later run with #17956's libraries stopped at 13.4 s, so JJenkx reads these differences as run-to-run variance, not progress. - **Where it comes from:** their later diagnostic run names a texture read with `DepthReadCause::Access`, one of the reads this PR leaves as `Access`. **Arcade Game Zone (PPSA19015) on Linux, run by edubox** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6795191989), full report in [#8562](https://github.com/boykopovar/AnyPS5/discussions/8562)): `main` `71ce478956` with #17863, #18037 and #18319, with and without `7ce55ad00e`, an NVIDIA GeForce RTX 4080 SUPER (driver 620.70.06), CachyOS, GCC 16.2.1, Release. - **Without this PR** it stops at about 50 s on the refusal above, then a `[gpu] driver failure` and an abort. - **Here** a 150 s run has no driver failure and reaches the front end and a mini-game, at 54.1 FPS on average over 8,095 frames. **Spirit of the North: Enhanced Edition (PPSA02306) on Windows, run by JJenkx** ([comment](https://github.com/boykopovar/AnyPS5/pull/15941#issuecomment-6802596472)): `main` `5bc74bb293` and `7ce55ad00e` merged onto it (`82fab69fa8`), an AMD Radeon RX 6700 XT, 3 runs per build, alternated, with only the libraries differing. - **This PR doesn't change its stop:** with each build, 2 of 3 runs stop at about 298 s on `guest writes over native multisample depth are not implemented` (#18281), and 1 reaches the 330 s cap. - The title doesn't hit the refusal this PR changes. **Peppa Pig: World Adventures (PPSA09806) on Windows, run by HabibUrRehmanBhattii** ([#19981](https://github.com/boykopovar/AnyPS5/discussions/19981#discussioncomment-19624867)): this head, `58f6485059`, an NVIDIA GeForce RTX 4070, one run. - **On `main` `3f6cc968ba`** ([report](https://github.com/boykopovar/AnyPS5/discussions/19981)), on a tree with local AGC and shader edits they describe as unrelated, it stopped at 30.8 s on the refusal above, and an earlier run stopped on `initial multisample color contents overlap resident native depth`. - **Here** the refusal above doesn't stop it. It runs to 44.7 s (272 presents) and stops on `initial multisample color contents overlap resident native depth`, the refusal of a multisampled colour target's initial import that hugodearaujo's #17956 changes. - The log doesn't say which read reached the publication. **Pending:** Blue Prince (PPSA25009, [#9189](https://github.com/boykopovar/AnyPS5/discussions/9189)) hasn't been run on this branch yet. It's the title whose intro renders only with the guest's byte (above), so a run of it would check the byte this PR takes. ### Overlap - **#13021** (JAB-dev, merged) is the publication this extends. Its structure and its refusals for plain reads are unchanged. - **#13023** (JAB-dev, merged) had adjacent edits in `DepthSurface.hpp`, `DepthSurface.cpp` (`prepareDepthSampling`) and `NativeMultisampleDepth.cpp`, and merged with this branch without a conflict. - With #13023, a store during the import no longer counts as written, so fewer bytes are undecided. This PR's rule is unchanged. - **#15688, #15690 and #15707** (hugodearaujo, all merged) are a stack for D32S8 owners without HTILE, from Assassin's Creed Mirage (PPSA13960). This PR's targets have a depth-only HTILE, but its rule is in the publication they share, so it reaches their owners too. This PR's tests don't cover an owner without HTILE. - **#15688** publishes a written two-plane owner to its guest planes. The two compose: its publication fills the planes, and this PR changes what a reuse publication does with undecided bytes and what happens to the owner afterwards. - **#15690** attaches a smaller extent with the same Z_X layout to its owner. That bind then creates no new depth surface, so this PR's reuse publication doesn't run for it. This PR still applies to the binds of another identity that #15690 keeps refusing, such as a larger extent, another layout or an owner with HTILE. - **#15707** releases a published owner whose plane a written storage view covers, after `cachedStorageTexture` publishes it. With this PR, that storage access is a reuse. If its publication took a guest byte, the owner is already inactive with its guards removed, and #15707's release, which checks `active`, skips it; if not, the owner stays and #15707 releases it as before. They differ where a storage view overlaps an owner without covering a plane and the publication took a guest byte: #15707 keeps that owner, and this PR retires it. - Their new cases and this PR's sit at the same place in `NativeMultisampleDepth.cpp`, and keeping both sides resolves that file. The rest merges clean. - **#16363, #16364 and #16365** (hugodearaujo, all merged) are Assassin's Creed Mirage (PPSA13960)'s next changes, and name this PR as the fourth they need to get past `native multisample depth plane without HTILE does not hold one depth value in [0, 1]`. - #16363's runs show that with this PR as the fourth change, neither of two runs stops on that message, and that with this PR alone the run stops on it, as without it. - #16363 and #16365 add members next to `PublishToGuest`'s declaration, and #16363 adds a helper and a first line to `RequireNoResidentDepthRead_nid_no_patch`, whose signature this PR extends. #16364 rewords the debt entry. Keeping both sides resolves all three, with this PR's signatures, as the merges of `main` in `05cb62a9a6` (#16363) and `84d53ab953` (#16364 and #16365) do. - **#10469** (Ondra97) publishes D32 owners through the same `PublishToGuest`, and reclaims a D32 owner once its publication has completed and its sampled views are released. - At its head `df36ea5802`, it conflicts with this PR in `PublishToGuest`'s signature, where this PR adds the cause and #10469 adds its format check, and at the end of `PublishToGuest`, where #10469 makes a published HTILE D32 owner inactive and this PR returns whether the publication took a guest byte. Keeping both sides resolves them, with #10469's lines before the `return` (`git merge-tree` on `main` `9c0d96916c`). - With both, a reuse publication of an HTILE D32 owner would also take the guest's undecided bytes. #10469 makes that owner inactive after every publication, so this PR's retirement when the publication took a guest byte adds nothing for it: the check after publication skips the inactive owner, and its guards are removed with the other inactive ones. That combination hasn't been run. - **#10492 and #10497** (Ondra97), from the same stack on #9950, have the same two conflicts at their heads `66a2da10bc` and `7a318d5d26`, and keeping both sides resolves them too. - **#9950** (ebarr24) and **#16501** (JJenkx, closed) publish written native multisample D32 owners. Both reword the debt entry's first line, and #16501 adds its cases at the same place in `NativeMultisampleDepth.cpp`. Keeping both sides resolves them. JJenkx's Resident Evil Village (PPSA01556) run in #16501 stops at the same next check with this PR merged as without it. - **#16880** (muhmuhkuh) reads single-sample views of native multisample depth from guest memory, and publishes D32 owners with HTILE. Since its rebase onto `main` `bb86118e0f`, which has #19846's publication of bare D32 owners, it no longer carries #9950's D32 publication ([comment](https://github.com/boykopovar/AnyPS5/pull/16880#issuecomment-6922709611)). Merge order: either ([its thread](https://github.com/boykopovar/AnyPS5/pull/16880#issuecomment-6838134377)). Whichever of the two lands second adds the cause below. - At #16880's head `bd6552b5e9`, which still keeps `GuestHoldsSamples()` for #17890's `PublishedUnderStorage()`, the two merge without a textual conflict (`git merge-tree`, `416bc9ad90` with `bd6552b5e9`). The merged tree still doesn't build until `PublishForGuestRead()` passes the cause, as below. - Its new `PublishForGuestRead()` calls `PublishToGuest()`, which takes a cause with this PR and returns whether it took a guest byte, so that call passes `DepthReadCause::Access` and drops the result. An `Access` publication leaves the owner resident, as `PublishForGuestRead` expects. Without the argument the merged tree doesn't build. - **#16301** (dantdmdarealguy, merged) publishes over a colour alias its owner took in. It adds its cases at the same place in `NativeMultisampleDepth.cpp`, rewords this PR's debt entry by one word and adds an entry after it, and retires the colour aliases at the end of `PublishToGuest`, where this PR now returns whether the publication took a guest byte. Keeping both sides resolves them, with #16301's lines before the `return`, as the merge of `main` in `7ce55ad00e` does. - **#16116** (Nesyth, merged) ends each guard removal with `publishDepthGuards(removed != 0)` in place of the `anyDepthGuard()` store. Since 091068b618, this PR's guard removal at the end of `RequireNoResidentDepthRead_nid_no_patch` and #16116 merge clean, as the merge of `main` in `7ce55ad00e` shows. - **#7256** (gjonn) moves the three `RequireNoResidentDepthRead_nid_no_patch` calls on a new depth surface's planes, which this PR marks `Reuse`, into its `requireNativePlanesFree`, called for each new surface and each layered slice. Merge order: this PR goes first, and #7256 then puts `DepthReadCause::Reuse` on those three calls in their new place, as this PR's merge did on #14051's moved index-buffer line ([proposed in its thread](https://github.com/boykopovar/AnyPS5/pull/7256#issuecomment-6718276305), no objection). - **#10049** (frankea) closed unmerged on 16 Nov, in favour of #13248 (hugodearaujo, merged), which frankea found already covers the case it was opened for ([comment](https://github.com/boykopovar/AnyPS5/pull/10049#issuecomment-6909448522)). The `RequireNoMultisampleTarget` merge order agreed in its thread no longer applies. - **#15443 and #15446** (edubox, both merged) add cases at the same place in `NativeMultisampleDepth.cpp`. The merges of `main` in `a3600e57f7` (#15446) and `e2ab111fbf` (#15443) keep both sides. - **#15300** (Prophet069, merged) lets `releaseRetired` free a native multisample surface once it's inactive and no longer host-written. Before it, a retired multisample owner stayed listed. After a reuse publication that took a guest byte the old owner is both, so #15300 frees it; since 091068b618 that is where it is retired. **#15301** (Prophet069, merged) changes the sampled depth shadow's allocation in `DepthSurface.cpp`, away from this PR's hunks. The branch merges clean with both and with #15855, and with `main` `acac7c8541`. - **#15404** (JJenkx, merged) retires displaced single-sample surfaces, while this PR's retirement is for multisample native owners after a reuse publication. It merged with this branch without a conflict. - **#14969** (JJenkx, merged) keeps guest writes over a stale stencil plane, in `DepthSurface.cpp` and the AGC debt file. Its stencil baseline runs only for surfaces whose stencil plane can be mirrored, which are single-sample, so this PR's multisample reuse path doesn't reach it. It leaves `retireStencil` unchanged. It merged with this branch without a conflict. - **#17890** (hugodearaujo, merged) releases a published multisample owner whose planes lie under pending storage units when a draw that overwrites every sample binds it, and imports a new owner from guest memory. Its `PublishedUnderStorage()` sits before `PublishToGuest`'s declaration, and the merge of `main` in `58f6485059` keeps both (see Tested). Its release looks only at active owners, so an owner this PR's reuse publication retired isn't one it meets. - **#15059** (Sam-mon7, merged) sizes surfaces with `SurfaceGuestBytes`, including the two storage-image accesses this PR marks `Reuse`. The merge in `58f6485059` keeps both (see Tested). - **#20368** (talha-devp, merged) binds small, rarely read draw inputs in place. It adds two arguments to the `InPlaceDrawInput` call in `prepareDrawInputs`'s vertex range loop, the line after the vertex buffer `RequireNoMultisampleTarget` call this PR marks `Reuse`. The two lines conflicted as text, and the merge of `main` in `c71026cc1f` keeps both (see Tested): the check still runs before the in-place bind, and #20368 adds no depth read of its own. - **#22062** (ycbuzi) publishes multisample depth over pages only an import window touched: a page whose protection an import resolved without changing its bytes no longer counts as CPU-stored (`StoreUnchangedSinceLastCollect`), so its host-changed bytes are published where the read threw before. It changes the same `else` branch of `PublishToGuest`'s byte loop as this PR, and both rewrite the debt entry, so the two conflict in `DepthSurface.cpp` and the debt file (`git merge-tree`, `c71026cc1f` with #22062's `7a78b2aabd`). - They compose: #22062 decides whether an undecided byte's page was stored, and this PR decides what a stored one does, taking the guest's byte on a reuse and throwing on other reads. Keeping #22062's loop, with this PR's branch in place of its `Require`, resolves the code: ```cpp if (!pageUnstored) pageUnstored = GuestMemory::StoreUnchangedSinceLastCollect(address, bytes, plane.range.generation); if (*pageUnstored || GuestMemory::StoreUnchangedSinceLastCollect(plane.range.address + offset, 1u, plane.range.generation)) continue; Require(cause == DepthReadCause::Reuse, "native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store"); tookGuest[index] = true; result[index][offset] = current[index][offset]; ``` In the debt entry, this PR's "A written page's byte" becomes "A CPU-stored page's byte", and #22062's "one inside an import window is overwritten" follows the list of reads that throw. With both, a reuse over a page only an import window touched publishes the host's bytes, as #22062's reads do, since no CPU store reached it. - In a dry merge of the two (`bd8f8b7465`), `agc_driver_native_depth_publication`, which runs this PR's reuse cases and #22062's `ImportSameValue` and `ImportThenSameDepth`, and `agc_write_tracking` pass 3 of 3 on GitHub's Linux runner ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/44024880499)); on Windows, `agc_write_tracking` passes 3 of 3 and the publication test skips (no Vulkan device). - Merge order: either. If this PR goes first, #22062 takes the block above when it merges `main`; if #22062 goes first, this PR's merge of `main` does. - **#22647** (Nesyth) commits draws from records resolved on the finisher under `APS5_DIRECT_DRAWS`. It moves `prepareDrawInputs`'s pixel-kill check into `requireUncountedKills(state)`, on the line after the index buffer `RequireNoMultisampleTarget` call this PR marks `Reuse`, so the two conflict in that one hunk of `Graphics/src/Draw.cpp` (`git merge-tree` on `main` `291a878fd2`, with #22647's `85c9eed5d1`). Keeping both lines resolves it. - Its new `takePreparedInputs` adds index and vertex buffer `RequireNoMultisampleTarget` calls for the same reads. `cause` defaults to `DepthReadCause::Access`, so with both PRs they build, but they would treat a multisample depth owner under those ranges as an access where `prepareDrawInputs` takes it as a reuse. Whichever of the two lands second also passes `DepthReadCause::Reuse` on those two calls, so both paths treat the reads alike. - Merge order: either, as proposed in #22647's thread. - **I#15600** (oneandonlydean): #13021's commit-time window applies here unchanged. ### 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 (the four regressions were reported in discussions #8691, #8671 and #9091). Related: #9533, #9717, #13021, #13023, #15600 - [x] Unblocks: NINJA GAIDEN: Ragebound (PPSA28002, #8671), Curved Space (PPSA02817, #8691) and New Joe & Mac: Caveman Ninja (PPSA02801, #9091) past the publication refusal, each to the close of a 125 s run (JJenkx's runs above), though New Joe & Mac still stops on it after about 48 s, from an `Access` read, in xXPBSXx's one Windows run; SAMURAI MAIDEN (PPSA04132, #7265) past the refusal during asset loading, to the menu, the talk-event scenes and 3D gameplay, with the same refusal still at some later loading screens (birdmarty's run above); Arcade Game Zone (PPSA19015, #8562) past the refusal, through a 150 s run to the front end and a mini-game (edubox's run above); Peppa Pig: World Adventures (PPSA09806, #19981) past the refusal, to 44.7 s, where it stops on another refusal (HabibUrRehmanBhattii's run above); Blue Prince (PPSA25009, #9189) not run yet - [x] GPUs tested: Mesa llvmpipe (LLVM 20.1.2), Ubuntu 24.04, on a cloud Linux machine and GitHub's Linux runner; GitHub's Windows runner has no Vulkan device; AMD Radeon RX 570 (RADV POLARIS10, GFX8; ryanc2112); NVIDIA GeForce RTX 4070 and AMD Radeon Graphics, RDNA 2 integrated (Windows 11; AlfaRojo); NVIDIA GeForce RTX 5090 (Windows 11; klosixgaming-arch); AMD Radeon RX 6650 XT (RADV; JJenkx's title runs); AMD Radeon RX 6800 (Windows; birdmarty's title run); NVIDIA GeForce RTX 5070 Ti and the Ryzen 7 7700X's integrated AMD Radeon (Windows 11, with the validation layer; Superseabas, at ab7598d803 and d4583e9ccd); NVIDIA GeForce RTX 4080 SUPER (Windows; xXPBSXx's title run); NVIDIA GeForce RTX 4070 Ti (Linux) and GeForce GT 1030 (Windows 11 VM; milescoviello, the default native multisample depth test); NVIDIA GeForce RTX 4090 (Windows 11, with the validation layer; magnub); NVIDIA GeForce RTX 4080 SUPER (Linux; edubox's title run); AMD Radeon RX 6700 XT (Windows; JJenkx's title runs); NVIDIA GeForce RTX 4070 (Windows; HabibUrRehmanBhattii's title run); NVIDIA GeForce RTX 4090 (Arch Linux, driver 620.70.06, with the validation layer; domx4q); NVIDIA GeForce RTX 5080 (driver 610.88) and the Ryzen 7 9800X3D's integrated AMD Radeon (Windows 11 Pro; Lyrnc) - [x] AI-assisted: yes
Superseabas commented 2026-11-09 17:51:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-09T17:51:53Z.

Review: APPROVED


Re-test of head d4583e9ccd on Windows with real Vulkan devices, merged onto main 6541a1f0fc (clean merge), since GitHub's Windows runner skips these tests. All three points from my earlier comment are settled here.

Setup: as before. Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 r3, Release, an RTX 5070 Ti (driver 621.01) and the Ryzen 7 7700X's integrated Radeon (AMD 26.10.2), ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.

Full ^agc suite (1,527 tests, -j 8):

RTX 5070 Ti Radeon (iGPU)
main 1526 / 1527 1526 / 1527
this PR 1526 / 1527 1526 / 1527

The one failure on each GPU is the same with and without this PR: agc_driver_quad_pixel_mask on the RTX (#14341) and agc_driver_sample_order_grid_reference on the Radeon (#9503). No VUID- lines and no missing-layer lines. agc_driver_native_depth_publication passes 3 of 3 on each GPU, and the 24 agc_driver_native_depth_ tests pass on both, with _driver_queued_fill skipping. tools/check_conventions.py --base upstream/main passes.

The case I raised. DecidedVertexRead is the sequence from my probe: a Reuse read with nothing undecided. It now keeps the owner, the rebind returns the same view with no new surface, and sampling works on both GPUs, as it did with Access.

Mutations, agc_driver_native_depth_publication, one run per GPU, same on both:

  • Putting back the previous head's rule, so that Reuse retires every ever-written owner, fails DecidedVertexRead with a depth read of a host-written native owner retired or re-imported it.
  • With Reuse never retiring, the test fails with guest writes over native multisample depth are not implemented.

So both directions of the retirement are covered on real Windows hardware, matching your lavapipe runs. Dropping the final retire(*surface) loop changes no result here.

Not run: any title.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5830220933 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15941#pullrequestreview-5830220933). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-09T17:51:53Z. **Review:** APPROVED --- Re-test of head `d4583e9ccd` on Windows with real Vulkan devices, merged onto `main` `6541a1f0fc` (clean merge), since GitHub's Windows runner skips these tests. All three points from my earlier comment are settled here. **Setup:** as before. Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 r3, Release, an RTX 5070 Ti (driver 621.01) and the Ryzen 7 7700X's integrated Radeon (AMD 26.10.2), `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. **Full `^agc` suite** (1,527 tests, `-j 8`): | | RTX 5070 Ti | Radeon (iGPU) | |---|---|---| | `main` | 1526 / 1527 | 1526 / 1527 | | this PR | 1526 / 1527 | 1526 / 1527 | The one failure on each GPU is the same with and without this PR: `agc_driver_quad_pixel_mask` on the RTX (#14341) and `agc_driver_sample_order_grid_reference` on the Radeon (#9503). No `VUID-` lines and no missing-layer lines. `agc_driver_native_depth_publication` passes 3 of 3 on each GPU, and the 24 `agc_driver_native_depth_` tests pass on both, with `_driver_queued_fill` skipping. `tools/check_conventions.py --base upstream/main` passes. **The case I raised.** `DecidedVertexRead` is the sequence from my probe: a `Reuse` read with nothing undecided. It now keeps the owner, the rebind returns the same view with no new surface, and sampling works on both GPUs, as it did with `Access`. **Mutations**, `agc_driver_native_depth_publication`, one run per GPU, same on both: - Putting back the previous head's rule, so that `Reuse` retires every ever-written owner, fails `DecidedVertexRead` with `a depth read of a host-written native owner retired or re-imported it`. - With `Reuse` never retiring, the test fails with `guest writes over native multisample depth are not implemented`. So both directions of the retirement are covered on real Windows hardware, matching your lavapipe runs. Dropping the final `retire(*surface)` loop changes no result here. Not run: any title.
MarcZX10 commented 2026-11-17 07:09:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T07:09:56Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head c71026cc1fddf38d5ca65d54a86e9e941fc258f7, base main, PR #15941.
  • Read the review folder: description, commit list, manifest, diff.patch and files.json.
  • Read the changed hunks of the eight reviewed files, and the head context of PublishToGuest, RequireNoResidentDepthRead_nid_no_patch, DepthSurfaceViewWithStencilWriteIntent and releaseRetired through repo_read.py.
  • No build and no test run. Nothing was changed in the repository.

Results

Check Result Note
Diff against manifest passed 8 files, changed hunks
Added code has no comments passed House rule
Full text of changed files not run Hunks and context only
Build and unit tests not run Author-reported runs only

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp:4666: the same-identity rebind is checked before the undecided store at line 4686. After the store, the case only checks a CPU-read refusal (line 4690), so no test covers a rebind over undecided bytes. The code does not publish in that case: DepthSurface.cpp:4076 runs the Reuse publication (lines 4083 to 4085) only when created. This is a coverage gap, not a found defect.
  • core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:1531: the storage access is now Reuse and runs before DepthSurfaceStorage at line 1532, which is unchanged. If a storage view targets the owner's own planes and has undecided bytes, the owner is retired before that lookup. The StorageTexture case uses a separate linear alias over the stencil page, so this path is not tested.

Sources

Not verified

  • Build and tests were not run here. The runs in the description (GitHub runners, lavapipe, several GPUs, at this head and earlier ones) are the author's. I did not repeat them and do not count them as my runs.
  • Full text of the eight reviewed files was not read. ShaderResources.cpp is in the reviewed list but its full text is not in the review folder (too large), so only its changed hunks were read. Nothing was excluded by rule. Because of this the verdict is COMMENT, not APPROVE.
  • Negative control not run, since no build or test ran.
  • Whether the inferred bytes match console memory: the Reuse publication takes the guest's undecided bytes, which the description itself calls inferred. This cannot be checked from the code. Title runs listed as pending (Blue Prince) are not run here.
  • Whether the storage path over the owner's own planes (second non-blocking point) behaves as intended after retirement.

To get this to a good state

Nothing is required.

Optional: see the two non-blocking points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5934357601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15941#pullrequestreview-5934357601). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T07:09:56Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `c71026cc1fddf38d5ca65d54a86e9e941fc258f7`, base `main`, PR #15941. - Read the review folder: description, commit list, manifest, `diff.patch` and `files.json`. - Read the changed hunks of the eight reviewed files, and the head context of `PublishToGuest`, `RequireNoResidentDepthRead_nid_no_patch`, `DepthSurfaceViewWithStencilWriteIntent` and `releaseRetired` through `repo_read.py`. - No build and no test run. Nothing was changed in the repository. ## Results | Check | Result | Note | |---|---|---| | Diff against manifest | passed | 8 files, changed hunks | | Added code has no comments | passed | House rule | | Full text of changed files | not run | Hunks and context only | | Build and unit tests | not run | Author-reported runs only | ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp:4666`: the same-identity rebind is checked before the undecided store at line 4686. After the store, the case only checks a CPU-read refusal (line 4690), so no test covers a rebind over undecided bytes. The code does not publish in that case: `DepthSurface.cpp:4076` runs the Reuse publication (lines 4083 to 4085) only when `created`. This is a coverage gap, not a found defect. - `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:1531`: the storage access is now `Reuse` and runs before `DepthSurfaceStorage` at line 1532, which is unchanged. If a storage view targets the owner's own planes and has undecided bytes, the owner is retired before that lookup. The `StorageTexture` case uses a separate linear alias over the stencil page, so this path is not tested. ## Sources - Byte decision on undecided bytes: https://github.com/boykopovar/AnyPS5/blob/c71026cc1fddf38d5ca65d54a86e9e941fc258f7/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L3257-L3261 - Owner retirement in the guard loop: https://github.com/boykopovar/AnyPS5/blob/c71026cc1fddf38d5ca65d54a86e9e941fc258f7/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L3835-L3840 - Reuse on a new depth surface: https://github.com/boykopovar/AnyPS5/blob/c71026cc1fddf38d5ca65d54a86e9e941fc258f7/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L4073-L4085 - Owner release at the next creation: https://github.com/boykopovar/AnyPS5/blob/c71026cc1fddf38d5ca65d54a86e9e941fc258f7/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L3137-L3144 ## Not verified - Build and tests were not run here. The runs in the description (GitHub runners, lavapipe, several GPUs, at this head and earlier ones) are the author's. I did not repeat them and do not count them as my runs. - Full text of the eight reviewed files was not read. `ShaderResources.cpp` is in the reviewed list but its full text is not in the review folder (too large), so only its changed hunks were read. Nothing was excluded by rule. Because of this the verdict is `COMMENT`, not `APPROVE`. - Negative control not run, since no build or test ran. - Whether the inferred bytes match console memory: the Reuse publication takes the guest's undecided bytes, which the description itself calls inferred. This cannot be checked from the code. Title runs listed as pending (Blue Prince) are not run here. - Whether the storage path over the owner's own planes (second non-blocking point) behaves as intended after retirement. ## To get this to a good state Nothing is required. Optional: see the two non-blocking points above.
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!15941
No description provided.