upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/d3d12_com.cpp
diff options
context:
space:
mode:
authorNiiRoZz <simonin.remi25@gmail.com>2026-11-23 17:29:49 +0100
committerMumogg <104529023+Mumogg@users.noreply.github.com>2026-11-24 03:52:20 -0600
commitd1f8a6566d2c3a352603c0e72d3b00f6d2d7907d (patch)
treea46f13413d6697288bfd7cd724b06dae7fd4948b /runtime/shims/d3d12_com.cpp
parent69b46dfccbb84c55db31c41be6c752526c2160bd (diff)
d3d12: CreateCommandSignature creates a DISPATCH_MESH signature on a device with mesh shaders
The Vulkan layer created signatures for draw, draw-indexed and dispatch only and answered E_NOTIMPL for DISPATCH_MESH, which the PC runtime creates on any mesh-shader tier 1 device. A title that creates such a signature at startup and asserts on the result stopped there. The signature is created when the device has VK_EXT_mesh_shader (MeshShaderTier 1), as a new IndirectKind::dispatch_mesh (the name and value #3777 uses, so the two merge). ExecuteIndirect with it records nothing yet and says so once; #3777 replays it as vkCmdDrawMeshTasksIndirectEXT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit efc347830b9ccf1461baf9a764ac9e5e911de8f6)
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index 4f4904e96..55fea20c9 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -834,19 +834,15 @@ public:
834 } else if (count_buffer_offset != 0) { 834 } else if (count_buffer_offset != 0) {
835 return check(false); 835 return check(false);
836 } 836 }
837 // The record size is checked for every call: D3D12 rejects a signature whose stride cannot hold a record 837 if (kind == leonida::IndirectKind::dispatch_mesh) {
838 // even when no command runs. The argument span is what the signature can walk, max_command_count * stride: 838 // Not replayed yet (#3777 replays it as vkCmdDrawMeshTasksIndirectEXT): nothing is recorded, and the
839 // the host refuses a range that ends past the buffer (`240` with stride `20` in a `256`-byte buffer), and 839 // first such call says so. The list stays valid.
840 // it checks the offset itself when max_command_count is 0, where the required bytes are none. 840 static std::atomic<bool> logged{false};
841 const UINT64 record_size = 841 if (!logged.exchange(true, std::memory_order_relaxed))
842 kind == leonida::IndirectKind::draw ? sizeof(D3D12_DRAW_ARGUMENTS) 842 std::fprintf(stderr, "[rt] d3d12: ExecuteIndirect with a DISPATCH_MESH signature is not replayed yet; "
843 : kind == leonida::IndirectKind::draw_indexed ? sizeof(D3D12_DRAW_INDEXED_ARGUMENTS) 843 "nothing was recorded\n");
844 : kind == leonida::IndirectKind::dispatch ? sizeof(D3D12_DISPATCH_ARGUMENTS) 844 return;
845 : 0; 845 }
846 if (!record_size || stride < record_size || stride % 4 != 0) return check(false);
847 if (argument_buffer_offset > arg_desc.Width ||
848 UINT64(max_command_count) > (arg_desc.Width - argument_buffer_offset) / stride)
849 return check(false);
850 leonida::ExecuteIndirect cmd{}; 846 leonida::ExecuteIndirect cmd{};
851 cmd.kind = kind; 847 cmd.kind = kind;
852 cmd.stride = stride; 848 cmd.stride = stride;