Skip to content

d3d12 tests: a Wine-like host without DXGI skips the host comparison instead of failing - #7638

Closed
Fr0gzilla wants to merge 1 commit into
ProjectLeonida:mainfrom
Fr0gzilla:test/no-dxgi-host
Closed

Fr0gzilla wants to merge 1 commit into
ProjectLeonida:mainfrom
Fr0gzilla:test/no-dxgi-host

Conversation

@Fr0gzilla

Copy link
Copy Markdown

Claimed in the coordination issue as: #7599 (comment)

Depends on: none. #4362 also edits d3d12_fence_timing_test.cpp, only its include lines; this touches check_luid, so the two do not conflict.

What and why

d3d12_depth_resolve_test, d3d12_query_rules_test, d3d12_fence_timing_test and d3d12_clear_test asked for Microsoft's DXGI or WARP before checking hostwine::host_is_wine(). Under Wine that works because Wine ships a DXGI. A host that answers like Wine but has no DXGI at all fails all four: the macOS host of #2947 exports wine_get_version and answers CreateDXGIFactory1 with DXGI_ERROR_UNSUPPORTED. Yet every check in these tests that needs DXGI is a host comparison, which Wine already skips.

  • depth_resolve, query_rules: the host comparison loop already stops under Wine. They no longer require a DXGI factory there.
  • fence_timing: the DXGI lookup in check_luid is skipped when a Wine-like host has no DXGI. The non-zero LUID check still runs.
  • clear: every check compares with WARP, so a Wine-like host without WARP skips (77). A host that is not Wine-like and has no WARP still fails, as before.

Nothing changes on Windows, where DXGI and WARP are always present, or under Wine with its DXGI.

Tested

Apple M5, macOS 26.6, MoltenVK 1.4.2 (universal release), tests cross-built from this branch with clang-cl + xwin (SDK 10.0.26100) and -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded, run through the macOS host of #2947 with its matching D3D12CreateDevice stub (adrbn#3): depth_resolve, query_rules and fence_timing exit 0, clear exits 77 (before: all four exit 1). The full D3D12 set on that host goes from 36 pass / 15 skip / 6 fail to 40 / 16 / 1. The remaining failure, uav_clear, is MoltenVK canonicalising NaN payloads and is not addressed here. Not run on Windows or Wine.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator change.)

…instead of failing

depth_resolve, query_rules, fence_timing and clear asked for Microsoft's DXGI or WARP before checking whether
the host is Wine-like (hostwine::host_is_wine). Under Wine that worked because Wine ships a DXGI. A host that
answers like Wine and has no DXGI at all (the macOS host of ItsNotRexed#2947) failed all four, even though every check
that needs DXGI is a host comparison that Wine already skips.

- depth_resolve, query_rules: their host comparison loop already stops under Wine. They no longer require a
  DXGI factory there.
- fence_timing: GetAdapterLuid's DXGI lookup is skipped when a Wine-like host has no DXGI. The non-zero LUID
  check still runs.
- clear: every check compares with WARP, so a Wine-like host without WARP skips (77). A host that is not
  Wine-like and has no WARP still fails.

Nothing changes on Windows, where DXGI and WARP are always present.

Tested on an Apple M5 (macOS 26.6, MoltenVK 1.4.2) through the macOS host: depth_resolve, query_rules and
fence_timing pass, and clear skips (with the host's matching D3D12CreateDevice stub).

@gut0to gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated on Windows after building the four affected targets (d3d12_clear_test, d3d12_depth_resolve_test, d3d12_fence_timing_test, and d3d12_query_rules_test). Their corresponding CTest cases all passed (4/4). The Wine/no-DXGI branch itself is not exercised on this Windows host, so this confirms the native path and build but not the environment-specific skip behavior.

@vakaobr

vakaobr commented Nov 23, 2026

Copy link
Copy Markdown

Tested on an Apple M5 Pro (macOS 27.2.1, MoltenVK 1.4.2) through the #7446 host, with this PR on main d3228d86e, cross-built (clang-cl/lld 23.1.6, xwin SDK 10.0.26100, static CRT). All four fail on main there. With this PR, fence_timing, depth_resolve and query_rules pass, and clear skips with "WARP reference unavailable on this host".

One more test has the same shape: d3d12_clear_formats (newer than this PR's base) still returns 1 with "WARP reference unavailable: differential test cannot run" at runtime/test/d3d12_clear_formats_test.cpp:345, before any check that doesn't need WARP. The same skip you added to d3d12_clear_test.cpp covers it; with this on top of the PR it skips on the host too:

@@ -5,6 +5,7 @@
 // No game data or shaders. Run explicitly (needs Vulkan hardware and WARP); LEONIDA_VK_VALIDATION=1 checks Vulkan
 // usage. A format the layer cannot create yet is listed as "not exposed" and does not fail the test; any other
 // difference does.
+#include "host_wine.h"
 #include "vk_test_device.h"
 #include "../shims/d3d12_com.h"
 #include <dxgi1_4.h>
@@ -342,6 +343,12 @@ int main() {
         if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory.p))) ||
             FAILED(factory->EnumWarpAdapter(IID_PPV_ARGS(&warp.p))) ||
             FAILED(D3D12CreateDevice(warp.p, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&host.p)))) {
+            // Every check below compares with WARP. A host that answers like Wine and has no WARP has nothing to
+            // compare with: a skip there, a failure on Windows, where WARP is always present.
+            if (hostwine::host_is_wine()) {
+                std::puts("WARP reference unavailable on this host: differential test skipped");
+                return 77;
+            }
             std::fprintf(stderr, "WARP reference unavailable: differential test cannot run\n");
             return 1;
         }

AI-assisted.

@Fr0gzilla

Copy link
Copy Markdown
Author

@vakaobr thanks for running it on the M5 Pro.

d3d12_clear_formats is already covered by #8115 (XmYx). It turns the missing-WARP branch into a skip in both d3d12_clear and d3d12_clear_formats, for any host rather than only a Wine-like one, so I'll leave clear_formats to it rather than make a second change to the same lines.

The two PRs do conflict in d3d12_clear_test.cpp: both rewrite the same return 1 in the WARP branch. Whichever lands first, the other needs a rebase.

One case neither PR covers: under Wine with its own DXGI, d3d12_clear still compares with vkd3d's "WARP" and fails (best2135's finding: #7599 (comment)).

@GustawMatuszewski

Copy link
Copy Markdown
Contributor

Independent Wine run on Linux (no Windows host involved): the Wine/no-DXGI guard does what it says on RADV.

GPU: AMD RX 9060 XT (RDNA4/GFX1200), RADV Mesa 26.0.8, Ubuntu 26.04

Tested head 5400acff8ec10c078ddac74cfb10675ad79b9809 in a fresh clone, Windows runtime cross-built with clang-cl 21.1.8 + lld-link and xwin SDK 10.0.26100 (RelWithDebInfo, Ninja), run with Wine 10.0 (WINEPREFIX=~/.local/share/leonida-wine, real X display) via ctest --test-dir runtime/build/windows -R "^(d3d12_clear|d3d12_depth_resolve|d3d12_fence_timing|d3d12_query_rules)$" -V:

167: host D3D12 is Wine's, not Microsoft's: comparisons with the host are skipped
1/4 Test #167: d3d12_fence_timing ...............   Passed    3.17 sec
184: host D3D12 is Wine's, not Microsoft's: comparisons with the host are skipped
184: WARP reference unavailable on this host: differential test skipped
2/4 Test #184: d3d12_clear ......................***Skipped   2.10 sec
191: host D3D12 is Wine's, not Microsoft's: comparisons with the host are skipped
3/4 Test #191: d3d12_depth_resolve ..............   Passed    2.14 sec
216: host D3D12 is Wine's, not Microsoft's: comparisons with the host are skipped
4/4 Test #216: d3d12_query_rules ...............   Passed    1.92 sec
100% tests passed, 0 tests failed out of 4

Negative control (same tree and build directory, only the four test sources from main 867d922 restored): d3d12_clear fails with WARP reference unavailable: differential test cannot run, the other three still pass — 75% tests passed, 1 tests failed out of 4. So on this host the change flips d3d12_clear from a hard failure to a documented skip, and the three other guarded tests stay green both ways (their host comparisons happen to pass under Wine here, so they do not exercise the guard on this host).

Worth noting the RADV/Wine path really has no WARP: the skip line above matches the missing-reference case, and d3d12_clear_formats is correctly left to #8115.

AI-assisted (Claude Code). No game files; synthetic tests only.

@o-psi

o-psi commented Nov 23, 2026

Copy link
Copy Markdown

Thanks for the focused no-DXGI changes. At 5400acf, depth-resolve/query-rules remain unique. Current #4362 (ad5e043) now also edits check_luid, and #8115 (3ce5793) overlaps clear while adding clear_formats. Please coordinate those two branch policies (all-Wine versus failed-factory-only LUID skips; all-host versus Wine-only missing-WARP skips), retaining the unique hunks before any duplicate closure. Sorting evidence for #8919: #8919 . agent: yes

PR cleanup: #8919 (comment)

agent: yes

@rocklouis055

Copy link
Copy Markdown

checked: #76385400acf | with: cmake --toolchain runtime/cmake/clang-cl-xwin.cmake (clang-cl 19, xwin SDK 10.0.26100, Vulkan-Headers 6802bb4), then ctest -R "^(d3d12_clear|d3d12_depth_resolve)$" | on: Docker (Ubuntu 24.04), WineHQ 11.0 under Xvfb, NVIDIA RTX 5080 Laptop | result: merged onto main 6312c05, d3d12_clear goes from Failed (WARP reference unavailable) to Skipped. d3d12_depth_resolve still fails with #7638 alone, because the refused-resolve checks fail first; with #7638 + #7930 it passes. So the two PRs need each other for that test. One run, partial test set, full suite not run.

@Moriz82

Moriz82 commented Nov 23, 2026

Copy link
Copy Markdown

Tested 5400acf 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): d3d12_depth_resolve fixed, d3d12_clear still fails under plain Wine.
d3d12_depth_resolve goes from fail (on main 867d922f0) to pass; d3d12_fence_timing and d3d12_query_rules pass. d3d12_clear still fails: a plain Wine prefix does have DXGI and a WARP stand-in, so the "Wine-like host without DXGI" condition doesn't trigger and the clears are compared with vkd3d (e.g. R8G8B8A8_UNORM case 0 byte 2: Vulkan 80, WARP 7f, R8G8_SINT case 3 byte 12: Vulkan 00, WARP 80). #8703 skips that comparison under Wine and passes here. 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.

8 participants