Skip to content

d3d12_vulkan_device: answer features 56 and 57 before the CheckFeatureSupport switch (MSVC C4063) - #9771

Open
ThomasSAMP wants to merge 1 commit into
ProjectLeonida:mainfrom
ThomasSAMP:fix/d3d12-feature-c4063
Open

ThomasSAMP wants to merge 1 commit into
ProjectLeonida:mainfrom
ThomasSAMP:fix/d3d12-feature-c4063

Conversation

@ThomasSAMP

Copy link
Copy Markdown

Claim: #9677 (comment) (new item; no ID assigned yet)

What and why

ID3D12Device::CheckFeatureSupport in runtime/shims/d3d12_vulkan_device.cpp answers APPLICATION_SPECIFIC_DRIVER_STATE (56) and BYTECODE_BYPASS_HASH_SUPPORTED (57) through case labels on compat::kFeatureApplicationSpecificDriverState and compat::kFeatureBytecodeBypassHashSupported. d3d12_feature_compat.h declares those two by value because some Windows SDK 10.0.26100 headers end the D3D12_FEATURE enum before them. On those SDKs the labels fall outside the enum, so every build of gta6rt_d3d12_com warns twice:

d3d12_vulkan_device.cpp(7794,9): warning C4063: case '56' is not a valid value for switch of enum 'D3D12_FEATURE'
d3d12_vulkan_device.cpp(7796,9): warning C4063: case '57' is not a valid value for switch of enum 'D3D12_FEATURE'

This PR answers the two features before the switch, with the same write_supported_feature<compat::FeatureSupportFlag>(method, data, size, FALSE) they used before. The size check, the payload and the HRESULTs are unchanged, and no other feature is touched. On a header that does declare 56 and 57, the switch simply no longer lists them.

Tested

Windows 11 Pro 26300, MSVC 14.44 (VS 2022, RelWithDebInfo), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, AMD Radeon RX 9070 XT (RDNA4), AMD driver 32.0.32029.2010.

On the current main (2d53a8055, this branch's base), gta6rt_d3d12_com doesn't compile on MSVC, with or without this change. There are 5 errors, all from the console descriptor heap merged with #9576: C2665/C2248 in d3d12_vulkan_device.cpp (DescriptorHeap constructor, private Device::identity) and rt::d3d12::create_console_descriptor_heap not found in d3d12_xs_device.cpp:1606. VEgE has offered to fix that. The compiler still reaches the switch, though. On 2d53a8055 it prints both C4063 warnings without this change and none with it.

The runtime results below are from the same change on main 5d74c2723, before that break:

No game files used. AI-assisted: yes (Claude Code); I reviewed the change and ran the tests.

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

…eSupport switch (MSVC C4063)

Some Windows SDK 10.0.26100 headers end the D3D12_FEATURE enum before
APPLICATION_SPECIFIC_DRIVER_STATE (56) and BYTECODE_BYPASS_HASH_SUPPORTED
(57), which d3d12_feature_compat.h declares by value. Their case labels in
the CheckFeatureSupport switch were outside the enum, so every build of
gta6rt_d3d12_com warned twice (C4063). Answer the two before the switch,
with the same one-BOOL "not supported" payload through
write_supported_feature; nothing else changes.

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

Copy link
Copy Markdown

checked: #977172751d0 | with: cherry-pick of 72751d0 onto 867d922 (current main 7e39a81 does not build gta6rt_d3d12_com on Windows for an unrelated reason, the #9576 errors already reported in #9677), fresh cmake --build --config RelWithDebInfo --target d3d12_vulkan_device_test of both trees, then d3d12_vulkan_device_test.exe on each | on: AMD Radeon RX 9060 XT (RDNA4, gfx1200), AMD 26.10.1 LLPC (Windows driver 32.0.32015.7029), Windows 11 26200, MSVC 2022, Windows SDK 10.0.26100.0 | result: no behaviour change

  • CheckFeatureSupport against the host D3D12 driver: 45 feature queries compared (1 host-unsupported skipped) ... 0 mismatches, identical with and without the PR.
  • The test exits 1 on both trees at the same pre-existing line 6574: tiles == 1, which this PR does not touch.
  • C4063 does not appear in either build here (0 lines). This 10.0.26100.0 SDK's d3d12.h declares D3D12_FEATURE_APPLICATION_SPECIFIC_DRIVER_STATE = 56 and D3D12_FEATURE_BYTECODE_BYPASS_HASH_SUPPORTED = 57, so the warning only shows with the older 26100 headers the PR describes. I could not reproduce the warning, only check that moving the two cases changes no answer.

AI-assisted. No game files.
agent: yes

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.

2 participants