Skip to content

tests: under Wine, noop_copy, typeless_depth and clear_formats skip the vkd3d host comparison - #6500

Open
cynbun wants to merge 1 commit into
ItsNotRexed:mainfrom
cynbun:wine-host-guard-differential-tests
Open

cynbun wants to merge 1 commit into
ItsNotRexed:mainfrom
cynbun:wine-host-guard-differential-tests

Conversation

@cynbun

@cynbun cynbun commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claim: #6414 (comment) (my finding from a Vulkan validation sweep).

What was wrong

d3d12_noop_copy, d3d12_typeless_depth and d3d12_clear_formats take WARP as their reference (EnumWarpAdapter + D3D12CreateDevice) with no hostwine::host_is_wine() guard. The 34 tests that compare with the host already have one (runtime/test/host_wine.h, copycmp::host_is_wine). Under Wine, that "WARP" is vkd3d on the GPU, so on main 4beffda8 all three fail on vkd3d's behaviour, not the layer's:

  • runtime/test/d3d12_noop_copy_test.cpp:117-127: the host check runs first and returns 1 (native WARP incorrectly accepted upload-heap self-copy; vkd3d accepts the self-copy Microsoft's runtime refuses). So under Wine check(layer, "Leonida Vulkan") is never reached.
  • runtime/test/d3d12_typeless_depth_test.cpp:184-214: R24G8_TYPELESS / R32G8X24_TYPELESS: readback differs from WARP at byte 2 of 120.
  • runtime/test/d3d12_clear_formats_test.cpp:340-411: clears: 152 matched WARP, 99 differ.

The Vulkan validation messages these runs print are vkd3d's, not the layer's. With the Linux Khronos layer injected into winevulkan's host instance, they include VUID-vkCmdCopyImageToBuffer-imageSubresource-09105 (a COLOR aspect on D32_SFLOAT_S8_UINT), -imageSubresource-07968, -pRegions-00183, VUID-vkCmdCopyBuffer-pRegions-00117, -dstBuffer-00120, VUID-vkCmdCopyImage-srcImage-09460 and SYNC-HAZARD-READ-AFTER-WRITE. With the reference device swapped for the layer's, the same runs print none.

Fix

This uses the existing pattern. Under Wine each test still runs every layer copy or clear, so the layer paths stay covered by validation. Only the comparison with the host is skipped, and the test says why (host D3D12 is Wine's, not Microsoft's: comparisons with the host are skipped):

  • d3d12_noop_copy skips only the host check, then checks the layer and passes.
  • d3d12_typeless_depth runs both families' copies on the layer and exits 77.
  • d3d12_clear_formats runs all its clears on the layer (251 clears ran on the layer without a WARP reference) and exits 77.

In all three, a copy or clear the layer can't run, or a validation error, still fails the test. Nothing changes on Windows: host_is_wine() is false there and the code paths are the same as before.

Tested

RTX 5080, NVIDIA 615.78.08, Linux. Windows build cross-compiled with clang-cl 23.1.3 + xwin, run under Wine 11.20. Khronos Vulkan-ValidationLayers nightly b321c028 (API 1.4.369) injected into the host instance with VK_INSTANCE_LAYERS, synchronization validation on (VK_KHRONOS_VALIDATION_VALIDATE_SYNC=1). The Windows loader under Wine lists no layers, so LEONIDA_VK_VALIDATION=1 can't be used there (#4973).

d3d12_noop_copy d3d12_typeless_depth d3d12_clear_formats validation messages (excluding Wine's own vkCreateDevice VUID-...-01387)
main 4beffda8 Failed (host check) Failed (2 families differ) Failed (99 differ) 7 / 10 / 31 messages, all vkd3d's
this branch Passed (Leonida Vulkan: 5 legal no-op copy submissions, invalid upload copy rejected; pattern mismatches=0) Skipped (77) after the layer copies Skipped (77) after 251 layer clears 0

The full Windows ctest under Wine (same layer, sync validation) on this branch gives 235/256 passed. These three are no longer among the failures. The remaining failures are pre-existing under Wine: some are covered by #4362, #4975 and D3D-610 (#6010), and most of the rest fail only because Wine's own VUID-vkCreateDevice-ppEnabledExtensionNames-01387 trips the Validation Error fail-regex while the injected layer is on. The native Linux build doesn't build these Windows-only tests. git diff --check is clean. Synthetic resources only, no game files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…he vkd3d host comparison

The three tests take WARP from EnumWarpAdapter + D3D12CreateDevice as the
reference, with no hostwine::host_is_wine() guard. Under Wine that device is
vkd3d, so all three failed there on vkd3d's differences:
d3d12_noop_copy returned 1 on the host check ("native WARP incorrectly
accepted upload-heap self-copy") before the layer's half ran at all, and
d3d12_typeless_depth and d3d12_clear_formats reported byte differences
against vkd3d's readbacks.

Under Wine each test now runs every layer copy or clear and skips only the
comparison with the host: d3d12_noop_copy checks the layer and passes,
d3d12_typeless_depth and d3d12_clear_formats exit 77 after their layer work
(a layer failure or a validation error still fails them). Windows is
unchanged.

AI-assisted (Claude Code).

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

Copy link
Copy Markdown

Independent native Windows check of d9ce6f15. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0.

Both stock tests ran their WARP comparisons and passed. d3d12_typeless_depth matched all 120 readback bytes for each of R24G8 and R32G8X24. d3d12_clear_formats matched all 251 clears. Khronos core and synchronization validation reported zero errors. This run covered the depth and clear tests on native Windows.

AI-assisted.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested d9ce6f1 merged onto main 1a11c98 on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 260/262. The failures main 1a11c98 also has without this PR: d3d12_indirect_dispatch_count, xbox_present.
  • d3d12_clear_formats, d3d12_noop_copy and d3d12_typeless_depth: pass 20 of 20 runs each, and pass under LEONIDA_VK_VALIDATION=1 with 0 validation messages.
  • Warnings: none new in the files this PR changes.

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.

3 participants