Skip to content

tests: count the SDK 1.4.363 swapchain-flags validation message apart, as the sRGB one - #9340

Open
bailu12300 wants to merge 1 commit into
ItsNotRexed:mainfrom
bailu12300:fix/known-swapchain-flags-validation
Open

bailu12300 wants to merge 1 commit into
ItsNotRexed:mainfrom
bailu12300:fix/known-swapchain-flags-validation

Conversation

@bailu12300

Copy link
Copy Markdown

Claim: coordination issue #9065.

What and why

With LEONIDA_VK_VALIDATION=1 on Windows, four swapchain tests fail on their "any validation error fails the test" rule:

3/7 Test #135: vk_presenter_sync ................***Failed
4/7 Test #205: d3d12_present ....................***Failed
5/7 Test #207: xbox_present .....................***Failed
6/7 Test #215: dxgi_swapchain ...................***Failed

and every one of them fails on the same message, once per swapchain creation:

validation: vkCreateSwapchainKHR(): pCreateInfo->flags has VkSwapchainCreateFlagBitsKHR values
(VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) that require the extensions VK_KHR_swapchain_mutable_format.

VUID-VkSwapchainCreateInfoKHR-flags-parameter, message id 0xa4ba1dd3.

The presenter passes flags = 0. I instrumented runtime/src/vulkan_present.h right before the call and the test's own vkCreateSwapchainKHR wrapper, and both printed flags = 0, pNext null, imageUsage 18/19 — so the bit is not in our struct. To rule our code out entirely I then wrote a standalone program that shares nothing with the repository: a hidden Win32 window, a VK_KHR_win32_surface surface, one queue, vkCreateSwapchainKHR with flags 0 (and, as a control, with VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR), and VK_LAYER_KHRONOS_validation plus a debug messenger:

device: NVIDIA GeForce RTX 5060
[msg] id 0xa4ba1dd3: vkCreateSwapchainKHR(): pCreateInfo->flags has ... VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR ...
case 'hidden window, flags 0': result 0, flags 0, new messages 1
[msg] id 0xa4ba1dd3: vkCreateSwapchainKHR(): ... (the same message for the case that really passes the bit)
case 'hidden window, flags MUTABLE': result 0, flags 4, new messages 1

So on Windows 11 26100 + RTX 5060 (driver 32.0.16.2124) with the Vulkan SDK 1.4.363 validation layer, a creation with flags 0 is reported as if it asked for the mutable-format bit. That is a validation-layer message this code cannot cause.

Fix

The repository already counts one such known false positive apart (known_srgb_swapchain_storage_error, matched by message id, with known_validation_errors() so a test skips only when it is the sole error). This adds the second, the same way:

  • runtime/test/vk_test_device.h: known_swapchain_flags_error() matches 0xa4ba1dd3, counts into the known total, and the printed message is marked.
  • runtime/test/dxgi_swapchain_test.cpp: its own counter gets the same match.
  • d3d12_present_test.cpp, xbox_present_test.cpp, vk_presenter_sync_test.cpp: fail only when validation errors exceed the known ones, otherwise report them and return 77 (all four already have SKIP_RETURN_CODE 77).

Tested

Windows 11, NVIDIA GeForce RTX 5060, driver 32.0.16.2124 (621.24), Vulkan SDK 1.4.363:

AI-assisted: yes

…tion message on Windows SDK 1.4.363, so count it apart

The validation layer built with Vulkan SDK 1.4.363 reports, once per vkCreateSwapchainKHR, "pCreateInfo->flags has
VkSwapchainCreateFlagBitsKHR values (VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) that require the extensions
VK_KHR_swapchain_mutable_format" (VUID-VkSwapchainCreateInfoKHR-flags-parameter, id 0xa4ba1dd3), even when the flags
passed are 0. Measured on Windows 11 26100 + RTX 5060 (driver 32.0.16.2124) with a standalone program that creates a
hidden window, a Win32 surface and a swapchain with flags 0 and enables nothing else: it prints flags 0 itself and still
gets the message, and the same message comes for the case that really passes the mutable-format bit.

With LEONIDA_VK_VALIDATION=1 that made four swapchain tests fail on "any validation error": d3d12_present, xbox_present,
dxgi_swapchain and vk_presenter_sync. The message is now counted apart like the sRGB swapchain STORAGE one, and those
four tests skip (77) when it is the only validation error, so a run on that SDK no longer fails on a message the code
cannot cause. Without the layer all four still pass.

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

Independent Windows + GPU + Vulkan SDK 1.4.363.0 verification of 1157ea52f (AI-assisted).

  • Environment: Windows 11 x64, MSVC 19.44.35230.0 (Ninja Release), Windows SDK 10.0.26100.0, NVIDIA GeForce RTX 3060 (driver 621.24), Vulkan SDK 1.4.363.0, no game files.
  • Test runs (LEONIDA_VK_VALIDATION=1):
    • vk_presenter_sync_test: PASS (exit 0)
    • d3d12_present_test: PASS (exit 0)
    • xbox_present_test: PASS (exit 0)
    • dxgi_swapchain_test: PASS (exit 0)
  • Test runs (validation off): all 4 PASS (exit 0).
  • Observation & code review:
    • On this clean Vulkan SDK 1.4.363.0 + RTX 3060 (621.24) host, 0xa4ba1dd3 did not fire (likely an implicit third-party/overlay Vulkan layer on the reporter's host mutating pCreateInfo->flags before VK_LAYER_KHRONOS_validation), so all 4 tests passed with exit 0 and 0 known/unknown validation errors rather than skipping.
    • The filtering logic mirrors the existing known_srgb_swapchain_storage_error pattern cleanly: tests still fail on any unknown validation error, skip (77) only when all validation errors are known layer false positives, and pass (0) when none occur. Built with 0 new MSVC warnings.

LGTM.

@ikurta92-png

ikurta92-png commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 1157ea52f on NVIDIA GeForce RTX 3060 (Ampere), driver 617.42, Windows 11 Pro 10.0.26300, MSVC 19.51 (VS 2026), RelWithDebInfo, Vulkan SDK 1.4.363.1 (the other runs here are on 1.4.363.0): pass; 0xa4ba1dd3 does not fire on 1.4.363.1 either, with or without this PR.

  • This PR, LEONIDA_VK_VALIDATION off and on, 2 runs each: vk_presenter_sync, d3d12_present, xbox_present and dxgi_swapchain all Passed (exit 0, not skipped), every test printing (validation on) in the validation runs, 0 validation messages in total, so the new known-check path is never taken here.
  • Control, main 6312c057f (two commits past the PR's parent 867d922f0; those two only touch pe_loader and xgameruntime.cpp), the same 4 tests with LEONIDA_VK_VALIDATION=1: 4/4 pass, 0 validation messages, no VUID-VkSwapchainCreateInfoKHR-flags-parameter.
  • On the implicit-layer idea above: VK_LOADER_DEBUG=layer on dxgi_swapchain_test shows four layers loaded on this host: VK_LAYER_KHRONOS_validation (1.4.363.1), VK_LAYER_NV_optimus, VK_LAYER_NV_present and VK_LAYER_OBS_HOOK. Still no 0xa4ba1dd3 with all four active. So if a third-party layer causes it on the author's machine, it is not the OBS hook or the NVIDIA layers, at least on driver 617.42. Steam, EOS and GOG overlay layers are registered here but did not load outside their launchers.

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

@VibeClauding

Copy link
Copy Markdown

Data point on where the message comes from: the same Vulkan SDK (1.4.363.0) doesn't produce it here.

Windows 11 26200, RTX 3070 (NVIDIA 610.88, Vulkan 1.4.341), MSVC 14.44, main 6312c057f, LEONIDA_VK_VALIDATION=1: vk_presenter_sync, d3d12_present, xbox_present and dxgi_swapchain all pass (device: NVIDIA GeForce RTX 3070 (validation on)), and 0xa4ba1dd3 / MUTABLE_FORMAT never appears. That holds both with the Steam, Fossilize and OBS layers disabled and with every implicit layer left on.

So it isn't the 1.4.363 validation layer on its own. An app that passes flags = 0 while validation sees MUTABLE_FORMAT_BIT looks more like a layer in front of validation changing the create info. Implicit layers usually sit closer to the application than a validation layer the app enables itself. Your standalone program would load the same implicit layers, so it doesn't rule them out.

The obvious candidate on an NVIDIA machine is the driver's own implicit VK_LAYER_NV_present ("NVIDIA Presentation Layer", registered by nv-vk64.json in the driver store and on by default). Its behaviour may depend on the driver version (yours is 621.24, mine 610.88) or on NVIDIA App settings such as Smooth Motion. @Doctordefector saw xbox_present pass on Blackwell with NV_present loaded, so the card alone doesn't explain it either.

A one-variable check on your machine:

$env:DISABLE_LAYER_NV_PRESENT_1 = "1"   # the disable variable from its manifest
$env:LEONIDA_VK_VALIDATION = "1"
ctest --test-dir runtime/build -R "^(vk_presenter_sync|d3d12_present|xbox_present|dxgi_swapchain)$" --output-on-failure

If the message disappears, the comments in the PR ("the validation layer built with Vulkan SDK 1.4.363 reports ...") name the wrong source. Disabling that layer under validation might then be better than skipping. Either way, matching on the message ID alone would also hide a real flags error from our own code (one that sets the bit without the extension). One option is to count it as known only when the create info we passed had flags == 0.

AI-assisted (Claude Code). No game files.

@egexon

egexon commented Nov 23, 2026

Copy link
Copy Markdown

Tested 1157ea5 (merged onto main 867d922) on RTX 5070, NVIDIA 621.24, Windows 11 (build 26200), Vulkan validation layer on (LEONIDA_VK_VALIDATION=1, VK_VALIDATION_VALIDATE_SYNC=1): pass.

  • d3d12_present: passes with this PR, and passes on main.
  • dxgi_swapchain: passes with this PR, and passes on main.
  • vk_presenter_sync: passes with this PR, and passes on main.
  • xbox_present: passes with this PR, and passes on main.

Ran the tests that belong to the test files this PR changes (ctest entries, or the test program directly when it is not registered), with no game files (LEONIDA_GAME_DIR unset). 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.

5 participants