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:
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index 55b523d96..987dd2d64 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -90,6 +90,7 @@ const char* name(leonida::ReplayResult result) {
90 case leonida::ReplayResult::invalid_copy: return "invalid copy or resolve"; 90 case leonida::ReplayResult::invalid_copy: return "invalid copy or resolve";
91 case leonida::ReplayResult::invalid_query: return "invalid query"; 91 case leonida::ReplayResult::invalid_query: return "invalid query";
92 case leonida::ReplayResult::invalid_indirect_arguments: return "invalid indirect argument or count buffer range"; 92 case leonida::ReplayResult::invalid_indirect_arguments: return "invalid indirect argument or count buffer range";
93 case leonida::ReplayResult::invalid_draw: return "draw kind does not match the pipeline (mesh or vertex)";
93 case leonida::ReplayResult::unsupported: return "unsupported"; 94 case leonida::ReplayResult::unsupported: return "unsupported";
94 } 95 }
95 return "?"; 96 return "?";
@@ -433,6 +434,20 @@ public:
433 record_draw(true, indices, instances, first_index, base_vertex, first_instance); 434 record_draw(true, indices, instances, first_index, base_vertex, first_instance);
434 } 435 }
435 436
437 // ID3D12GraphicsCommandList6: a mesh draw. The bound graphics pipeline must have a mesh shader (checked at
438 // execution, where the pipeline is resolved). D3D12 caps each count at 65535 and their product at 2^22
439 // (D3D12_MS_DISPATCH_MAX_THREAD_GROUPS_PER_GRID); a larger grid is a recording error.
440 void STDMETHODCALLTYPE DispatchMesh(UINT x, UINT y, UINT z) override {
441 d3d12_trace::record("ID3D12GraphicsCommandList6::DispatchMesh");
442 if (x > 65535 || y > 65535 || z > 65535 || std::uint64_t(x) * y * z > (1u << 22)) return check(false);
443 if (!graphics_pipeline_ || !graphics_.layout) return check(false);
444 if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; // as record_draw: nothing is rasterized
445 leonida::Draw draw{graphics_pipeline_, graphics_.data, draw_views(), depth_, {}, 0, viewport_,
446 scissor_, blend_factor_, front_stencil_ref_, back_stencil_ref_, false, x, y, z, 0, 0};
447 draw.mesh = true;
448 check(list_.draw(std::move(draw)));
449 }
450
436 void STDMETHODCALLTYPE ResourceBarrier(UINT count, const D3D12_RESOURCE_BARRIER* barriers) override { 451 void STDMETHODCALLTYPE ResourceBarrier(UINT count, const D3D12_RESOURCE_BARRIER* barriers) override {
437 d3d12_trace::record("ID3D12GraphicsCommandList::ResourceBarrier"); 452 d3d12_trace::record("ID3D12GraphicsCommandList::ResourceBarrier");
438 if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false); 453 if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false);