Skip to content

d3d12_view_slices: clear every array-view range with a rectangle as well (D3D-VIEW-SLICES-RECT) - #9028

Closed
coenflict wants to merge 1 commit into
ProjectLeonida:mainfrom
coenflict:orchestrator/msaa-dsv-array-parity
Closed

coenflict wants to merge 1 commit into
ProjectLeonida:mainfrom
coenflict:orchestrator/msaa-dsv-array-parity

Conversation

@coenflict

Copy link
Copy Markdown
Contributor

Item: D3D-VIEW-SLICES-RECT, claim. Depends on: none.

What

d3d12_view_slices clears every array-view range a second time, this time with a rectangle ({2, 1, 6, 7} in mip 0, scaled to the view's mip, since D3D12 rects are in the mip's own texels). The readback must be one inside the rectangle for the slices the view names, and zero everywhere else. This covers the 4x TEXTURE2DMSARRAY RTV and DSV views (ArraySize -1, plus counted slices for the depth array) and the TEXTURE2DARRAY mip-chain views. Like the existing cases, each one runs against the host's D3D12 on the layer's adapter and against WARP.

The layer clears with a rectangle through vkCmdClearAttachments in a rendering scope, not through vkCmdClear*Image. Until now no test covered that path on a multisample array view. The resolve and readback are the same as in the image-clear run, so the two runs together can tell a wrong clear from a wrong resolve.

Test only, no runtime change.

Why, and the Intel finding

This came out of looking at the Intel Arrow Lake-HX finding (six DSV D32_FLOAT 4x failures on driver 101.9175). As far as I can read it, that is D3D-739 / #8244 (a quirk of the native Intel reference), not a layer defect:

  • The failing lines name on Intel(R) Graphics, which is the host reference. The layer's lines say on the layer.
  • The test creates its host on the layer's adapter by LUID, and that comes before LEONIDA_HOST_ADAPTER (d3d12_copy_compare.h:74). So the host stays Intel whatever that variable is set to.

I have no Intel GPU, so that part is not confirmed on the hardware.

This PR also edits the check lambda that #8244 edits. Whichever PR lands second needs a small rebase. Once both are in, #8244's host-zero allowance would also apply to the rectangle cases.

Tested

Windows 11 26340, MSVC (VS 18) x64, Ninja RelWithDebInfo, Vulkan SDK 1.4.363, with LEONIDA_VK_VALIDATION=1, using ctest -R "^(d3d12_view_slices|d3d12_clear|d3d12_clear_formats)$" and running the test directly:

Layer on (LEONIDA_VK_DEVICE) main 867d922 this PR
NVIDIA RTX 5090, 621.24 24 layer / 42 host clears, 0 failures 48 layer / 84 host clears, 0 failures
AMD Radeon iGPU (RDNA2), 32.0.21042.62 24 / 42, 0 failures 48 / 84, 0 failures

d3d12_clear and d3d12_clear_formats pass on both GPUs. There were no validation messages.

  • Negative control (not in the patch): with detail::clip changed so a rectangle clear reaches only the view's first layer, the layer gets 15 failures, all in the new rectangle cases, and the host and WARP have none.
  • My own first draft used an unscaled rectangle. The host, WARP and the layer all agreed that it was clipped at mips 1 and 2, which confirms the per-mip coordinates the test now uses.
  • check_no_game_data.py passes on the changed file.

Synthetic tests only, no game files. AI-assisted (Claude Code).

🤖 Generated with Claude Code

Each range (ArraySize -1 and, for the 4x depth array, counted slices) is cleared a second
time with a rectangle of mip 0 scaled to the view's mip, and checked inside and outside it
against the host's D3D12 and WARP. On the layer that clear goes through vkCmdClearAttachments
in a rendering scope, which no test covered on a TEXTURE2DMSARRAY view; the readback and
resolve are the same as the image clear's, so the pair tells a wrong clear apart from a
wrong resolve. D3D-VIEW-SLICES-RECT. Test only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Independent Linux CPU review

What changed: d3d12_view_slices clears every array-view range with a rectangle as well (D3D-VIEW-SLICES-RECT).

Checked: diff review of runtime/test/d3d12_view_slices_test.cpp (no local runtime build).

Looks correct; no game files.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head 41f924a0e merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0) across both GPUs with LEONIDA_VK_VALIDATION=1:

  • python -I scripts/check_no_game_data.py runtime/test/d3d12_view_slices_test.cpp: clean (exit 0)
  • cmake --build runtime/build --target d3d12_view_slices_test --parallel: built cleanly
  • LEONIDA_VK_VALIDATION=1 .\runtime\build\d3d12_view_slices_test.exe on NVIDIA GeForce RTX 5060 Ti (driver 610.88, Vulkan 1.4.341): passed, 0 validation errors (array views: 48 clears on the layer, 84 on the host; 42 out-of-range views refused; 0 failures)
  • LEONIDA_VK_VALIDATION=1 LEONIDA_VK_DEVICE=Radeon .\runtime\build\d3d12_view_slices_test.exe on AMD Radeon(TM) Graphics (driver 24.10.24, Vulkan 1.3.280): passed, 0 validation errors (48 clears on the layer, 84 on the host; 42 out-of-range views refused; 0 failures)

AI-assisted.

@DeerSilver

Copy link
Copy Markdown

Tested 41f924a0e against 867d922f0 on Windows 11 26H2 (build 26300.9974), MSVC 2022 Build Tools, Ninja RelWithDebInfo, Vulkan-Headers 1.4.363 (LEONIDA_VULKAN_HEADERS_FETCH), with the layer on each GPU of one laptop via LEONIDA_VK_DEVICE. This includes the Intel host reference you couldn't check:

Layer on host reference (as printed) main 867d922f0 this PR
NVIDIA GeForce RTX 5060 Laptop GPU, 621.24 RTX 5060, and WARP 24 layer / 42 host clears, 42 out-of-range refused, 0 failures 48 / 84, 42 refused, 0 failures
Intel UHD Graphics (Raptor Lake mobile, Xe-LP), 101.7088 Intel(R) UHD Graphics, and WARP 24 / 42, 42 refused, 0 failures 48 / 84, 42 refused, 0 failures

So on Xe-LP / 101.7088 the host and the layer agree on every rectangle case (RTV and DSV 4x MS arrays, mip-chain arrays); none of the DSV D32_FLOAT 4x failures from the Arrow Lake-HX finding show up on this older Intel driver and GPU.

d3d12_clear passes on both GPUs. d3d12_clear_formats passes on the RTX 5060; on the Intel UHD it reports 10 sRGB differences against WARP (R8G8B8A8_UNORM_SRGB / B8G8R8A8_UNORM_SRGB, one step low, e.g. bb vs bc). That is identical on main, so it's not from this PR. Not run with LEONIDA_VK_VALIDATION=1 (no validation layer installed here). Synthetic tests only.

AI-assisted (Claude Code).

@egexon

egexon commented Nov 23, 2026

Copy link
Copy Markdown

Tested 41f924a (merged onto main 867d922) on RTX 5070, NVIDIA 621.24, Windows 11 (build 26200), Vulkan validation layer on (LEONIDA_VK_VALIDATION=1, VK_VALIDATION_VALIDATE_SYNC=1): pass.

  • d3d12_view_slices: passes with this PR, and passes on main.

Ran the tests that belong to the test files this PR changes (ctest entries, or the test program directly when it is not registered), with no game files (LEONIDA_GAME_DIR unset). AI-assisted (Claude Code).

@marso006

Copy link
Copy Markdown

Tested 41f924a0e (based on main 867d922f0) on Windows 11, NVIDIA GeForce RTX 5060 Ti (Blackwell), driver 617.42, VS 2026 (scripts/build_runtime.ps1, RelWithDebInfo), Vulkan SDK 1.4.363.0: pass. Synthetic, no game files.

Independent check, claim. AI-assisted (Claude Code).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants