fix(agc): execute the DB's out-of-place depth expand #6146

Merged
EagleBearerYS merged 54 commits from upstream-pr/6146 into main 2026-11-14 03:20:52 +00:00
EagleBearerYS commented 2026-10-14 23:29:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T23:29:28Z.


What

A draw that sets DB_RENDER_CONTROL's DEPTH_COMPRESS_DISABLE with DB_Z_WRITE_BASE different from DB_Z_READ_BASE is a DB expand. The DB writes the read surface's depth plane, uncompressed and in the same swizzle, at the write base. With DB_DEPTH_CONTROL 0, DecodeState took the "always-pass depth/stencil state is rendered without a depth target" path, so the draw drew nothing and the write base kept whatever the CPU had written there.

Resident Evil Village (PPSA01556, 01.210.000) issues four such draws per frame in its first 3D scene, then lights, fogs, resolves and blends the scene from the copy. With zeros there, which is the far plane in its reverse Z, the scene renders as soft light discs on black. One of the game's draws, from a register trace at first player control:

DB_RENDER_CONTROL 0x00000060  DB_DEPTH_CONTROL 0x00000000  DB_DEPTH_VIEW 0x00000000
DB_Z_INFO 0x20000183  DB_STENCIL_INFO 0x20000181
DB_Z_READ_BASE 0x202a8a0000  DB_Z_WRITE_BASE 0x20298b0000
DB_STENCIL_READ_BASE 0x2029430000  DB_STENCIL_WRITE_BASE 0x2029430000  DB_HTILE_DATA_BASE 0x20293e0000
CB_COLOR_CONTROL 0x00cc0000  CB_TARGET_MASK 0xffffffff  CB_SHADER_MASK 0x00000000
PA_SC_AA_CONFIG 0x00108001

That's Z_32_FLOAT, one sample, SW_64KB_Z_X, 1920x2160. All other depth draws in the frame read and write at the same base.

  • Recognition: DecodeDepthExpandPass decodes the target with the draw state's own decoder (depthTargetFor) and takes exactly this shape:

    • DEPTH_COMPRESS_DISABLE set, and no bits besides the two compress-disable bits and bit 13. Without a copy bit, COPY_CENTROID and COPY_SAMPLE select nothing and are ignored, so #5937's 0xc0 shape is the same expand;
    • no depth, stencil or depth-bounds tests, and no colour writes by ColorWriteMask's rule, so an INVALID-format target writes nothing, as for a draw;
    • a single-sample Z_32_FLOAT or Z_16 SW_64KB_Z_X surface at the view's first slice, without mips or layer exports. Its stencil plane stays in place, is read-only, or moves, with the depth plane or alone;
    • 64 KiB-aligned bases;
    • a viewport and scissor covering the surface, by the coverage check the colour-metadata pass uses.
  • The copy: each moving plane of the live depth surface at the read base, with any pending fast clear applied, is copied into the storage image of a view of its write base and marked written: R32F or R16 UNORM SW_64KB_Z_X for the depth plane, and R8 UINT at DB_STENCIL_WRITE_BASE for the stencil plane. A slice of a depth array goes to the same slice of the write base. Sampled views of the write base use that image. Raw and CPU reads store it into guest memory in the Z swizzle, as for any written storage image.

  • In order: the expand runs only from the draw precheck, which decodes it and the colour-metadata pass as one outcome and runs either the same way: it drains the draw pipeline, takes the GPU lock, writes the packet's labels and runs the pass.

    • The precheck runs on queue 0's packet worker while the draws before it can still be queued for the draw pipeline's committer, which #1202 turned on by default. Recorded ahead of them, the expand's copy read the depth from before them, its repeat check didn't see their writes, and a read surface that a queued draw creates was read from guest memory. The drain, as the colour-metadata passes have (a39261b75c), records the copy after every earlier draw. An indirect expand was already drained before the precheck.
    • The drain waits only when draws are queued, and at most for the draws the pipeline holds (8 by default); Resident Evil Village issues four expands per frame.
    • The state-only depth check refuses an out-of-place expand ("is run by the draw precheck, in order, and is not drawn"). A path that classifies a draw from its state alone, without running the pass, reports the expand instead of drawing or skipping it.
  • Address-based builds: they read host-imported heaps in place without storing the results pending there. So the expanded planes still pending in imported write bases are stored ahead of every address-based build (StoreDepthExpandWrites). Resident Evil Village's copy shader reads its write base through a V# right after the expand.

    • Host imports are made per registered range, so a plane can lie across two imports, or across an import and a range that is heap-mirrored or copied. A plane is stored when any existing import overlaps it (HostImportOverlaps), not only when one import holds all of it.
    • When every registered range under the plane has an import, the write-back records the plane on the GPU into each range's import, one segment per range (on main, since ea3a2152d). When part of it has no import, the write-back goes through the CPU after a wait for the expand.
    • The store only looks imports up: it makes and evicts none, so it can't dissolve a cached address space. A plane that no import holds stays noted while it is pending, and UploadFinish stores again after the build's own imports, so a build that imports the range itself stores the plane before reading it. When nothing is noted, that second call is a lock and a scan of an empty map.
    • These builds also skipped the results pending under their own read-only V#s. A read-only V# inside a heap the build maps whole was merged into the heap's region on the per-build path, or dropped inside a base region of the cached address space, so nothing stored what an image had left pending there, and the GPU read the import's older bytes. UploadFinish now stores the results pending under every read-only V# of an address-based build, as it already did for written ones. Pointer reads keep the exemption; for them the expand's planes are still stored ahead of every such build, as above.
  • Indirect expands: Resident Evil Village issues its expands as indirect draws.

    • DRAW_INDIRECT, DRAW_INDEX_INDIRECT and their multi forms read their count and records on the CPU, as the draw path's CPU route does.
    • They run the expand when a record draws something, and write nothing otherwise, as does a direct expand, indexed or not, of no vertices, indices or instances.
  • No depth surface at the read base yet (Resident Evil Village does this once during boot): the write base takes DB_DEPTH_CLEAR when an HTILE depth clear of the surface is pending, and otherwise the read base's guest bytes.

  • Repeats: an expand whose plane the write base's image already holds is skipped. The surface's write serial and the image's content version decide that; 7 expands in the test make 3 copies.

  • What throws: every other out-of-place expand, naming the reason: Z_24 or no depth plane, multisampled, other swizzles, mips and layer exports, partial coverage, and one into a live depth surface of the same device or from one of another extent, format or sample count. An in-place expand changes nothing modelled, as before.

  • Debt: a new "Out-of-place DB expand" entry under Unknown function info lists what is inferred and what is left:

    • the HTILE words aren't read, so an HTILE the CPU or a DMA fill cleared counts as expanded, and an HTILE stencil clear isn't modelled;
    • the draw's geometry and sample count aren't checked, and its pixel shader never runs;
    • only one surface form is taken; the others, an expand into a live depth surface and 32-bit integer views of the write base throw;
    • a guest CPU read after a label reads the bytes from before the expand, as for any pending storage-image result;
    • none of it is measured on the console.

    The entry keeps to the gaps, within the 1,000 characters check_conventions.py allows. Two things it leaves out: the first expand into a write base uploads bytes that the copy then overwrites (35-47 ms at 1920x2160 on lavapipe, against about 3 ms for a later expand), and a depth surface bound later at the write base without HTILE starts from the expanded plane (TakeStorage, #5446), while one bound with HTILE doesn't. "Reused depth storage" stays as on main. A second new entry, "Pending storage-image results under the heaps of an address-based build", says what such a build stores and what it leaves to pointer reads. The "HTILE address of a depth array slice" entry goes: since #5111 each slice has its own HTILE.

  • Not done here, with the reasons:

    • DB_RENDER_OVERRIDE's forced-dirty copies (0x28000000 depth, 0x50000000 stencil) with moving bases: public facts name the bits but not what the DB writes under them, and #1395 takes that path.
    • Raw reads of the read base after an in-place expand: a raw read (CPU, DMA, address-based copy) of a live single-sample depth surface is stale with or without an expand. That needs coherent read-back of live depth surfaces, a general feature, and a store-back on every in-place expand would cost a full-plane copy per expand.
    • Storing pending planes before a label becomes CPU-visible: that changes coherence for every pending GPU result, not only expands.
    • Decoding the guest's HTILE words in the branch with no surface: the copy reads the live surface, which the emulator renders uncompressed, and a pending HTILE clear is already applied. #5627's reader could serve it if a title clears part of an HTILE that way.
    • Running an indirect expand as an indirect dispatch: the records are read on the CPU, which waits when the GPU wrote them; no title is known to issue indirect expands often.

Tested

  • agc_driver_depth_expand_out_of_place, an execution test through PM4 using the game's register values:
    • a depth-only draw writes a gradient into a 160x96 surface; the expand copies it to another base;
    • the copy is read back through an R32F SW_64KB_Z_X image_load and through GuestMemory::Read, detiled with the driver's SW_64KB_Z_X equation.
    • On main 9f03c4fe0 the write base holds 0 of 15,360 texels of the depth. With the change it holds 15,360 of 15,360 both ways, with one raster sample and with the game's two (PA_SC_AA_CONFIG 0x00108001).
    • It also covers:
      • indirect expands: DRAW_INDIRECT, DRAW_INDEX_INDIRECT, and a record that draws nothing;
      • a read base with no depth surface: HTILE-cleared, and plain guest bytes;
      • buffer and address-based buffer copies of the write base right after the expand;
      • a repeated expand, which copies only after a change.
  • agc_driver_depth_expand_review checks the expand beyond the game's case:
    • a surface without a stencil plane;
    • a drawn stencil plane: its contents are kept, and the read base, stencil and HTILE guest bytes are unchanged;
    • an in-place expand, and an always-pass draw with equal bases;
    • a second expand after the surface changed;
    • a GPU buffer read right after the expand;
    • one submission expanding to two write bases;
    • three expands right after a depth draw still queued for the committer, one for each way the expand finds its source: a surface that already exists, a repeat of an expand into the same write base, and a read surface that the queued draw creates. The test holds the committer with a blocking commit, as agc_driver_pipelined_fill does for fills, and puts the depth draw and the expand in one submission. On GitHub's Linux runner, with main's DrawPrecheck.cpp, each of 10 runs failed all three cases on the texture read of the write base, with the draw queued every time; with the drain, all three passed 20 of 20 (run).
  • Six more cases in agc_driver_depth_expand_out_of_place copy the write base with address-based programs right after the expand:
    • Its memory as two registered ranges, both imported (split-imported-buffer-read, split-imported-pointer-read), or one imported and the other heap-mirrored (split-mirrored-buffer-read) or copied (split-copied-buffer-read).
      • Without 103316e332, on main and on this branch's base, all four fail: expanded planes stored ahead of the copies: 0 (expected 1), then 0 of 15360 texels hold the read surface's depth with both ranges imported, or 3072 of 15360 with one mirrored or copied.
      • With it, all four print 1 and 15360 of 15360.
      • On main, a temporary print in the write-back showed DB expand: GPU path, 2 segment(s), 131072 bytes with both ranges imported. With one mirrored or copied it showed DB expand: CPU path, 0 segment(s), 65536 bytes, after that range's own write-back of the other 64 KiB.
    • Every host import refused (unimported-mirrored-buffer-read, unimported-copied-buffer-read): these pass with and without 103316e332, because the mirror refresh and the copy store the pending plane themselves.
  • address-based-storage-image-read in agc_driver_depth_expand_out_of_place stores a value to every texel of an image with one compute dispatch, then copies the image's bytes through a read-only V# with the address-based copy kernel. It does that twice with different values: the first copy takes the per-build path, the second the cached address space. Without bfcd1839a8 both copies hold 0 of 15360 texels; with it, 15360 of 15360.
  • depthExpandPassTests in agc_driver_graphics check the decoder on the game's values and every refusal.
  • Completeness follow-ups (the 9 commits from f2f52d08a to a6005bab04, merged at the head), each red without its change on CI's Linux configuration (lavapipe) and green with it:
    • agc_driver_graphics: the state-only refusal (with it reverted: "an out-of-place DB expand that reached the draw path was not refused"), the 0xc0 shape, an INVALID-format colour target and a non-finite clear (with the old decode: "… with color writes is not implemented"), Z_16 and Z_24, slices and layer exports, and the stencil decode.
    • agc_driver_depth_expand_review, each read through a texture and raw:
      • a Z_16 surface: 15360 of 15360 through the R16 view and raw, detiled with the 16-bit equation (before: "… of a depth plane other than Z_32_FLOAT is not implemented");
      • slice 1 of a two-slice array: 15360 of 15360, while slice 0 keeps the CPU's bytes (before: "… of a depth view with a base slice or a mip level is not implemented");
      • a stencil plane moved with the depth plane and alone: the two-value pattern matches 15360 of 15360 through the R8 view and raw (before: "… of the stencil plane is not implemented").
    • agc_driver_depth_expand_out_of_place:
      • direct-indexed: DRAW_INDEX_2 with no indices, or no instances, keeps 32768 of 32768 dwords the CPU wrote (before: 17408), and a three-index expand matches 15360 of 15360;
      • five-range-write-base (a write base across five registered ranges, as Resident Evil Village's spans five 4 MiB mappings), compute-queue-read (an ACB copy), dma-read (DMA_DATA), depth-bind-of-write-base and store-without-import-room: 15360 of 15360 in each check. The last pins the import-neutral store, which no lavapipe run can make fail: every address-based build there imports its ranges itself.
      • it also runs as agc_driver_depth_expand_out_of_place_inline, with APS5_PIPELINED_DRAWS=0.
    • Every commit builds and passes the expand, graphics, BDA, sparse-buffer, address and storage tests from the one that adds them; the expand tests pass 5 of 5 with the pipeline at its default and with it off.
  • Linux (lavapipe), with CI's flags:
    • Merged with main d6eafa54d0 (97ad315a0a, the head), which brings #7927's depth mips (whamre). #7927's mip branch now runs inside depthTargetFor, which both decodeDepth and the expand call. decodeDepth keeps main's checks for partially resident depth and stencil, and its own depth-mip refusal goes, as on main. The expand still refuses depth mips and mip views itself.
      • On GitHub's runners (run), the expand tests, agc_driver_graphics and the other tests built from the changed files pass 10 runs in a row on Linux. On Windows they build and pass, with the Vulkan tests skipping. agc_driver_graphics reports Passed in all 10 Linux runs, so its disabled-colour and expand-decoder cases ran.
      • An ^agc sweep on Linux (run) fails 1 of 877: agc_driver_sgpr_pattern_fill_keys, main's #8715 test, failed once under the sweep's parallel load ("the dispatch completed 17 times without a pending write over the keys") and passes 20 of 20 alone (run). It has failed the same way under load on branches without this PR.
    • Validation layer, main against this PR (CONTRIBUTING's AGC rule), on one GitHub Linux runner (run). Both runs used VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and ctest -V, with VK_LOADER_DEBUG=layer to show the layer loading. The device was llvmpipe (LLVM 20.1.2) on Mesa 25.2.8, Ubuntu 24.04.5, Khronos validation layers 1.3.275.
      • Tests: main's depth tests, agc_driver_depth_storage, _clear_hle, _fast_clear, _plane_sampling and _htile_write, with agc_driver_graphics and the other tests built from the changed files, on both trees, plus this PR's three expand tests. main's tree ran its set once and this PR's three times.
      • The loader inserted VK_LAYER_KHRONOS_validation 6 times on main and 36 with this PR, and neither log has was not found but was requested by env var VK_INSTANCE_LAYERS.
      • Both logs report the same two messages, VUID-VkDeviceCreateInfo-pNext-pNext and VUID-VkImageCreateInfo-samples-02258. This PR adds no VUID- message.
    • Merged with main 2f161d4f33 (fa02e9bbe3), which brings #8975's DB depth copies. Both PRs had pulled the CB metadata pass's coverage check out into a helper, so the merge keeps main's drawCovers (which also checks PA_CL_VTE_CNTL), points the expand's call at it, and drops this PR's passCovers. A DEPTH_COPY draw still reaches #8975's decoder: the expand's decoder returns nothing unless a compress-disable bit is set. On GitHub's runners (run), the depth-expand tests, agc_driver_graphics and agc_driver_depth_storage pass 5 runs in a row on Linux, with the other tests of that run: 34 in all, none skipped or failed. On Windows 28 of the run's 33 tests pass 5 runs in a row, agc_driver_graphics among them, and 5 skip, as the runner has no Vulkan device: the three depth-expand tests, agc_driver_depth_storage and agc_driver_sgpr_pattern_fill_keys. An ^agc sweep on Linux (run) fails 1 of 865, agc_driver_sgpr_pattern_fill_keys under the sweep's parallel load, as on main.
    • 846f0af61f cuts the "Out-of-place DB expand" debt entry to its gaps and leaves "Reused depth storage" as on main, which #8412 also edits, so the two no longer conflict. On GitHub's runners (run), Linux: agc_driver_depth_expand_out_of_place, its _inline run, agc_driver_depth_expand_review and agc_driver_graphics pass 5 runs in a row, and an ^agc sweep fails 1 of 851 (57 skipped), agc_driver_sgpr_pattern_fill_keys under the sweep's parallel load, as on main. The Windows job stopped at main's own MinGW build error in tests/execution/ImageArrayWindowPastLayerLimit.cpp, before any test ran; this commit changes only the debt file.
    • Merged with main 6696def6e6 (dbbcdcd1c0), which brings #6725: the decoder compares the depth write base only when the depth plane is written. With this PR, a split-base draw with a compress-disable control (0x20, 0x40 or 0x60) is an out-of-place expand, so DepthStencilTests expects the expand's refusal for those three in its state, and "depth read and written at different addresses" for a depth clear (0x01).
    • Merged with main a86577e464 (13ad1f4663), which brings #7178's depth clear and #7346's 32-bit depth-bits debt entry. The debt file keeps both of main's entries. The merges before it: main f474fb7768 (c053a554a7; decodeDepth takes main's DB_RENDER_CONTROL check) and main 55f82fee83 (24ec2d46c3; the debt file keeps main's plane-fill entry and drops the HTILE slice entry, as 25594523ae does). On GitHub's runners (run): of the 709 ^agc tests on Linux, 661, the expand tests among them, pass 3 runs in a row, 48 skip and none fail, and the libc and libkernel suites pass. On Windows the only failures are agc_driver_pm4_replay_tool and agc_shader_replay_tool, which fail the same way on that runner for an unrelated branch (run).
    • At 25594523ae, on GitHub's runners: ctest -R '^agc' ran 604 tests, 1 failed (agc_driver_preparation_scope_settle, as on main), 41 skipped on Linux, and 598 tests, 1 failed (agc_driver_pm4_replay_tool, as on main), 466 skipped on Windows (run). The expand tests and agc_driver_graphics pass 10 runs in a row on Linux, and agc_driver_graphics on Windows, whose runner has no Vulkan driver for the others; with the sources of the previous head (d359e15280) the new cases don't build (run).
    • The previous head merges main 2e5dd5aa14, which brought #5627, #5554 and #5524's changes to DepthSurface.cpp: the HTILE clear, ApplyFastClear and surface retirement, which the expand uses. The only conflict was one include block, where main dropped a duplicate GuestMemory.hpp include next to the two this PR adds.
    • At the head, on GitHub's Linux runner: ctest -R '^agc' ran 603 tests, 1 failed (agc_driver_preparation_scope_settle), 41 skipped (run). On main 2e5dd5aa14 alone: 601 tests, the same one failed, 41 skipped (run). The two extra tests are this PR's. The two expand tests and seven others around the code the merge changed passed 10 of 10 at the head (run).
    • On GitHub's Linux runner, agc_driver_depth_expand_out_of_place fails with 103316e332's code reverted (run), and again with bfcd1839a8's reverted (run). With the code, the two expand tests pass 3 of 3, and in the second run so do agc_driver_graphics, agc_driver_bda_device, agc_driver_bda_span_reads and agc_sparse_buffer_holes. The libc and libkernel suites pass in every build.
    • Every commit builds, and the three tests pass at each commit from the one that adds them.
    • Before the merge of main 8856f180ca, in WSL: ctest -R '^agc' at 6596a1d3a2 ran 558 tests, 0 failed, 40 skipped (the same 40 as on main), and the two expand tests passed 10 of 10. Merged into main d92a8dad39: 579 of 579 in two of three runs (41 skipped), the third failing only agc_driver_preparation_scope_settle, which also fails on main. The full suite there: 1195 of 1201; the other 6 are 5 network tests that need IPv6, which the build VM lacks, and that flake.
    • At the first fix commit, the game's case also passed under the validation layers with synchronization validation, with no SYNC hazards.
  • Windows: the full Build workflow on my fork at the head, 25594523ae (run): MinGW build, then ctest: 1,293 tests, 0 failed: 805 pass and 488 skip, all skips expected by check_skips.py.
  • Windows: the full Build workflow on my fork at 7809e9d443 merged into main 8856f180ca, the tree of the head's merge commit (run): MinGW build, then ctest: 1267 tests, 0 failed, 475 skipped, all expected by check_skips.py. agc_driver_graphics passed. The workflow carried the runner-image CA-bundle fix (CI only, no source change). The head itself built with MinGW in the sweep's Windows job (run), where ctest -R '^agc' ran 597 tests: 465 skipped, and 1 failed, agc_driver_pm4_replay_tool, which fails the same way on main 2e5dd5aa14 in that job (the tool exits 0xc0000139 there). Windows runners have no Vulkan driver, so the expand execution tests are skip stubs there and ran on a GPU separately (next item).
  • Windows on an NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11 10.0.26300: a MinGW (GCC 15.2.0) Release build, ANYPS5_REQUIRE_VULKAN=1 with only the NVIDIA driver visible, ctest -R '^agc_driver_depth_expand_(out_of_place|review)$' --repeat until-fail:5.
    • At the head, 25594523ae: ctest -R '^agc_driver_depth_expand_(out_of_place|out_of_place_inline|review)$|^agc_driver_graphics$' --repeat until-fail:5 passes all four 5 of 5. Every expand case holds 15360 of 15360 in every run: the Z_16 read base within one 16-bit step, and its 16-bit raw read and R16 UNORM texture read; the stencil-only and depth-and-stencil expands (7696 texels of 0x5a and 7664 of 0xa5); slice 1 of a depth array, with slice 0 keeping the CPU's bytes; and the queued-draw, two-write-base, in-place and always-pass cases.
    • On b7b1ca2ee2's tree (67ab3167d9, identical to it), before the merge of main 8856f180ca and the drain, merged with #5815's follow-up for one combined run, both pass 5 of 5. The four split cases print expanded planes stored ahead of the copies: 1 (expected 1) and 15360 of 15360, and the address-based storage-image read prints 15360 of 15360 texels hold it for both copies, through the cached address space and without it.
    • The tolerance change (a4137dc3f1) fixes a failure this PR had on that GPU. At e252c03bc6, agc_driver_depth_expand_review failed 3 of 3 with second expand: second read base: 15358 of 15360 texels hold the drawn depth.
      • That line is the test's own check that its depth draw wrote the gradient, before any expand. The expand's copies matched.
      • The two far-corner texels of the second gradient (offset 0.5), (158, 95) and (159, 95), came back 4.05e-6 and 4.11e-6 low: 68 and 69 ulps at 0.875. The test allowed a fixed 4e-6, which lavapipe always met exactly.
      • Both expand tests now accept half the gradient's step in x (0.5 / 65536, about 7.6e-6). A read of the wrong texel is still a full step off.
  • Resident Evil Village (PPSA01556, 01.210.000) on an NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11 10.0.26300, Ryzen 9 5900HS, 15.4 GB:
    • Setup:
      • main 23be5a02b, plus #5113 and #5111 (merged since; this change builds on both);
      • plus this change, as it was before its explanatory code comments were removed (the code is the same).
      • Resident Evil Village also needs local commits to reach its first 3D scene on this PC: #5851, #5815, #5703 and #5671; red-zone leaf framing in the relinker (from #5052 and #5640, which has merged since); first-draw shader preparation, title-stage experiments and frame-trace logging.
    • Without the change:
      • the title screen is a dark silhouette in fog;
      • the first 3D scene shows only soft light discs at first player control;
      • the copy at 0x20298b0000 holds the zeros the CPU wrote at boot.
    • With it:
      • both of the game's expand forms run, one line each, with no refusal: [gpu] DB expand: the depth plane of 0x202a8a0000 (1920x2160) is written at 0x20298b0000 and, once during boot, [gpu] DB expand: 0x202a8a0000 (1920x2160) has no depth surface; its guest bytes are written at 0x20298b0000;
      • the title is lit (mean brightness 101.4 against 61.0), and the first 3D scene renders sharp at first player control;
      • Continue to first control took 5.6 min, against about 16 min without the change; most likely the scene's fade-in had been running on zero depth.
    • Raw reads of the write base: in that run, two compute copies that read the write base as a raw buffer still saw zeros, while the sampled reads that the lighting uses were correct.
      • A memory trace on the same setup (which carried #5851, since closed) shows why. The write base 0x20298b0000+0xff0000 spans five separate 4 MiB direct mappings, from 0x2029800000 to 0x202a800000, so it crosses four mapping edges and more than one host import holds the plane.
      • 103316e332 stores such a plane (above), and the split cases reproduce the game's case.
    • Again at this head (25594523ae), 2026-10-15, on main 2e5dd5aa14 with the local commits Resident Evil Village needs on this PC (the merge with this change is clean), with APS5_LAZY_SHADER_PREPARE=1 APS5_HOST_IMPORT_MIB=6400 APS5_NO_GPL=1:
      • the main menu is lit: mean brightness 48.6 with this change against 34.2 without it, at the same camera point (measured as for the title above);
      • the scarecrow's cloth is textured, the sky is lit, and the foreground grass and branches show detail. Without the change the scarecrow is a black silhouette and the foreground is dark;
      • both expand forms log once each, for 0x202a8a0000 (1920x2160) at 0x20298b0000, as above. Without the change neither logs;
      • the run has no fatal error, access violation, termination, null image or invalid runtime value.
    • Again at 89d7d879da, 2026-10-28, at first player control after Continue. Both trees are main 04fefebe90 with #11580 merged locally and a local one-line scePadOpen change for ports 3 and 4, one with this change and one without. Environment APS5_LAZY_SHADER_PREPARE=1 APS5_NO_GPL=1 APS5_HOST_IMPORT_MIB=6000, unprofiled, one boot each, clocks not held, 0.3–0.5 fps at the shot:
      • without the change the scene at the "R Look" prompt is three out-of-focus glows. With it, the lamp, the pendant lights, the shelving and the lit lampshade in the foreground are drawn:

        Without this PR With this PR
        First player control without this PR First player control with this PR
      • both expand forms log once each, as above; without the change neither logs;

      • Host memory: at first control, host heap 1 held 1,101 MiB beyond the 5,999 MiB of live host imports with this change, against 969 MiB without it. That's 132 MiB more, from one pair. Readings at a 6400 MiB import setting, taken at different points of the boot, put the gap at 110 to 280 MiB. The two places where this change stores pending results to guest memory (expand write bases, and the read ranges of address-based builds) stored 12 distinct images, 50.1 MiB, in a traced boot. The source of the rest isn't found yet;

      • At APS5_HOST_IMPORT_MIB=6400: 2 of 5 boots with this change and 0 of 3 without it aborted in the intro. Each time, a host import failed at vkAllocateMemory (-2), and then a compute dispatch stopped on "AGC graphics: guest buffer has no GPU owner". That's main's path for a failed host-import join, which a tighter heap reaches. The two traced boots with this change passed the intro.

  • 2c8eaec716, main 11f976b27c merged in, which brings #8099 (a stencil clear on a target without a stencil plane is ignored) and #8871. This PR moves decodeDepth's target decoding into depthTargetFor, and #8099 changed two lines of the old decodeDepth. The merge applies #8099's two lines to this PR's decodeDepth: stencilClear is read only when the target has a stencil plane, and the writable-plane check no longer repeats stencil. Main's other hunks merged unchanged. The PR's own diff differs from before the merge only in those two lines. On GitHub's runners:
    • Tests (run): agc_driver_graphics, which holds #8099's case, and the depth expand, depth storage and depth clear tests pass 10 of 10 on Linux, none skipped. On Windows they build and pass, with 8 skipping without a Vulkan device. This PR's tests don't build against main's code, so the red is the one above.
    • Validation, main against this head (run), on one GitHub Linux runner: the loader inserted VK_LAYER_KHRONOS_validation 6 times on main and 12 with this PR, and neither log has was not found. Both logs report the same two messages, VUID-VkDeviceCreateInfo-pNext-pNext and VUID-VkImageCreateInfo-samples-02258, so this PR adds no VUID- message.
    • Suites: libc and libkernel pass on both runners. The libc and libkernel suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • dbaad7ace3, main 0db47b263d merged in, which brings #6946's draw finisher pipeline with its pipelined CB metadata pass. precheckDraw keeps this PR's shared block for a metadata pass or a depth expand, and #6946's pipelined path runs inside it for metadata passes only. A depth expand still drains the queue and records inline, as before. Both includes are kept.
    • Tests (run): this PR's depth expand tests, #6946's agc_driver_pipelined_metadata_pass, agc_metadata_pass and the draw pipeline trace tests pass 10 of 10 on Linux, none skipped. An ^agc sweep on Linux passes (run).
    • Windows: on our verify's Windows build, which compiles tests/execution, main's agc_driver_pipelined_metadata_pass and agc_driver_pipelined_metadata_pass_draw_pipeline (from #6946) fail at vkCreateInstance (-9) on GitHub's device-less runner, before this PR's code; upstream's Windows job builds them as skipped stubs. The rest build and pass there, with the Vulkan tests skipping.
    • Suites: libc and libkernel pass on both runners. The libc and libkernel suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • dd34282b4e, main 44a59edc3a merged in, which brings #6682. One conflict, in GuestBufferMemory.cpp's upload loop, where both PRs add a flush after the regions are copied: this PR's depth expand stores and #6682's unit-shadow publish for address-based heaps. Both are kept, this PR's first. On GitHub's runners (run), of the depth expand tests, agc_metadata_pass and #6682's unit-shadow tests, 33 pass 10 runs in a row on Linux and 3 of the unit-shadow tests skip there; on Windows 35 build, 27 pass 10 runs in a row, and 8 skip: those 3, and 5 that need a Vulkan device. The libc and libkernel suites pass on both, run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 9f70521a8a, main e5ca7307cf merged in, which brings #6292's draw-path locks. One conflict, in DepthSurface.cpp's includes: this branch's GuestBufferMemory.hpp and ShaderResources.hpp and #6292's Mutex.hpp, all kept. On GitHub's runners (run), of the depth expand tests, agc_metadata_pass and #6682's unit-shadow tests, 33 pass 10 runs in a row on Linux and 3 of the unit-shadow tests skip there; on Windows 35 build, 27 pass 10 runs in a row, and 8 skip: those 3, and 5 that need a Vulkan device. The libc and libkernel suites pass on both, run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 94c49deb18, main c9b75825f3 merged in, which brings #8999's DB depth copy draws (milescoviello). Four conflicts, each resolved by keeping both sides' changes:
    • State.cpp: #8999 moves decodeDepth's depth-plane decoding into decodeDepthPlane. The expand's decoder now calls it too, and sets the clear values from DB_DEPTH_CLEAR and DB_STENCIL_CLEAR after it, as decodeDepth does.
    • DepthSurface.hpp: this PR's expand-pass declarations and #8999's DepthCopySourceWords and DepthCopySourceScope. CopyDepthSample, which #8999 removes, stays removed.
    • VulkanDevice.hpp: this PR's DepthExpandPass. VulkanDevice::DepthCopyPass, which #8999 removes, stays removed.
    • DrawPrecheck.cpp: this PR's indirectRecordsDraw check and #8999's DepthCopyDraw.
    • On GitHub's runners (run), the depth and unit-shadow tests (^agc_driver_depth_, ^agc_driver_unit_shadow, ^agc_unit_shadow), with the other tests built from the changed files: on Linux 60 run, 57 pass 10 runs in a row, 3 unit-shadow tests skip, 0 fail; the expand tests and #8999's agc_driver_depth_copy_draw are among the passes. On Windows 59 run, 29 pass 10 runs in a row and 30 skip without a Vulkan device, 0 fail. The libc and libkernel suites pass on both (142 and 204 tests on Linux, 169 and 217 on Windows), run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • An ^agc sweep (run): Linux 981 run, 917 pass, 64 skip, 0 fail. Windows 1,005 run, 282 pass, 719 skip, 4 fail: agc_submit_progress, agc_submit_progress_no_timeline, agc_driver_pipelined_metadata_pass and agc_driver_pipelined_metadata_pass_draw_pipeline, which also fail on main c9b2660d56 (run).
  • Tekken Dark Resurrection (PPSA31371), by @klosixgaming-arch (comment): this PR merged cleanly onto main 49d1f9b07e and built on Windows (Release, WinLibs), and the title ran for the full 112 s. Its log differed from a main run only within run-to-run noise, with no error added or removed. The visual effect wasn't checked.
  • AMD Radeon 8060S (Strix Halo, RDNA 3.5), RADV, by @Chuk49 (comment): per their report, this PR's 94c49deb18 merged cleanly onto main cb78d89650 and ran against that main on Arch Linux (kernel 7.2.8, Mesa 26.2.2, GCC 16.2.1), with RADV as the only ICD and VK_LAYER_KHRONOS_validation loaded in every Vulkan test. The depth tests and agc_driver_graphics give 41/41 with this PR and 38/38 on main in each of three runs, the three depth expand tests included; the one skip, on both sides, is agc_driver_native_depth_bda_clear. Neither side logs a VUID- line. The full suite gives 2,347/2,348 with this PR and 2,344/2,345 on main; the one failure on both is agc_driver_tessellation, RADV's nir_opt_varyings crash from #5444.
  • 89d7d879da, main 035ac96edd merged in, which brings #9940 (compared host imports). One conflict, in GuestBufferMemory.cpp: this PR's HostImportOverlaps and #9940's ComparedHostImportCovers were both added right after HostImportCovers, and both are kept. Nothing else conflicted, and this PR's changed lines are the same. On GitHub's runners (run), the depth, unit-shadow and host-import tests, with the other tests built from the files the merge changes, ran 10 times each. Linux: 845 run, 830 pass, 15 skip, 0 fail. Windows: 866 run, 741 pass, 125 skip, 0 fail. The libc and libkernel suites pass on both (145 and 210 on Linux, 174 and 231 on Windows), run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • NVIDIA GeForce RTX 5070 Ti on Windows, by @THEMANnt at 89d7d879da against main 035ac96edd (review): fresh builds of both from source, with Vulkan required, shader caching off and VK_LAYER_KHRONOS_validation loaded (the loader logs confirm it was inserted). This PR passes all 9 focused graphics and depth tests, and main the 6 they share, with no skips or failures; neither log has a VUID message. The expand tests still check full 15,360/15,360-texel transfers through the covered read-back and address-based routes.
  • 9894ba7d14, oneandonlydean's merge of main 88e804b0a7, which brings #9717 and #8395. The conflicts were in DrawPrecheck.cpp's includes (this PR's <algorithm> beside main's second DepthSurface.hpp include) and the debt file, where this PR's "Out-of-place DB expand" entry sits beside #8395's reworded GS_FAST_LAUNCH entry; both sides are kept, and this PR's changed lines are the same. On GitHub's runners (run, on 2e1ec328ec, the same merge with those two includes in the other order), the depth, unit-shadow and host-import tests ran 10 times each. Linux: 44 run, 41 pass, 3 skip, 0 fail. Windows: 45 run, 2 pass, 43 skip, 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners. TechLevelZero's NVIDIA bot ran this head merged onto main 88e804b on an RTX 2000 Ada (report): 2,555 passed, 6 failed, none new (3 also fail on main, 3 unstable on main), 45 skipped, with no new validation IDs (975 tests on the GPU).
  • aca3cf0ca5, a merge of main b611e634f7 (×10, every agc test), which brings BunnyFl's #15855 (the sampled depth shadow allocated through the image allocator) and mrfelek's #15783 (moved read-only draw inputs kept within the draw snapshot cap).
    • The conflict: one, in docs/dev/debt/libSceAgcDriver.md, where #15783 extends the "Draw input snapshots" entry next to this PR's "Pending storage-image results under the heaps of an address-based build" entry. The merge keeps both. The code merged without conflicts, DepthSurface.cpp included, which main's #15300, #15301 and #15855 changed. This PR's diff over main is unchanged.
    • ×10: the depth, unit-shadow and host-import tests, with agc_driver_graphics. Linux: 56 run, 52 pass, 4 skip (agc_unit_shadow, agc_driver_unit_shadow, agc_driver_unit_shadow_budget, agc_host_import_sparse), 0 fail. Windows: 60 run, 4 pass, 56 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • Every agc test, once: Linux: 1,336 run, 1,249 pass, 85 skip, 2 fail. Windows: 1,375 run, 412 pass, 963 skip (no Vulkan device), 0 fail. Both failures are main's:
      • agc_driver_image_gather_volume ("the vertex shader was not emitted in the device's module form") fails the same way in main's own linux check on 638187daec, the #15855 merge (job). JJenkx's #15875, merged after b611e634f7, updates the test for the specialized vertex form #14265 emits.
      • agc_driver_pipeline_journal's 120-second timeout (833/1336 Test #1431: agc_driver_pipeline_journal ***Timeout 120.32 sec), main's own cold run.
  • AMD Radeon RX 9070 XT on Windows, by BunnyFl (change request, approval), on aca3cf0ca5 merged onto main 0eba5db30d, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1:
    • The change request (11-05 01:54Z): agc_driver_depth_expand_out_of_place passed 2 of 9 runs and agc_driver_depth_expand_out_of_place_inline 3 of 8. Each failure they read stopped in the same case, address-based buffer copies of a write base across an imported range and a heap-mirrored one: after the depth draw, the read base held 0 of 15,360 texels of the drawn depth. No host import failed, and no VUID- message appeared.
    • Later that day, on the same machine, driver and trees, all 144 runs of the two tests passed:
      • 64 on this PR's head: on main 0eba5db30d with and without the validation layer, and with another process holding 3.3 GB of device memory, and on main 0540ef0ef2;
      • 80 on the print build diag/6146-amd-split-mirrored (b272a98b22) with APS5_TRACE_DEPTH_SYNC=1, 48 of them while another process held 3.3 GB and wrote 3.3 GB, then 9 GB, on the GPU. In all 80 the split cases hold 15,360 of 15,360 texels at the read base, the read base's depth surface is live at every step from the depth draw on, and no [depth-retire] or [depth-texture] line appears.
    • With this PR on main d23df92b38 and VK_LAYER_KHRONOS_validation, the three expand tests, the six depth tests from the change request and agc_driver_graphics pass 10 of 10, with no VUID- message. With main's DrawPrecheck.cpp, the three expand tests abort.
    • The one difference found: the failing logs report a 12,004 MiB VK_EXT_memory_budget budget for the device-local heap, and every later run 15,419 MiB. Holding device memory from another process didn't lower the budget the test sees, so what lowered it, and whether it relates to the failure, isn't known.
    • BunnyFl withdrew the change request and approved at aca3cf0ca5. If the failure comes back on that machine, they'll run the print build and post its log.
  • TechLevelZero's AMD and NVIDIA bots at aca3cf0ca5, both on Linux:
    • AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8), merged onto main b611e63 (report): 2,872 passed, 10 failed, none new (9 also fail on main, 1 unstable on main), 60 skipped, with no new validation IDs (992 tests on the GPU). This PR's three expand tests, agc_driver_depth_expand_out_of_place, agc_driver_depth_expand_out_of_place_inline and agc_driver_depth_expand_review, ran on the GPU with the validation layer and passed; being new, they aren't in main's validation baseline.
    • NVIDIA RTX 2000 Ada (driver 595.99.02), merged onto main acac7c8 (report): 2,890 passed, 6 failed, none new (3 also fail on main, 3 unstable on main), 55 skipped, with no new validation IDs (999 tests on the GPU). This PR's three expand tests, agc_driver_depth_expand_out_of_place, agc_driver_depth_expand_out_of_place_inline and agc_driver_depth_expand_review, ran on the GPU with the validation layer and passed; being new, they aren't in main's validation baseline.
  • e85032327f, a merge of main 090f57166a (×10, every agc test).
    • The conflict: DepthMaintenanceRejection in State.cpp, against stuart-russell's #16058, which narrows the maintenance bits to 0x101c (depth and stencil copy, resummarize and decompress), so reserved DB_RENDER_CONTROL bits 14–31 no longer count. This PR didn't change that mask; it adds the out-of-place expand branch before it. The merge keeps this PR's branch first, then #16058's mask and its resummarize line, and this PR's diff in that function is now the five-line branch.
    • DecodeDepthExpandPass still refuses an out-of-place expand with any other DB_RENDER_CONTROL bit set, reserved bits 14–31 included, as on aca3cf0ca5, while #16058's maintenance check now ignores those bits.
    • ×10: every test matching ^agc_driver_depth_, ^agc_driver_unit_shadow, ^agc_unit_shadow, ^agc_driver_host_import or ^agc_host_import, with agc_driver_graphics. Linux: 56 run, 52 pass, 4 skip (agc_unit_shadow, agc_driver_unit_shadow, agc_driver_unit_shadow_budget and agc_host_import_sparse), 0 fail; agc_driver_depth_expand_out_of_place, agc_driver_depth_expand_review and agc_driver_graphics, which has #16058's reserved-bit cases, pass 10 of 10. Windows: 60 run, 4 pass, 56 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 327 and 344 tests on Linux and 358 and 371 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • Every agc test, once: Windows: 1,424 run, 424 pass, 1,000 skip, 0 fail. Linux: 1,385 run, 1,295 pass, 88 skip, 2 fail:
      • agc_driver_image_depth24 ("image_load of 8_24_UNORM reads the wrong depth for format 141: 0x3effe004 for texel 0x007ff001") also fails on main 090f57166a's own tree (run), and adriadam10's #16807 has since fixed it on main;
      • agc_driver_sgpr_pattern_fill_keys failed once in that 4-wide run ("the dispatch completed 513 times without a pending write over the keys"), then passed 3 of 3 run alone on this head (run) and on main's tree (run).
  • 525ed87a85, a merge of main dd7c8de5de (×10).
    • The conflict: one line in DrawPrecheck.cpp, where oneandonlydean's #17083 passes DrawPipeline::CommitKind::ColorMetadata to the colour-metadata pass's Enqueue, the call whose capture this PR renames to pass = *metadata. The merge keeps both: Enqueue(DrawPipeline::CommitKind::ColorMetadata, [this, localDevice, queueId, opcode, pass = *metadata] {. This PR's other new Enqueue, in DepthExpandReview.cpp's test helper, uses the overload without a kind, which #17083 keeps. This PR's other changed lines are the same, and the debt file differs in context only.
    • ×10: every test matching ^agc_driver_depth_, ^agc_driver_unit_shadow, ^agc_unit_shadow, ^agc_driver_host_import or ^agc_host_import, with agc_driver_graphics and guest_font_graphics. Linux: 57 run, 53 pass, 4 skip (agc_unit_shadow, agc_driver_unit_shadow, agc_driver_unit_shadow_budget and agc_host_import_sparse), 0 fail; agc_driver_depth_expand_out_of_place, agc_driver_depth_expand_out_of_place_inline, agc_driver_depth_expand_review and agc_driver_graphics pass 10 of 10. Windows: 61 run, 4 pass, 57 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 344 and 346 tests on Linux and 375 and 373 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • NVIDIA GeForce RTX 4080 on Windows, by @NathanFahey23 (comment): e85032327f merged with --no-ff onto main c2ea254d0d (clean), Windows 11 Home 10.0.26300, driver 32.0.16.2101, WinLibs GCC 15.2.0, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, no validation layer. Of the tests matching ^(agc_|shader|video_out|guest_video), 1,532 of 1,532 pass with this PR and 1,529 of 1,529 on main, and the three new depth-expand tests pass.
  • NVIDIA GeForce RTX 4070 Ti on Linux and GeForce GT 1030 on Windows, by @milescoviello (comment): e85032327f against its merge base main 090f57166a. They built agc_driver_graphics_tests, agc_driver_prepared_graphics_tests and agc_driver_prepared_unregistered_graphics_tests on each side and ran their tests 3 times each with ctest. Linux (Ubuntu 26.04.1, NVIDIA 615.71.09, GCC 15.2, Release): 52 tests. Windows (a Windows 11 VM, NVIDIA 582.78, WinLibs GCC 15.2 UCRT, Release): 50 tests. Every test passes 3 of 3 on both sides. This PR's three depth-expand tests aren't in that set.
  • 5fda38b35f, a merge of main e907e6d31b (×10, every agc test).
    • The conflict: one, in docs/dev/debt/libSceAgcDriver.md, against zaryabzip's #15868. #15868 replaces the old sceAgcDriverGetHsOffchipParam entry with a sceAgcDriverGetHsOffchipParam, sceAgcDriverSetHsOffchipParam entry further down, and this PR removes the stale "HTILE address of a depth array slice" entry on the next line. The merge drops both lines, so it keeps #15868's new entry and this PR's removal. This PR's changed lines are the same in all 14 files.
    • Depth changes from main: since 525ed87a85, main brought #13023, #15688, #15690, #15707 and #16373, which change DepthSurface.cpp and merged without conflicts, so this merge also ran every agc test once.
    • ×10: the same set as 525ed87a85's. Linux: 57 run, 53 pass, 4 skip (agc_unit_shadow, agc_driver_unit_shadow, agc_driver_unit_shadow_budget and agc_host_import_sparse), 0 fail; agc_driver_depth_expand_out_of_place, agc_driver_depth_expand_out_of_place_inline, agc_driver_depth_expand_review, agc_driver_graphics and guest_font_graphics pass 10 of 10. Windows: 61 run, 4 pass, 57 skip (no Vulkan device), 0 fail.
    • Every agc test, once: Windows: 1,572 run, 478 pass, 1,094 skip (no Vulkan device), 0 fail. Linux: 1,529 run, 1,433 pass, 95 skip, 1 fail: agc_driver_frame_replay_busy_queue ("the replay gave up pacing or released the compute queue while the graphics queue was still copying"). main went red on that test with #12567, which e907e6d31b includes, and adriadam10's #17921 has since fixed it on main.
    • Suites: libc and libkernel run 350 and 348 tests on Linux with 0 failed, and 380 and 375 on Windows. On Windows, libkernel's guest_kernel_resident_fmem_export and guest_kernel_resident_fmem_export_patched fail in both runs. The same harness fails them on main 7259cce111 alone (run), and main's own Windows job passes them, so they come from the verify harness, not this PR. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

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
  • Related: #5499 (DB depth copy into a colour target), #5113 and #5446 (storage writes into a depth plane, the other direction), #5937 (the 0xc0 shape)
  • Unblocks: PPSA01556 #5169 (the blurred first 3D scene)
  • GPUs tested: NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11; lavapipe (Linux), with the validation comparison (llvmpipe, Mesa 25.2.8) on GitHub's runner; AMD Radeon 8060S (RDNA 3.5), RADV, Mesa 26.2.2, Arch Linux, by @Chuk49; NVIDIA GeForce RTX 4080, driver 32.0.16.2101, Windows 11, by @NathanFahey23; NVIDIA GeForce RTX 4070 Ti, NVIDIA 615.71.09, Ubuntu 26.04.1, and GeForce GT 1030, NVIDIA 582.78, a Windows 11 VM, by @milescoviello
  • AI-assisted: yes

Overlap: #6188 (draws compiled ahead of queue 0) rewrites most of DrawPrecheck.cpp, including precheckDraw, where this PR runs the DB expand and the colour-metadata pass as one outcome. Whichever merges second carries the other's change: in #6188's design, a DepthExpand outcome next to MetadataPass, decoded by DecodeDepthExpandPass and run by the executor after the drain. Without one, #6188's ahead classification gets the state-only refusal, so a merge that forgets the expand fails loudly instead of dropping it.

#5925 (resolving ahead) guards only the colour-metadata branch of precheckDraw with resolvingAhead(). Here both passes share one block, so DrawPrecheck.cpp conflicts there, and the guard belongs on that block's first line, where it covers both.

#1395 (DB_RENDER_OVERRIDE depth copies) decodes other bits, so the two decodes don't overlap. If both merge, a draw with both takes the expand, and #1395's copy could write through this PR's plane views and pending notes so that its result reaches guest memory the same way.

#6682 (publish unit-shadow results before an address-based build maps its heaps) also adds a line at the end of UploadFinish in GuestBufferMemory.cpp. Whichever merges second keeps both, with this PR's StoreDepthExpandWrites first.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4865943814 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6146). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T23:29:28Z. --- ### What A draw that sets DB_RENDER_CONTROL's DEPTH_COMPRESS_DISABLE with DB_Z_WRITE_BASE different from DB_Z_READ_BASE is a DB expand. The DB writes the read surface's depth plane, uncompressed and in the same swizzle, at the write base. With DB_DEPTH_CONTROL 0, `DecodeState` took the "always-pass depth/stencil state is rendered without a depth target" path, so the draw drew nothing and the write base kept whatever the CPU had written there. Resident Evil Village (PPSA01556, 01.210.000) issues four such draws per frame in its first 3D scene, then lights, fogs, resolves and blends the scene from the copy. With zeros there, which is the far plane in its reverse Z, the scene renders as soft light discs on black. One of the game's draws, from a register trace at first player control: ``` DB_RENDER_CONTROL 0x00000060 DB_DEPTH_CONTROL 0x00000000 DB_DEPTH_VIEW 0x00000000 DB_Z_INFO 0x20000183 DB_STENCIL_INFO 0x20000181 DB_Z_READ_BASE 0x202a8a0000 DB_Z_WRITE_BASE 0x20298b0000 DB_STENCIL_READ_BASE 0x2029430000 DB_STENCIL_WRITE_BASE 0x2029430000 DB_HTILE_DATA_BASE 0x20293e0000 CB_COLOR_CONTROL 0x00cc0000 CB_TARGET_MASK 0xffffffff CB_SHADER_MASK 0x00000000 PA_SC_AA_CONFIG 0x00108001 ``` That's Z_32_FLOAT, one sample, SW_64KB_Z_X, 1920x2160. All other depth draws in the frame read and write at the same base. - **Recognition:** `DecodeDepthExpandPass` decodes the target with the draw state's own decoder (`depthTargetFor`) and takes exactly this shape: - DEPTH_COMPRESS_DISABLE set, and no bits besides the two compress-disable bits and bit 13. Without a copy bit, COPY_CENTROID and COPY_SAMPLE select nothing and are ignored, so #5937's 0xc0 shape is the same expand; - no depth, stencil or depth-bounds tests, and no colour writes by `ColorWriteMask`'s rule, so an INVALID-format target writes nothing, as for a draw; - a single-sample Z_32_FLOAT or Z_16 SW_64KB_Z_X surface at the view's first slice, without mips or layer exports. Its stencil plane stays in place, is read-only, or moves, with the depth plane or alone; - 64 KiB-aligned bases; - a viewport and scissor covering the surface, by the coverage check the colour-metadata pass uses. - **The copy:** each moving plane of the live depth surface at the read base, with any pending fast clear applied, is copied into the storage image of a view of its write base and marked written: R32F or R16 UNORM SW_64KB_Z_X for the depth plane, and R8 UINT at DB_STENCIL_WRITE_BASE for the stencil plane. A slice of a depth array goes to the same slice of the write base. Sampled views of the write base use that image. Raw and CPU reads store it into guest memory in the Z swizzle, as for any written storage image. - **In order:** the expand runs only from the draw precheck, which decodes it and the colour-metadata pass as one outcome and runs either the same way: it drains the draw pipeline, takes the GPU lock, writes the packet's labels and runs the pass. - The precheck runs on queue 0's packet worker while the draws before it can still be queued for the draw pipeline's committer, which #1202 turned on by default. Recorded ahead of them, the expand's copy read the depth from before them, its repeat check didn't see their writes, and a read surface that a queued draw creates was read from guest memory. The drain, as the colour-metadata passes have (a39261b75c), records the copy after every earlier draw. An indirect expand was already drained before the precheck. - The drain waits only when draws are queued, and at most for the draws the pipeline holds (8 by default); Resident Evil Village issues four expands per frame. - The state-only depth check refuses an out-of-place expand ("is run by the draw precheck, in order, and is not drawn"). A path that classifies a draw from its state alone, without running the pass, reports the expand instead of drawing or skipping it. - **Address-based builds:** they read host-imported heaps in place without storing the results pending there. So the expanded planes still pending in imported write bases are stored ahead of every address-based build (`StoreDepthExpandWrites`). Resident Evil Village's copy shader reads its write base through a V# right after the expand. - Host imports are made per registered range, so a plane can lie across two imports, or across an import and a range that is heap-mirrored or copied. A plane is stored when any existing import overlaps it (`HostImportOverlaps`), not only when one import holds all of it. - When every registered range under the plane has an import, the write-back records the plane on the GPU into each range's import, one segment per range (on `main`, since ea3a2152d). When part of it has no import, the write-back goes through the CPU after a wait for the expand. - The store only looks imports up: it makes and evicts none, so it can't dissolve a cached address space. A plane that no import holds stays noted while it is pending, and `UploadFinish` stores again after the build's own imports, so a build that imports the range itself stores the plane before reading it. When nothing is noted, that second call is a lock and a scan of an empty map. - These builds also skipped the results pending under their own read-only V#s. A read-only V# inside a heap the build maps whole was merged into the heap's region on the per-build path, or dropped inside a base region of the cached address space, so nothing stored what an image had left pending there, and the GPU read the import's older bytes. `UploadFinish` now stores the results pending under every read-only V# of an address-based build, as it already did for written ones. Pointer reads keep the exemption; for them the expand's planes are still stored ahead of every such build, as above. - **Indirect expands:** Resident Evil Village issues its expands as indirect draws. - `DRAW_INDIRECT`, `DRAW_INDEX_INDIRECT` and their multi forms read their count and records on the CPU, as the draw path's CPU route does. - They run the expand when a record draws something, and write nothing otherwise, as does a direct expand, indexed or not, of no vertices, indices or instances. - **No depth surface at the read base yet** (Resident Evil Village does this once during boot): the write base takes DB_DEPTH_CLEAR when an HTILE depth clear of the surface is pending, and otherwise the read base's guest bytes. - **Repeats:** an expand whose plane the write base's image already holds is skipped. The surface's write serial and the image's content version decide that; 7 expands in the test make 3 copies. - **What throws:** every other out-of-place expand, naming the reason: Z_24 or no depth plane, multisampled, other swizzles, mips and layer exports, partial coverage, and one into a live depth surface of the same device or from one of another extent, format or sample count. An in-place expand changes nothing modelled, as before. - **Debt:** a new "Out-of-place DB expand" entry under Unknown function info lists what is inferred and what is left: - the HTILE words aren't read, so an HTILE the CPU or a DMA fill cleared counts as expanded, and an HTILE stencil clear isn't modelled; - the draw's geometry and sample count aren't checked, and its pixel shader never runs; - only one surface form is taken; the others, an expand into a live depth surface and 32-bit integer views of the write base throw; - a guest CPU read after a label reads the bytes from before the expand, as for any pending storage-image result; - none of it is measured on the console. The entry keeps to the gaps, within the 1,000 characters `check_conventions.py` allows. Two things it leaves out: the first expand into a write base uploads bytes that the copy then overwrites (35-47 ms at 1920x2160 on lavapipe, against about 3 ms for a later expand), and a depth surface bound later at the write base without HTILE starts from the expanded plane (`TakeStorage`, #5446), while one bound with HTILE doesn't. "Reused depth storage" stays as on `main`. A second new entry, "Pending storage-image results under the heaps of an address-based build", says what such a build stores and what it leaves to pointer reads. The "HTILE address of a depth array slice" entry goes: since #5111 each slice has its own HTILE. - **Not done here, with the reasons:** - DB_RENDER_OVERRIDE's forced-dirty copies (0x28000000 depth, 0x50000000 stencil) with moving bases: public facts name the bits but not what the DB writes under them, and #1395 takes that path. - Raw reads of the read base after an in-place expand: a raw read (CPU, DMA, address-based copy) of a live single-sample depth surface is stale with or without an expand. That needs coherent read-back of live depth surfaces, a general feature, and a store-back on every in-place expand would cost a full-plane copy per expand. - Storing pending planes before a label becomes CPU-visible: that changes coherence for every pending GPU result, not only expands. - Decoding the guest's HTILE words in the branch with no surface: the copy reads the live surface, which the emulator renders uncompressed, and a pending HTILE clear is already applied. #5627's reader could serve it if a title clears part of an HTILE that way. - Running an indirect expand as an indirect dispatch: the records are read on the CPU, which waits when the GPU wrote them; no title is known to issue indirect expands often. ### Tested - `agc_driver_depth_expand_out_of_place`, an execution test through PM4 using the game's register values: - a depth-only draw writes a gradient into a 160x96 surface; the expand copies it to another base; - the copy is read back through an R32F SW_64KB_Z_X `image_load` and through `GuestMemory::Read`, detiled with the driver's SW_64KB_Z_X equation. - On `main` 9f03c4fe0 the write base holds 0 of 15,360 texels of the depth. With the change it holds 15,360 of 15,360 both ways, with one raster sample and with the game's two (PA_SC_AA_CONFIG 0x00108001). - It also covers: - indirect expands: `DRAW_INDIRECT`, `DRAW_INDEX_INDIRECT`, and a record that draws nothing; - a read base with no depth surface: HTILE-cleared, and plain guest bytes; - buffer and address-based buffer copies of the write base right after the expand; - a repeated expand, which copies only after a change. - `agc_driver_depth_expand_review` checks the expand beyond the game's case: - a surface without a stencil plane; - a drawn stencil plane: its contents are kept, and the read base, stencil and HTILE guest bytes are unchanged; - an in-place expand, and an always-pass draw with equal bases; - a second expand after the surface changed; - a GPU buffer read right after the expand; - one submission expanding to two write bases; - three expands right after a depth draw still queued for the committer, one for each way the expand finds its source: a surface that already exists, a repeat of an expand into the same write base, and a read surface that the queued draw creates. The test holds the committer with a blocking commit, as `agc_driver_pipelined_fill` does for fills, and puts the depth draw and the expand in one submission. On GitHub's Linux runner, with `main`'s `DrawPrecheck.cpp`, each of 10 runs failed all three cases on the texture read of the write base, with the draw queued every time; with the drain, all three passed 20 of 20 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38724834563)). - Six more cases in `agc_driver_depth_expand_out_of_place` copy the write base with address-based programs right after the expand: - Its memory as two registered ranges, both imported (`split-imported-buffer-read`, `split-imported-pointer-read`), or one imported and the other heap-mirrored (`split-mirrored-buffer-read`) or copied (`split-copied-buffer-read`). - Without 103316e332, on `main` and on this branch's base, all four fail: `expanded planes stored ahead of the copies: 0 (expected 1)`, then `0 of 15360 texels hold the read surface's depth` with both ranges imported, or `3072 of 15360` with one mirrored or copied. - With it, all four print 1 and `15360 of 15360`. - On `main`, a temporary print in the write-back showed `DB expand: GPU path, 2 segment(s), 131072 bytes` with both ranges imported. With one mirrored or copied it showed `DB expand: CPU path, 0 segment(s), 65536 bytes`, after that range's own write-back of the other 64 KiB. - Every host import refused (`unimported-mirrored-buffer-read`, `unimported-copied-buffer-read`): these pass with and without 103316e332, because the mirror refresh and the copy store the pending plane themselves. - `address-based-storage-image-read` in `agc_driver_depth_expand_out_of_place` stores a value to every texel of an image with one compute dispatch, then copies the image's bytes through a read-only V# with the address-based copy kernel. It does that twice with different values: the first copy takes the per-build path, the second the cached address space. Without bfcd1839a8 both copies hold 0 of 15360 texels; with it, 15360 of 15360. - `depthExpandPassTests` in `agc_driver_graphics` check the decoder on the game's values and every refusal. - **Completeness follow-ups** (the 9 commits from f2f52d08a to a6005bab04, merged at the head), each red without its change on CI's Linux configuration (lavapipe) and green with it: - `agc_driver_graphics`: the state-only refusal (with it reverted: "an out-of-place DB expand that reached the draw path was not refused"), the 0xc0 shape, an INVALID-format colour target and a non-finite clear (with the old decode: "… with color writes is not implemented"), Z_16 and Z_24, slices and layer exports, and the stencil decode. - `agc_driver_depth_expand_review`, each read through a texture and raw: - a Z_16 surface: 15360 of 15360 through the R16 view and raw, detiled with the 16-bit equation (before: "… of a depth plane other than Z_32_FLOAT is not implemented"); - slice 1 of a two-slice array: 15360 of 15360, while slice 0 keeps the CPU's bytes (before: "… of a depth view with a base slice or a mip level is not implemented"); - a stencil plane moved with the depth plane and alone: the two-value pattern matches 15360 of 15360 through the R8 view and raw (before: "… of the stencil plane is not implemented"). - `agc_driver_depth_expand_out_of_place`: - `direct-indexed`: DRAW_INDEX_2 with no indices, or no instances, keeps 32768 of 32768 dwords the CPU wrote (before: 17408), and a three-index expand matches 15360 of 15360; - `five-range-write-base` (a write base across five registered ranges, as Resident Evil Village's spans five 4 MiB mappings), `compute-queue-read` (an ACB copy), `dma-read` (DMA_DATA), `depth-bind-of-write-base` and `store-without-import-room`: 15360 of 15360 in each check. The last pins the import-neutral store, which no lavapipe run can make fail: every address-based build there imports its ranges itself. - it also runs as `agc_driver_depth_expand_out_of_place_inline`, with `APS5_PIPELINED_DRAWS=0`. - Every commit builds and passes the expand, graphics, BDA, sparse-buffer, address and storage tests from the one that adds them; the expand tests pass 5 of 5 with the pipeline at its default and with it off. - Linux (lavapipe), with CI's flags: - **Merged with `main` d6eafa54d0** (97ad315a0a, the head), which brings #7927's depth mips (whamre). #7927's mip branch now runs inside `depthTargetFor`, which both `decodeDepth` and the expand call. `decodeDepth` keeps `main`'s checks for partially resident depth and stencil, and its own depth-mip refusal goes, as on `main`. The expand still refuses depth mips and mip views itself. - On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39738079453)), the expand tests, `agc_driver_graphics` and the other tests built from the changed files pass 10 runs in a row on Linux. On Windows they build and pass, with the Vulkan tests skipping. `agc_driver_graphics` reports Passed in all 10 Linux runs, so its disabled-colour and expand-decoder cases ran. - An `^agc` sweep on Linux ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39738113987)) fails 1 of 877: `agc_driver_sgpr_pattern_fill_keys`, `main`'s #8715 test, failed once under the sweep's parallel load ("the dispatch completed 17 times without a pending write over the keys") and passes 20 of 20 alone ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39746237167)). It has failed the same way under load on branches without this PR. - **Validation layer, `main` against this PR** (CONTRIBUTING's AGC rule), on one GitHub Linux runner ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39746185816)). Both runs used `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1` and `ctest -V`, with `VK_LOADER_DEBUG=layer` to show the layer loading. The device was llvmpipe (LLVM 20.1.2) on Mesa 25.2.8, Ubuntu 24.04.5, Khronos validation layers 1.3.275. - Tests: `main`'s depth tests, `agc_driver_depth_storage`, `_clear_hle`, `_fast_clear`, `_plane_sampling` and `_htile_write`, with `agc_driver_graphics` and the other tests built from the changed files, on both trees, plus this PR's three expand tests. `main`'s tree ran its set once and this PR's three times. - The loader inserted `VK_LAYER_KHRONOS_validation` 6 times on `main` and 36 with this PR, and neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. - Both logs report the same two messages, `VUID-VkDeviceCreateInfo-pNext-pNext` and `VUID-VkImageCreateInfo-samples-02258`. This PR adds no `VUID-` message. - **Merged with `main` 2f161d4f33** (fa02e9bbe3), which brings #8975's DB depth copies. Both PRs had pulled the CB metadata pass's coverage check out into a helper, so the merge keeps `main`'s `drawCovers` (which also checks `PA_CL_VTE_CNTL`), points the expand's call at it, and drops this PR's `passCovers`. A `DEPTH_COPY` draw still reaches #8975's decoder: the expand's decoder returns nothing unless a compress-disable bit is set. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39600564011)), the depth-expand tests, `agc_driver_graphics` and `agc_driver_depth_storage` pass 5 runs in a row on Linux, with the other tests of that run: 34 in all, none skipped or failed. On Windows 28 of the run's 33 tests pass 5 runs in a row, `agc_driver_graphics` among them, and 5 skip, as the runner has no Vulkan device: the three depth-expand tests, `agc_driver_depth_storage` and `agc_driver_sgpr_pattern_fill_keys`. An `^agc` sweep on Linux ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39600630632)) fails 1 of 865, `agc_driver_sgpr_pattern_fill_keys` under the sweep's parallel load, as on `main`. - **846f0af61f** cuts the "Out-of-place DB expand" debt entry to its gaps and leaves "Reused depth storage" as on `main`, which #8412 also edits, so the two no longer conflict. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39587841006)), Linux: `agc_driver_depth_expand_out_of_place`, its `_inline` run, `agc_driver_depth_expand_review` and `agc_driver_graphics` pass 5 runs in a row, and an `^agc` sweep fails 1 of 851 (57 skipped), `agc_driver_sgpr_pattern_fill_keys` under the sweep's parallel load, as on `main`. The Windows job stopped at `main`'s own MinGW build error in `tests/execution/ImageArrayWindowPastLayerLimit.cpp`, before any test ran; this commit changes only the debt file. - **Merged with `main` 6696def6e6** (dbbcdcd1c0), which brings #6725: the decoder compares the depth write base only when the depth plane is written. With this PR, a split-base draw with a compress-disable control (0x20, 0x40 or 0x60) is an out-of-place expand, so `DepthStencilTests` expects the expand's refusal for those three in its state, and "depth read and written at different addresses" for a depth clear (0x01). - **Merged with `main` a86577e464** (13ad1f4663), which brings #7178's depth clear and #7346's 32-bit depth-bits debt entry. The debt file keeps both of `main`'s entries. The merges before it: `main` f474fb7768 (c053a554a7; `decodeDepth` takes `main`'s DB_RENDER_CONTROL check) and `main` 55f82fee83 (24ec2d46c3; the debt file keeps `main`'s plane-fill entry and drops the HTILE slice entry, as 25594523ae does). On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39096314311)): of the 709 `^agc` tests on Linux, 661, the expand tests among them, pass 3 runs in a row, 48 skip and none fail, and the libc and libkernel suites pass. On Windows the only failures are `agc_driver_pm4_replay_tool` and `agc_shader_replay_tool`, which fail the same way on that runner for an unrelated branch ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39061670036)). - At 25594523ae, on GitHub's runners: `ctest -R '^agc'` ran 604 tests, 1 failed (`agc_driver_preparation_scope_settle`, as on `main`), 41 skipped on Linux, and 598 tests, 1 failed (`agc_driver_pm4_replay_tool`, as on `main`), 466 skipped on Windows ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38751280379)). The expand tests and `agc_driver_graphics` pass 10 runs in a row on Linux, and `agc_driver_graphics` on Windows, whose runner has no Vulkan driver for the others; with the sources of the previous head (d359e15280) the new cases don't build ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38751262263)). - The previous head merges `main` 2e5dd5aa14, which brought #5627, #5554 and #5524's changes to `DepthSurface.cpp`: the HTILE clear, `ApplyFastClear` and surface retirement, which the expand uses. The only conflict was one include block, where `main` dropped a duplicate `GuestMemory.hpp` include next to the two this PR adds. - At the head, on GitHub's Linux runner: `ctest -R '^agc'` ran 603 tests, 1 failed (`agc_driver_preparation_scope_settle`), 41 skipped ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38740954281)). On `main` 2e5dd5aa14 alone: 601 tests, the same one failed, 41 skipped ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38740973645)). The two extra tests are this PR's. The two expand tests and seven others around the code the merge changed passed 10 of 10 at the head ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38740936806)). - On GitHub's Linux runner, `agc_driver_depth_expand_out_of_place` fails with 103316e332's code reverted ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38706864779)), and again with bfcd1839a8's reverted ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38707030190)). With the code, the two expand tests pass 3 of 3, and in the second run so do `agc_driver_graphics`, `agc_driver_bda_device`, `agc_driver_bda_span_reads` and `agc_sparse_buffer_holes`. The libc and libkernel suites pass in every build. - Every commit builds, and the three tests pass at each commit from the one that adds them. - Before the merge of `main` 8856f180ca, in WSL: `ctest -R '^agc'` at 6596a1d3a2 ran 558 tests, 0 failed, 40 skipped (the same 40 as on `main`), and the two expand tests passed 10 of 10. Merged into `main` d92a8dad39: 579 of 579 in two of three runs (41 skipped), the third failing only `agc_driver_preparation_scope_settle`, which also fails on `main`. The full suite there: 1195 of 1201; the other 6 are 5 network tests that need IPv6, which the build VM lacks, and that flake. - At the first fix commit, the game's case also passed under the validation layers with synchronization validation, with no SYNC hazards. - Windows: the full Build workflow on my fork at the head, 25594523ae ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38751301447)): MinGW build, then `ctest`: 1,293 tests, 0 failed: 805 pass and 488 skip, all skips expected by `check_skips.py`. - Windows: the full Build workflow on my fork at 7809e9d443 merged into `main` 8856f180ca, the tree of the head's merge commit ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38721540697)): MinGW build, then `ctest`: 1267 tests, 0 failed, 475 skipped, all expected by `check_skips.py`. `agc_driver_graphics` passed. The workflow carried the runner-image CA-bundle fix (CI only, no source change). The head itself built with MinGW in the sweep's Windows job ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38740954281)), where `ctest -R '^agc'` ran 597 tests: 465 skipped, and 1 failed, `agc_driver_pm4_replay_tool`, which fails the same way on `main` 2e5dd5aa14 in that job (the tool exits 0xc0000139 there). Windows runners have no Vulkan driver, so the expand execution tests are skip stubs there and ran on a GPU separately (next item). - Windows on an NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11 10.0.26300: a MinGW (GCC 15.2.0) Release build, `ANYPS5_REQUIRE_VULKAN=1` with only the NVIDIA driver visible, `ctest -R '^agc_driver_depth_expand_(out_of_place|review)$' --repeat until-fail:5`. - At the head, 25594523ae: `ctest -R '^agc_driver_depth_expand_(out_of_place|out_of_place_inline|review)$|^agc_driver_graphics$' --repeat until-fail:5` passes all four 5 of 5. Every expand case holds 15360 of 15360 in every run: the Z_16 read base within one 16-bit step, and its 16-bit raw read and R16 UNORM texture read; the stencil-only and depth-and-stencil expands (7696 texels of 0x5a and 7664 of 0xa5); slice 1 of a depth array, with slice 0 keeping the CPU's bytes; and the queued-draw, two-write-base, in-place and always-pass cases. - On b7b1ca2ee2's tree (67ab3167d9, identical to it), before the merge of `main` 8856f180ca and the drain, merged with #5815's follow-up for one combined run, both pass 5 of 5. The four split cases print `expanded planes stored ahead of the copies: 1 (expected 1)` and `15360 of 15360`, and the address-based storage-image read prints `15360 of 15360 texels hold it` for both copies, through the cached address space and without it. - The tolerance change (a4137dc3f1) fixes a failure this PR had on that GPU. At e252c03bc6, `agc_driver_depth_expand_review` failed 3 of 3 with `second expand: second read base: 15358 of 15360 texels hold the drawn depth`. - That line is the test's own check that its depth draw wrote the gradient, before any expand. The expand's copies matched. - The two far-corner texels of the second gradient (offset 0.5), (158, 95) and (159, 95), came back 4.05e-6 and 4.11e-6 low: 68 and 69 ulps at 0.875. The test allowed a fixed 4e-6, which lavapipe always met exactly. - Both expand tests now accept half the gradient's step in x (0.5 / 65536, about 7.6e-6). A read of the wrong texel is still a full step off. - **Resident Evil Village** (PPSA01556, 01.210.000) on an NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11 10.0.26300, Ryzen 9 5900HS, 15.4 GB: - **Setup:** - `main` 23be5a02b, plus #5113 and #5111 (merged since; this change builds on both); - plus this change, as it was before its explanatory code comments were removed (the code is the same). - Resident Evil Village also needs local commits to reach its first 3D scene on this PC: #5851, #5815, #5703 and #5671; red-zone leaf framing in the relinker (from #5052 and #5640, which has merged since); first-draw shader preparation, title-stage experiments and frame-trace logging. - **Without the change:** - the title screen is a dark silhouette in fog; - the first 3D scene shows only soft light discs at first player control; - the copy at 0x20298b0000 holds the zeros the CPU wrote at boot. - **With it:** - both of the game's expand forms run, one line each, with no refusal: `[gpu] DB expand: the depth plane of 0x202a8a0000 (1920x2160) is written at 0x20298b0000` and, once during boot, `[gpu] DB expand: 0x202a8a0000 (1920x2160) has no depth surface; its guest bytes are written at 0x20298b0000`; - the title is lit (mean brightness 101.4 against 61.0), and the first 3D scene renders sharp at first player control; - Continue to first control took 5.6 min, against about 16 min without the change; most likely the scene's fade-in had been running on zero depth. - **Raw reads of the write base:** in that run, two compute copies that read the write base as a raw buffer still saw zeros, while the sampled reads that the lighting uses were correct. - A memory trace on the same setup (which carried #5851, since closed) shows why. The write base 0x20298b0000+0xff0000 spans five separate 4 MiB direct mappings, from 0x2029800000 to 0x202a800000, so it crosses four mapping edges and more than one host import holds the plane. - 103316e332 stores such a plane (above), and the split cases reproduce the game's case. - **Again at this head (25594523ae), 2026-10-15,** on `main` 2e5dd5aa14 with the local commits Resident Evil Village needs on this PC (the merge with this change is clean), with `APS5_LAZY_SHADER_PREPARE=1 APS5_HOST_IMPORT_MIB=6400 APS5_NO_GPL=1`: - the main menu is lit: mean brightness 48.6 with this change against 34.2 without it, at the same camera point (measured as for the title above); - the scarecrow's cloth is textured, the sky is lit, and the foreground grass and branches show detail. Without the change the scarecrow is a black silhouette and the foreground is dark; - both expand forms log once each, for 0x202a8a0000 (1920x2160) at 0x20298b0000, as above. Without the change neither logs; - the run has no fatal error, access violation, termination, null image or invalid runtime value. - **Again at 89d7d879da, 2026-10-28,** at first player control after Continue. Both trees are `main` 04fefebe90 with #11580 merged locally and a local one-line `scePadOpen` change for ports 3 and 4, one with this change and one without. Environment `APS5_LAZY_SHADER_PREPARE=1 APS5_NO_GPL=1 APS5_HOST_IMPORT_MIB=6000`, unprofiled, one boot each, clocks not held, 0.3–0.5 fps at the shot: - without the change the scene at the "R Look" prompt is three out-of-focus glows. With it, the lamp, the pendant lights, the shelving and the lit lampshade in the foreground are drawn: | Without this PR | With this PR | |---|---| | ![First player control without this PR](https://raw.githubusercontent.com/EagleBearerYS/AnyPS5/371a593bdd9cb8300fc57b278328f60262cbf0f9/discussions/5169/2026-10-28/01-first-control-main-04fefebe90-11580.png) | ![First player control with this PR](https://raw.githubusercontent.com/EagleBearerYS/AnyPS5/371a593bdd9cb8300fc57b278328f60262cbf0f9/discussions/5169/2026-10-28/02-first-control-6146-89d7d879da-11580.png) | - both expand forms log once each, as above; without the change neither logs; - **Host memory:** at first control, host heap 1 held 1,101 MiB beyond the 5,999 MiB of live host imports with this change, against 969 MiB without it. That's 132 MiB more, from one pair. Readings at a 6400 MiB import setting, taken at different points of the boot, put the gap at 110 to 280 MiB. The two places where this change stores pending results to guest memory (expand write bases, and the read ranges of address-based builds) stored 12 distinct images, 50.1 MiB, in a traced boot. The source of the rest isn't found yet; - **At `APS5_HOST_IMPORT_MIB=6400`:** 2 of 5 boots with this change and 0 of 3 without it aborted in the intro. Each time, a host import failed at `vkAllocateMemory` (-2), and then a compute dispatch stopped on "AGC graphics: guest buffer has no GPU owner". That's `main`'s path for a failed host-import join, which a tighter heap reaches. The two traced boots with this change passed the intro. - **2c8eaec716, `main` 11f976b27c merged in**, which brings #8099 (a stencil clear on a target without a stencil plane is ignored) and #8871. This PR moves `decodeDepth`'s target decoding into `depthTargetFor`, and #8099 changed two lines of the old `decodeDepth`. The merge applies #8099's two lines to this PR's `decodeDepth`: `stencilClear` is read only when the target has a stencil plane, and the writable-plane check no longer repeats `stencil`. Main's other hunks merged unchanged. The PR's own diff differs from before the merge only in those two lines. On GitHub's runners: - **Tests** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39817856941)): `agc_driver_graphics`, which holds #8099's case, and the depth expand, depth storage and depth clear tests pass 10 of 10 on Linux, none skipped. On Windows they build and pass, with 8 skipping without a Vulkan device. This PR's tests don't build against `main`'s code, so the red is the one above. - **Validation, `main` against this head** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39817933566)), on one GitHub Linux runner: the loader inserted `VK_LAYER_KHRONOS_validation` 6 times on `main` and 12 with this PR, and neither log has `was not found`. Both logs report the same two messages, `VUID-VkDeviceCreateInfo-pNext-pNext` and `VUID-VkImageCreateInfo-samples-02258`, so this PR adds no `VUID-` message. - **Suites:** libc and libkernel pass on both runners. The libc and libkernel suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **dbaad7ace3, `main` 0db47b263d merged in**, which brings #6946's draw finisher pipeline with its pipelined CB metadata pass. `precheckDraw` keeps this PR's shared block for a metadata pass or a depth expand, and #6946's pipelined path runs inside it for metadata passes only. A depth expand still drains the queue and records inline, as before. Both includes are kept. - **Tests** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39907779831)): this PR's depth expand tests, #6946's `agc_driver_pipelined_metadata_pass`, `agc_metadata_pass` and the draw pipeline trace tests pass 10 of 10 on Linux, none skipped. An `^agc` sweep on Linux passes ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39907816582)). - **Windows:** on our verify's Windows build, which compiles `tests/execution`, `main`'s `agc_driver_pipelined_metadata_pass` and `agc_driver_pipelined_metadata_pass_draw_pipeline` (from #6946) fail at `vkCreateInstance` (-9) on GitHub's device-less runner, before this PR's code; upstream's Windows job builds them as skipped stubs. The rest build and pass there, with the Vulkan tests skipping. - **Suites:** libc and libkernel pass on both runners. The libc and libkernel suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - `python3 tools/check_conventions.py --base origin/main`: passed. - **dd34282b4e, `main` 44a59edc3a merged in**, which brings #6682. One conflict, in `GuestBufferMemory.cpp`'s upload loop, where both PRs add a flush after the regions are copied: this PR's depth expand stores and #6682's unit-shadow publish for address-based heaps. Both are kept, this PR's first. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39926156592)), of the depth expand tests, `agc_metadata_pass` and #6682's unit-shadow tests, 33 pass 10 runs in a row on Linux and 3 of the unit-shadow tests skip there; on Windows 35 build, 27 pass 10 runs in a row, and 8 skip: those 3, and 5 that need a Vulkan device. The libc and libkernel suites pass on both, run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **9f70521a8a, `main` e5ca7307cf merged in**, which brings #6292's draw-path locks. One conflict, in `DepthSurface.cpp`'s includes: this branch's `GuestBufferMemory.hpp` and `ShaderResources.hpp` and #6292's `Mutex.hpp`, all kept. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39935441810)), of the depth expand tests, `agc_metadata_pass` and #6682's unit-shadow tests, 33 pass 10 runs in a row on Linux and 3 of the unit-shadow tests skip there; on Windows 35 build, 27 pass 10 runs in a row, and 8 skip: those 3, and 5 that need a Vulkan device. The libc and libkernel suites pass on both, run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **94c49deb18, `main` c9b75825f3 merged in**, which brings #8999's DB depth copy draws (milescoviello). Four conflicts, each resolved by keeping both sides' changes: - `State.cpp`: #8999 moves `decodeDepth`'s depth-plane decoding into `decodeDepthPlane`. The expand's decoder now calls it too, and sets the clear values from `DB_DEPTH_CLEAR` and `DB_STENCIL_CLEAR` after it, as `decodeDepth` does. - `DepthSurface.hpp`: this PR's expand-pass declarations and #8999's `DepthCopySourceWords` and `DepthCopySourceScope`. `CopyDepthSample`, which #8999 removes, stays removed. - `VulkanDevice.hpp`: this PR's `DepthExpandPass`. `VulkanDevice::DepthCopyPass`, which #8999 removes, stays removed. - `DrawPrecheck.cpp`: this PR's `indirectRecordsDraw` check and #8999's `DepthCopyDraw`. - On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40107950518)), the depth and unit-shadow tests (`^agc_driver_depth_`, `^agc_driver_unit_shadow`, `^agc_unit_shadow`), with the other tests built from the changed files: on Linux 60 run, 57 pass 10 runs in a row, 3 unit-shadow tests skip, 0 fail; the expand tests and #8999's `agc_driver_depth_copy_draw` are among the passes. On Windows 59 run, 29 pass 10 runs in a row and 30 skip without a Vulkan device, 0 fail. The libc and libkernel suites pass on both (142 and 204 tests on Linux, 169 and 217 on Windows), run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - An `^agc` sweep ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40108007241)): Linux 981 run, 917 pass, 64 skip, 0 fail. Windows 1,005 run, 282 pass, 719 skip, 4 fail: `agc_submit_progress`, `agc_submit_progress_no_timeline`, `agc_driver_pipelined_metadata_pass` and `agc_driver_pipelined_metadata_pass_draw_pipeline`, which also fail on `main` c9b2660d56 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40109333265)). - **Tekken Dark Resurrection (PPSA31371), by @klosixgaming-arch** ([comment](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6405120671)): this PR merged cleanly onto `main` 49d1f9b07e and built on Windows (Release, WinLibs), and the title ran for the full 112 s. Its log differed from a `main` run only within run-to-run noise, with no error added or removed. The visual effect wasn't checked. - **AMD Radeon 8060S (Strix Halo, RDNA 3.5), RADV, by @Chuk49** ([comment](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6412725009)): per their report, this PR's 94c49deb18 merged cleanly onto `main` cb78d89650 and ran against that `main` on Arch Linux (kernel 7.2.8, Mesa 26.2.2, GCC 16.2.1), with RADV as the only ICD and `VK_LAYER_KHRONOS_validation` loaded in every Vulkan test. The depth tests and `agc_driver_graphics` give 41/41 with this PR and 38/38 on `main` in each of three runs, the three depth expand tests included; the one skip, on both sides, is `agc_driver_native_depth_bda_clear`. Neither side logs a `VUID-` line. The full suite gives 2,347/2,348 with this PR and 2,344/2,345 on `main`; the one failure on both is `agc_driver_tessellation`, RADV's `nir_opt_varyings` crash from #5444. - **89d7d879da, `main` 035ac96edd merged in**, which brings #9940 (compared host imports). One conflict, in `GuestBufferMemory.cpp`: this PR's `HostImportOverlaps` and #9940's `ComparedHostImportCovers` were both added right after `HostImportCovers`, and both are kept. Nothing else conflicted, and this PR's changed lines are the same. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40326433732)), the depth, unit-shadow and host-import tests, with the other tests built from the files the merge changes, ran 10 times each. Linux: 845 run, 830 pass, 15 skip, 0 fail. Windows: 866 run, 741 pass, 125 skip, 0 fail. The libc and libkernel suites pass on both (145 and 210 on Linux, 174 and 231 on Windows), run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **NVIDIA GeForce RTX 5070 Ti on Windows**, by @THEMANnt at 89d7d879da against `main` 035ac96edd ([review](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5657391987)): fresh builds of both from source, with Vulkan required, shader caching off and `VK_LAYER_KHRONOS_validation` loaded (the loader logs confirm it was inserted). This PR passes all 9 focused graphics and depth tests, and `main` the 6 they share, with no skips or failures; neither log has a `VUID` message. The expand tests still check full 15,360/15,360-texel transfers through the covered read-back and address-based routes. - **9894ba7d14, oneandonlydean's merge of `main` 88e804b0a7**, which brings #9717 and #8395. The conflicts were in `DrawPrecheck.cpp`'s includes (this PR's `<algorithm>` beside `main`'s second `DepthSurface.hpp` include) and the debt file, where this PR's "Out-of-place DB expand" entry sits beside #8395's reworded GS_FAST_LAUNCH entry; both sides are kept, and this PR's changed lines are the same. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41411996117), on 2e1ec328ec, the same merge with those two includes in the other order), the depth, unit-shadow and host-import tests ran 10 times each. Linux: 44 run, 41 pass, 3 skip, 0 fail. Windows: 45 run, 2 pass, 43 skip, 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. TechLevelZero's NVIDIA bot ran this head merged onto `main` 88e804b on an RTX 2000 Ada ([report](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6577053617)): 2,555 passed, 6 failed, none new (3 also fail on `main`, 3 unstable on `main`), 45 skipped, with no new validation IDs (975 tests on the GPU). - **aca3cf0ca5, a merge of `main` b611e634f7** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41909188784), [every `agc` test](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41909362002)), which brings BunnyFl's #15855 (the sampled depth shadow allocated through the image allocator) and mrfelek's #15783 (moved read-only draw inputs kept within the draw snapshot cap). - **The conflict:** one, in `docs/dev/debt/libSceAgcDriver.md`, where #15783 extends the "Draw input snapshots" entry next to this PR's "Pending storage-image results under the heaps of an address-based build" entry. The merge keeps both. The code merged without conflicts, `DepthSurface.cpp` included, which `main`'s #15300, #15301 and #15855 changed. This PR's diff over `main` is unchanged. - **×10:** the depth, unit-shadow and host-import tests, with `agc_driver_graphics`. Linux: 56 run, 52 pass, 4 skip (`agc_unit_shadow`, `agc_driver_unit_shadow`, `agc_driver_unit_shadow_budget`, `agc_host_import_sparse`), 0 fail. Windows: 60 run, 4 pass, 56 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **Every `agc` test, once:** Linux: 1,336 run, 1,249 pass, 85 skip, 2 fail. Windows: 1,375 run, 412 pass, 963 skip (no Vulkan device), 0 fail. Both failures are `main`'s: - `agc_driver_image_gather_volume` ("the vertex shader was not emitted in the device's module form") fails the same way in `main`'s own `linux` check on 638187daec, the #15855 merge ([job](https://github.com/boykopovar/AnyPS5/actions/runs/41906999149/job/126869200694)). JJenkx's #15875, merged after b611e634f7, updates the test for the specialized vertex form #14265 emits. - `agc_driver_pipeline_journal`'s 120-second timeout (`833/1336 Test #1431: agc_driver_pipeline_journal ***Timeout 120.32 sec`), `main`'s own cold run. - **AMD Radeon RX 9070 XT on Windows, by BunnyFl** ([change request](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5778711710), [approval](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5786072915)), on aca3cf0ca5 merged onto `main` 0eba5db30d, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`: - **The change request (11-05 01:54Z):** `agc_driver_depth_expand_out_of_place` passed 2 of 9 runs and `agc_driver_depth_expand_out_of_place_inline` 3 of 8. Each failure they read stopped in the same case, address-based buffer copies of a write base across an imported range and a heap-mirrored one: after the depth draw, the read base held 0 of 15,360 texels of the drawn depth. No host import failed, and no `VUID-` message appeared. - **Later that day,** on the same machine, driver and trees, all 144 runs of the two tests passed: - 64 on this PR's head: on `main` 0eba5db30d with and without the validation layer, and with another process holding 3.3 GB of device memory, and on `main` 0540ef0ef2; - 80 on the print build `diag/6146-amd-split-mirrored` (b272a98b22) with `APS5_TRACE_DEPTH_SYNC=1`, 48 of them while another process held 3.3 GB and wrote 3.3 GB, then 9 GB, on the GPU. In all 80 the split cases hold 15,360 of 15,360 texels at the read base, the read base's depth surface is live at every step from the depth draw on, and no `[depth-retire]` or `[depth-texture]` line appears. - With this PR on `main` d23df92b38 and `VK_LAYER_KHRONOS_validation`, the three expand tests, the six depth tests from the change request and `agc_driver_graphics` pass 10 of 10, with no `VUID-` message. With `main`'s `DrawPrecheck.cpp`, the three expand tests abort. - **The one difference found:** the failing logs report a 12,004 MiB `VK_EXT_memory_budget` budget for the device-local heap, and every later run 15,419 MiB. Holding device memory from another process didn't lower the budget the test sees, so what lowered it, and whether it relates to the failure, isn't known. - BunnyFl withdrew the change request and approved at aca3cf0ca5. If the failure comes back on that machine, they'll run the print build and post its log. - **TechLevelZero's AMD and NVIDIA bots at aca3cf0ca5,** both on Linux: - AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8), merged onto `main` b611e63 ([report](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6645243866)): 2,872 passed, 10 failed, none new (9 also fail on `main`, 1 unstable on `main`), 60 skipped, with no new validation IDs (992 tests on the GPU). This PR's three expand tests, `agc_driver_depth_expand_out_of_place`, `agc_driver_depth_expand_out_of_place_inline` and `agc_driver_depth_expand_review`, ran on the GPU with the validation layer and passed; being new, they aren't in `main`'s validation baseline. - NVIDIA RTX 2000 Ada (driver 595.99.02), merged onto `main` acac7c8 ([report](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6648522624)): 2,890 passed, 6 failed, none new (3 also fail on `main`, 3 unstable on `main`), 55 skipped, with no new validation IDs (999 tests on the GPU). This PR's three expand tests, `agc_driver_depth_expand_out_of_place`, `agc_driver_depth_expand_out_of_place_inline` and `agc_driver_depth_expand_review`, ran on the GPU with the validation layer and passed; being new, they aren't in `main`'s validation baseline. - **e85032327f, a merge of `main` 090f57166a** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42376098230), [every `agc` test](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42376113537)). - **The conflict:** `DepthMaintenanceRejection` in `State.cpp`, against stuart-russell's #16058, which narrows the maintenance bits to `0x101c` (depth and stencil copy, resummarize and decompress), so reserved DB_RENDER_CONTROL bits 14–31 no longer count. This PR didn't change that mask; it adds the out-of-place expand branch before it. The merge keeps this PR's branch first, then #16058's mask and its resummarize line, and this PR's diff in that function is now the five-line branch. - `DecodeDepthExpandPass` still refuses an out-of-place expand with any other DB_RENDER_CONTROL bit set, reserved bits 14–31 included, as on aca3cf0ca5, while #16058's maintenance check now ignores those bits. - **×10:** every test matching `^agc_driver_depth_`, `^agc_driver_unit_shadow`, `^agc_unit_shadow`, `^agc_driver_host_import` or `^agc_host_import`, with `agc_driver_graphics`. Linux: 56 run, 52 pass, 4 skip (`agc_unit_shadow`, `agc_driver_unit_shadow`, `agc_driver_unit_shadow_budget` and `agc_host_import_sparse`), 0 fail; `agc_driver_depth_expand_out_of_place`, `agc_driver_depth_expand_review` and `agc_driver_graphics`, which has #16058's reserved-bit cases, pass 10 of 10. Windows: 60 run, 4 pass, 56 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 327 and 344 tests on Linux and 358 and 371 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **Every `agc` test, once:** Windows: 1,424 run, 424 pass, 1,000 skip, 0 fail. Linux: 1,385 run, 1,295 pass, 88 skip, 2 fail: - `agc_driver_image_depth24` ("image_load of 8_24_UNORM reads the wrong depth for format 141: 0x3effe004 for texel 0x007ff001") also fails on `main` 090f57166a's own tree ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42389027833)), and adriadam10's #16807 has since fixed it on `main`; - `agc_driver_sgpr_pattern_fill_keys` failed once in that 4-wide run ("the dispatch completed 513 times without a pending write over the keys"), then passed 3 of 3 run alone on this head ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42380783157)) and on `main`'s tree ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42389027833)). - **525ed87a85, a merge of `main` dd7c8de5de** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42510520221)). - **The conflict:** one line in `DrawPrecheck.cpp`, where oneandonlydean's #17083 passes `DrawPipeline::CommitKind::ColorMetadata` to the colour-metadata pass's `Enqueue`, the call whose capture this PR renames to `pass = *metadata`. The merge keeps both: `Enqueue(DrawPipeline::CommitKind::ColorMetadata, [this, localDevice, queueId, opcode, pass = *metadata] {`. This PR's other new `Enqueue`, in `DepthExpandReview.cpp`'s test helper, uses the overload without a kind, which #17083 keeps. This PR's other changed lines are the same, and the debt file differs in context only. - **×10:** every test matching `^agc_driver_depth_`, `^agc_driver_unit_shadow`, `^agc_unit_shadow`, `^agc_driver_host_import` or `^agc_host_import`, with `agc_driver_graphics` and `guest_font_graphics`. Linux: 57 run, 53 pass, 4 skip (`agc_unit_shadow`, `agc_driver_unit_shadow`, `agc_driver_unit_shadow_budget` and `agc_host_import_sparse`), 0 fail; `agc_driver_depth_expand_out_of_place`, `agc_driver_depth_expand_out_of_place_inline`, `agc_driver_depth_expand_review` and `agc_driver_graphics` pass 10 of 10. Windows: 61 run, 4 pass, 57 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 344 and 346 tests on Linux and 375 and 373 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **NVIDIA GeForce RTX 4080 on Windows, by @NathanFahey23** ([comment](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6716526572)): e85032327f merged with `--no-ff` onto `main` c2ea254d0d (clean), Windows 11 Home 10.0.26300, driver 32.0.16.2101, WinLibs GCC 15.2.0, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, no validation layer. Of the tests matching `^(agc_|shader|video_out|guest_video)`, 1,532 of 1,532 pass with this PR and 1,529 of 1,529 on `main`, and the three new depth-expand tests pass. - **NVIDIA GeForce RTX 4070 Ti on Linux and GeForce GT 1030 on Windows, by @milescoviello** ([comment](https://github.com/boykopovar/AnyPS5/pull/6146#issuecomment-6730298201)): e85032327f against its merge base `main` 090f57166a. They built `agc_driver_graphics_tests`, `agc_driver_prepared_graphics_tests` and `agc_driver_prepared_unregistered_graphics_tests` on each side and ran their tests 3 times each with `ctest`. Linux (Ubuntu 26.04.1, NVIDIA 615.71.09, GCC 15.2, Release): 52 tests. Windows (a Windows 11 VM, NVIDIA 582.78, WinLibs GCC 15.2 UCRT, Release): 50 tests. Every test passes 3 of 3 on both sides. This PR's three depth-expand tests aren't in that set. - **5fda38b35f, a merge of `main` e907e6d31b** ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42703507605), [every `agc` test](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42703601955)). - **The conflict:** one, in `docs/dev/debt/libSceAgcDriver.md`, against zaryabzip's #15868. #15868 replaces the old `sceAgcDriverGetHsOffchipParam` entry with a `sceAgcDriverGetHsOffchipParam, sceAgcDriverSetHsOffchipParam` entry further down, and this PR removes the stale "HTILE address of a depth array slice" entry on the next line. The merge drops both lines, so it keeps #15868's new entry and this PR's removal. This PR's changed lines are the same in all 14 files. - **Depth changes from `main`:** since 525ed87a85, `main` brought #13023, #15688, #15690, #15707 and #16373, which change `DepthSurface.cpp` and merged without conflicts, so this merge also ran every `agc` test once. - **×10:** the same set as 525ed87a85's. Linux: 57 run, 53 pass, 4 skip (`agc_unit_shadow`, `agc_driver_unit_shadow`, `agc_driver_unit_shadow_budget` and `agc_host_import_sparse`), 0 fail; `agc_driver_depth_expand_out_of_place`, `agc_driver_depth_expand_out_of_place_inline`, `agc_driver_depth_expand_review`, `agc_driver_graphics` and `guest_font_graphics` pass 10 of 10. Windows: 61 run, 4 pass, 57 skip (no Vulkan device), 0 fail. - **Every `agc` test, once:** Windows: 1,572 run, 478 pass, 1,094 skip (no Vulkan device), 0 fail. Linux: 1,529 run, 1,433 pass, 95 skip, 1 fail: `agc_driver_frame_replay_busy_queue` ("the replay gave up pacing or released the compute queue while the graphics queue was still copying"). `main` went red on that test with #12567, which e907e6d31b includes, and adriadam10's #17921 has since fixed it on `main`. - **Suites:** libc and libkernel run 350 and 348 tests on Linux with 0 failed, and 380 and 375 on Windows. On Windows, libkernel's `guest_kernel_resident_fmem_export` and `guest_kernel_resident_fmem_export_patched` fail in both runs. The same harness fails them on `main` 7259cce111 alone ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42693594401)), and `main`'s own Windows job passes them, so they come from the verify harness, not this PR. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Related: #5499 (DB depth copy into a colour target), #5113 and #5446 (storage writes into a depth plane, the other direction), #5937 (the 0xc0 shape) - [x] Unblocks: PPSA01556 #5169 (the blurred first 3D scene) - [x] GPUs tested: NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11; lavapipe (Linux), with the validation comparison (llvmpipe, Mesa 25.2.8) on GitHub's runner; AMD Radeon 8060S (RDNA 3.5), RADV, Mesa 26.2.2, Arch Linux, by @Chuk49; NVIDIA GeForce RTX 4080, driver 32.0.16.2101, Windows 11, by @NathanFahey23; NVIDIA GeForce RTX 4070 Ti, NVIDIA 615.71.09, Ubuntu 26.04.1, and GeForce GT 1030, NVIDIA 582.78, a Windows 11 VM, by @milescoviello - [x] AI-assisted: yes Overlap: #6188 (draws compiled ahead of queue 0) rewrites most of `DrawPrecheck.cpp`, including `precheckDraw`, where this PR runs the DB expand and the colour-metadata pass as one outcome. Whichever merges second carries the other's change: in #6188's design, a `DepthExpand` outcome next to `MetadataPass`, decoded by `DecodeDepthExpandPass` and run by the executor after the drain. Without one, #6188's ahead classification gets the state-only refusal, so a merge that forgets the expand fails loudly instead of dropping it. #5925 (resolving ahead) guards only the colour-metadata branch of `precheckDraw` with `resolvingAhead()`. Here both passes share one block, so `DrawPrecheck.cpp` conflicts there, and the guard belongs on that block's first line, where it covers both. #1395 (DB_RENDER_OVERRIDE depth copies) decodes other bits, so the two decodes don't overlap. If both merge, a draw with both takes the expand, and #1395's copy could write through this PR's plane views and pending notes so that its result reaches guest memory the same way. #6682 (publish unit-shadow results before an address-based build maps its heaps) also adds a line at the end of `UploadFinish` in `GuestBufferMemory.cpp`. Whichever merges second keeps both, with this PR's `StoreDepthExpandWrites` first.
THEMANnt commented 2026-10-26 12:53:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T12:53:58Z.

Review: COMMENTED


Reviewed 94c49deb1801efefd7f2a421a8398bfc3d83b4ac against c9b75825f383e16a85d1859c2a18061a3a7e9beb. Focused tests pass; no actionable finding in the tested paths. Final approval remains pending merge-conflict resolution.

The changed decoder, ordered draw-precheck routing, depth/stencil plane copies and pending-write integration are consistent with the tested behavior. Unsupported layouts and states are explicitly refused, and the remaining console/coherence gaps stay documented in the debt note.

Validation: Built both exact revisions with matching third-party commit pins on Windows, NVIDIA GeForce RTX 5070 Ti, driver 616.92. The PR passes 9/9 focused tests with zero skips: graphics, depth clear HLE, out-of-place depth expand, depth expand review, fast clear, HTILE write, plane sampling, depth storage and the inline depth-expand variant. The base passes all 6/6 common tests with zero skips. Both runs require Vulkan, disable shader caching and load VK_LAYER_KHRONOS_validation 1.4.363; loader logs confirm insertion. Neither log contains a VUID- message, so the PR adds none in this comparison. The expand cases verify complete 15360/15360 transfers across direct/indirect, raw/address-based and other covered routes. Source conventions and whitespace checks pass.

Scope: Real source-built NVIDIA Vulkan execution; no full repository suite, AMD/RADV run, game/console test, performance claim or independently rerun mutation control. GitHub now reports merge conflicts on this unchanged head. Resolve them and validate the resulting revision before final approval; the successful pinned-head tests above do not establish the result of a future conflict resolution.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5652264406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5652264406). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-26T12:53:58Z. **Review:** COMMENTED --- Reviewed `94c49deb1801efefd7f2a421a8398bfc3d83b4ac` against `c9b75825f383e16a85d1859c2a18061a3a7e9beb`. Focused tests pass; no actionable finding in the tested paths. Final approval remains pending merge-conflict resolution. The changed decoder, ordered draw-precheck routing, depth/stencil plane copies and pending-write integration are consistent with the tested behavior. Unsupported layouts and states are explicitly refused, and the remaining console/coherence gaps stay documented in the debt note. **Validation:** Built both exact revisions with matching third-party commit pins on Windows, NVIDIA GeForce RTX 5070 Ti, driver 616.92. The PR passes 9/9 focused tests with zero skips: graphics, depth clear HLE, out-of-place depth expand, depth expand review, fast clear, HTILE write, plane sampling, depth storage and the inline depth-expand variant. The base passes all 6/6 common tests with zero skips. Both runs require Vulkan, disable shader caching and load VK_LAYER_KHRONOS_validation 1.4.363; loader logs confirm insertion. Neither log contains a VUID- message, so the PR adds none in this comparison. The expand cases verify complete 15360/15360 transfers across direct/indirect, raw/address-based and other covered routes. Source conventions and whitespace checks pass. **Scope:** Real source-built NVIDIA Vulkan execution; no full repository suite, AMD/RADV run, game/console test, performance claim or independently rerun mutation control. GitHub now reports merge conflicts on this unchanged head. Resolve them and validate the resulting revision before final approval; the successful pinned-head tests above do not establish the result of a future conflict resolution.
THEMANnt commented 2026-10-26 18:54:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T18:54:20Z.

Review: APPROVED


Reviewed 89d7d879da49f7a6026d7dfb1880ea8af3d88244 against 035ac96edd092773a5ba0131453de80084a23533. Approve; the conflict blocking my earlier review is resolved.

The merge retains both this PR's HostImportOverlaps and main's ComparedHostImportCovers. I checked the combined merge diff and the ordered expand/write-back integration, then rebuilt the updated source rather than carrying forward the old-head test result.

Validation: Fresh exact-source Windows builds with verified matching third-party pins. On NVIDIA RTX 5070 Ti, the candidate passes all 9 focused graphics/depth tests; the base passes all 6 common tests, with zero skips or failures. Both runs require Vulkan, disable shader caching and load VK_LAYER_KHRONOS_validation; loader logs confirm actual insertion, and neither log contains a VUID message. The expand tests still verify complete 15,360/15,360-texel transfers through the covered read-back and address-based routes.

This supersedes the earlier conflict-pending comment. Validation covers the focused modeled behavior; no new game, AMD/RADV, performance or console measurement is claimed. Documented coherence and unsupported-layout limits remain.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5657391987 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5657391987). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-26T18:54:20Z. **Review:** APPROVED --- Reviewed `89d7d879da49f7a6026d7dfb1880ea8af3d88244` against `035ac96edd092773a5ba0131453de80084a23533`. Approve; the conflict blocking my earlier review is resolved. The merge retains both this PR's `HostImportOverlaps` and main's `ComparedHostImportCovers`. I checked the combined merge diff and the ordered expand/write-back integration, then rebuilt the updated source rather than carrying forward the old-head test result. **Validation:** Fresh exact-source Windows builds with verified matching third-party pins. On NVIDIA RTX 5070 Ti, the candidate passes all 9 focused graphics/depth tests; the base passes all 6 common tests, with zero skips or failures. Both runs require Vulkan, disable shader caching and load `VK_LAYER_KHRONOS_validation`; loader logs confirm actual insertion, and neither log contains a VUID message. The expand tests still verify complete 15,360/15,360-texel transfers through the covered read-back and address-based routes. This supersedes the earlier conflict-pending comment. Validation covers the focused modeled behavior; no new game, AMD/RADV, performance or console measurement is claimed. Documented coherence and unsupported-layout limits remain.
BunnyFl commented 2026-11-05 01:54:25 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


@EagleBearerYS one finding from a Windows run on AMD, which the runs so far don't cover (NVIDIA on Windows, RADV and lavapipe on Linux).

Confirmed (P2): split-mirrored-buffer-read fails on Windows with an RX 9070 XT

Setup: head aca3cf0ca5 merged onto main 0eba5db30d (clean merge), Windows 11, WinLibs GCC, Release, BUILD_TESTING=ON, AMD Radeon RX 9070 XT (AMD Software 26.10.2, Vulkan driver 2.0.416), ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, test executables rebuilt before each set.

Test Loop of 5 runs Other runs
agc_driver_depth_expand_out_of_place 0 of 5 passed failed 2, passed 2
agc_driver_depth_expand_out_of_place_inline 3 of 5 passed failed 3

Every failure whose output I read stops in the same case, at the test's own check of the depth draw (core/libs/prx/libSceAgcDriver/tests/execution/DepthExpandOutOfPlace.cpp:490), before the write base is compared:

address-based buffer copies, one a range, of a write base across two registered ranges, the first imported and the second heap-mirrored: read base 0x200090000, write base 0x201100000, ranges 0x200110000 and 0x201110000, copy at 0x2000f0000
  expanded planes stored ahead of the copies: 1 (expected 1); heap mirrors made: 1
  read base: 0 of 15360 texels hold the drawn depth gradient; texel (0, 0) 0x00000000 (0), (159, 95) 0x00000000 (0)
AGC graphics: address-based buffer copies, one a range, of a write base across two registered ranges, the first imported and the second heap-mirrored: the depth draw did not write its gradient at the read base

In the passing _inline runs the same case, with the same addresses, prints 15360 of 15360 for both the read base and the copy of the write base. Every case before it in the failing runs holds 15360 of 15360. No host import failed in these runs (failed 0 in the shutdown line), and the validation layer reports no VUID- message in any of them.

I haven't found the cause. In the log above, the texture read of the read base (DrawnDepth, core/libs/prx/libSceAgcDriver/tests/execution/DepthExpandOutOfPlace.cpp:489-490), made after this case's address-based copies, returns zeros. Presumably something between the depth draw and that read loses the depth surface's contents, or the read takes another image; I haven't confirmed which. I can't tell from these logs whether that is this PR's new stores in UploadFinish (the expanded planes and the read-only V# results) acting on the heap mirror, or a main path the case's layout reaches. Happy to run a build with extra prints if that helps.

What else I ran (same machine and merge)

  • agc_driver_depth_expand_review passes in every run. The six depth neighbours (agc_driver_depth_storage, _clear_hle, _fast_clear, _plane_sampling, _htile_write, _copy_draw) and agc_driver_graphics pass 7 of 7 on the merge and on main 0eba5db30d, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: neither log has a missing-layer line or a VUID- message.
  • Negative control: with main's DrawPrecheck.cpp, all three expand tests abort.
  • check_conventions.py: passes. pr_overlap.py --branch: line conflicts only with #12944 (a member added after writes in GuestBufferMemory.hpp, next to this PR's reads) and #15868 (the debt entry below the HTILE slice entry this PR removes); both are adjacent-line edits.
  • Code read: the repeat check's raw DepthSurface* comparison is guarded by written, which comes from the global ++depthWrites counter at creation (core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:965) and on every write, and reads has the same lifetime as writes. No findings there.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5778711710 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5778711710). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-05T01:54:25Z. **Review:** CHANGES_REQUESTED --- @EagleBearerYS one finding from a Windows run on AMD, which the runs so far don't cover (NVIDIA on Windows, RADV and lavapipe on Linux). ## Confirmed (P2): `split-mirrored-buffer-read` fails on Windows with an RX 9070 XT Setup: head `aca3cf0ca5` merged onto `main` `0eba5db30d` (clean merge), Windows 11, WinLibs GCC, Release, `BUILD_TESTING=ON`, AMD Radeon RX 9070 XT (AMD Software 26.10.2, Vulkan driver 2.0.416), `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, test executables rebuilt before each set. | Test | Loop of 5 runs | Other runs | |---|---|---| | `agc_driver_depth_expand_out_of_place` | 0 of 5 passed | failed 2, passed 2 | | `agc_driver_depth_expand_out_of_place_inline` | 3 of 5 passed | failed 3 | Every failure whose output I read stops in the same case, at the test's own check of the depth draw (`core/libs/prx/libSceAgcDriver/tests/execution/DepthExpandOutOfPlace.cpp:490`), before the write base is compared: ``` address-based buffer copies, one a range, of a write base across two registered ranges, the first imported and the second heap-mirrored: read base 0x200090000, write base 0x201100000, ranges 0x200110000 and 0x201110000, copy at 0x2000f0000 expanded planes stored ahead of the copies: 1 (expected 1); heap mirrors made: 1 read base: 0 of 15360 texels hold the drawn depth gradient; texel (0, 0) 0x00000000 (0), (159, 95) 0x00000000 (0) AGC graphics: address-based buffer copies, one a range, of a write base across two registered ranges, the first imported and the second heap-mirrored: the depth draw did not write its gradient at the read base ``` In the passing `_inline` runs the same case, with the same addresses, prints `15360 of 15360` for both the read base and the copy of the write base. Every case before it in the failing runs holds 15360 of 15360. No host import failed in these runs (`failed 0` in the shutdown line), and the validation layer reports no `VUID-` message in any of them. I haven't found the cause. In the log above, the texture read of the read base (`DrawnDepth`, `core/libs/prx/libSceAgcDriver/tests/execution/DepthExpandOutOfPlace.cpp:489-490`), made after this case's address-based copies, returns zeros. Presumably something between the depth draw and that read loses the depth surface's contents, or the read takes another image; I haven't confirmed which. I can't tell from these logs whether that is this PR's new stores in `UploadFinish` (the expanded planes and the read-only V# results) acting on the heap mirror, or a `main` path the case's layout reaches. Happy to run a build with extra prints if that helps. ## What else I ran (same machine and merge) - `agc_driver_depth_expand_review` passes in every run. The six depth neighbours (`agc_driver_depth_storage`, `_clear_hle`, `_fast_clear`, `_plane_sampling`, `_htile_write`, `_copy_draw`) and `agc_driver_graphics` pass 7 of 7 on the merge and on `main` `0eba5db30d`, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: neither log has a missing-layer line or a `VUID-` message. - Negative control: with `main`'s `DrawPrecheck.cpp`, all three expand tests abort. - `check_conventions.py`: passes. `pr_overlap.py --branch`: line conflicts only with #12944 (a member added after `writes` in `GuestBufferMemory.hpp`, next to this PR's `reads`) and #15868 (the debt entry below the HTILE slice entry this PR removes); both are adjacent-line edits. - Code read: the repeat check's raw `DepthSurface*` comparison is guarded by `written`, which comes from the global `++depthWrites` counter at creation (`core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:965`) and on every write, and `reads` has the same lifetime as `writes`. No findings there. AI-assisted: yes (Claude Code)
BunnyFl commented 2026-11-05 13:59:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-05T13:59:00Z.

Review: APPROVED


@EagleBearerYS thanks for the print build. I'm withdrawing my change request: I can't reproduce the split-mirrored-buffer-read failure any more, on the same machine, driver and trees, and I don't think an unexplained failure I can't repeat should hold the PR back.

What I ran today

All on the same Windows 11 machine and RX 9070 XT, with the same AMD driver as the failing runs (32.0.32015.12012), ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, test executables and libraries rebuilt for each tree. Each row is 8 runs of agc_driver_depth_expand_out_of_place plus 8 of agc_driver_depth_expand_out_of_place_inline:

Tree Validation layer Other Passed
your diag/6146-amd-split-mirrored (b272a98b22) on main 0eba5db30d, APS5_TRACE_DEPTH_SYNC=1 on 16 of 16
the same off 16 of 16
this PR's head aca3cf0ca5 on main 0eba5db30d (the failing runs' base) on 16 of 16
the same off 16 of 16
your diag build, as above off another process holding 3.3 GB, 3.3 GB written on the GPU, then 9 GB written on the GPU 48 of 48
this PR's head on 0eba5db30d off another process holding 3.3 GB 16 of 16
this PR's head on main 0540ef0ef2 on 16 of 16

In all 80 diag runs the split cases print 15360 of 15360 at the read base, the read base's depth surface is live at every [step] from the depth draw on (the three steps before the draw print none, as expected), and no [depth-retire] or [depth-texture] line appears.

Then the gated run on today's main d23df92b38, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: the three expand tests, the six depth neighbours from my review and agc_driver_graphics pass, 10 of 10. Neither log has a missing-layer line or a VUID- message. With main's DrawPrecheck.cpp the three expand tests abort and the other seven pass. check_conventions.py passes. pr_overlap.py --branch finds only shared lines, no shared exports, with #12944 (GuestBufferMemory.hpp), #15868 (the debt file), #16025 (DepthSurface.hpp) and #16058 (State.cpp); I haven't checked each of those against this PR line by line.

The one difference I found

The failing logs from my review report VK_EXT_memory_budget budget of 12004 MiB for the device-local heap; every run today reports 15419 MiB. I compared one failing log line by line with a passing one from today: apart from addresses, timings and that budget line, they match up to the split-mirrored case. I tried to recreate the lower budget by holding device memory from another process (the 3.3 GB and 9 GB rows above), but the budget the test sees stayed at 15419 MiB, so I don't know what lowered it that night, and I haven't shown that the budget is related to the failure at all.

If the failure comes back on this machine, I'll run your diag build straight away and post the log you asked for.

Approving at aca3cf0ca5.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5786072915 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5786072915). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-05T13:59:00Z. **Review:** APPROVED --- @EagleBearerYS thanks for the print build. I'm withdrawing my [change request](https://github.com/boykopovar/AnyPS5/pull/6146#pullrequestreview-5778711710): I can't reproduce the `split-mirrored-buffer-read` failure any more, on the same machine, driver and trees, and I don't think an unexplained failure I can't repeat should hold the PR back. ## What I ran today All on the same Windows 11 machine and RX 9070 XT, with the same AMD driver as the failing runs (32.0.32015.12012), `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, test executables and libraries rebuilt for each tree. Each row is 8 runs of `agc_driver_depth_expand_out_of_place` plus 8 of `agc_driver_depth_expand_out_of_place_inline`: | Tree | Validation layer | Other | Passed | |---|---|---|---| | your `diag/6146-amd-split-mirrored` (`b272a98b22`) on `main` `0eba5db30d`, `APS5_TRACE_DEPTH_SYNC=1` | on | | 16 of 16 | | the same | off | | 16 of 16 | | this PR's head `aca3cf0ca5` on `main` `0eba5db30d` (the failing runs' base) | on | | 16 of 16 | | the same | off | | 16 of 16 | | your diag build, as above | off | another process holding 3.3 GB, 3.3 GB written on the GPU, then 9 GB written on the GPU | 48 of 48 | | this PR's head on `0eba5db30d` | off | another process holding 3.3 GB | 16 of 16 | | this PR's head on `main` `0540ef0ef2` | on | | 16 of 16 | In all 80 diag runs the split cases print 15360 of 15360 at the read base, the read base's depth surface is live at every `[step]` from the depth draw on (the three steps before the draw print `none`, as expected), and no `[depth-retire]` or `[depth-texture]` line appears. Then the gated run on today's `main` `d23df92b38`, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: the three expand tests, the six depth neighbours from my review and `agc_driver_graphics` pass, 10 of 10. Neither log has a missing-layer line or a `VUID-` message. With `main`'s `DrawPrecheck.cpp` the three expand tests abort and the other seven pass. `check_conventions.py` passes. `pr_overlap.py --branch` finds only shared lines, no shared exports, with #12944 (`GuestBufferMemory.hpp`), #15868 (the debt file), #16025 (`DepthSurface.hpp`) and #16058 (`State.cpp`); I haven't checked each of those against this PR line by line. ## The one difference I found The failing logs from my review report `VK_EXT_memory_budget budget of 12004 MiB` for the device-local heap; every run today reports 15419 MiB. I compared one failing log line by line with a passing one from today: apart from addresses, timings and that budget line, they match up to the split-mirrored case. I tried to recreate the lower budget by holding device memory from another process (the 3.3 GB and 9 GB rows above), but the budget the test sees stayed at 15419 MiB, so I don't know what lowered it that night, and I haven't shown that the budget is related to the failure at all. If the failure comes back on this machine, I'll run your diag build straight away and post the log you asked for. Approving at `aca3cf0ca5`. AI-assisted: yes (Claude Code)
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!6146
No description provided.