Skip to content

D3D-377: Match Close errors for forbidden bundle calls - #3378

Open
maxhurst131 wants to merge 1 commit into
ItsNotRexed:mainfrom
maxhurst131:fix/d3d12-bundle-close-status
Open

maxhurst131 wants to merge 1 commit into
ItsNotRexed:mainfrom
maxhurst131:fix/d3d12-bundle-close-status

Conversation

@maxhurst131

Copy link
Copy Markdown
Contributor

D3D-377. [Claim in the coordination issue]([{"number":3232,"title":"Coordinating who works on what (16)"}]
#3232 (comment))

Depends on: #3255

The PRs edit the same bundle-restrictions paragraph and COM tests. When they are combined, use the bundle-rejection helper for the additional restrictions from #3255.

What and why

The layer previously reported E_INVALIDARG for both invalid arguments and forbidden bundle calls. Record the appropriate HRESULT when recording first fails, so Close() can return E_FAIL for a forbidden bundle call and E_INVALIDARG for a bad argument. A synthetic comparison with WARP reproduced the difference using SetPredication. Credit to @nightmoon1996 for the finding. D3D12 Close documentation

Tested

Windows 11 build 26300, MSVC 19.51, Vulkan SDK 1.4.363.0. RTX 5070 with NVIDIA driver 621.24 and Ryzen 7600X Radeon iGPU with AMD Vulkan driver 26.11.2 (Windows driver 32.0.21045.29003). Vulkan validation enabled for CTest.

  • WARP returned E_FAIL for the forbidden bundle call and S_OK for the direct list. The layer initially returned E_INVALIDARG for the bundle and matched both WARP results after the fix.
  • The updated COM regression failed with the original code and passed with the fix.
  • ctest -C RelWithDebInfo -R '^d3d12_(com|gcl8|vulkan_device|bundle)$' passed on the RTX 5070 (4/4).
  • ctest -C RelWithDebInfo -R '^d3d12_com$' passed on the Radeon iGPU (1/1).
  • The docs link, repository path, list item and design row suites passed (11 tests total).
  • Tested against main at f847748c. The PR's merge tree is identical to the tested tree.

Checklist

  • No game data, keys or decryption, including in logs or reports.
  • No translator rule changed.

AI-assisted (Codex).

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head merged with main f847748, MSVC 14.51):

Concern: none on the behaviour. #3255's d3d12_bundle_forbidden_test compares only the success/failure verdict against the host, so it stays valid with E_FAIL. Only the targets above were built and run, not the full ctest.

@Koro4e

Koro4e commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested c9cf0181 on NVIDIA GeForce RTX 3060 (Windows 11, MSVC 19.44, CMake/VS generator, runtime configured with LEONIDA_VULKAN_HEADERS_FETCH=ON):

  • d3d12_com_test: pass (exit 0).
  • Negative control with runtime/shims/d3d12_com.cpp reverted to main 16282101: fail (exit 1).

No game files. AI-assisted.

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Windows + GPU check: AMD Radeon RX 9070 (RDNA4), Windows 11, MSVC Release, Vulkan SDK 1.4.363. Tested head c9cf018 merged onto main f847748 (clean merge), full build, full ctest -C Release -j 4: 100% tests passed out of 132 | new failures vs main: none. The main baseline on the same machine passes 132/132.

AI-assisted (Claude Code); runs on my machine.

@evilclanker9000

Copy link
Copy Markdown
Contributor

Tested c9cf018 on Windows 11, RTX 5080 (driver 616.92) and AMD Radeon iGPU gfx1036 (driver 26.10.1): ctest -R "^d3d12_(com|gcl8|vulkan_device|bundle)$" (MSVC, RelWithDebInfo, LEONIDA_VK_DEVICE set per run, device line confirmed, VK_LOADER_LAYERS_DISABLE=~implicit~, no validation layer installed) — pass on both, 4/4 each (d3d12_com, d3d12_gcl8, d3d12_vulkan_device, d3d12_bundle).

PR head only, not combined with #3255. No negative control run.

AI-assisted.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested c9cf018 merged onto main f847748 on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 141/141.
  • d3d12_com: pass 20 of 20 runs, and pass under LEONIDA_VK_VALIDATION=1 with 0 validation messages.
  • Warnings: none new in the files this PR changes.

AI-assisted (Claude Code).

@zzEmmazz

Copy link
Copy Markdown
Contributor

Tested c9cf0181, applied alone on main f847748c (without #3255, which is still open): pass, with two host answers below that differ from what the layer returns.
Windows 11 (26200), MSVC 14.50 (VS 2026), Ninja RelWithDebInfo. Two GPUs: Ryzen 7 9700X iGPU (RDNA2, AMD 32.0.21042.62) and RTX 3070 (NVIDIA 610.74), picked with LEONIDA_VK_DEVICE.

  • Test change only, on main's d3d12_com.cpp: d3d12_com fails at line 187: bundle_parent->Close() == E_FAIL. So the test guards the change.
  • Whole PR: ctest -R "^d3d12_(com|gcl8|vulkan_device|bundle)$" 4/4 passed with LEONIDA_VK_DEVICE=radeon and 4/4 with LEONIDA_VK_DEVICE=3070. The diff (from its base 16282101) applies to f847748c without conflict.
  • Host check, independent of the layer: a small D3D12 program (no debug layer) that records one call into a new list and prints Close(), on the RTX 3070, the Radeon iGPU and WARP. All three adapters gave the same answers, and GetDeviceRemovedReason stayed S_OK throughout:
list recorded call Close()
bundle nothing S_OK
bundle SetPredication(null, 0, EQUAL_ZERO) E_FAIL
direct SetPredication(null, 0, EQUAL_ZERO) S_OK
bundle ClearRenderTargetView E_FAIL
bundle ResourceBarrier (transition) E_FAIL
bundle CopyBufferRegion E_FAIL
bundle CopyResource E_FAIL
bundle DiscardResource E_FAIL
bundle BeginQuery + EndQuery (occlusion) E_FAIL
bundle ResolveQueryData E_FAIL
bundle ExecuteBundle (an empty closed bundle) E_FAIL
bundle IASetVertexBuffers(32, 1, null) S_OK
direct IASetVertexBuffers(32, 1, null) S_OK
direct BeginQuery (occlusion) with no EndQuery E_FAIL
direct BeginQuery + EndQuery (occlusion) S_OK

So E_FAIL for a forbidden bundle call holds on hardware adapters too, not only WARP, including the query calls and ExecuteBundle that this PR moves from E_INVALIDARG to E_FAIL.

  • Two rows differ from the layer with this PR: the host closes a direct list with a query left open with E_FAIL, while Close() here still records E_INVALIDARG for it (check(!list_.queries_open()), as on main); and the host returns S_OK for IASetVertexBuffers(32, 1, null) in a bundle, where the test line added here expects E_INVALIDARG from the layer. The layer's answer in both cases is the one main already gives; this PR does not change it.

Not checked: the combination with #3255; which error the host reports when a bad argument and a forbidden call are both recorded in one bundle; the host under the D3D12 debug layer; the rest of ctest.

@memorypressure

Copy link
Copy Markdown

Verified on Linux: main moved past this branch — 70e3acf (2026-11-23) makes bundles that set viewports, scissors, render targets or ClearState fail their Close, with invalid_bundle_call coverage beyond this PR's tests, and the branch now conflicts with those changes (re-confirmed). One piece never landed anywhere though: main's Close still returns E_INVALIDARG where the measured PC runtime gives E_FAIL — verified on main, invalid_ ? E_INVALIDARG : S_OK at d3d12_com.cpp:197 — a divergence main's own docs acknowledge. If matching the HRESULT is wanted it is a two-line follow-up against 70e3acf rather than this branch. As it stands I would recommend closing; see also #3382, same family. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

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