diff options
| author | Mumogg <104529023+Mumogg@users.noreply.github.com> | 2026-11-24 03:51:27 -0600 |
|---|---|---|
| committer | Mumogg <104529023+Mumogg@users.noreply.github.com> | 2026-11-24 03:52:20 -0600 |
| commit | 88b8dbad9d59aab22da34c49035bd7841c822633 (patch) | |
| tree | 80e0bd3cf4ecfff8bb84473780ea907436f5e6ba /runtime/shims/d3d12_com.cpp | |
| parent | d1f8a6566d2c3a352603c0e72d3b00f6d2d7907d (diff) | |
d3d12: ExecuteIndirect keeps main's argument validation; DISPATCH_MESH has a record size and returns after it
Resolving the cherry-pick of efc347830 I dropped main's record-size, stride and span checks (e1ec785b2), which
d3d12_execute_indirect_validation_test depends on and which matter to every D3D12 user (found in review on
#377). They are back as on main, the record-size chain knows D3D12_DISPATCH_MESH_ARGUMENTS, and the early
return for a DISPATCH_MESH signature comes after the checks.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 55fea20c9..cf02df519 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -834,6 +834,20 @@ 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 | ||
| 838 | // even when no command runs. The argument span is what the signature can walk, max_command_count * stride: | ||
| 839 | // the host refuses a range that ends past the buffer (`240` with stride `20` in a `256`-byte buffer), and | ||
| 840 | // it checks the offset itself when max_command_count is 0, where the required bytes are none. | ||
| 841 | const UINT64 record_size = | ||
| 842 | kind == leonida::IndirectKind::draw ? sizeof(D3D12_DRAW_ARGUMENTS) | ||
| 843 | : kind == leonida::IndirectKind::draw_indexed ? sizeof(D3D12_DRAW_INDEXED_ARGUMENTS) | ||
| 844 | : kind == leonida::IndirectKind::dispatch ? sizeof(D3D12_DISPATCH_ARGUMENTS) | ||
| 845 | : kind == leonida::IndirectKind::dispatch_mesh ? sizeof(D3D12_DISPATCH_MESH_ARGUMENTS) | ||
| 846 | : 0; | ||
| 847 | if (!record_size || stride < record_size || stride % 4 != 0) return check(false); | ||
| 848 | if (argument_buffer_offset > arg_desc.Width || | ||
| 849 | UINT64(max_command_count) > (arg_desc.Width - argument_buffer_offset) / stride) | ||
| 850 | return check(false); | ||
| 837 | if (kind == leonida::IndirectKind::dispatch_mesh) { | 851 | if (kind == leonida::IndirectKind::dispatch_mesh) { |
| 838 | // Not replayed yet (#3777 replays it as vkCmdDrawMeshTasksIndirectEXT): nothing is recorded, and the | 852 | // Not replayed yet (#3777 replays it as vkCmdDrawMeshTasksIndirectEXT): nothing is recorded, and the |
| 839 | // first such call says so. The list stays valid. | 853 | // first such call says so. The list stays valid. |