test(agc): share depth raster pipelines across native depth cases #21781

Merged
chitters2004 merged 1 commit from upstream-pr/21781 into main 2026-11-27 17:19:35 +00:00
chitters2004 commented 2026-11-16 19:30:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by chitters2004 on 2026-11-16T19:30:58Z.


What

agc_driver_native_depth_separate_stencil times out on Windows llvmpipe on main (30 s limit), and agc_driver_native_depth_stencil takes about 20 s. The time goes into pipeline compiles in the test fixture, not into the driver:

  • DepthRaster in tests/execution/NativeMultisampleDepth.cpp built a render pass, layout, shader modules and one graphics pipeline per sample for every raster it made, because each pipeline baked in that sample's stencil reference.
  • An 8x separate-stencil case with a plane fill therefore compiled 40 pipelines, about 0.61 s with the validation layer and no shader cache. The 8x case without a fill compiled 16, about 0.27 s.

The change:

  • Pipelines, their render pass, layout and modules are kept per device, format, sample count, extent, stencil plane, stencil state, compare op, pass op and per-pixel mode.
  • The stencil reference is now dynamic state (VK_DYNAMIC_STATE_STENCIL_REFERENCE), set per sample when a raster runs.
  • A raster still owns its framebuffer.
  • The cache is cleared before each test device is destroyed (Device::release, and a guard in CheckDriverPath).
  • Every case records the same draws, with the same references, as before.

Only the test changes. Driver code is untouched.

Tested

Local, Linux lavapipe (LLVM 20.1.2), with the validation and synchronization validation layers:

  • all 30 agc_driver_native_depth_* tests pass, with no VUID or SYNC-HAZARD messages;
  • separate_stencil 0.67 → 0.33 s and stencil 0.46 → 0.22 s (this device exposes only 4x).

Fork CI on this head (run 43925993913): Linux lavapipe gate and Windows pass, and the report is clean. Windows llvmpipe times:

test main this PR
native_depth_separate_stencil timeout (30.03 s) 3.04 s
native_depth_stencil 19.63 s 1.81 s
native_depth_clears timeout (30.02 s) 21.18 s

native_depth_clears is still slow because of its DriverDispatch case. There a driver-recorded HTILE dispatch sometimes waits on its fence for more than 10 s on Windows. That is a separate issue and is not changed here.

python3 tools/check_conventions.py --base origin/main passes.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Unblocks: none
  • GPUs tested: lavapipe (llvmpipe, Mesa, LLVM 20.1.2) on Ubuntu 24.04; fork CI Windows llvmpipe (LLVM 23.1.4)
  • AI-assisted: yes

🤖 Generated with Claude Code

https://claude.ai/code/session_011mLh2bE18haVtnPYp4NK3J

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5343651274 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21781). Originally posted by [chitters2004](https://github.com/chitters2004) on 2026-11-16T19:30:58Z. --- ### What `agc_driver_native_depth_separate_stencil` times out on Windows llvmpipe on `main` (30 s limit), and `agc_driver_native_depth_stencil` takes about 20 s. The time goes into pipeline compiles in the test fixture, not into the driver: - `DepthRaster` in `tests/execution/NativeMultisampleDepth.cpp` built a render pass, layout, shader modules and one graphics pipeline per sample for every raster it made, because each pipeline baked in that sample's stencil reference. - An 8x separate-stencil case with a plane fill therefore compiled 40 pipelines, about 0.61 s with the validation layer and no shader cache. The 8x case without a fill compiled 16, about 0.27 s. The change: - Pipelines, their render pass, layout and modules are kept per device, format, sample count, extent, stencil plane, stencil state, compare op, pass op and per-pixel mode. - The stencil reference is now dynamic state (`VK_DYNAMIC_STATE_STENCIL_REFERENCE`), set per sample when a raster runs. - A raster still owns its framebuffer. - The cache is cleared before each test device is destroyed (`Device::release`, and a guard in `CheckDriverPath`). - Every case records the same draws, with the same references, as before. Only the test changes. Driver code is untouched. ### Tested Local, Linux lavapipe (LLVM 20.1.2), with the validation and synchronization validation layers: - all 30 `agc_driver_native_depth_*` tests pass, with no VUID or SYNC-HAZARD messages; - `separate_stencil` 0.67 → 0.33 s and `stencil` 0.46 → 0.22 s (this device exposes only 4x). Fork CI on this head ([run 43925993913](https://github.com/chitters2004/AnyPS5/actions/runs/43925993913)): Linux lavapipe gate and Windows pass, and the report is clean. Windows llvmpipe times: | test | `main` | this PR | |---|---|---| | `native_depth_separate_stencil` | timeout (30.03 s) | 3.04 s | | `native_depth_stencil` | 19.63 s | 1.81 s | | `native_depth_clears` | timeout (30.02 s) | 21.18 s | `native_depth_clears` is still slow because of its DriverDispatch case. There a driver-recorded HTILE dispatch sometimes waits on its fence for more than 10 s on Windows. That is a separate issue and is not changed here. `python3 tools/check_conventions.py --base origin/main` passes. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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] Unblocks: none - [x] GPUs tested: lavapipe (llvmpipe, Mesa, LLVM 20.1.2) on Ubuntu 24.04; fork CI Windows llvmpipe (LLVM 23.1.4) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011mLh2bE18haVtnPYp4NK3J
MarcZX10 commented 2026-11-20 11:24:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:24:38Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing in the inspected diff establishes a blocking defect; the changed behavior still needs a Windows build result confirmed independently.

What I ran

Reviewed head 2e4400a92d6d0cd8143549c4ca3d12da6729883d using the pinned repo_read.py reader. No build or tests were run.

Results

Check Result Note
Diff and changed-file context passed One changed C++ test file inspected
Build and tests not run No local execution performed

Findings

Blocking

None in the inspected code.

Non-blocking

  • Please confirm the Windows build includes <map> directly. The new cache uses std::map; this file’s explicit <map> include is currently inside the Linux-only include block (NativeMultisampleDepth.cpp:130).

Not verified

The full 5,187-line changed file was not read; focused reads covered the cache, raster construction and use, device cleanup, and driver-path cleanup. No build, tests, CI report, or physical-console behavior was independently verified. files.json was not available through the reader; the manifest lists one changed file and marks it included.

To get this to a good state

Nothing is required. Optionally confirm the Windows build’s direct header coverage for std::map.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5991921496 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21781#pullrequestreview-5991921496). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T11:24:38Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing in the inspected diff establishes a blocking defect; the changed behavior still needs a Windows build result confirmed independently. ## What I ran Reviewed head `2e4400a92d6d0cd8143549c4ca3d12da6729883d` using the pinned `repo_read.py` reader. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed-file context | passed | One changed C++ test file inspected | | Build and tests | not run | No local execution performed | ## Findings ### Blocking None in the inspected code. ### Non-blocking - Please confirm the Windows build includes `<map>` directly. The new cache uses `std::map`; this file’s explicit `<map>` include is currently inside the Linux-only include block (`NativeMultisampleDepth.cpp:130`). ## Not verified The full 5,187-line changed file was not read; focused reads covered the cache, raster construction and use, device cleanup, and driver-path cleanup. No build, tests, CI report, or physical-console behavior was independently verified. `files.json` was not available through the reader; the manifest lists one changed file and marks it included. ## To get this to a good state Nothing is required. Optionally confirm the Windows build’s direct header coverage for `std::map`.
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!21781
No description provided.