Skip to content

d3d12_xs proxy: slots 14/62/76 and heap GetDevice clear the output before failing - #1158

Merged
ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
quackottu:xs-proxy-outptr
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
quackottu:xs-proxy-outptr

Conversation

@quackottu

Copy link
Copy Markdown
Contributor

The Xbox-ABI proxy in runtime/shims/d3d12_xs_device.cpp returned errors with the caller's output pointer untouched:

  • device slot 14 (CreateDescriptorHeap) creates into a local, so when the PC device's CreateDescriptorHeap fails, or riid is null, *out is never written;
  • slot 62 (CreateComputePipelineState) returns for a null riid before touching out;
  • slot 76 (Xbox texture creation) does the same for a null description or riid;
  • heap slot 7 (GetDevice) checks riid before out.

d3d12.h (Windows SDK 10.0.26100) declares these outputs _COM_Outptr_, which means NULL on failure, and the inner Vulkan device already clears *out before validating. Through the proxy, a raw-pointer caller kept whatever was in its variable and could Release garbage. Each of the four now does if (!out) return E_POINTER; *out = nullptr; before its other checks.

main this PR
slot 14, null IID, output holds a sentinel E_INVALIDARG, sentinel kept E_INVALIDARG, NULL
slot 14, NumDescriptors = 0 (inner device fails) E_INVALIDARG, sentinel kept E_INVALIDARG, NULL
slot 62, null IID sentinel kept NULL
slot 76, null description sentinel kept NULL

Tests:

  • device_proxy_test adds raw slot 14/62 calls with a null IID and a slot 76 call with a null description. On main: FAIL slot 14/62 … nulls its output, FAIL slot 76 nulls its output for a null description, 3 failures. With this change: OK.
  • d3d12_vulkan_device_test adds slot 14 with NumDescriptors = 0 through the inner device and the proxy. On main it fails at proxy_out == nullptr; with this change it exits 0.
  • d3d12_descriptor_test still passes. Full ctest on Windows 11, RTX 5070 (621.24), VS 2022 Build Tools, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: 54/54.

Heap slot 7 is fixed but has no test of its own. #558 rewrites slot 14's null-output line into a capability check; the clear goes on the line after it, and I'll rebase on whichever lands first.

AI-assisted.

…fore failing

d3d12.h declares these outputs _COM_Outptr_ (NULL on failure), and the
inner Vulkan device clears it, but the Xbox-ABI proxy returned an error
with the caller's pointer untouched: slot 14 created into a local, and
slots 62/76 and heap slot 7 checked riid/desc before touching out.
@undeadhuman37

Copy link
Copy Markdown
Contributor

Tested bc59ef4 on NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 Home 25H2 (26200.9974), VS 2022 Build Tools, Vulkan SDK 1.4.363.1: pass.

  • Build: 0 warnings. ctest: 55/55 passed.
  • device_proxy_test: OK (0 failures), also with LEONIDA_VK_VALIDATION=1 and 0 validation errors.
  • d3d12_vulkan_device_test: all matched, exit 0, with and without validation. With validation, the test reports VUID-vkCreateDevice-ppEnabledExtensionNames-01387 twice (VK_KHR_swapchain without VK_KHR_surface). That is not from this PR: the branch predates ff69741 on main, which fixes it, and main (d3841c0) runs the same test with 0 validation errors here. A rebase onto main should clear it.

AI-assisted. No game files.

@marquezinii

Copy link
Copy Markdown
Contributor

Tested bc59ef4 on NVIDIA GeForce RTX 5070, driver 621.24 (32.0.16.2124), Windows 11 26H2 (26300), MSVC 14.52 (VS Build Tools 18), Ninja, RelWithDebInfo: pass.

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested bc59ef4 on AMD Radeon RX 9070 (RDNA4), AMD 26.11.2 (LLPC), Windows 11 Pro 26300, MSVC 14.44 (VS 2022 Build Tools), scripts\build_runtime.ps1 (RelWithDebInfo): pass

device_proxy_test d3d12_vulkan_device_test
this PR (bc59ef4) OK, 69 PASS / 0 FAIL OK (exit 0)
control: PR tests + main's d3d12_xs_device.cpp exit 1: FAIL slot 14 nulls its output for a null IID, FAIL slot 62 ...null IID, FAIL slot 76 ...null description exit 1 at line 1797: proxy_out == nullptr

So the new checks catch the old behaviour and the fix makes them pass, as described. Full ctest on main (c63773d) was 54/54 on the same machine before checking this out.

AI-assisted (Claude Code).

@TricksterG

Copy link
Copy Markdown
Contributor

Tested bc59ef4 on RTX 5090 (Blackwell, driver 621.24), Windows 11 Pro 26300, MSVC 14.44 (VS 2022), Vulkan SDK 1.4.363.0 with validation layers, VS generator, Release, -DLEONIDA_SDL3=OFF: pass.

AI-assisted (Claude Code): it built the branch, ran the tests and wrote this comment.

  • Build: 0 warnings. ctest: 54/54 (gameinput disabled).
  • device_proxy_test: OK (0 failures), 0 VUIDs.
  • d3d12_vulkan_device_test: all matched.

One validation error appears with LEONIDA_VK_VALIDATION=1, but it isn't from this PR: VUID-vkCreateDevice-ppEnabledExtensionNames-01387 (VK_KHR_swapchain enabled without the instance's VK_KHR_surface). It shows up the same way in builds of the other branches on this base, and current main (d3841c0) already guards it with has_swapchain && instance_has_surface. The branch is 81 commits behind main (no conflicts), so a rebase should drop it.

@ItsNotRexed
ItsNotRexed merged commit a8b06e0 into ProjectLeonida:main Nov 22, 2026
10 of 11 checks passed
quackottu added a commit to quackottu/Leonida that referenced this pull request Nov 22, 2026
…fixes

The list proxy's GetDevice and device slots 12/51 clear the output before
any failure, as ProjectLeonida#1158 does for the other proxy slots. d3d12_vulkan_device_test
copies through console slots 15/9 on a slot-12 list and executes its PC list.
The docs no longer say every proxy slot forwards in PC order.
mokkymiah pushed a commit to mokkymiah/Leonida that referenced this pull request Nov 22, 2026
…fixes

The list proxy's GetDevice and device slots 12/51 clear the output before
any failure, as ProjectLeonida#1158 does for the other proxy slots. d3d12_vulkan_device_test
copies through console slots 15/9 on a slot-12 list and executes its PC list.
The docs no longer say every proxy slot forwards in PC order.
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.

6 participants