Skip to content

CheckFeatureSupport(FEATURE_LEVELS): an empty or missing list is E_INVALIDARG, as on the host - #991

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
quackottu:feature-levels-invalidarg
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
quackottu:feature-levels-invalidarg

Conversation

@quackottu

Copy link
Copy Markdown
Contributor

CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS) returned DXGI_ERROR_UNSUPPORTED for NumFeatureLevels == 0, and with a count and a null pFeatureLevelsRequested it read through the null pointer. The host D3D12 runtime returns E_INVALIDARG for both, on the NVIDIA adapter and on WARP (measured on this machine with the real d3d12.dll). When none of the requested levels is supported the host also writes MaxSupportedFeatureLevel = 0 next to DXGI_ERROR_UNSUPPORTED; the layer left the field as the caller set it.

  • runtime/shims/d3d12_vulkan_device.cpp: refuse an empty or missing list before reading it; write the level before the unsupported return.
  • d3d12_vulkan_device_test: three cases next to the existing FEATURE_LEVELS check (count 0, null array, only 12_2).

Tested (Windows 11, RTX 5070 (driver 621.24), MSVC 14.44, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION=1, overlay layers off): d3d12_vulkan_device_test passes. With the shim from main it fails at the count-0 case (DXGI_ERROR_UNSUPPORTED). #459 checks this feature's size argument only, so the two don't overlap. No game files.

AI-assisted.

🤖 Generated with Claude Code

…VALIDARG

NumFeatureLevels 0 returned DXGI_ERROR_UNSUPPORTED, and a null
pFeatureLevelsRequested with a count was read. The host D3D12 runtime
(NVIDIA and WARP) returns E_INVALIDARG for both. When no requested level
is supported the host also writes MaxSupportedFeatureLevel 0 next to
DXGI_ERROR_UNSUPPORTED; the layer left the field as it was.
@UlteriorMotive00

Copy link
Copy Markdown
Contributor

Tested 7b11673 (on main) on AMD RDNA2 iGPU and RTX 5070: pass.

Windows 11 Home 10.0.26300, MSVC 14.44.35207, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, Ninja RelWithDebInfo (scripts\build_runtime.ps1), LEONIDA_VK_VALIDATION=1, VK_LOADER_LAYERS_DISABLE=~implicit~. One PC, two GPUs, picked with VK_LOADER_DRIVERS_SELECT: AMD Radeon iGPU of a Ryzen 7 9800X3D (RDNA2, 1002:13C0, AMD 2026.04.17) and NVIDIA GeForce RTX 5070 (Blackwell, 617.42).

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

@kapitche

Copy link
Copy Markdown
Contributor

Tested 7b11673 on Windows 11, MSVC 14.51, with the full shader toolchain: ctest 33/33 on an RTX 4080 SUPER (32.0.16.1714), including this PR's tests. On an Intel UHD 770 (32.0.101.6129) the one failure is d3d12_vulkan_device comparing OPTIONS1 with the other GPU's host device. That fails on main too, #962 fixes it, and it isn't from this PR.

@BACONMANXDGOD

Copy link
Copy Markdown
Contributor

Tested 7b11673: pass on both GPUs. Windows 11 26200, MSVC 19.44, Vulkan SDK 1.4.363, LEONIDA_VK_VALIDATION=1, applied to main 43d4703 (merges cleanly). GPUs: Intel Arrow Lake Xe-LPG iGPU (Windows 32.0.101.8132) and RTX 5070 Ti Laptop (617.42), selected with VK_LOADER_DRIVERS_SELECT.

  • The whole d3d12_vulkan_device_test exits 0 on the Intel iGPU and on the RTX, the new FEATURE_LEVELS cases included. On Intel it also compares against Intel's own D3D12 driver: FORMAT_INFO on Intel(R) Graphics: 195 queries, 0 mismatches and CheckFeatureSupport options (Intel(R) Graphics): 15 feature queries compared, NoOutputsSamples=0xd, 0 mismatches.
  • Control: with 43d4703's d3d12_vulkan_device.cpp it fails on both GPUs at line 1769: CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &no_levels, ...) == E_INVALIDARG.

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

@ItsNotRexed
ItsNotRexed merged commit 294deab into ItsNotRexed:main Nov 22, 2026
11 checks passed
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