Skip to content

d3d12: answer CheckFeatureSupport(D3D12_OPTIONS) with the console's larger structure (rebase of #4026) - #6583

Open
Kam471 wants to merge 1 commit into
ItsNotRexed:mainfrom
Kam471:assist-4026-rebased
Open

Kam471 wants to merge 1 commit into
ItsNotRexed:mainfrom
Kam471:assist-4026-rebased

Conversation

@Kam471

@Kam471 Kam471 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Rebase of #4026 for current main (the original head is conflicting). Original author: @mariuslozo-boop; authorship is preserved. Branch Kam471:assist-4026-rebased, one commit on 1cc6e3c12.

Answers CheckFeatureSupport(D3D12_OPTIONS) asked with the console's 0x40-byte structure instead of returning E_INVALIDARG for the larger size. The original PR is the fix; this is only the rebase.

Tested on the rebase base:

  • d3d12_vulkan_device, device_proxy, d3d12_options1_first_use: 3/3
  • OPTIONS 0x40 check: 2/2 on the Vulkan device and the device proxy; also passes over WARP
  • git diff --check clean; git merge-tree vs main exits 0.

Conflicts were test files only; main's compare_fences block and the PR's optsize calls are both kept.

…le's larger structure

A retail console title asks for D3D12_OPTIONS with 0x40 bytes where the PC structure is 0x3C
and stops on E_INVALIDARG (measured by the XCL project; GTA VI is not measured). A size above
the PC structure now gets the PC fields, every byte after them zeroed and S_OK, in the Vulkan
device and in the Xbox-ABI proxy's device slot 13 over a PC runtime (WARP refuses 0x40, which
device_proxy_test prints). A smaller size and every other feature keep the exact-size rule: no
other console size is measured, and a console structure may carry input fields that zeros
would answer wrongly (shims/d3d12_console_feature.h). The first such call logs its size.

Tests: one shared check (test/d3d12_options_size_check.h) runs on the raw Vulkan device, the
proxy over it, the standalone Vulkan device and the proxy over WARP: 0x3C, 0x3D, 0x40 with a
0xCD-filled buffer, 0x44, 0x80, 0x1000 and 0x10000 (guard bytes after the structure untouched),
smaller sizes and no buffer refused, other features still E_INVALIDARG. device_proxy_test also
calls slot 13 with garbage in the upper halves of the 32-bit arguments.

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

Copy link
Copy Markdown
Contributor

Heads-up: like #4026, this replaces device slot 13 (proxy_check_feature_support), which #4695 also changes. Whichever merges second conflicts, and git also keeps both Slot == 13 dispatcher branches, which fails to compile (C2660). A tested resolution that keeps both behaviours (the console-sized OPTIONS answer, then #4695's answer log) is in kingzzim7-create@c7defe9f9, made against the earlier rebase 6ec9d70; details and test results are in #4026.

AI-assisted (Claude)

@wasonidas

Copy link
Copy Markdown

Independent Windows CPU/WARP check of 6248a5238704959648f817dd0691f19afb557a29 on main 1cc6e3c1 (MSVC 19.44.35230, SDK 10.0.26100.0). The CPU build completed, the focused CTest run passed 10/10, and device_proxy_test passed all 91 checks. Native WARP rejected the 0x40-byte OPTIONS request. Proxy slot 13 accepted it, zeroed the tail and preserved guard bytes. The size controls for other feature IDs still returned E_INVALIDARG. No Vulkan hardware runs or game files.

The slot-13 overlap with #4695 is already reported. One additional integration result: git merge-tree --write-tree with #6578 at 85eb02cb also reports a content conflict in runtime/shims/d3d12_vulkan_device.cpp. The combined OPTIONS handler needs to preserve both behaviors: populate the local answer from the enabled Vulkan capabilities, then write it with the console-size tail handling.

AI-assisted.

@thehollowedone

Copy link
Copy Markdown

Independent Windows GPU check of 6248a523. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0.

Both the Vulkan-backed device and its Xbox proxy accepted the 64-byte D3D12_OPTIONS query. On each path, the first 60 bytes matched its standard-size response, the four extra bytes were zero, and the 16 bytes past the end of the response stayed intact. Khronos core and synchronization validation reported zero errors. This focused fixture used the published runtime and checked only the two supported query sizes. The independent WARP check covers the software path.

AI-assisted.

@devnull34 devnull34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware & Environment

  • Host: Windows 11 Build 26300 x64
  • GPU: AMD Radeon RX 7900 GRE (16 GB VRAM, RDNA3 gfx1100, Vulkan 1.3.296)
  • Toolchain: MSVC 19.44 (Visual Studio 2022), CMake 4.4, Windows SDK 10.0.26100.0

Verification Summary

Targets compiled with MSVC 19.44 and executed natively on AMD Radeon RX 7900 GRE:

  1. **\device_proxy_test.exe**:

    • Passed with 83 forwarded PC vtable slots and all proxy overrides verified.
    • Verified that WARP refuses 0x40 bytes for \D3D12_OPTIONS\ with \E_INVALIDARG\ (0x80070057), while the Xbox-ABI proxy slot 13 correctly serves console-sized requests (0x3C, 0x3D, 0x40, 0x44, 0x80, 0x1000, 0x10000) with zero-extended buffers and \S_OK.
    • Verified that smaller sizes and non-OPTIONS features remain strictly guarded with exact-size checks and \E_INVALIDARG.
  2. **\d3d12_vulkan_device_test.exe**:

    • Passed across all placed resource, upload heap, buffer/texture copy, resolve, and console \CheckFeatureSupport(D3D12_OPTIONS)\ size validation tests on Radeon RX 7900 GRE.
  3. CTest:

    • \device_proxy: Passed (0.03s)
    • \device_proxy_trace: Passed (0.03s)
    • \d3d12_vulkan_device: Passed (3.79s)
    • Total: 3/3 passed (100%).
  4. Hygiene & Compliance:

    • Clean-room compliant: zero game data or proprietary assets used or referenced.
    • \git diff HEAD~1..HEAD --check: Clean (0 whitespace/formatting defects).

LGTM!

@ElsCiber

Copy link
Copy Markdown

Independent Windows + NVIDIA check of 6248a523 (base main 1cc6e3c1): pass. AI-assisted.

  • GPU: NVIDIA GeForce GTX 1660 SUPER (Turing, subgroup 32), driver 621.14, Vulkan 1.4.357

  • CPU: AMD Ryzen 5 3600; OS: Windows 11 Pro 26300

  • Build: MSVC (VS Build Tools 2022) + Ninja, RelWithDebInfo, Windows SDK 10.1.26100.7705, Vulkan SDK 1.4.363.0

  • ctest -R "^(d3d12_vulkan_device|device_proxy|d3d12_options1_first_use)$": 3/3. device_proxy prints PASS slot 13 answers D3D12_OPTIONS at 0x3C, 0x40 and larger sizes (extra bytes zero), refuses smaller ones, and WARP still refuses the 0x40-byte request (0x80070057), as the premise says. d3d12_vulkan_device: 46 CheckFeatureSupport queries compared with the host, 0 mismatches.

  • Full ctest -j 4: 248/250. The two failures aren't this PR's. d3d12_indirect_dispatch_count fails the same way on main 1cc6e3c1 (d3d12_indirect_dispatch_count fails on main since #4312: cs_indirect_dispatch_count.comp still reads its root UAV from s0:s1 #6162). loader failed once under -j 4 and then passed 3/3 alone; main didn't show it.

I didn't check the slot 13 conflict with #4695 that kingzzim7 raised.

@Jadiac5

Jadiac5 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 6248a52 on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: pass

  • Earlier checks on this head ran on WARP/CPU and an RTX 3080 Ti; this is the first on an AMD GPU.
  • Build: MSVC 19.44, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.1, fresh build folder. 0 errors. The 2 warnings in d3d12_vulkan_device_test.cpp (6977, 6984) are on lines this PR does not touch.
  • d3d12_vulkan_device_test.exe on the RX 9070 XT: exit 0, with and without LEONIDA_VK_VALIDATION=1; 0 lines mentioning a validation error or VUID. It runs optsize::check on the Vulkan device, behind the proxy, and on the standalone device. The host comparison line reads CheckFeatureSupport options ... 45 feature queries compared, 0 mismatches.
  • device_proxy_test.exe (WARP behind the proxy): 91 PASS, 0 FAIL. WARP answers the 0x40-byte OPTIONS request with 0x80070057 (E_INVALIDARG), so slot 13 does the work.
  • ctest on the neighbours (device_proxy, device_proxy_trace, xs_proxy_mock*, queue_proxy, allocator_proxy, d3d12_options1_first_use, vulkan_device_filter, root_sig, pe_loader, pe_loader_bounds): 13/13 passed. test_docs_repo_paths, test_docs_links, test_docs_env_vars: OK. git diff --check clean.
  • Negative control (d3d12_vulkan_device.cpp, d3d12_xs_device.cpp, d3d12_xs_device.h at 1cc6e3c, tests and d3d12_console_feature.h kept):
    • device_proxy_test: 3 failures (device slot 13 is the CheckFeatureSupport override, slot 13 answers D3D12_OPTIONS at 0x3C, 0x40 and larger sizes, slot 13 reads feature and size as 32-bit values), exit 1.
    • d3d12_vulkan_device_test: a larger size is not S_OK at sizes 0x3d, 0x40, 0x44, 0x80, 0x1000 and 0x10000 (HRESULT 0x80070057), exit 1.
    • PR files restored and rebuilt: both pass.
  • d3d12_vulkan_device.cpp:6811: log_once keys on the message and the size, so the "asked for more bytes" line prints once per distinct size, not once. d3d12_vulkan_device_test prints 6 of them (sizes 61, 64, 68, 128, 4096, 65536). The comment at d3d12_console_feature.h says "log the size of the first such D3D12_OPTIONS call".
  • Not done: not run against the retail executable; the 0x40-byte request is taken from the PR's cited measurement on another title. The slot-13 overlap with d3d12_xs: log CheckFeatureSupport answers at the device proxy (boot.md Q11/Q22) #4695 and D3D12_FEATURE_D3D12_OPTIONS: answer the five booleans from the enabled Vulkan features #6578 is already reported on the thread and not retested.

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.

8 participants