Skip to content

D3D-86: answer SHADER_MODEL and ROOT_SIGNATURE in CheckFeatureSupport - #704

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
Ayinaki:d3d86-shader-model-root-signature
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
Ayinaki:d3d86-shader-model-root-signature

Conversation

@Ayinaki

@Ayinaki Ayinaki commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Item: D3D-86 (see #634). This closes the SHADER_MODEL and ROOT_SIGNATURE groups; FORMAT_INFO is @cemalyakla's, and the D3D12_OPTIONS families (OPTIONS1–5, 7–9, 11–16, 18) are untouched and still open.

What changed

CheckFeatureSupport answered both queries with E_INVALIDARG from its default: arm, so a game asking for either got an error where the PC runtime answers.

  • D3D12_FEATURE_SHADER_MODEL: answered as 6.0 (DXIL 1.0), not the driver's maximum. Nothing in the runtime compiles DXIL — the game's shaders arrive as SPIR-V from the offline translator, and the only DXIL path (the BVH builder) is lowered to standard DXIL, whose baseline is 6.0. A request above it is clamped down to 6.0. Answering 6.8 because the NVIDIA driver does would invite shaders this layer has no front end for, which is the failure mode section 4.1 already describes as worse than a false "unsupported".
  • D3D12_FEATURE_ROOT_SIGNATURE: answered as 1.1, the version the proxy can always produce. 1.2 blobs are rewritten as 1.1 when the host serializer stops at 1.1 and nothing is lost (d3d12_xs_rootsig.cpp), and Windows 10's d3d12.dll stops there, so 1.1 is what the game can rely on on every supported host. A higher request is clamped down.
  • Refusals, in both: a wrong DataSize, a null buffer, and an undefined enum value are E_INVALIDARG.
  • runtime/test/d3d12_vulkan_device_test.cpp gains compare_feature_support, which uses the same host-device oracle as the existing GetCopyableFootprints comparison (every defined request is sent to both devices and the HRESULTs must match, with the value clamped to the layer's ceiling), plus explicit assertions pinning the ceiling and each refusal case.
  • docs/d3d12_vulkan.md section 3 and section 4.1 record the answers and the measurements.

Measured against the host PC runtime (616.86)

Query Request Host answer
SHADER_MODEL 6.0–6.8 S_OK, echoes the request
SHADER_MODEL 6.9 S_OK, clamped to 6.8
SHADER_MODEL 0 E_INVALIDARG
ROOT_SIGNATURE 1.0, 1.1, 1.2 S_OK, echoes the request
either wrong DataSize E_INVALIDARG

Two host behaviours the test deliberately does not reproduce: the host runtime crashed the process on an undefined shader model (0x5f, and once on 0) and on a null pFeatureSupportData for ROOT_SIGNATURE. The layer refuses those with E_INVALIDARG instead, and only values the runtime defines are ever sent to the host, so the test cannot take it down.

Tested

d3d12_vulkan_device_test on Windows 11, RTX 5070 (driver 616.86), Vulkan 1.4.351, MSVC 14.52, RelWithDebInfo with Ninja: exit 0, and 0 feature-query mismatches against the host device. The same test passed on main before the change, and its existing GetCopyableFootprints and allocation/footprint comparisons still match.

No game files were used; the test builds its own resources and shaders-free comparisons, as before.

Depends on: none

CheckFeatureSupport fell through to E_INVALIDARG for
D3D12_FEATURE_SHADER_MODEL and D3D12_FEATURE_ROOT_SIGNATURE, so a game
asking either got an error where the PC runtime answers. Report DXIL 1.0
and root signature 1.1, the versions this layer can honour rather than
the driver's maximum, clamp higher requests down, and refuse an undefined
value, a wrong DataSize and a null buffer, as the host runtime does.
@VictorJulianiR

Copy link
Copy Markdown
Contributor

On 2112681, Windows WARP accepts the named D3D_SHADER_MODEL_5_1 request. The public shim rejects the same request with E_INVALIDARG. I used separate, correctly sized structures for each call.

Requested maximum Native D3D12 WARP Shim on llvmpipe
5.1 S_OK, 5.1 E_INVALIDARG
6.0 S_OK, 6.0 S_OK, 6.0

Could you handle 5.1 and include it in the host comparison? The 6.0 ceiling still permits returning 5.1 to a caller that requested it. The Microsoft feature-support helper includes this query in its fallback list. AI-assisted, GitHub-hosted Windows Server 2022, Microsoft Basic Render Driver and Mesa llvmpipe. Hosted results · Microsoft helper.

D3D12's baseline is 5.1, and both WARP and the RTX 5070 runtime answer a 5.1 request with S_OK and 5.1; the layer
refused everything below 6.0, so a caller asking for the minimum got E_INVALIDARG. The host comparison now covers
5.1, the test pins it, and the docs record both measurements.
@Ayinaki

Ayinaki commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, that is a real divergence and it reproduces here. On the RTX 5070 (driver 616.86), D3D12_FEATURE_SHADER_MODEL with D3D_SHADER_MODEL_5_1 answers S_OK and echoes 5.1, so the host and WARP agree and the layer's refusal of everything below 6.0 was simply wrong.

Fixed in the follow-up commit: 5.1 is now echoed, a value below 5.1 is still E_INVALIDARG (that is what 0 does on the host), and the ceiling is unchanged, so a 5.1 request no longer has to be clamped up to 6.0. compare_feature_support now includes 5.1 in the list it takes to the host, main pins that the answer is 5.1, and section 4.1 of docs/d3d12_vulkan.md records both measurements (5.1-6.8 echo the request, 6.9 clamps to 6.8 on this driver).

Test run after the change: d3d12_vulkan_device_test.exe exits 0 on Windows 11 with the RTX 5070 / 616.86, with no mismatches from the host comparison, including the new 5.1 case.

@ismailchaka1

Copy link
Copy Markdown
Contributor

Tested e4d7234 on an NVIDIA GeForce RTX 4070 SUPER, driver 32.0.16.1088, Windows 11, MSVC 2022 (Ninja, RelWithDebInfo), LEONIDA_VK_VALIDATION=1: pass.

PR head as-is, no game files. AI-assisted.

@ItsNotRexed
ItsNotRexed merged commit ce8c10a into ItsNotRexed:main Nov 22, 2026
8 of 9 checks passed
@rasptum

rasptum commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested e4d7234 on NVIDIA GeForce RTX 3060, driver 596.36, Windows 10 Pro 19045: fail on a Windows 10 host, in the new compare_feature_support. On main at 8df277f the same thing stops d3d12_vulkan_device_test at line 1339: feature_mismatches <= 0 (ctest 30/31).

This is the failure @Proudnoob4 has since claimed and @etcetera-yt reported in #634, so this is a third Windows 10 machine with the same four lines (shader model 0x67 to 0x69 and root signature 0x3: the layer clamps, the host refuses). What I can add is the full table of host answers, measured with a small host-only probe (plain D3D12CreateDevice on the RTX 3060, d3d12.dll 10.0.19041.5794, no Leonida code):

Query Request Windows 10 host
SHADER_MODEL 5.1, 6.0 to 6.5 S_OK, echoes the request
SHADER_MODEL 6.6 S_OK, clamped to 6.5
SHADER_MODEL 6.7, 6.8, 6.9 E_INVALIDARG
ROOT_SIGNATURE 1.0, 1.1 S_OK, echoes the request
ROOT_SIGNATURE 1.2 E_INVALIDARG

One detail that matters for the fix: this runtime's own maximum is 6.5, and it still accepts a 6.6 request and clamps it. So "the highest request the host answered" is 6.6 here, one above its maximum, and the refusals start at 6.7.

What was run:

Build: MSVC 19.44 (VS 2022 Build Tools 17.14), Windows SDK 10.0.26100, Vulkan SDK 1.4.363, CMake + Ninja, RelWithDebInfo. No game files.

AI-assisted (Claude Code), run on my own machine. Repository test programs and one host-only probe.

ItsNotRexed pushed a commit that referenced this pull request Nov 22, 2026
…ainst the layer's clamp

Windows 10's d3d12.dll refuses shader models 6.7-6.9 and root signature 1.2 with E_INVALIDARG, where a newer runtime clamps them, so the SHADER_MODEL / ROOT_SIGNATURE comparison from #704 counted 4 mismatches on every Windows 10 machine. A request above the highest one the host answered is now checked against the layer's own clamp (S_OK, 6.0 / 1.1) instead, and the count is printed.
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