Skip to content

d3d12_clear: under Wine, run the layer's clears and skip the vkd3d host comparison - #8703

Closed
pr1sm-dev wants to merge 1 commit into
ProjectLeonida:mainfrom
pr1sm-dev:d3d12-clear-wine-skip
Closed

pr1sm-dev wants to merge 1 commit into
ProjectLeonida:mainfrom
pr1sm-dev:d3d12-clear-wine-skip

Conversation

@pr1sm-dev

Copy link
Copy Markdown

Claimed in #8683 (#8683 (comment)). Finding and fix idea by @best2135 in #7599 (#7599 (comment)).

What and why

Under Wine, EnumWarpAdapter answers with vkd3d on the GPU, not Microsoft's WARP. d3d12_clear therefore compared the layer with the GPU driver's results where WARP's are defined, and failed on cases where the layer matches WARP (it has since #521):

  • UNORM/SNORM 0.5 ties: the layer stores 0x80 / 0x40 (WARP's values), vkd3d on NVIDIA 0x7f / 0x3f.
  • Out-of-range UINT clears: clamped differently (e.g. R8G8_UINT case 3 byte 13: Vulkan ff, WARP 00).
  • D16_UNORM (format 55) and the D32_FLOAT_S8X24_UINT stencil plane (format 20) differ as well, as best2135 reported.

#8115 and #7638 skip only when no WARP device can be created. That covers Wine 10.0, which has no WARP adapter (#8115 measured Failed -> Skipped there), but Wine 11.22 answers EnumWarpAdapter with vkd3d, so the comparison runs and fails: with #8115 merged locally, d3d12_clear still fails here. The same happens under Proton (vkd3d-proton), as GeremC noted in #166.

Change

runtime/test/d3d12_clear_test.cpp only, the same pattern as #6500 for d3d12_clear_formats: under hostwine::host_is_wine() the test creates no host device, runs every colour, castable-format, depth/stencil and D3D-437 clear on the layer, still fails on a layer clear/readback failure or a new Vulkan validation error, and exits 77 (ctest: skipped; the test is already registered with SKIP_RETURN_CODE 77). --volume skips under Wine; --rgb9e5 doesn't touch the host and is unchanged. Nothing changes on Windows.

Tested

Linux Mint 22.2, Wine 11.22, NVIDIA GeForce RTX 3070 (driver 595.91.07, no Resizable BAR), runtime cross-built with clang-cl 21.1.8 + xwin 0.10.0 (SDK 10.0.26100):

  • before (main dde82f27e; the test file is unchanged on 867d922f0): d3d12_clear Failed ("20 color/depth format(s) differ from WARP": 18 colour, D16_UNORM, D32_FLOAT_S8X24_UINT stencil)
  • after (this branch, on main 867d922f0): d3d12_clear Skipped; 232 clears ran on the layer without a readback failure or validation error
  • d3d12_rgb9e5_rtv unchanged (Skipped: no RGB9E5 render targets on this adapter)

Not tested on Windows (no Windows machine); the Windows path only gains !wine && guards that are true there.

Possible conflicts: #8115 and #7638 edit the same WARP reference unavailable block; whichever lands second needs a trivial rebase.

AI-assisted (Claude Code, Claude Opus 5.5).

…st comparison

Under Wine, EnumWarpAdapter answers with vkd3d on the GPU, not Microsoft's
WARP, so d3d12_clear compared the layer against the GPU driver's rounding
of 0.5 ties, its out-of-range integer clears and its stencil readback, and
failed on cases where the layer matches WARP (ProjectLeonida#521). Like the other host
comparisons under Wine (ProjectLeonida#6500 for d3d12_clear_formats), the test now runs
every clear on the layer, still fails on a layer readback failure or a new
Vulkan validation error, and exits 77 (skip) instead of comparing.

Finding by best2135 (ProjectLeonida#7599). Tested under Wine 11.22, RTX 3070.

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

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head d071ddb8d merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0) to confirm the native Windows WARP comparison path is unaffected:

  • python -I scripts/check_no_game_data.py runtime/test/d3d12_clear_test.cpp: clean (exit 0)
  • cmake --build runtime/build --target d3d12_clear_test --parallel: built cleanly
  • LEONIDA_VK_VALIDATION=1 .\runtime\build\d3d12_clear_test.exe on NVIDIA GeForce RTX 5060 Ti (driver 610.88, Vulkan 1.4.341): passed, 0 validation errors (3D RTVs: 648 RGBA texels match WARP, RTV and DSV clears: 232 full/rectangle readbacks matched WARP)
  • LEONIDA_VK_VALIDATION=1 LEONIDA_VK_DEVICE=Radeon .\runtime\build\d3d12_clear_test.exe on AMD Radeon(TM) Graphics (driver 24.10.24, Vulkan 1.3.280): passed, 0 validation errors (232/232 readbacks matched WARP)

AI-assisted.

@MartinIndra02

Copy link
Copy Markdown
Contributor

Independent build + test (native Windows control): PASS

AI-assisted (Claude Code). Windows 11 x64 (native, not Wine), MSVC 19.44.35220, Ninja RelWithDebInfo, NVIDIA GeForce RTX 3080 driver 621.24 / 32.0.16.2124, WARP as the reference.

Head d071ddb8d, based on current main 867d922f0.

Test Result
ctest -R d3d12_clear (d3d12_clear, d3d12_clear_formats) 2/2 passed
d3d12_clear_test.exe exit 0: 3D RTVs: 648 RGBA texels match WARP ..., RTV and DSV clears: 232 full/rectangle readbacks matched WARP

On native Windows hostwine::host_is_wine() is false and every host comparison still runs (232 readbacks compared with WARP, the same as before), so the change doesn't weaken the Windows run. I can't run the Wine path here.

Note: under Wine the --volume-only path now returns 77 (skip) without running check_volume_rtvs on the layer at all. The other cases still run the layer's clears and only skip the comparison. If the layer-only volume checks are meaningful without a host, they could run there too. No issues found.

@NurRobin

Copy link
Copy Markdown

Tested d071ddb under Wine on Linux, NVIDIA RTX 3070 Ti and AMD RADV (Raphael iGPU): pass.

ctest -R '^d3d12_clear$' under Wine fails on main on both GPUs and is skipped on this head on both. The skip comes after the layer's own clears run. Verbose output on the 3070 Ti:

host D3D12 is Wine's, not Microsoft's: comparisons with the host are skipped
232 clears ran on the layer without a WARP reference (host D3D12 is Wine's)

So this gives the Linux and Wine evidence the earlier checks didn't have. I didn't need #8115 or #7638 for it: this head alone turns the test from failed to skipped here.

Setup: CachyOS Linux 7.3.1, Wine 11.21, runtime cross-built with clang-cl 23.1.4 and the xwin SDK 10.0.26100 (runtime/cmake/clang-cl-xwin.cmake). Two GPUs, each run alone by hiding the other with VK_LOADER_DRIVERS_SELECT: NVIDIA RTX 3070 Ti (615.78.08) and the AMD Raphael iGPU of a Ryzen 7 9800X3D (RADV, Mesa 26.2.6). Baseline is main 867d922 built the same way.

AI-assisted: yes. Claude Code ran these tests on my machine and wrote this summary.

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

Tested d071ddb8d under Wine on a real AMD GPU: d3d12_clear passes, no new failures.

AMD Radeon RX 6700 XT (gfx1031), RADV Mesa 26.3.1, CachyOS Linux 7.3.5 (niri, XWayland). The Windows runtime is cross-built with clang-cl + xwin, merged onto main 867d922f0, and the full ctest (271 tests) is diffed against main under three Wines: WineHQ 11.22, Proton CachyOS 11.0 (cachyos-11.0-20261015-slr; vkd3d-proton 0bb64c5, DXVK 3.1.1-97) and Proton Experimental 11.0 (experimental-11.0-20261112; vkd3d-proton 2576c0b, DXVK 3.1.1-209). The Proton runs use files/bin/wine with a proton run-made prefix and WINEDLLOVERRIDES="d3d12=n;d3d12core=n;dxgi=n", as in docs/testing.md.

  • WineHQ 11.22: d3d12_clear fixed (17 failed vs 18 on main), nothing new.
  • Both Protons: d3d12_clear already passes there on main (DXVK's DXGI), and still does with this PR.

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

@Moriz82

Moriz82 commented Nov 23, 2026

Copy link
Copy Markdown

Tested d071ddb on NVIDIA GeForce RTX 4070, driver 610.57.04, CachyOS Linux, Wine 11.20 (real Hyprland session; Windows runtime cross-compiled with clang-cl 23.1.3 + xwin SDK 10.0.26100): pass.
d3d12_clear goes from fail (on main 867d922f0, 20 formats differ from Wine's WARP stand-in) to skip (77) under Wine. #7638 and #8115 don't clear this test under plain Wine (it has DXGI and a WARP stand-in). No game files. AI-assisted (Claude).

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