Skip to content

feat(agc): draw DB depth copies with a driver pixel program - #8999

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
milescoviello:feat/db-depth-copy-draw
Oct 24, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
milescoviello:feat/db-depth-copy-draw

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

#8975 has merged. This PR is now its one commit, 994337f614, on main 4ec064d.

#8975 runs a draw with DB_RENDER_CONTROL.DEPTH_COPY as a compute pass over the whole surface, chosen when the viewport and scissor cover it. The maintainers accepted that with its debt line, and asked for this as a follow-up: on #5499 they proposed running the copy as the draw itself, "a pixel shader reading the depth sample, rasterized from the title's geometry, so coverage comes from the draw and nothing needs guessing". They were fine with a driver-owned guest pixel program marked as driver-authored in the debt file.

This does that. The precheck rewrites a copy of the draw's registers and sends it through the normal draw path:

  • No depth target. DB_RENDER_CONTROL becomes 0, so nothing is tested or written. The decoder still requires no depth or stencil tests.
  • A driver pixel program in place of the title's. SPI_SHADER_PGM_*_PS, the user SGPRs, SPI_PS_INPUT_ENA/ADDR (PERSP_CENTER | POS_FIXED_PT), SPI_SHADER_COL_FORMAT (32_R), CB_SHADER_MASK, DB_SHADER_CONTROL and alpha-to-mask are rewritten.
  • Everything else stays the title's: vertex stage, primitive, viewport, scissor and sample mask.

The programs are hand-encoded RDNA2 and published beside the null pixel program, prepared at use:

  • v_and_b32 / v_lshrrev_b32 unpack POS_FIXED_PT (v2) into x and y.
  • image_load reads one sample: 2D_MSAA with the sample index in s8 for a multisampled plane, 2D for a one-sample plane.
  • exp mrt0 writes it.

The T# comes from DepthCopySourceWords, built from the plane as decodeDepth decodes it. decodeDepthPlane is factored out of decodeDepth, so the address, pipe-bank XOR, slice and HTILE fields match the surface the draws registered; decodeDepth keeps its own checks.

Reading a multisampled plane. The draw's resources go through DepthSurfaceTexture. For a multisampled plane, that path normally runs the guest-memory import checks of native multisample sampling (CheckCurrent, the creation-time owner), which a plane only the host draws have written doesn't pass. The decode marks a draw with the multisampled copy program (State::depthCopySource, placed in existing padding, so sizeof(State) is unchanged). Graphics::Draw and DrawWithRecipe then open a DepthCopySourceScope. Inside it, DepthSurfaceTexture and DepthSurfaceHolds skip those checks for the plane, but still check the descriptor (CheckResource), apply a pending fast clear, and refresh the sample shadow as before. One-sample planes take the existing path unchanged.

What goes: the compute pass (DepthSample.comp and its CMake loop), DispatchDepthSample, CopySample/CopyDepthSample, RunDepthCopyPass and VulkanDevice::DepthCopyPass. The copy is now an ordinary draw, so:

What is still refused: stencil copies, depth tests, depth formats other than Z_32_FLOAT, mipmapped or partially resident planes, a partial sample mask, color target 0 blending, indirect draws, and targets other than a single-sample R32 float of the plane's size. The debt entry is rewritten for the driver-authored program. It records one known difference from the console: with COPY_CENTROID it copies sample 0, so an edge pixel whose sample 0 the draw doesn't cover can differ.

Tested

  • Current head 65a247ec66 (rebased onto main 0bf13e4; the Draw.hpp/Draw.cpp conflict keeps main's PipelinedColorMetadataPassWrites, DrawPipelineEnabled and CommitTrims and drops RunDepthCopyPass as before). The 23 tests matching ^agc_driver_graphics$|depth_copy|^agc_driver_depth pass 3 of 3 on Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09) and on the Windows 11 VM (GT 1030, 582.66, WinLibs GCC 15.2.0 r7).

Earlier heads: Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02, on #8975 at 127aba3ed6 (main f894ba6). The change was then rebased onto #8975's two lavapipe test commits (223e90289b, 67cea1c314). They only edit a test case this PR removes, so the tree is the same as the tested one. Under lavapipe (llvmpipe, LLVM 20.1.2), the 31 depth tests, agc_driver_depth_copy_draw among them, pass 3 of 3 at the rebased head.

New execution test agc_driver_depth_copy_draw (tests/execution/DepthCopyDraw.cpp). One submission holds three draws of the same triangle, whose edge crosses a 64x4 target:

  1. a depth write at 0.25 over a plane filled with 0.75;
  2. the DB depth copy into an R32 float target filled with -1.0;
  3. a reference draw with an ordinary pixel shader into a second target.

Every texel the reference wrote must hold 0.25 in the copy target, and every other texel must still hold -1.0. With #8975's compute copy, the same test stops at "DB depth copy into a target without a resident image is not implemented", because that pass needs a tiled resident target. On an R32 target it can take, the compute pass would write every texel.

Decode tests (agc_driver_graphics, depthCopyPassTests):

  • the decoded plane and the source T#, round-tripped through DecodeTextureResource for a two-sample and a one-sample plane;
  • XOR stripping and slice addressing;
  • refusal of mips and of blending;
  • a viewport over part of the surface now decodes.

On main 2f161d4, after #8975 merged (3d17a2413d): the 32 tests matching depth|Depth|db_copy|DbCopy|^agc_driver_graphics$ pass 3 of 3, except agc_driver_sample_order_recipe_depth_locations. That one is new on main from #6683 and fails there on this card too; #9056 fixes it. Under lavapipe (llvmpipe, LLVM 20.1.2), all 32 pass.

On main 4ec064d (994337f614, rebased over #6887, whose DispatchMultisampleImage declaration sat next to the removed DispatchDepthSample): the 46 tests matching depth|Depth|^agc_driver_graphics$|multisample_readback|^agc_driver_msaa pass 3 of 3, except the same agc_driver_sample_order_recipe_depth_locations. They include #6887's MultisampleReadback test.

On main cc00785 (f5574fea1b). This rebase is over #7927 (depth mip levels) and #8992 (Graphics::Draw split into a prepare and a record step), with one conflict in each file:

  • State.cpp: feat(agc): render into depth mip levels #7927 added its mip and view-slice handling inside decodeDepth, while this PR moves that decoding into decodeDepthPlane. The mip block now lives in the helper. A DB depth copy still refuses a mipmapped source before it decodes the plane, so the block only acts for draws.
  • Draw.cpp: the depth copy source scope now opens in the new Draw, around both its prepare and its record step.

^agc_driver_(depth_storage|graphics|depth_copy_draw)$ passes 3 of 3. That set includes #7927's mip decode checks in agc_driver_graphics.

Suites: the 31 tests matching depth|Depth|^agc_driver_graphics$ pass 3 of 3. Khronos validation layer 1.4.363 over ^agc_driver_(depth_storage|graphics|depth_copy_draw): #8975's head passes 5 of 5 and this head 6 of 6, with no VUID on either.

CoD Black Ops II (PPSA34502), whose depth copies are one-sample: release libs, 12 GB cap, the scripted 203 s run to the war-room menu. The log shows no driver failure or refusal. The menu renders as with #8975's compute copy: the same scene, with the blurred background behind its panel and dialog.

@clairtonmichel, AMD Radeon RX 7900 XTX (RADV, Mesa 26.2.5, Fedora): the 31 tests, agc_driver_depth_copy_draw among them, pass.

Windows (Windows 11 VM, NVIDIA GeForce GT 1030, driver 582.78, WinLibs GCC 15.2.0, Release): an earlier head didn't build there. DepthCopyDraw.cpp aligned its depth memory with alignas(65536), and MinGW allows at most 8192. 5646817 instead aligns a span at run time inside an array 64 KiB larger, as #8310 does for another test. At this head, agc_driver_graphics and agc_driver_depth_copy_draw build and pass 3 of 3. After the rebase onto main 895f47f, at 4478a90829, agc_driver_depth_storage, agc_driver_graphics and agc_driver_depth_copy_draw pass 3 of 3 there again.

macOS (Apple M2 Max, macOS 27.2, x86_64 under Rosetta 2, MoltenVK 1.4.2 from the 1.4.363 SDK and MoltenVK main with SPIRV-Cross #2704): @jotitadev ran it on #8658's macOS port (main a6dcea9 plus the port), since main alone doesn't build there. agc_driver_depth_copy_draw and agc_driver_depth_storage pass 3 of 3 on both MoltenVK builds, so the hand-written driver pixel program compiles and runs there, two-sample read included. The full ^agc suite fails the same 15 tests as the port without this PR; two flaky tests differ in opposite directions and pass alone.

Not tested: a multisampled source in an execution test (the decode and descriptor are tested; PPSA12361, the two-sample title, isn't available to me), Intel.

Checklist

🤖 Generated with Claude Code

@clairtonmichel

Copy link
Copy Markdown

Tested on AMD Ryzen 7 9800X3D and AMD Radeon RX 7900 XTX (Fedora Linux, Mesa 26.2.5):

  • Built cleanly with zero errors.
  • Ran the full depth/db_copy suite including the new draw-based copy test (agc_driver_depth_copy_draw): 100% passed successfully (31/31 green).
  • Driver pixel program depth copies and reference triangle coverage tests behave flawlessly on host. Ready to merge!

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @clairtonmichel, that's the draw-based copy on AMD as well. I added it to the Tested section and the GPU line.

AI-assisted: yes (Claude Code)

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 5431 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L3188, L3195
PR 6146 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp L342-343
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp L10
core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp L79-80
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L385-390, L393, L395-399, L404-408, L417-419, L462
PR 6959 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L3188

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5115 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5441 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPrecheck.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6202 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6867 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6960 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 7223 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7410 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7484 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7668 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7677 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7682 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 8004 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8140 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 8212 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8223 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9193 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9387 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9393 docs/dev/debt/libSceAgcDriver.md
PR 9400 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 9401 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9431 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9432 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9489 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9672 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9673 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9674 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9675 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9676 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9700 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9842 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9891 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9892 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9893 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9895 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9898 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9904 docs/dev/debt/libSceAgcDriver.md
PR 9905 docs/dev/debt/libSceAgcDriver.md
PR 9906 docs/dev/debt/libSceAgcDriver.md
PR 9969 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10000 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10046 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10049 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 10348 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10420 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10472 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10489 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10515 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10581 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md

@milescoviello
milescoviello force-pushed the feat/db-depth-copy-draw branch 2 times, most recently from 31d3a6b to 1a20e39 Compare October 21, 2026 10:30
@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 21, 2026
@milescoviello
milescoviello force-pushed the feat/db-depth-copy-draw branch from 1a20e39 to 3d17a24 Compare October 21, 2026 12:48
@milescoviello

Copy link
Copy Markdown
Contributor Author

#8975 has merged, so this is rebased onto main 2f161d4. The head is 3d17a2413d, the one draw-based copy commit. On that base the 32 depth tests pass 3 of 3 here, except #6683's new agc_driver_sample_order_recipe_depth_locations, which fails on main on this card as well (#9056 fixes it). Under lavapipe all 32 pass. The description is updated: no dependency now.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the build label Oct 21, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026
@milescoviello
milescoviello force-pushed the feat/db-depth-copy-draw branch from 3d17a24 to 994337f Compare October 21, 2026 17:41
@milescoviello

Copy link
Copy Markdown
Contributor Author

Rebased onto main 4ec064d after #6887 conflicted in TextureDetiler.hpp: its new DispatchMultisampleImage declaration was next to the DispatchDepthSample this PR removes. The head is now 994337f614. On that base the 46 depth, graphics and multisample readback tests pass 3 of 3, except agc_driver_sample_order_recipe_depth_locations, which fails on main on this card too (#9056 fixes it).

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 21, 2026

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First Apple GPU / MoltenVK run of this PR. The draw-based depth copy works here, including the multisampled read path.

Machine: Apple M2 Max, macOS 27.2, x86_64 under Rosetta 2. Vulkan loader + MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), and MoltenVK main + SPIRV-Cross #2704. Release, BUILD_TESTING=ON.

Base/method: PR #8658 feat/macos-port @ a1fb8e3e9c (current main a6dcea9279 plus the macOS port), not main — main does not build on macOS. This PR's diff (git diff merge-base..564681799 -- . ':!docs') applied on top, clean.

Result (--repeat until-fail:3, both drivers): agc_driver_depth_copy_draw and agc_driver_depth_storage pass 3/3 on each.

the DB depth copy wrote the drawn depth exactly where its draw rasterized

So the driver pixel program path lands on MoltenVK: the hand-encoded RDNA2 program (v_and_b32/v_lshrrev_b32 unpack of POS_FIXED_PT, image_load, exp mrt0) compiles and runs, and the 2D_MSAA image_load reads the right sample of the two-sample plane inside the DepthCopySourceScope.

Full ^agc suite with this PR (SDK, clean rebuild): 15 failures, the same set as the #8658 base — agc_driver_depth_copy_draw is not among them. Two tests differ between the base and PR runs in opposite directions (agc_driver_cross_workgroup_flag, agc_driver_uint8x4_color_target); both are intermittent here and pass on their own --repeat until-fail:3, so neither is attributable to this PR. No new failure.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2; and MoltenVK main + SPIRV-Cross #2704).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @jotitadev. That's the first Apple GPU run, and it's good to know the hand-written RDNA2 copy program runs through MoltenVK and SPIRV-Cross, the two-sample image_load included. I added it to the Tested section and the GPU line.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@milescoviello
milescoviello force-pushed the feat/db-depth-copy-draw branch from 5646817 to f5574fe Compare October 22, 2026 10:05
@milescoviello

Copy link
Copy Markdown
Contributor Author

Rebased onto main cc00785 as f5574fea1b. #7927 (depth mip levels) and #8992 (the Graphics::Draw prepare/record split) each overlapped one hunk:

The focused tests pass 3 of 3. Details in Tested.

AI-assisted: yes (Claude Code)

@EagleBearerYS

Copy link
Copy Markdown
Contributor

@milescoviello a merge-order note: #9533, with #9717 and #9742 stacked on it, adds if (stencil) found->RequireStencilProven(); to the native depth branch in DepthSurface.cpp that this PR splits on depthCopySourceActive. Composed, the stencil check goes in your else branch after CheckCurrent(). If a depth copy can also read the stencil plane, it belongs in the copy-source branch too; I'd check that in the rebase. #9533 goes after this PR and rebases over it, the same order #9717's body lists.

@milescoviello

Copy link
Copy Markdown
Contributor Author

@EagleBearerYS agreed on the order: this PR first, and #9533 rebases over it.

A DB depth copy here never reads the stencil plane. DecodeDepthCopyPass accepts only DEPTH_COPY, the centroid bit and the copy sample of DB_RENDER_CONTROL. It refuses STENCIL_COPY (bit 3), along with clears, resummarize and decompress, with "DB depth copy combined with a stencil copy, clear, resummarize or decompress", and the copy draw samples only the depth plane. So RequireStencilProven() belongs only in the else branch after CheckCurrent(), as you composed it. If a later change adds stencil copies, that branch will need the check too.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@milescoviello
milescoviello force-pushed the feat/db-depth-copy-draw branch from f5574fe to 4478a90 Compare October 23, 2026 00:44
@milescoviello

Copy link
Copy Markdown
Contributor Author

Rebased onto main 895f47f as 4478a90829, still two commits.

One conflict, in State.cpp: #8099 (dc6da1b) made decodeDepth ignore a stencil clear on a target without a stencil plane. It computes the stencil clear after the stencil plane flag, and its Require checks only the read-only flag. This PR splits decodeDepth into decodeDepthPlane and decodeDepth, so that change now sits in the split decodeDepth. DrawRejection keeps main's version unchanged.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
@milescoviello
milescoviello force-pushed the feat/db-depth-copy-draw branch from 4478a90 to 65a247e Compare October 23, 2026 19:07
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@milescoviello

Copy link
Copy Markdown
Contributor Author

Rebased onto main 0bf13e4 as 65a247ec66, still two commits; main had added three functions next to RunDepthCopyPass in Graphics/include/Draw.hpp and Graphics/src/Draw.cpp.

  • The conflict: main added PipelinedColorMetadataPassWrites, DrawPipelineEnabled and CommitTrims right next to RunDepthCopyPass, which this PR removes (the compute pass it ran is gone). The resolution keeps main's three functions and drops RunDepthCopyPass as before. No other file conflicted, and sizeof(State) (824) and the journal format (8) are still main's.
  • Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, NVIDIA 615.71.09): the 23 tests matching ^agc_driver_graphics$|depth_copy|^agc_driver_depth pass 3 of 3, including agc_driver_depth_copy_draw and agc_depth_copy_kept_bytes.
  • Windows 11 VM (GT 1030, 582.66, WinLibs GCC 15.2.0 r7): the same 23 tests pass 3 of 3 on the head. The run's main side didn't build, since the target list included this PR's new agc_driver_depth_copy_draw_tests, so it has no main row.

AI-assisted: yes (Claude Code)

@adriadam10 adriadam10 self-assigned this Oct 23, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@adriadam10
adriadam10 force-pushed the feat/db-depth-copy-draw branch from 65a247e to 22b2a18 Compare October 24, 2026 07:23
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
milescoviello and others added 2 commits October 24, 2026 11:59
A draw with DB_RENDER_CONTROL.DEPTH_COPY ran as a compute pass over the
whole surface, chosen when the viewport and scissor covered it. It now
runs as the title's own draw: the precheck rewrites the draw's registers
to bind no depth target and a driver-authored guest pixel program, then
draws it through the normal path. The program reads POS_FIXED_PT, loads
one sample of the Z_32_FLOAT plane through a T# built from the DB
registers (DepthCopySourceWords), and exports it to color target 0 as
32_R, so only the pixels the draw covers are written, and the normal draw
path orders it after the draws that rendered the plane.

- The plane is decoded by decodeDepthPlane, factored out of decodeDepth,
  so its address, pipe-bank XOR and slice match the registered surface.
- Two programs, one per source kind: image_load 2D_MSAA with the sample in
  s8, and image_load 2D. They are published with the null pixel program
  and prepared at use.
- A multisampled plane is read from its host image or sample shadow
  without the guest-memory import checks of native multisample sampling,
  inside a DepthCopySourceScope opened by Graphics::Draw for draws whose
  decode found the multisampled copy program (State::depthCopySource).
- The compute pass, its shader and the CopySample path are removed.
- A new execution test draws depth over a triangle, copies it with the
  same triangle and compares the covered texels with a reference draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test declared its depth plane alignas(65536). WinLibs GCC 15.2
rejects static objects aligned above 8192 bytes ("requested alignment
'65536' exceeds object file maximum 8192"), so agc_driver_depth_copy_draw
did not build on Windows. The plane is now a 64 KiB aligned span inside
a larger array, as boykopovar#8310 does for the array window test, and the test
checks the alignment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@adriadam10
adriadam10 force-pushed the feat/db-depth-copy-draw branch from 22b2a18 to 9f9c60f Compare October 24, 2026 10:58
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@adriadam10
adriadam10 merged commit 43768fa into boykopovar:main Oct 24, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

main conflicted in docs/dev/debt/libSceAgcDriver.md (the "Multisampled target guest access" line changed next to this PR's "DB depth copies" line). I rebased the branch and kept both lines; the code is unchanged, and no references to the removed depth-copy symbols are left. Tested on RTX 4070 Ti (author), RX 7900 XTX (@clairtonmichel) and M2 Max / MoltenVK (@jotitadev); merged.

@milescoviello

Copy link
Copy Markdown
Contributor Author

@adriadam10 thank you for the rebase and the merge.

AI-assisted: yes (Claude Code)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants