test(agc): skip the two-sample stencil copy cases without 2x custom sample locations on the depth target #20289

Closed
peacocksir wants to merge 1 commit from upstream-pr/20289 into main
peacocksir commented 2026-11-14 23:47:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by peacocksir on 2026-11-14T23:47:33Z.


What

agc_driver_stencil_copy_draw, added by #16025, fails on lavapipe. Its four two-sample cases draw with custom sample locations on a 2x VK_FORMAT_D32_SFLOAT_S8_UINT depth target:

  • Lavapipe allows only 1x and 4x for that format (format sampleCounts: VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT), so creating the target logs VUID-VkImageCreateInfo-samples-02258.
  • The driver then refuses the draw in ValidateSampleLocations: custom sample locations require VK_EXT_sample_locations support for the draw's sample count.

The driver behaves as intended here: it refuses a draw the device can't run. The test assumes every device can run it.

This PR changes only the test. It still runs the two one-sample cases on every device. Before the two-sample cases, it checks the device for what the driver requires for these draws:

  • framebufferDepthSampleCounts has 2x (Pipeline.cpp, "device does not support depth targets with the draw's sample count").
  • sampledImageStencilSampleCounts has 2x (DepthSurface.cpp, "the device cannot sample the native depth target's stencil at its sample count").
  • SampleLocationsCompatibleDepth(context, VK_FORMAT_D32_SFLOAT_S8_UINT, 2), the driver's own check for custom sample locations on that depth format.

If any of them fails, the test shuts the driver down, prints skipped, the device has no sampled 2x D32_SFLOAT_S8_UINT depth targets with custom sample locations, so only the one-sample stencil copies ran and returns VulkanTestSkipped. This follows agc_driver_sample_order, which checks the same limits and helper (SampleOrder.cpp, GridReference and RecipeDepthLocations).

VK_FORMAT_D32_SFLOAT_S8_UINT is the host format on every device: the test's depth registers select Z format 3 with stencil, and HostDepthFormat only substitutes VK_FORMAT_D16_UNORM_S8_UINT.

One driver check is not mirrored. Whether a 2x depth target is sampleable also depends on two vkGetPhysicalDeviceImageFormatProperties queries in DepthSurface.cpp that use the driver's internal sample-shadow usage. A device that passes the three checks above but fails those queries would still fail this test with the driver's own refusal message, not skip. I know of no such device.

Pull requests don't run the self-hosted linux job, which has Mesa's Vulkan drivers. It runs only on pushes to main and on manual dispatch. Since #16025 merged, it fails on main with this test: run 43647851509 at 995a10cdbb reports 99% tests passed, 3 tests failed out of 5493, namely agc_driver_stencil_copy_draw and the two narrow-subgroup tests that #19332 skips.

Tested

Head 503e74637c on main 89ecbc95f8. StencilCopyDraw.cpp, DepthSurface.cpp and Pipeline.cpp are unchanged between 3c310597b6 and 89ecbc95f8. The A/B runs below compare main 3c310597b6 with this change applied on it.

All A/B runs used the same environment on both sides:

  • Environment: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer.
  • Command: ctest --test-dir build -R '^agc_driver_stencil_copy_draw$' -V, 3 times per side and GPU.
  • Validation layer: every log shows the loader inserting VK_LAYER_KHRONOS_validation.

Ubuntu 24.04, GCC 13.3.0, Release, lavapipe (Mesa 25.2.8, LLVM 20.1.2), Khronos validation layer 1.4.335 built from source.

main this PR
agc_driver_stencil_copy_draw fails 3/3: VUID-VkImageCreateInfo-samples-02258, then the custom sample locations refusal skips 3/3 after the one-sample cases pass, 0 VUID-

I repeated the branch side at 503e74637c with the same result: skips 3/3, 0 VUID-.

Windows 10 22H2 (19045), WinLibs GCC 15.2.0 r7 UCRT, Release, Vulkan SDK 1.4.363.1 validation layer, implicit layers disabled (VK_LOADER_LAYERS_DISABLE=~implicit~). One PC with both GPUs, each selected with ANYPS5_GPU. These runs check that the two-sample cases still run where the device supports them:

GPU main this PR
Intel UHD Graphics 770 (8086:4680), driver 101.7088 passes 3/3, all six cases passes 3/3, all six cases, no skip, 0 VUID-
NVIDIA GeForce RTX 4060 (10de:2882), driver 610.74 passes 3/3, all six cases passes 3/3, all six cases, no skip, 0 VUID-

"All six cases" means the log ends with the DB stencil copy wrote both drawn stencil values exactly where its draw rasterized, which the test prints only after the last two-sample case.

Other checks:

  • Full ctest --test-dir build --output-on-failure -j6 --timeout 300 on lavapipe at 503e74637c: 5491 of 5493 pass, and agc_driver_stencil_copy_draw skips. The two failures, agc_driver_global_atomic_csub and agc_driver_coherent_atomic_loads_enabled (timeout), are not caused by this PR. They come from lavapipe's 8-lane subgroups, and my open #19332 skips them.
  • python3 tools/check_conventions.py --base origin/main passes.
  • tools/pr_overlap.py finds no overlap with open pull requests.
  • tools/check_skips.py's device-limitation pattern accepts the skip message.

Not tested:

  • AMD and macOS / MoltenVK on my side. In a comment on this PR, another contributor reports the two-sample cases running and passing at 503e74637c on RDNA2 (gfx1036) and RDNA3 (gfx1100), and the skip on llvmpipe.
  • A device that has 2x custom sample locations but can't sample a 2x D32_SFLOAT_S8_UINT target (see the end of What).

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 (Mesa 25.2.8), Ubuntu 24.04; Intel UHD Graphics 770, driver 101.7088, Windows 10 22H2; NVIDIA GeForce RTX 4060, driver 610.74, Windows 10 22H2
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5317519905 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20289). Originally posted by [peacocksir](https://github.com/peacocksir) on 2026-11-14T23:47:33Z. --- ### What `agc_driver_stencil_copy_draw`, added by #16025, fails on lavapipe. Its four two-sample cases draw with custom sample locations on a 2x `VK_FORMAT_D32_SFLOAT_S8_UINT` depth target: - Lavapipe allows only 1x and 4x for that format (`format sampleCounts: VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT`), so creating the target logs `VUID-VkImageCreateInfo-samples-02258`. - The driver then refuses the draw in `ValidateSampleLocations`: `custom sample locations require VK_EXT_sample_locations support for the draw's sample count`. The driver behaves as intended here: it refuses a draw the device can't run. The test assumes every device can run it. This PR changes only the test. It still runs the two one-sample cases on every device. Before the two-sample cases, it checks the device for what the driver requires for these draws: - `framebufferDepthSampleCounts` has 2x (`Pipeline.cpp`, "device does not support depth targets with the draw's sample count"). - `sampledImageStencilSampleCounts` has 2x (`DepthSurface.cpp`, "the device cannot sample the native depth target's stencil at its sample count"). - `SampleLocationsCompatibleDepth(context, VK_FORMAT_D32_SFLOAT_S8_UINT, 2)`, the driver's own check for custom sample locations on that depth format. If any of them fails, the test shuts the driver down, prints `skipped, the device has no sampled 2x D32_SFLOAT_S8_UINT depth targets with custom sample locations, so only the one-sample stencil copies ran` and returns `VulkanTestSkipped`. This follows `agc_driver_sample_order`, which checks the same limits and helper (`SampleOrder.cpp`, `GridReference` and `RecipeDepthLocations`). `VK_FORMAT_D32_SFLOAT_S8_UINT` is the host format on every device: the test's depth registers select Z format 3 with stencil, and `HostDepthFormat` only substitutes `VK_FORMAT_D16_UNORM_S8_UINT`. One driver check is not mirrored. Whether a 2x depth target is sampleable also depends on two `vkGetPhysicalDeviceImageFormatProperties` queries in `DepthSurface.cpp` that use the driver's internal sample-shadow usage. A device that passes the three checks above but fails those queries would still fail this test with the driver's own refusal message, not skip. I know of no such device. Pull requests don't run the self-hosted `linux` job, which has Mesa's Vulkan drivers. It runs only on pushes to `main` and on manual dispatch. Since #16025 merged, it fails on `main` with this test: run 43647851509 at 995a10cdbb reports `99% tests passed, 3 tests failed out of 5493`, namely `agc_driver_stencil_copy_draw` and the two narrow-subgroup tests that #19332 skips. ### Tested Head 503e74637c on `main` 89ecbc95f8. `StencilCopyDraw.cpp`, `DepthSurface.cpp` and `Pipeline.cpp` are unchanged between 3c310597b6 and 89ecbc95f8. The A/B runs below compare `main` 3c310597b6 with this change applied on it. All A/B runs used the same environment on both sides: - **Environment:** `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer`. - **Command:** `ctest --test-dir build -R '^agc_driver_stencil_copy_draw$' -V`, 3 times per side and GPU. - **Validation layer:** every log shows the loader inserting `VK_LAYER_KHRONOS_validation`. **Ubuntu 24.04, GCC 13.3.0, Release, lavapipe (Mesa 25.2.8, LLVM 20.1.2), Khronos validation layer 1.4.335 built from source.** | | `main` | this PR | |---|---|---| | `agc_driver_stencil_copy_draw` | fails 3/3: `VUID-VkImageCreateInfo-samples-02258`, then the custom sample locations refusal | skips 3/3 after the one-sample cases pass, 0 `VUID-` | I repeated the branch side at 503e74637c with the same result: skips 3/3, 0 `VUID-`. **Windows 10 22H2 (19045), WinLibs GCC 15.2.0 r7 UCRT, Release, Vulkan SDK 1.4.363.1 validation layer, implicit layers disabled (`VK_LOADER_LAYERS_DISABLE=~implicit~`).** One PC with both GPUs, each selected with `ANYPS5_GPU`. These runs check that the two-sample cases still run where the device supports them: | GPU | `main` | this PR | |---|---|---| | Intel UHD Graphics 770 (8086:4680), driver 101.7088 | passes 3/3, all six cases | passes 3/3, all six cases, no skip, 0 `VUID-` | | NVIDIA GeForce RTX 4060 (10de:2882), driver 610.74 | passes 3/3, all six cases | passes 3/3, all six cases, no skip, 0 `VUID-` | "All six cases" means the log ends with `the DB stencil copy wrote both drawn stencil values exactly where its draw rasterized`, which the test prints only after the last two-sample case. Other checks: - Full `ctest --test-dir build --output-on-failure -j6 --timeout 300` on lavapipe at 503e74637c: 5491 of 5493 pass, and `agc_driver_stencil_copy_draw` skips. The two failures, `agc_driver_global_atomic_csub` and `agc_driver_coherent_atomic_loads_enabled` (timeout), are not caused by this PR. They come from lavapipe's 8-lane subgroups, and my open #19332 skips them. - `python3 tools/check_conventions.py --base origin/main` passes. - `tools/pr_overlap.py` finds no overlap with open pull requests. - `tools/check_skips.py`'s device-limitation pattern accepts the skip message. Not tested: - AMD and macOS / MoltenVK on my side. In a comment on this PR, another contributor reports the two-sample cases running and passing at 503e74637c on RDNA2 (gfx1036) and RDNA3 (gfx1100), and the skip on llvmpipe. - A device that has 2x custom sample locations but can't sample a 2x `D32_SFLOAT_S8_UINT` target (see the end of What). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) 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 (Mesa 25.2.8), Ubuntu 24.04; Intel UHD Graphics 770, driver 101.7088, Windows 10 22H2; NVIDIA GeForce RTX 4060, driver 610.74, Windows 10 22H2 - [x] AI-assisted: yes

Pull request closed

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!20289
No description provided.