Repository navigation
Conversation
…dispatch until they execute
ExecuteIndirect keeps only a signature's final argument and reads it at the start of each record, so a
[CONSTANT, DISPATCH] record {7, 1, 1, 1} ran 7 groups without the constant, and [CONSTANT, DRAW] passed the
record's start to vkCmdDrawIndirect (the constant became the vertex count). Until ProjectLeonida#2077 executes such
signatures, a valid one with any argument before its draw or dispatch is refused with E_NOTIMPL and one log
line. d3d12_indirect_signature_test checks [CONSTANT, DISPATCH/DRAW/DRAW_INDEXED]: refused, or run as D3D12 says.
…ning them until ProjectLeonida#1865 A draw ExecuteIndirect is replayed without the list's pipeline, render targets and root arguments until ProjectLeonida#1865, so a correct ProjectLeonida#2077 would have turned the draw cases red. They now pass when refused with E_NOTIMPL or accepted, and only the dispatch runs; the dependency is in the test and docs/d3d12_vulkan.md 4.7. The points VS/PS go. The doc also says the refusal logs one line per distinct argument count, not once.
|
Tested dbac43d on NVIDIA GeForce RTX 4080 (driver 617.42), Windows 11, clang-cl cross-build: the targets that ran pass; d3d12_command_signature_root_test did not run.
AI-assisted. |
|
Tested
On the Not run: #3929's tests on top of this change (the PR body notes they need the Microsoft runtime), AMD and Intel adapters, and the rest of CTest. AI-assisted. Synthetic tests only; no game data. |
|
Tested dbac43d on Intel UHD 770, driver 32.0.101.7088, Windows 11, MSVC: d3d12_indirect_signature_test exits 0 on two runs with LEONIDA_VK_VALIDATION=1. The DISPATCH control runs 1 group, and [CONSTANT, DISPATCH], [CONSTANT, DRAW] and [CONSTANT, DRAW_INDEXED] are each refused with E_NOTIMPL (argument count 2). With the Khronos validation layer loaded via VK_INSTANCE_LAYERS the run also exits 0 with 0 validation error lines and 0 FAIL lines. d3d12_command_signature_root_test does not exist at this head (it is added by #3929), so the HRESULT exemption was not checked. AI-assisted. |
|
Independent check — pass, GPU-verified (Windows 11, NVIDIA RTX 5090, driver 617.42, Vulkan SDK 1.4.363.0).
Doc check: the AI-assisted (Devin); no game files. |
…otRexed#5777 ItsNotRexed#5790 ItsNotRexed#5795 ItsNotRexed#5799 ItsNotRexed#5803 ItsNotRexed#5889 ItsNotRexed#5910 ItsNotRexed#5603 ItsNotRexed#5647 ItsNotRexed#5649 ItsNotRexed#5698 ItsNotRexed#5764 ItsNotRexed#5800 ItsNotRexed#5833 ItsNotRexed#5881 ItsNotRexed#5886 ItsNotRexed#5967 ItsNotRexed#7012 ItsNotRexed#8919 fork integration. Each parent after the first is an exact reviewed PR head. ItsNotRexed#5129 dbac43d ItsNotRexed#5129 (comment) ItsNotRexed#5347 e3934c0 ItsNotRexed#5347 (comment) ItsNotRexed#5777 a08ecfa ItsNotRexed#5777 (comment) ItsNotRexed#5790 0ff8cfe ItsNotRexed#5790 (comment) ItsNotRexed#5795 543e14b ItsNotRexed#5795 (comment) ItsNotRexed#5799 ed41a76 ItsNotRexed#5799 (comment) ItsNotRexed#5803 1ea182f ItsNotRexed#5803 (comment) ItsNotRexed#5889 50d42e8 ItsNotRexed#5889 (comment) ItsNotRexed#5910 b43c1d6 ItsNotRexed#5910 (comment) ItsNotRexed#5603 5933f28 ItsNotRexed#5603 (comment) ItsNotRexed#5647 569856d ItsNotRexed#5647 (comment) ItsNotRexed#5649 40dc11e ItsNotRexed#5649 (comment) ItsNotRexed#5698 a80acd7 ItsNotRexed#5698 (comment) ItsNotRexed#5764 f9e2ff3 ItsNotRexed#5764 (comment) ItsNotRexed#5800 579be80 ItsNotRexed#5800 (comment) ItsNotRexed#5833 ce06fb6 ItsNotRexed#5833 (comment) ItsNotRexed#5881 a5a1ff5 ItsNotRexed#5881 (comment) ItsNotRexed#5886 da0dffb ItsNotRexed#5886 (comment) ItsNotRexed#5967 3da3ae0 ItsNotRexed#5967 (comment) ItsNotRexed#7012 d6b6358 ItsNotRexed#7012 (comment) AI-assisted integration.
Claimed in the coordination issue as: #5032 (comment)
What and why
ExecuteIndirectwith a command signature that has an argument before its draw or dispatch(
[CONSTANT, DRAW],[CONSTANT, DRAW_INDEXED],[CONSTANT, DISPATCH], and the same with views) was accepted byCreateCommandSignature, but the list kept only the last argument's kind, the stride and the record offset, andthe replay handed that offset to Vulkan. So Vulkan read the record from its first byte: the constant became the
first draw or dispatch argument, and the constant itself never reached the shader.
Measured on
main(3faac55) with the new test, record{constant 7, then the draw or dispatch}, the rootconstant set to 100 directly before the call:
[CONSTANT, DISPATCH], record{7, 1, 1, 1}: 7 groups ran, and they saw the constant 100. D3D12 runs 1 groupwith constant 7. The plain
[DISPATCH]control in the same test runs 1 group, so the harness is right.[CONSTANT, DRAW](stride 20) and[CONSTANT, DRAW_INDEXED](stride 24): accepted (S_OK). The API dump showsvkCmdDrawIndirect/vkCmdDrawIndexedIndirectcalled at the record's start (offset 131072, a 64 KiB boundary,not +4), so Vulkan reads
{7, 3, 1, 0}: 7 vertices, 3 instances, first vertex 1. The draw itself doesn't renderon
mainanyway: anExecuteIndirectdraw is recorded outside rendering and without a pipeline (validation:VUID-vkCmdDrawIndirect-renderpass,-None-08606), and the submission didn't finish in 20 s. That part is Runtime: milestone M5 synthetic gate (without mesh) — ExecuteIndirect draws render now, multi-threaded lists, 5,120-SRV bindless table, pipeline cache #1865(M5, "ExecuteIndirect draws render now"); once it lands, these signatures would draw the wrong vertex count.
The real fix is #2077 (multi-argument signatures). Until it lands, this makes such a signature fail clearly
instead of drawing wrong:
CreateCommandSignaturereturnsE_NOTIMPLfor a valid signature with more than one argument. It logs one lineper distinct argument count:
[rt] d3d12: CreateCommandSignature refused (E_NOTIMPL): arguments before the draw or dispatch are not executed yet; argument count N. Invalid signatures still getE_INVALIDARGfirst, and a null output stillgets
E_UNEXPECTED, as before. Single-argument signatures are unchanged. When Runtime: ExecuteIndirect with multi-argument command signatures (root constants/descriptors, VB/IB views per record) on VK_EXT_device_generated_commands #2077's path lands, it deletes this8-line block.
d3d12_indirect_signature_test:[CONSTANT, DISPATCH]: passes if it is refused withE_NOTIMPLor runs as D3D12 says (1 group, constant 7).So it keeps passing when Runtime: ExecuteIndirect with multi-argument command signatures (root constants/descriptors, VB/IB views per record) on VK_EXT_device_generated_commands #2077 makes it work. A plain
[DISPATCH]control runs first.[CONSTANT, DRAW]and[CONSTANT, DRAW_INDEXED]: only created, never run. They pass if they are refused withE_NOTIMPLor accepted. Until Runtime: milestone M5 synthetic gate (without mesh) — ExecuteIndirect draws render now, multi-threaded lists, 5,120-SRV bindless table, pipeline cache #1865, a drawExecuteIndirectis replayed without the list's pipeline, rendertargets and root arguments (
GraphicsCommandList::ExecuteIndirectrecords them for a dispatch only). Running adraw here would test Runtime: milestone M5 synthetic gate (without mesh) — ExecuteIndirect draws render now, multi-threaded lists, 5,120-SRV bindless table, pipeline cache #1865, not the signature, and would turn a correct Runtime: ExecuteIndirect with multi-argument command signatures (root constants/descriptors, VB/IB views per record) on VK_EXT_device_generated_commands #2077 red. The dependency is written in
the test and the docs: once Runtime: milestone M5 synthetic gate (without mesh) — ExecuteIndirect draws render now, multi-threaded lists, 5,120-SRV bindless table, pipeline cache #1865 lands, the draws should run too.
docs/d3d12_vulkan.md§4.7 has the refusal and the measurement.With #3929. #3929 changes the same function. The code merges cleanly (
git merge-treewith #3929's head), and thedoc item sits apart from #3929's. One semantic point:
d3d12_command_signature_root_testcompares the layer'sHRESULT with the host's. For a valid signature with a root argument, the host gives
S_OKand the layer now givesE_NOTIMPL. Whichever lands second needs the exemption #3929 already makes for mesh dispatch (#3777): not comparedwhile the layer answers
E_NOTIMPL.Tested
RunPod: NVIDIA GeForce RTX 5080, Linux, driver 580.65.06. Windows build cross-compiled with clang-cl 21 and xwin
(RelWithDebInfo), run through Wine 11.0 under
xvfb-run. Validation is the host'sVK_LAYER_KHRONOS_validation(SDK 1.4.363.1,
VK_INSTANCE_LAYERS).LEONIDA_VK_VALIDATION=1doesn't work under Wine, because winevulkan doesn'tlist the layer. The host layer does report errors here: it flagged the draws above.
d3d12_indirect_signature, before:main's layer with this test gives exit 1:[FAIL] [CONSTANT, DISPATCH]: accepted; 7 group(s), constant + 1 = 101, want 1 group(s), constant + 1 = 8.In a local variant that goes on past that failure,
mainaccepts both draw signatures, and the test reports themas "accepted; not run" without touching the GPU. That is the path a correct Runtime: ExecuteIndirect with multi-argument command signatures (root constants/descriptors, VB/IB views per record) on VK_EXT_device_generated_commands #2077 takes before Runtime: milestone M5 synthetic gate (without mesh) — ExecuteIndirect draws render now, multi-threaded lists, 5,120-SRV bindless table, pipeline cache #1865.
d3d12_indirect_signature, after: exit 0, with the control and 3 refusals. 6 of 6 runs passed, with0 validation errors.
ctest -R "indirect|^d3d12_vulkan_device$"through Wine, after:d3d12_vulkan_device,d3d12_indirect_rt,d3d12_indirect_signature.d3d12_indirect_zero(77: the host D3D12 is Wine's).d3d12_indirect_dispatch_count, with exit 1 and no output, exactly as withmain's binaries. It needsd3dcompiler_47and WARP. Its plain[DISPATCH]path isn't touched here.tests/test_ctest_registration.py: 4 OK.Not covered
LEONIDA_VK_VALIDATION=1, andd3d12_vulkan_device's host comparison: it skips under Wine. Itscommand signature:cases are all refused before the new check, so they shouldn't move.#3929's test run on top of this change. It needs the Microsoft runtime.INCREMENTING_CONSTANTbefore the action are refused bythe same check, but the test doesn't create them.
No game files.
AI-assisted (Claude Code).