Repository navigation
Runtime: a bundle's draws run with the parent's state, and what the bundle set stays on the parent - #2145
Conversation
…undle set stays on the parent A draw recorded in a bundle took the bundle's own viewport, targets, root arguments and buffers. A bundle cannot set a viewport, so every bundle draw was dropped without an error, and nothing of the parent's state reached it. Only the stencil reference and the blend factor were handed back. Inside a bundle, state calls, draws and Dispatch are now kept as deferred calls, and ExecuteBundle plays them on the parent through the members a direct call uses, between the bundle's state-free commands, in order. A draw sees the parent's state plus what the bundle set, and what the bundle set stays on the parent, as measured on the PC runtime. This replaces the stencil-reference and blend-factor carry-back fields. Trace lines are written once, when the bundle records the call. ClearUnorderedAccessView is refused in a bundle, like the other clears. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested
AI-assisted (Claude Code). |
|
Tested
So on this Blackwell card the PR's new bundle coverage is green, but the existing AI-assisted. |
|
Tested b76c78a on AMD Radeon RX 7600 (RDNA3), AMD 26.11.2 (LLPC), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8: d3d12_bundle_test passes.
AI-assisted (Claude Code, reviewed with Codex). No game files. |
|
Tested b76c78a (merged onto main 4947579) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: pass
AI-assisted (Claude). |
Claimed in the coordination issue as: #1548 (comment) (new D3D item)
What and why
A draw recorded in a bundle was dropped.
record_drawsnapshots the recording list's own viewport, render targets, root arguments and vertex/index buffers, and skips the draw when the list has no viewport. A bundle may not callRSSetViewports,RSSetScissorRectsorOMSetRenderTargets, so its viewport is always empty: every bundle draw was skipped, with no error.execute_bundlecopied the bundle's already-recorded commands, so none of the parent's state could reach them either, and of what a bundle sets only the stencil reference and the blend factor (#1660) came back to the parent.Measured on the PC runtime first (RTX 4060 Ti and WARP, the same in every valid case):
The change. Inside a bundle, state calls, draws and
Dispatchare kept as deferred calls (BundleCall: a function and the bundle's command count at that point).ExecuteBundleplays them on the parent through the private members a direct call uses, and copies the bundle's state-free commands (markers,WriteBufferImmediate) between them in their original order, through a range form ofCommandList::execute_bundle. Inheritance and hand-back both follow from that one mechanism.blend_factor_set_andstencil_ref_set_are gone; deferringOMSetBlendFactorand the stencil setters covers them. Runtime: carry bundle blend factors back to parent draws #1660's block ind3d12_draw_testis unchanged and still describes the behaviour: worked through by hand it gives {64, 0, 255, 64}.check_d3d12_trace.pyis unchanged.Close; a draw or dispatch then makes the list invalid.ClearUnorderedAccessViewUint/Floatare refused in a bundle like the other clears (they were recorded and really cleared).For open PRs that add per-list state (#1451
RSSetDepthBias, #469 shading rate): after this, a setter works in a bundle by going throughdefer(...)with its private assignment; a_set_flag and a line inExecuteBundleare no longer needed.docs/d3d12_vulkan.mdsays so.Known differences left as they are: a bundle that sets no topology gets the parent's, as on the NVIDIA host (Microsoft's rule is "undefined", and WARP removes the device); a bad root argument in a bundle now fails the parent's
Close, not the bundle's;ExecuteIndirectandClearStatein a bundle are not deferred.Tested
Windows 11, NVIDIA GeForce RTX 4060 Ti (driver 32.0.16.2101), clang-cl 23.1.6 with the xwin SDK (10.0.26100) through
runtime/cmake/clang-cl-xwin.cmake, run natively. No game files.d3d12_bundle: 10 scenarios on the layer and on both hosts (RTX 4060 Ti and WARP, 20 host comparisons), all against one measured table: 0 failures, 3 runs. Plus on the layer: trace counts for a bundle executed five times, marker order (p0,p1,b1,draw,b2,draw,b3,p2), a PSO and root signature released right after recording with the bundle run from two parents and released while one is open, state calls and a draw on a closed bundle, zero-count root constants.main's runtime sources all 10 layer scenarios fail (a bundle draw leaves the clear colour; hand-back cases fail the parent'sClose), and the 20 host comparisons pass.command_list_test: the range form (first past the end, last clamped, empty ranges, default arguments).d3d12_com_test: a UAV clear in a bundle with a real descriptor is refused (fails with the refusal removed).d3d12_com,d3d12_trace,command_list,d3d12_compute,d3d12_set0_compute,d3d12_pipeline_library,d3d12_indirect_rt,d3d12_indirect_zero,d3d12_query_rules,d3d12_vulkan_device,unimplemented_policy,xs_proxy_mock*,queue_proxypass. Fullctest: 111 of 113.d3d12_subgroupcan't be built here (myllvm-mchas no AMDGPU target), andd3d12_drawfails onmaintoo, 0 of 10, at "fence signal 21 is not above 30" and then the bundle blend pixel (Tests: wait for the bundle blend draws in d3d12_draw (fence 31, not 21) #1995 fixes the fence value). With that value set to 31 locally,d3d12_drawpassed 10 of 10 on this branch; the file is not changed here.Dispatchgoes through the same mechanism but has no GPU case.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (not a translator change)🤖 Generated with Claude Code