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

Merged
milescoviello merged 2 commits from upstream-pr/8999 into main 2026-10-24 15:29:24 +00:00
milescoviello commented 2026-10-21 09:09:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T09:09:16Z.


What

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

#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:

  • the pipeline ordering, CMASK fast-clear handling and target residency of normal draws apply;
  • #8975's explicit drain, CMASK refusal and surface lookup aren't needed;
  • linear color targets work too (the compute pass refused them).

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 0bf13e4bb9; 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 f894ba69d3). 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 2f161d4f33, 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 4ec064d29b (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 cc0078595d (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: #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. 564681799c 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 895f47f4ee, 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 a6dcea9279 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

  • Based on current main; no other open PR implements the same functions (overlaps the draft #1395)
  • 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 (#8975 merged). Merge order: #10414 (@orezraey) goes after this and merges main (they meet only in docs/dev/debt/libSceAgcDriver.md)
  • Fixes: none
  • Unblocks: none beyond what #8975 unblocked
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04; AMD Radeon RX 7900 XTX, RADV (Mesa 26.2.5), Fedora (@clairtonmichel); NVIDIA GeForce GT 1030, driver 582.78, Windows 11 (VM); Apple M2 Max, MoltenVK 1.4.2 and MoltenVK main, macOS 27.2 (@jotitadev)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4949156397 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T09:09:16Z. --- ### What #8975 has merged. This PR is now its one commit, `994337f614`, on `main` 4ec064d29b. #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: - the pipeline ordering, CMASK fast-clear handling and target residency of normal draws apply; - #8975's explicit drain, CMASK refusal and surface lookup aren't needed; - linear color targets work too (the compute pass refused them). 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` 0bf13e4bb9; 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` f894ba69d3). 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` 2f161d4f33, 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` 4ec064d29b** (`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` cc0078595d** (`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`: #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. 564681799c 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` 895f47f4ee, 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](https://github.com/boykopovar/AnyPS5/pull/8999#pullrequestreview-5607744519) on #8658's macOS port (`main` a6dcea9279 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 <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions (overlaps the draft #1395) - [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 (#8975 merged). Merge order: #10414 (@orezraey) goes after this and merges `main` (they meet only in `docs/dev/debt/libSceAgcDriver.md`) - [x] Fixes: none - [x] Unblocks: none beyond what #8975 unblocked - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04; AMD Radeon RX 7900 XTX, RADV (Mesa 26.2.5), Fedora (@clairtonmichel); NVIDIA GeForce GT 1030, driver 582.78, Windows 11 (VM); Apple M2 Max, MoltenVK 1.4.2 and MoltenVK main, macOS 27.2 (@jotitadev) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clairtonmichel commented 2026-10-21 09:13:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by clairtonmichel on 2026-10-21T09:13:48Z.


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!
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6312387918 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6312387918). Originally posted by [clairtonmichel](https://github.com/clairtonmichel) on 2026-10-21T09:13:48Z. --- 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 commented 2026-10-21 09:23:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T09:23:12Z.


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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6312561088 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6312561088). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T09:23:12Z. --- 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)
milescoviello commented 2026-10-21 12:49:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T12:49:15Z.


#8975 has merged, so this is rebased onto main 2f161d4f33. 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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6316375939 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6316375939). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T12:49:15Z. --- #8975 has merged, so this is rebased onto `main` 2f161d4f33. 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)
milescoviello commented 2026-10-21 17:42:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T17:42:03Z.


Rebased onto main 4ec064d29b 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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6322561104 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6322561104). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T17:42:03Z. --- Rebased onto `main` 4ec064d29b 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)
jotitadev commented 2026-10-22 00:10:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T00:10:41Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5607744519 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#pullrequestreview-5607744519). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T00:10:41Z. **Review:** COMMENTED --- 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 commented 2026-10-22 00:12:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T00:12:28Z.


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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329449802 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6329449802). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T00:12:28Z. --- 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)
milescoviello commented 2026-10-22 10:06:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T10:06:05Z.


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

  • #7927's mip handling now sits in decodeDepthPlane.
  • The depth copy source scope opens in the new Draw.

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

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6338139070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6338139070). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T10:06:05Z. --- Rebased onto `main` cc0078595d as `f5574fea1b`. #7927 (depth mip levels) and #8992 (the `Graphics::Draw` prepare/record split) each overlapped one hunk: - #7927's mip handling now sits in `decodeDepthPlane`. - The depth copy source scope opens in the new `Draw`. The focused tests pass 3 of 3. Details in Tested. AI-assisted: yes (Claude Code)
EagleBearerYS commented 2026-10-22 12:42:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T12:42:31Z.


@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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341019419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6341019419). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-22T12:42:31Z. --- @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 commented 2026-10-22 12:43:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T12:43:45Z.


@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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341044261 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8999#issuecomment-6341044261). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T12:43:45Z. --- @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)
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!8999
No description provided.