Repository navigation
Conversation
…ailing it Wine's vulkan-1.dll lists no instance layers and refuses every explicit one (win32u/vulkan.c: "Loading explicit layers is not supported!", VK_ERROR_LAYER_NOT_PRESENT). create_vulkan_device_standalone asked for VK_LAYER_KHRONOS_validation whenever LEONIDA_VK_VALIDATION=1, so under Wine vkCreateInstance failed and D3D12XboxCreateDevice returned 0x80004005. The device now asks for the layer only when vkEnumerateInstanceLayerProperties lists it. Otherwise it says why on stderr and is created without it; the synchronization-validation request stays in the chain, so a host layer loaded through VK_INSTANCE_LAYERS before wine runs with sync validation, as on Windows. run_tiny_frame_validation (check_tiny_frame.py --validation) runs tiny_frame with LEONIDA_VK_VALIDATION=1 and VK_INSTANCE_LAYERS set and fails on a validation error. docs/testing.md says how to validate under Wine.
…here a layer is there Review of the previous commit: - run_tiny_frame_validation passed where no layer validated anything. It now turns on the layer's information messages and passes only when the layer's own CURRENT-VALIDATION-ENABLED report (with Synchronization) shows it was active in that process; it exits 77 when no layer was active. - VkValidationFeaturesEXT went on the instance with no layer to read it. It now goes there with VK_EXT_validation_features when the loader lists the layer, or, when it does not (Wine), only after a throwaway instance shows a validation layer is active: a second debug messenger with no severity bits breaks VUID-VkDebugUtilsMessengerCreateInfoEXT-messageSeverity-requiredbitmask, which a layer reports and the loader alone accepts. Wine passes no VK_* variable into the Windows environment, so VK_INSTANCE_LAYERS cannot be read, and lists no layer extension, so VK_EXT_validation_features cannot be named; it does pass the structure on (the host layer reports Synchronization). - A failing vkEnumerateInstanceLayerProperties is reported with its VkResult. - CMake says why the validation run is a process of its own. docs/testing.md: the stderr lines, and the Wine hang that looked like a hang at device creation (a new xvfb-run while the prefix's wineserver and explorer.exe are still on the previous run's closed display), with wineserver -k as the way out.
…o under Wine vk_test_device.h asked for VK_LAYER_KHRONOS_validation and failed with "not installed" when the loader did not list it, so under Wine (whose loader lists no layers) no d3d12_*_test could run with LEONIDA_VK_VALIDATION=1. It now asks for the layer when listed, and otherwise relies on one enabled from outside (VK_INSTANCE_LAYERS before wine loads the host's) with the same messenger and synchronization-validation request. Either way, every device makes one deliberate invalid call after creation (a buffer with no usage bits, VUID-VkBufferCreateInfo-usage-requiredbitmask) and must see it reported as a validation error; the probe's error is taken back off the count. If it is not reported, the device fails with "validation is not active", so a test never reports 0 validation errors from a layer that was not loaded. vk_validation_probe (check_validation_probe.py) runs d3d12_com_test with the layer available (the probe must be reported and the test pass) and with it disabled in the loader (the test must fail and say validation is not active).
…rect_rt_test probes too vk_test_device.h printed the probe's deliberate error, so a test whose output must not contain "Validation Error" or "VUID-" (FAIL_REGULAR_EXPRESSION) would fail on it. It is still counted (and taken back off) but no longer printed. d3d12_indirect_rt_test makes its own instance and still stopped with "not installed" under Wine. It now asks for the layer only when the loader lists it, and otherwise relies on one enabled from outside; either way a second debug messenger with no severity bits (VUID-VkDebugUtilsMessengerCreateInfoEXT- messageSeverity-requiredbitmask) must be reported, or the test fails with "validation is not active".
…ey cannot see Review follow-ups for the validation-under-Wine change. - check_tiny_frame --validation: a CURRENT-VALIDATION-ENABLED report whose list of checks is empty or lacks Synchronization is a failure (it was taken as Synchronization). A run without the report is skipped only when nothing else is wrong; a validation error line or a bad exit code fails. - check_validation_probe: "not installed" (skip) is now only the loader not listing the layer while nothing reports the probe, or vkCreateInstance failing with VK_ERROR_LAYER_NOT_PRESENT. A listed layer that reports nothing, or another vkCreateInstance failure, fails in either run. - vk_test_device.h: with the layer unlisted, a throwaway instance first checks that an outside layer reports (a messenger with no severity bits), and VkValidationFeaturesEXT goes on the instance only after that; without it the device fails at once with "validation is not active". New tests: tests/test_check_validation_probe.py, and validation cases in tests/test_check_tiny_frame.py.
|
Tested
AI-assisted (Gemini 4 Neon). |
|
Tested a59c29d merged with main 3faac55 (clean merge) on native Windows 11 Pro 26300, MSVC 19.51, Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0 (its Full
The probe, with
So on native Windows the layer is still requested by name when the loader lists it, and a run that asks for validation without a layer fails instead of reporting 0 errors.
Not tested: Wine. No game files. AI-assisted (Claude Code built and ran the tests). |
|
Tested
|
# Conflicts: # docs/testing.md
|
Tested
Native Windows lists the Khronos layer, so this does not exercise the Wine No game files. AI-assisted. |
|
Tested
Two things in
With this the test passes again (checked): -| A program under `xvfb-run -a wine` never gets past its first Vulkan call (device creation), and `winedbg --command "bt all"` shows it in `wine_vk_init` | ...
+| A program under `xvfb-run -a wine` never gets past its first Vulkan call (device creation), and a `winedbg` backtrace (`bt all`) shows it in `wine_vk_init` | ...and line 553 deleted. The PR also no longer merges onto current Synthetic tests only, no game files. AI-assisted. |
…d flag, and drop the duplicate RADV Mesa 25.2 row
# Conflicts: # runtime/CMakeLists.txt # runtime/shims/d3d12_com.h # runtime/shims/d3d12_vulkan_device.cpp # runtime/test/check_tiny_frame.py
|
Thanks @sennecools for the review. Changes (two new commits, no rebase or force push):
Tested with the Windows runtime cross-built by clang-cl 19 and xwin, run under Wine 9.0 with the host's
13 of 16 passed. Python: None of the three failures comes from this PR. On plain
So with this PR the layer really runs under Wine, and it shows two problems that main's own tests could not show:
They belong to the tests from #5110, so I'd rather fix them in a follow-up than grow this PR. Tell me if you want them here. AI-assisted. |
|
Tested 3506e35 merged with main 8575d36 on native Windows 11, MSVC 14.51, Ninja RelWithDebInfo, plus Linux (WSL2) Python 3.12.16 (-I): pass |
|
Tested
Not run: other GPUs/vendors, Linux, anything that needs game files. No game files. AI-assisted (Claude Code). |
Claimed in the coordination issue as: #4933 (comment)
What and why
With
LEONIDA_VK_VALIDATION=1, a guest run throughgta6rt --rununder Wine could not get a Vulkan device:D3D12XboxCreateDevicereturned0x80004005([rt] d3d12: vkCreateInstance (Vulkan 1.3) failed), for example withtiny_frame (#3488). Without validation the same runs pass.
Cause: Wine's
vulkan-1.dlllists no instance layers and refuses every explicit one. In Wine 11.0,convert_instance_create_infoindlls/win32u/vulkan.cdoes
if (info->enabledLayerCount) { FIXME("Loading explicit layers is not supported!\n"); return VK_ERROR_LAYER_NOT_PRESENT; }(
WINEDEBUG=fixme+vulkanshows it, thenFailed to create vulkan instance, res -6).create_vulkan_device_standaloneasked for
VK_LAYER_KHRONOS_validationwhenever the variable was set, so the whole device failed. The layer itselfworks on this driver: loaded by the host's loader through
VK_INSTANCE_LAYERS, it runs inside the Wine process.Four commits:
The device asks for the layer only when
vkEnumerateInstanceLayerPropertieslists it.(After review.)
VkValidationFeaturesEXT(synchronization validation) goes on the instance only where a layer isthere: with
VK_EXT_validation_featuresenabled when the loader lists the layer, or, when it does not, only after athrowaway instance shows that a validation layer is active. That proof: a second debug messenger with no severity
bits breaks
VUID-VkDebugUtilsMessengerCreateInfoEXT-messageSeverity-requiredbitmask, which a layer reports and theloader alone accepts. Data on what Wine forwards:
VK_*variable into the Windows environment (wine cmd /c setwithVK_INSTANCE_LAYERSset showsonly
LEONIDA_VK_VALIDATION), so the runtime cannot readVK_INSTANCE_LAYERS.VK_EXT_validation_featuresis not among the host instance extensions in aWINEDEBUG=+vulkantrace), so it cannot be enabled by name there.VkValidationFeaturesEXTon: the host layer'sCURRENT-VALIDATION-ENABLEDreport lists"Synchronization" for the device's instance, and not without the structure.
The runtime says on stderr which way it went, and "validation is off" when no layer is active. A failing
vkEnumerateInstanceLayerPropertiesis reported with itsVkResult.vk_test_device.h(thed3d12_*_testprograms and others): the same choice. Every device then makes onedeliberately invalid call (a buffer with no usage bits) that must come back as a validation error; otherwise the
test fails with "validation is not active". A test can't report 0 validation errors from a layer that was not there.
The probe's own error is counted but not printed, so it can't match
FAIL_REGULAR_EXPRESSION "Validation Error;VUID-".d3d12_indirect_rt_test, which makes its own instance, probes the same way.New tests:
run_tiny_frame_validation(check_tiny_frame.py --validation) runs tiny_frame withLEONIDA_VK_VALIDATION=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand the layer's information messages on. It passes only when thelayer's own
CURRENT-VALIDATION-ENABLEDreport, with Synchronization, shows the layer was active in that process.It fails on any
Validation Errorline and exits 77 when no layer was active. It is its own process because thelayer is chosen when a process starts, and tiny_frame is the cheapest guest.
vk_validation_probe(check_validation_probe.py) runsd3d12_com_testtwice: with the layer (the probe must bereported and the test pass) and with it disabled in the loader (the test must fail with "validation is not active").
How to validate under Wine (also in docs/testing.md):
cd runtime/build/windows/fixtures/game/RelWithDebInfo VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation LEONIDA_VK_VALIDATION=1 LEONIDA_D3D12=vulkan \ xvfb-run -a wine ../../../gta6rt.exe --run tiny_frame.exe --trace-d3d12(Set
VK_LAYER_PATHto the SDK'sshare/vulkan/explicit_layer.dwhen the layer isn't installed system-wide.)The hang at device creation reported together with this was not about validation. A Wine program started under a new
xvfb-run -awhile the prefix'swineserverandexplorer.exefrom the previous run are still alive (on thatrun's closed display) can block in its first Vulkan call (
wine_vk_init,winevulkan/loader.c:348in awinedbgbacktrace) and never return. With Wine 11.0, 20 runs ofd3d12_com_testback to back, each under its ownxvfb-run -aand without validation: the first passed and the other 19 hung. The same 20 runs withwineserver -kbefore each all passed. docs/testing.md has the way out. The scripts that stop the prefix themselvesare in a separate PR. No Wine bug report found for it.
Tested
Wine 11.0, RTX 5080 (NVIDIA 580.65.06), Vulkan SDK 1.4.363.1 layer on the Linux host, clang-cl xwin cross-build:
check_tiny_frame.py --validation --runner wineonmain: FAIL (D3D12XboxCreateDevice failed, hr 0x80004005).With this branch: OK. With
VK_INSTANCE_LAYERSnaming a layer that is not installed: SKIP (77) and "validation isoff" on stderr. The first commit alone passed that case, which was review item 1.
xvfb-run -a ctest -R 'run_tiny_frame|vk_validation_probe': 3/3 pass.The command above:
tiny_frame: OK, 0Validation Errorlines, the runtime's "a validation layer is active" line.86 tests (
d3d12_*,vk_*,allocator_proxy,queue_proxy,dxgi_device,xbox_present,depth24*) underWine,
ctest -j4, with and without validation:apart from the negative half of
vk_validation_probe.fail either way under Wine (
d3d12_descriptor,d3d12_fence_timing,d3d12_heap_properties,d3d12_indirect_dispatch_count,d3d12_private_data,d3d12_residency,d3d12_subresource_copy), and none ofthem shows a validation error.
vk_sync_validation(skipped without validation) passes: synchronization validation reports a write-after-writehazard through Wine.
d3d12_queue_handoverfails with validation:VUID-vkCmdDraw-None-09600, an image expected inGENERALisstill
UNDEFINED. All of them come from the test's host pass, which under Wine is vkd3d on the same host layer;the Vulkan-layer pass is clean (see Not covered).
d3d12_indirect_rtpasses with 0 validation errors (before commit 4: "not installed").Review follow-ups (commit 5), on the pod with the rebuilt tree,
LEONIDA_VK_VALIDATION=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:vk_sync_validation,d3d12_com,vk_validation_probe,d3d12_indirect_rtandrun_tiny_frame_validationpass.
VK_INSTANCE_LAYERS,d3d12_com_testnow stops before its instance with "validation is not active: adeliberate invalid call on a throwaway instance was not reported".
tests/test_check_tiny_frame.py(18) and the newtests/test_check_validation_probe.py(6) pass. Againstcommit 4, these fail and pass now:
vkCreateInstancefailure, in either run;Not covered
unchanged, and the probe runs on top. Without the SDK, the device is now created with "validation is off", where
before it failed with 0x80004005. The GPU tests then fail with "validation is not active", as they failed before
with "not installed".
check_validation_probe.py's negative half relies onVK_LOADER_LAYERS_DISABLEhiding the layer. That was checkedonly through Wine's host loader.
d3d12_queue_handover's validation errors (above) are not fixed here. They are vkd3d's: it puts a new texture'sfirst layout transition into the first command list recorded that names it, not the first one executed
(
d3d12_command_list_track_resource_usage, libs/vkd3d/command.c). A separate change skips that test's host passunder Wine, as the other host comparisons do (
host_wine.h).dxgi_swapchain_test,vk_bindless_test,vk_descriptor_benchandvk_image_fuzzmake their own instanceswith the layer named and were not changed. They are Linux programs, or not run under Wine here.
AI-assisted (Claude Code). No game files.