Skip to content

d3d12: a draw or dispatch with no pipeline state bound is ignored, not a failed list - #9071

Closed
evilclanker9000 wants to merge 1 commit into
ProjectLeonida:mainfrom
evilclanker9000:deepseek/4-pso-missing-draw
Closed

evilclanker9000 wants to merge 1 commit into
ProjectLeonida:mainfrom
evilclanker9000:deepseek/4-pso-missing-draw

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: EGEN-PSO-MISSING-DRAW (#8868 (comment))

Depends on: none

What and why

record_draw and record_dispatch (runtime/shims/d3d12_com.cpp) made Close return E_INVALIDARG when a draw
or dispatch was recorded with no graphics or compute pipeline state bound. Without the debug layer, D3D12 closes that
list and the call does nothing: d3d12_close_parity_test measures it on WARP for DrawInstanced(3),
DrawInstanced(0), Dispatch(1, 1, 1) and Dispatch(0, 0, 0) "with nothing set". One failed Close fails the whole
ExecuteCommandLists, so the layer dropped a submission D3D12 runs: a title that records a draw before its pipeline
state is set (a placeholder draw while loading, or a pipeline whose creation failed) lost that frame's work, and the
window kept the previous frame or the clear colour.

The two calls now record nothing and log it once through note_once, the way the layer already treats a draw with no
viewport. A draw with a pipeline state but no root signature or no topology is still refused: that combination is not
in the measured column.

The four parity cases move from the known-difference table to match, d3d12_compute_test's misuse case expects the
closed list instead of a refused one, and docs/d3d12_vulkan.md carries the new counts. This is a layer-correctness
change measured against WARP; it is not a claim about a game frame or a boot phase.

Tested

Windows 11, NVIDIA GeForce RTX 5080, driver 32.0.16.1692, Vulkan SDK 1.4.363.1, MSVC 19.44, RelWithDebInfo, base
main 867d922f0.

  • ctest -R d3d12_close_parity, after: 113 cases, 82 match WARP, 16 known layer-stricter, 15 known layer-looser, 0 not run, 0 where WARP differs from the measured column, 0 failures. The four with nothing set rows are match
    (0x00000000 / 0x00000000).
  • Negative control: the same build with only the record_draw/record_dispatch hunks reverted (the base behaviour)
    reports 113 cases, 78 match WARP, 16 known layer-stricter, 15 known layer-looser, 4 failures; the four rows return
    0x80070057 where WARP returned 0x00000000. Restored, it is 82 matches and 0 failures again.
  • d3d12_compute_test: pass, including the misuse case that now expects Close to succeed.
  • Full ctest -C RelWithDebInfo: 272 of 275 run tests pass, including d3d12_draw, d3d12_m2_textured,
    d3d12_m3_frame, d3d12_translated_draw, d3d12_msaa_draw, d3d12_depth24_draw, d3d12_clear,
    d3d12_bundle, d3d12_bundle_forbidden, d3d12_gcl8 and command_list. The three that failed are unrelated:
    d3d12_vulkan_device and d3d12_depth_resolve also fail when rerun alone on this host without this change (the
    earlier targeted ctest run at 20:01 fails the same two), and d3d12_bindless_churn_validated lost its temporary
    index.json while other tests were running from the same temp folder; rerun alone it passes.

AI-assisted: yes (Cline).

Checklist

  • 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.

Tag: SHAYDERRR

…t a failed list

record_draw/record_dispatch made Close return E_INVALIDARG when no graphics or compute pipeline state was bound. D3D12 without the debug layer closes such a list and the call draws nothing (WARP, measured by d3d12_close_parity_test), and one failed Close fails the whole ExecuteCommandLists, so the layer dropped a submission D3D12 runs: a title that records a draw before its pipeline state is set loses that frame's work.

Both calls now record nothing and log it once through note_once; a missing root signature or topology with a pipeline state bound is still refused (that combination has not been measured). The four parity cases move from the known-difference table to match (113 cases: 78 matches before, 82 after, 20 layer-stricter before, 16 after), and docs/d3d12_vulkan.md carries the new counts.

@al3xar al3xar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI-assisted review and test.

Independent verification of 9d6e78fa3 on Windows 11 x64 (es-ES), MSVC 19.44.35230.0 (RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON), NVIDIA GeForce RTX 3060 (driver 621.24, Vulkan SDK 1.4.363.0), no game files used: pass.

  • Merge & hygiene: Merges cleanly with upstream/main (867d922f0, git merge-tree exit 0); python -I scripts/check_no_game_data.py clean.
  • Build: d3d12_close_parity_test and d3d12_compute_test built cleanly with MSVC /W4 (no new warnings).
  • Tests (LEONIDA_VK_VALIDATION=1):
    • d3d12_close_parity_test: pass, 0 validation errors (113 cases, 82 match WARP, 16 known layer-stricter, 15 known layer-looser, 0 not run, 0 where WARP differs from the measured column, 0 failures).
    • d3d12_compute_test: pass, 0 validation errors.
  • Negative control: Reverting runtime/shims/d3d12_com.cpp to upstream/main causes d3d12_close_parity_test to fail on all 4 with nothing set cases (78 match WARP, 4 failures, exit 1) and d3d12_compute_test to fail at line 565: SUCCEEDED(list->Close()) (exit 1).
  • Code & docs check: Skipping record_draw / record_dispatch via note_once when no pipeline state is bound while still failing on missing root signature/topology matches the WARP parity measurements, and docs/d3d12_vulkan.md counts match d3d12_close_parity_test.

@Grimkaaah Grimkaaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Independent Linux CPU review

What changed: d3d12 — a draw or dispatch with no pipeline state bound is ignored, not a failed list.

Checked: diff review of d3d12_com.cpp + test tweaks (no local runtime build).

Looks correct; no game files.

@Joaco9020

Copy link
Copy Markdown
Contributor

Tested 9d6e78fa3 on Windows 11, NVIDIA GeForce RTX 3070 (layer device), driver 621.01, MSVC 19.44, Vulkan SDK 1.4.363.1: pass, with a negative control.

d3d12_close_parity_test d3d12_compute_test
this PR exit 0; the four "with nothing set" rows (DrawInstanced(3), DrawInstanced(0), Dispatch(1, 1, 1), Dispatch(0, 0, 0)) all 0x00000000 | 0x00000000 | match; 113 cases, 82 match WARP, 16 known layer-stricter, 15 known layer-looser, 0 failures exit 0
HEAD~1's d3d12_com.cpp (same tests) exit 1: FAIL DrawInstanced(3) with nothing set: layer Close 0x80070057, WARP succeeds, same for DrawInstanced(0) exit 1 at line 565: SUCCEEDED(list->Close())

Note: this test's reference column is WARP; it doesn't put the NVIDIA hardware driver next to it, so this confirms the layer change on an NVIDIA Vulkan device, not a second hardware host's answer. Synthetic tests only, no game files. AI-assisted (Claude).

@bobcatchris

Copy link
Copy Markdown
Contributor

Independent verification on the retail executable, AMD (RX 7900 XTX, AMD's Windows Vulkan driver), from the frame-loop state all four machines now reach (tibzejoker's rt5-integration + #7858/#7746/#6885, stubs on, stop-26 assert stepped over). This PR's change is the difference between a dead loop and a running one here.

The cascade this PR breaks, measured with a one-call diagnostic on check(): the title's mesh-pipeline PSOs are stubs or refused at boot (98 amplification-stage refusals per 150 s — the layer's AS refusal, finding on the board), so set_pipeline binds program id 0; the first DrawInstanced then hits the old !graphics_pipeline_ rule, the list is marked invalid, and every later call on that list fails, so Close returns E_INVALIDARG about once per frame and no PresentX ever happens — the exact Close/PresentX symptom in the 3060 Ti report (50,502 Close failures, 0 presents).

With the skip: a 240-s run on the GPU, killed by the harness budget with the title still running — zero exceptions, zero list invalidations, PresentX ready, the frame loop clean end to end. The no-viewport case two lines below already had exactly this skip-not-invalidate behaviour, so the change also removes an inconsistency.

One addition worth considering, from the same measurement: the unrecognized-object diagnostic showed the title legitimately holds secondary-interface pointers (a QI answer at this+8) for its pipeline states — Object::from handles that via the tag QI, so nothing to fix, but a future check that reads a vtable directly would misfire on it.

Format/slot numbers and outcomes only; no game data. AI-assisted.

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