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.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index 6fc3e2c51..581bc0fa9 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -113,8 +113,9 @@ class CommandAllocator final
113 : public Child<CommandAllocator, ID3D12CommandAllocatorStubs, ID3D12Object, ID3D12DeviceChild, ID3D12Pageable, 113 : public Child<CommandAllocator, ID3D12CommandAllocatorStubs, ID3D12Object, ID3D12DeviceChild, ID3D12Pageable,
114 ID3D12CommandAllocator> { 114 ID3D12CommandAllocator> {
115public: 115public:
116 // {7d0e6b51-34a2-4f0c-9a61-0c5b2e8f4a10} 116 // {7d0e6b51-34a2-4f0c-9a61-0c5b2e8f4a10}, public in d3d12_xs_device.h: the device proxy's slot 9 wraps an allocator
117 static constexpr GUID kTag{0x7d0e6b51, 0x34a2, 0x4f0c, {0x9a, 0x61, 0x0c, 0x5b, 0x2e, 0x8f, 0x4a, 0x10}}; 117 // in an Xbox-ABI allocator proxy only when it answers this tag, because from() below resolves such a proxy.
118 static constexpr GUID kTag = d3d12_xs::kLeonidaCommandAllocatorTag;
118 explicit CommandAllocator(D3D12_COMMAND_LIST_TYPE type) : type_(type) {} 119 explicit CommandAllocator(D3D12_COMMAND_LIST_TYPE type) : type_(type) {}
119 // Lists own their recorded commands, so there is nothing to free. As on the PC runtime (D3D-51, measured by 120 // Lists own their recorded commands, so there is nothing to free. As on the PC runtime (D3D-51, measured by
120 // d3d12_vulkan_device_test): E_FAIL while a list is recording into this allocator, and S_OK while its lists are 121 // d3d12_vulkan_device_test): E_FAIL while a list is recording into this allocator, and S_OK while its lists are
@@ -124,7 +125,12 @@ public:
124 // The one list that is recording into this allocator, or null. D3D12 allows one at a time. 125 // The one list that is recording into this allocator, or null. D3D12 allows one at a time.
125 const void* recording() const { return recording_; } 126 const void* recording() const { return recording_; }
126 void set_recording(const void* list) { recording_ = list; } 127 void set_recording(const void* list) { recording_ = list; }
127 static CommandAllocator* from(IUnknown* object) { return Child::from<CommandAllocator>(object); } 128 // An allocator proxy (the title's allocator from device slot 9) stands for the allocator behind it, so every
129 // list method that takes an allocator (CreateCommandList, Reset) resolves it here.
130 static CommandAllocator* from(IUnknown* object) {
131 if (ID3D12CommandAllocator* real = d3d12_xs::allocator_proxy_real_allocator(object)) object = real;
132 return Child::from<CommandAllocator>(object);
133 }
128 134
129private: 135private:
130 D3D12_COMMAND_LIST_TYPE type_; 136 D3D12_COMMAND_LIST_TYPE type_;
@@ -214,10 +220,14 @@ public:
214 bind_root(compute_, signature); 220 bind_root(compute_, signature);
215 } 221 }
216 void STDMETHODCALLTYPE SetGraphicsRootSignature(ID3D12RootSignature* signature) override { 222 void STDMETHODCALLTYPE SetGraphicsRootSignature(ID3D12RootSignature* signature) override {
223 d3d12_trace::record("ID3D12GraphicsCommandList::SetGraphicsRootSignature");
217 bind_root(graphics_, signature); 224 bind_root(graphics_, signature);
218 } 225 }
219 226
220 void STDMETHODCALLTYPE SetPipelineState(ID3D12PipelineState* state) override { set_pipeline(state); } 227 void STDMETHODCALLTYPE SetPipelineState(ID3D12PipelineState* state) override {
228 d3d12_trace::record("ID3D12GraphicsCommandList::SetPipelineState");
229 set_pipeline(state);
230 }
221 231
222 // The bound heaps matter to direct heap indexing, which is still open (section 3.4); tables carry their VAs. 232 // The bound heaps matter to direct heap indexing, which is still open (section 3.4); tables carry their VAs.
223 void STDMETHODCALLTYPE SetDescriptorHeaps(UINT, ID3D12DescriptorHeap* const*) override {} 233 void STDMETHODCALLTYPE SetDescriptorHeaps(UINT, ID3D12DescriptorHeap* const*) override {}
@@ -327,11 +337,13 @@ public:
327 } 337 }
328 338
329 void STDMETHODCALLTYPE DrawInstanced(UINT vertices, UINT instances, UINT first_vertex, UINT first_instance) override { 339 void STDMETHODCALLTYPE DrawInstanced(UINT vertices, UINT instances, UINT first_vertex, UINT first_instance) override {
340 d3d12_trace::record("ID3D12GraphicsCommandList::DrawInstanced");
330 record_draw(false, vertices, instances, first_vertex, 0, first_instance); 341 record_draw(false, vertices, instances, first_vertex, 0, first_instance);
331 } 342 }
332 343
333 void STDMETHODCALLTYPE DrawIndexedInstanced(UINT indices, UINT instances, UINT first_index, INT base_vertex, 344 void STDMETHODCALLTYPE DrawIndexedInstanced(UINT indices, UINT instances, UINT first_index, INT base_vertex,
334 UINT first_instance) override { 345 UINT first_instance) override {
346 d3d12_trace::record("ID3D12GraphicsCommandList::DrawIndexedInstanced");
335 record_draw(true, indices, instances, first_index, base_vertex, first_instance); 347 record_draw(true, indices, instances, first_index, base_vertex, first_instance);
336 } 348 }
337 349