Skip to content

Tests: eight host-comparison tests skip Wine's host and still check the layer (TEST-WINE-HOST-GUARDS) - #519

Merged
QemmHD merged 3 commits into
ProjectLeonida:mainfrom
milk4sale:test/wine-host-guards
Nov 24, 2026
Merged

QemmHD merged 3 commits into
ProjectLeonida:mainfrom
milk4sale:test/wine-host-guards

Conversation

@milk4sale

@milk4sale milk4sale commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-WINE-HOST-GUARDS (claim)

What and why

Eight tests compare the layer with the host's D3D12/DXGI without the runtime/test/host_wine.h guard the other host-comparison tests use. Under Wine that host is vkd3d and Wine's own DXGI, so all eight fail on its answers, and in three of them the layer's own checks never run:

Test What happens under Wine on main With this change
d3d12_noop_copy vkd3d accepts the upload-heap self-copy; the test stops at "native WARP incorrectly accepted" before it looks at the layer host run skipped, layer checked: passes
d3d12_indirect_dispatch_count exits 1 with no message: Wine's D3DCompile has no RWByteAddressBuffer::InterlockedAdd (E5005), so the reference shader does not build host runs skipped, the layer's 8 results checked against expected(): passes
d3d12_typeless_depth the host reads both planes back as zeros; the layer holds the cleared values (00 00 40 / 00 00 80 3e for depth 0.25, stencil 5a) the comparison with the host is left out and the layer's readback is checked against the cleared depth and stencil at every texel: passes
d3d12_residency 14 mismatches: vkd3d answers S_OK where the layer answers E_INVALIDARG no host comparison; the layer's own record is checked (the valid calls succeed, the device is never removed, the fence reaches the values asked for): passes
d3d12_heap_properties 44 mismatches: vkd3d reports other heap flags no host comparison; the layer's own record is checked (the call succeeds for committed and placed resources and reports the heap type they were created with, and fails for reserved ones): passes
dxgi_swapchain 18 of 45 CreateSwapChainForHwnd answers differ from Wine's DXGI, and the test returns before its own swap-chain checks; further on, Wine's DXGI reports a driver version of its own where the layer reports 0 the three host comparisons skipped, the rest runs: passes
dxgi_host_parity page fault inside Wine's wined3d on GetBuffer(0, iid, null) exits 77: every row is a host comparison
dxgi_waitable_latency page fault inside Wine's dxgi on GetMaximumFrameLatency(null), after the layer's suite had passed host suite skipped, the layer's contracts checked: passes

The guard is hostwine::host_is_wine(), as in the other tests. d3d12_indirect_dispatch_count also prints the compiler's message when D3DCompile fails, instead of exiting 1 without a word. Tests only; no layer change.

Not in this pull request: d3d12_clear and d3d12_clear_formats fail the same way under Wine (in d3d12_clear_formats the layer has the stencil values that were cleared and Wine's host reads 0), but #307 and #428 touch those files.

Tested

Cross-built on Linux with clang-cl 23.1.4 and xwin (SDK 10.0.26100), run under wine-staging 11.21:

  • The eight tests on this branch: 7 pass and 1 exits 77 (dxgi_host_parity). Before the follow-up commit b358f4788 it was 6 and 2: d3d12_typeless_depth exited 77 too.
  • The whole suite (300 tests, one disabled), ctest -j 4: main 8f481cf gives 244 passed, 23 failed, 32 skipped; this branch (on c023a36) gives 250 passed, 15 failed, 34 skipped. The eight tests are the only ones whose result changed, and their sources are the same in both commits.
  • Negative control: with host_is_wine() forced to false and the eight tests rebuilt, each fails as it does on main (the same messages and mismatch counts, the same two fault addresses in wined3d and dxgi), so the path Windows takes behaves as before.
  • python -I scripts/check_no_game_data.py on the eight files, and git diff --check.
  • Follow-up b358f4788, after review: d3d12_heap_properties, d3d12_residency and d3d12_typeless_depth check the layer by itself on every host, before any comparison, and dxgi_swapchain names Wine as the reason it compared nothing. Controls on main 3ed8e50: a layer answering E_FAIL for a buffer's GetHeapProperties fails the first, a fence reaching 6 for 7 fails the second, and a flipped depth or stencil byte fails the third; with host_is_wine() forced to false the three pass their layer checks and then fail in the host comparison as on main (44 mismatches, 14 mismatches, readback differs from WARP). The whole suite was not run again for this commit.
  • Second follow-up e80697bab: the layer check of d3d12_heap_properties also holds every output asked for to having been written. With the layer leaving the two node masks unwritten, b358f4788 passes and e80697bab fails (62 wrong answers).

Not run on Windows, and not built with MSVC: I have neither here. On Windows host_is_wine() is false and each test takes the path it took before, except that since the follow-up three of them first run their layer checks; that part has not run on Windows.

The 15 that still fail here are outside this change: d3d12_clear and d3d12_clear_formats (above), d3d12_present and xbox_present (a tiling compositor resizes their 320x240 window; both pass in a nested gamescope session), device_proxy and device_proxy_trace, and nine loader and shim tests.

GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 620.70.06, Linux (CachyOS), through wine-staging 11.21

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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.

🤖 Generated with Claude Code

@kawaii-shakal

Copy link
Copy Markdown
Contributor

Review of head 6c1428a779eaf95d8758d6ffc747ddf746cf203f (read only; Linux, no Windows, no Wine, no GPU).

What I did: I read the diff of all eight tests and runtime/test/host_wine.h. I could not build or run them here (they need a Windows toolchain plus Wine or Windows).

Findings, from reading the code (nothing executed):

  • On real Windows nothing changes. host_is_wine() looks for wine_get_version in ntdll, which Microsoft's ntdll does not export, so every new guard is false there. In each test the host branch is the old code, unchanged apart from indentation. The one new behaviour is the extra D3DCompile error text in d3d12_indirect_dispatch_count.
  • On a Wine host, no skip hides a layer failure in six of the tests: noop_copy, indirect_dispatch_count, residency, heap_properties, dxgi_swapchain and dxgi_waitable_latency all still run the layer's own checks. In indirect_dispatch_count, setting native_result = want makes the WARP clause and the later native_result != want branch no-ops, and layer_result != want is still enforced.
  • In d3d12_typeless_depth and dxgi_host_parity, Wine exits 77 and the layer is not checked at all there. The PR says so, and both tests are pure host comparisons, so this is expected. Still, it means CI on a Wine host gives no coverage for these two.
  • Minor: under Wine, dxgi_swapchain prints "no host D3D12 device to compare with, skipped" (lines 645 and 648) because the guard returns the same -1. That message is misleading in a Wine log. A separate message, or a printf in the guard, would make the reason clear.

Not tested: I did not build or run anything (no clang-cl/xwin, Wine or Windows here). I did not reproduce the before/after ctest counts.


Review written by Claude (Claude Code, Opus 5.5), an AI agent, posted from a contributor's account.

demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…Wine's host and still check the layer (TEST-WINE-HOST-GUARDS)
…he layer (TEST-WINE-HOST-GUARDS)

d3d12_noop_copy, d3d12_indirect_dispatch_count, d3d12_typeless_depth, d3d12_residency, d3d12_heap_properties,
dxgi_swapchain, dxgi_host_parity and dxgi_waitable_latency compared the layer with the host's D3D12/DXGI without
the host_wine.h guard the other host-comparison tests use. Under Wine that host is vkd3d and Wine's own DXGI, so
all eight failed on its answers, two of them in a page fault inside wined3d/dxgi, and three before the layer's own
checks ran.

Under Wine the host comparison is now skipped: the tests whose every case is a host comparison exit 77, and the
others go on to check the layer. d3d12_indirect_dispatch_count also names a D3DCompile failure of its reference
shader instead of exiting 1 without a word. On Windows the tests run as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@moffington

Copy link
Copy Markdown
Contributor

I reproduced all eight failures on the merge base and got six passes and two skips at 6c1428a on RTX 3060 / Wine 11.20. Forcing the host path back on reproduced all eight failures. The copy, indirect-dispatch, swap-chain, and latency checks still exercise Leonida independently.

Please add layer assertions before treating heap properties and residency as correctness passes under Wine. In a local probe, a committed-buffer GetHeapProperties returning E_FAIL and a residency fence reaching 6 instead of 7 both passed. Please also retain a layer-only typeless-depth readback check. Both formats matched the expected depth and stencil at every texel on Leonida, while Wine’s reference returned zeros. The Wine guards and Windows comparisons can stay.

…on its own (TEST-WINE-HOST-GUARDS)

With no host to compare with (no host device, or Wine's), d3d12_heap_properties and d3d12_residency only printed
the layer's record, so a wrong answer of the layer still passed, and d3d12_typeless_depth exited 77 without looking
at the layer at all. Each now checks the layer by itself, on every host, before any comparison:

- d3d12_heap_properties: for every committed or placed resource the layer created, GetHeapProperties succeeds
  with both outputs, with the properties alone and with the flags alone, Type is the heap type it was created
  with (for a custom heap the CPU page property and memory pool too), and a call asking for one output reports
  what the call asking for both does. For a reserved resource the call fails.
- d3d12_residency: no call raises an exception, the plainly valid calls succeed, the device is never removed, and
  after EnqueueMakeResident the fence holds the value asked for (or stays put for a lower one, or after a failure).
- d3d12_typeless_depth: the layer's readback has to hold the cleared depth and stencil at every texel. Under Wine
  that is now the whole check and the test passes instead of exiting 77; elsewhere it runs before the comparison
  with WARP.

With LEONIDA_D3D49_VERBOSE=1 the first two print the layer's record when there is no host. dxgi_swapchain says
why it compared nothing under Wine instead of "no host D3D12 device".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@milk4sale

Copy link
Copy Markdown
Contributor Author

@moffington @kawaii-shakal thanks for the reviews. b358f4788 is a follow-up commit on top of ffce6b5c3, the head you both looked at (same eight files as 6c1428a77); nothing was rebased or force-pushed.

Layer assertions for heap properties and residency. Both tests now check the layer's own record on every host, before any comparison, so a run with no host to compare with (Wine, or no host device) fails on a wrong answer:

  • d3d12_heap_properties: for every committed or placed resource the layer created, GetHeapProperties has to succeed with both outputs, with the properties alone and with the flags alone; Type has to be the heap type it was created with (for a custom heap the CPU page property and the memory pool too); and a call asking for one output has to report what the call asking for both does. For a reserved resource the call has to fail. The values D3D12 derives itself (the flags a committed resource reports, the node masks) stay with the host comparison: I have no Microsoft answers recorded for them and did not want to pin the layer's own.
  • d3d12_residency: no call may raise an exception, the plainly valid calls (a buffer, a heap, the named priorities, two EnqueueMakeResident calls) have to succeed, the device may never be removed, and after EnqueueMakeResident the fence has to hold the value asked for, stay where it was for a lower one, and not move after a failure.

Your two probes, rebuilt into the layer here: with GetHeapProperties answering E_FAIL for buffers, d3d12_heap_properties exits 1 (139 wrong answers reported); with the fence reaching 6 for 7, d3d12_residency exits 1 with one line, EnqueueMakeResident NONE, two objects, value 7 (fence): the layer answers 0x6.

Layer-only typeless-depth readback. d3d12_typeless_depth no longer exits 77 under Wine. The layer's readback has to hold the cleared depth and stencil at every texel (0.25 / 0x5a, and 0.75 / 0x3c inside the rectangle), for both formats; under Wine that is the whole check and the test passes, elsewhere it runs before the comparison with WARP. For R24G8 the depth is the low 24 bits with one step of tolerance, for a device that keeps D24 as a float. A flipped depth byte and a flipped stencil byte each fail it, for both formats.

The swap-chain message. Under Wine dxgi_swapchain now prints the host's DXGI is Wine's, not compared with it for both comparisons instead of "no host D3D12 device".

With LEONIDA_D3D49_VERBOSE=1 the first two tests also print the layer's record when there is no host.

Tested on main 3ed8e50 with both commits, clang-cl 23.1.4 + xwin, wine-staging 11.21, RTX 4070 Ti (NVIDIA 620.70.06): seven of the eight tests pass and dxgi_host_parity exits 77 (it is still a pure host comparison). With host_is_wine() forced to false, the three changed tests pass their new layer checks and then fail in the host comparison as they do on main (44 mismatches, 14 mismatches, readback differs from WARP), so the path Windows takes still ends in the comparison. Not run on Windows and not built with MSVC: the new checks run there too, before the comparison, so a Windows run of these three would be welcome.

AI-assisted.

…een written (TEST-WINE-HOST-GUARDS)

The layer's own check compared a properties-only call with the call asking for both outputs, and passed when
both still held the sentinel the outputs start as. A GetHeapProperties that answered S_OK and left a field
unwritten (the node masks, or the page property and pool of a non-custom heap) therefore passed. Each of the
five property fields and the flags now has to differ from the sentinel as well.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@milk4sale

Copy link
Copy Markdown
Contributor Author

One more small commit, e80697bab, on top of b358f4788: a gap in the layer check I added to d3d12_heap_properties.

The check compared a properties-only call with the call asking for both outputs, and passed when both still held the sentinel the outputs start as. So a GetHeapProperties that answered S_OK and left a field unwritten passed for it. Each of the five property fields and the flags now also has to differ from the sentinel.

Control, with the layer rebuilt to leave CreationNodeMask and VisibleNodeMask unwritten: b358f4788 passes (31 resources, 0 wrong), e80697bab exits 1 with 62 wrong answers. On the unchanged layer it passes as before. Same setup as above (wine-staging 11.21, RTX 4070 Ti, NVIDIA 620.70.06); one file, tests only, not run on Windows. AI-assisted.

@kawaii-shakal

Copy link
Copy Markdown
Contributor

All eight affected tests passed on native Windows with MSVC (RelWithDebInfo), RTX 5070 Ti and Vulkan validation enabled. I used b358f47 plus the updated heap-properties source from e80697b (verified Git blob 1033e01e). The layer-only heap checks covered 31 resources, followed by 561 host comparisons with zero mismatches. Residency passed all 110 layer checks and all 99 comparable host values. Both typeless depth formats matched WARP, 120 bytes each. The five other affected tests also passed, including all 63 DXGI host-parity rows. This run covered the eight changed tests on Windows.

— Codex

@QemmHD

QemmHD commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Merging.

Why merged: TEST-WINE-HOST-GUARDS, test-only: eight host-comparison tests skip the host part under Wine and still check the layer, and the heap-properties and residency tests gain layer-only assertions. moffington's request for layer assertions is done, and kawaii-shakal ran all 8 on an RTX 5070 Ti with validation.

Why it's good: 8/8 pass both plain and under validation, with no skips on Windows. The only host libraries loaded are d3dcompiler_47 from SYSTEM32 and dxgi.dll.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 66d4f5a, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main 0b45fdc: the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The only failures are main's: d3d12_depth_resolve (pre-existing) and d3d12_close_parity (the #510 regression, fixed by #1286). All d3d12_* tests under validation show 0 VUIDs. git merge-tree against current main 6261ca9: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

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

@QemmHD
QemmHD merged commit 4a50caf into ProjectLeonida:main Nov 24, 2026
5 of 6 checks passed
azsekazvamdimitar pushed a commit to azsekazvamdimitar/leonida that referenced this pull request Nov 25, 2026
dxgi_host_answers and dxgi_waitable_latency presented to a window that was never shown. Under Wine's winewayland
the compositor never answers a FIFO present on an unmapped surface, so the first vsync present blocked in
vkQueuePresentKHR until the ctest timeout. Both now show the window without activating it, as
vk_presenter_sync_test does.

Depends on: ProjectLeonida#519 (dxgi_waitable_latency still compares against Wine's host DXGI without it).

Tested on the clang-cl cross build with ProjectLeonida#519 merged: both pass under WineHQ 11.22 (winewayland) and under
GE-Proton11-14 (winex11 through XWayland), RTX 3090, NVIDIA 590.48.01. AI-assisted.
azsekazvamdimitar pushed a commit to azsekazvamdimitar/leonida that referenced this pull request Nov 25, 2026
dxgi_host_answers and dxgi_waitable_latency presented to a window that was never shown. Under Wine's winewayland
the compositor never answers a FIFO present on an unmapped surface, so the first vsync present blocked in
vkQueuePresentKHR until the ctest timeout. Both now show the window without activating it, as
vk_presenter_sync_test does.

Depends on: ProjectLeonida#519 (dxgi_waitable_latency still compares against Wine's host DXGI without it).

Tested on the clang-cl cross build with ProjectLeonida#519 merged: both pass under WineHQ 11.22 (winewayland) and under
GE-Proton11-14 (winex11 through XWayland), RTX 3090, NVIDIA 590.48.01. AI-assisted.
azsekazvamdimitar added a commit to azsekazvamdimitar/leonida that referenced this pull request Nov 26, 2026
dxgi_host_answers and dxgi_waitable_latency presented to a window that was never shown. Under Wine's winewayland
the compositor never answers a FIFO present on an unmapped surface, so the first vsync present blocked in
vkQueuePresentKHR until the ctest timeout. Both now show the window without activating it, as
vk_presenter_sync_test does.

Depends on: ProjectLeonida#519 (dxgi_waitable_latency still compares against Wine's host DXGI without it).

Tested on the clang-cl cross build with ProjectLeonida#519 merged: both pass under WineHQ 11.22 (winewayland) and under
GE-Proton11-14 (winex11 through XWayland), RTX 3090, NVIDIA 590.48.01. AI-assisted.
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.

4 participants