diff options
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 22 |
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; |