Diligent Engine  v.2.4.g
CommandContext.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 
29 #pragma once
30 
31 #include <vector>
32 
33 #include "DeviceContext.h"
34 #include "D3D12ResourceBase.hpp"
35 #include "DescriptorHeap.hpp"
36 
37 namespace Diligent
38 {
39 
40 class TextureD3D12Impl;
41 class BufferD3D12Impl;
42 class BottomLevelASD3D12Impl;
43 class TopLevelASD3D12Impl;
44 
45 struct DWParam
46 {
47  // clang-format off
48  DWParam(FLOAT f) : Float{f} {}
49  DWParam(UINT u) : Uint {u} {}
50  DWParam(INT i) : Int {i} {}
51 
52  void operator= (FLOAT f) { Float = f; }
53  void operator= (UINT u) { Uint = u; }
54  void operator= (INT i) { Int = i; }
55  // clang-format on
56 
57  union
58  {
59  FLOAT Float;
60  UINT Uint;
61  INT Int;
62  };
63 };
64 
65 
67 {
68 public:
69  CommandContext(class CommandListManager& CmdListManager);
70 
71  // clang-format off
72  CommandContext (const CommandContext&) = delete;
73  CommandContext& operator = (const CommandContext&) = delete;
74  CommandContext ( CommandContext&&) = delete;
76  // clang-format on
77 
79 
80  // Submit the command buffer and reset it. This is encouraged to keep the GPU busy and reduce latency.
81  // Taking too long to build command lists and submit them can idle the GPU.
82  ID3D12GraphicsCommandList* Close(CComPtr<ID3D12CommandAllocator>& pAllocator);
83  void Reset(CommandListManager& CmdListManager);
84 
93 
94  void ClearUAVFloat(D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle,
95  D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle,
96  ID3D12Resource* pd3d12Resource,
97  const float* Color)
98  {
100  m_pCommandList->ClearUnorderedAccessViewFloat(GpuHandle, CpuHandle, pd3d12Resource, Color, 0, nullptr);
101  }
102 
103  void ClearUAVUint(D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle,
104  D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle,
105  ID3D12Resource* pd3d12Resource,
106  const UINT* Color)
107  {
109  m_pCommandList->ClearUnorderedAccessViewUint(GpuHandle, CpuHandle, pd3d12Resource, Color, 0, nullptr);
110  }
111 
112  void CopyResource(ID3D12Resource* pDstRes, ID3D12Resource* pSrcRes)
113  {
114  m_pCommandList->CopyResource(pDstRes, pSrcRes);
115  }
116 
117  void TransitionResource(TextureD3D12Impl& Texture, RESOURCE_STATE NewState);
118  void TransitionResource(BufferD3D12Impl& Buffer, RESOURCE_STATE NewState);
121 
122  void TransitionResource(TextureD3D12Impl& Texture, const StateTransitionDesc& Barrier);
123  void TransitionResource(BufferD3D12Impl& Buffer, const StateTransitionDesc& Barrier);
125  void TransitionResource(TopLevelASD3D12Impl& TLAS, const StateTransitionDesc& Barrier);
126 
127  //void BeginResourceTransition(GpuResource& Resource, D3D12_RESOURCE_STATES NewState, bool FlushImmediate = false);
128 
129  void ResolveSubresource(ID3D12Resource* pDstResource,
130  UINT DstSubresource,
131  ID3D12Resource* pSrcResource,
132  UINT SrcSubresource,
133  DXGI_FORMAT Format)
134  {
136  m_pCommandList->ResolveSubresource(pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format);
137  }
138 
140  {
141  if (!m_PendingResourceBarriers.empty())
142  {
143  m_pCommandList->ResourceBarrier(static_cast<UINT>(m_PendingResourceBarriers.size()), m_PendingResourceBarriers.data());
145  }
146  }
147 
148 
150  {
151  ID3D12DescriptorHeap* pSrvCbvUavHeap = nullptr;
152  ID3D12DescriptorHeap* pSamplerHeap = nullptr;
153 
154  ShaderDescriptorHeaps() noexcept {}
155 
156  ShaderDescriptorHeaps(ID3D12DescriptorHeap* _pSrvCbvUavHeap, ID3D12DescriptorHeap* _pSamplerHeap) noexcept :
157  pSrvCbvUavHeap{_pSrvCbvUavHeap},
158  pSamplerHeap{_pSamplerHeap}
159  {}
160  bool operator==(const ShaderDescriptorHeaps& rhs) const
161  {
162  return pSrvCbvUavHeap == rhs.pSrvCbvUavHeap && pSamplerHeap == rhs.pSamplerHeap;
163  }
164  explicit operator bool() const
165  {
166  return pSrvCbvUavHeap != nullptr || pSamplerHeap != nullptr;
167  }
168  };
169  void SetDescriptorHeaps(ShaderDescriptorHeaps& Heaps);
170 
171  void ExecuteIndirect(ID3D12CommandSignature* pCmdSignature, ID3D12Resource* pBuff, Uint64 ArgsOffset)
172  {
174  m_pCommandList->ExecuteIndirect(pCmdSignature, 1, pBuff, ArgsOffset, nullptr, 0);
175  }
176 
177  void ExecuteIndirect(ID3D12CommandSignature* pCmdSignature, Uint32 MaxCommandCount, ID3D12Resource* pArgsBuff, Uint64 ArgsOffset, ID3D12Resource* pCountBuff, Uint64 CountOffset)
178  {
180  m_pCommandList->ExecuteIndirect(pCmdSignature, MaxCommandCount, pArgsBuff, ArgsOffset, pCountBuff, CountOffset);
181  }
182 
183  void SetID(const Char* ID) { m_ID = ID; }
184  ID3D12GraphicsCommandList* GetCommandList() { return m_pCommandList; }
185 
186  DescriptorHeapAllocation AllocateDynamicGPUVisibleDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count = 1)
187  {
188  VERIFY(m_DynamicGPUDescriptorAllocators != nullptr, "Dynamic GPU descriptor llocators have not been initialized. Did you forget to call SetDynamicGPUDescriptorAllocators() after resetting the context?");
189  VERIFY(Type >= D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV && Type <= D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, "Invalid heap type");
191  }
192 
193  void ResourceBarrier(const D3D12_RESOURCE_BARRIER& Barrier)
194  {
195  m_PendingResourceBarriers.emplace_back(Barrier);
196  }
197 
198  void SetPipelineState(ID3D12PipelineState* pPSO)
199  {
200  if (pPSO != m_pCurPipelineState)
201  {
202  m_pCommandList->SetPipelineState(pPSO);
203  m_pCurPipelineState = pPSO;
204  }
205  }
206 
208  {
210  }
211 
212  void BeginQuery(ID3D12QueryHeap* pQueryHeap, D3D12_QUERY_TYPE Type, UINT Index)
213  {
214  m_pCommandList->BeginQuery(pQueryHeap, Type, Index);
215  }
216 
217  void EndQuery(ID3D12QueryHeap* pQueryHeap, D3D12_QUERY_TYPE Type, UINT Index)
218  {
219  m_pCommandList->EndQuery(pQueryHeap, Type, Index);
220  }
221 
222  void ResolveQueryData(ID3D12QueryHeap* pQueryHeap,
223  D3D12_QUERY_TYPE Type,
224  UINT StartIndex,
225  UINT NumQueries,
226  ID3D12Resource* pDestinationBuffer,
227  UINT64 AlignedDestinationBufferOffset)
228  {
229  m_pCommandList->ResolveQueryData(pQueryHeap, Type, StartIndex, NumQueries, pDestinationBuffer, AlignedDestinationBufferOffset);
230  }
231 
232 protected:
233  void InsertAliasBarrier(D3D12ResourceBase& Before, D3D12ResourceBase& After, bool FlushImmediate = false);
234 
235  CComPtr<ID3D12GraphicsCommandList> m_pCommandList;
236  CComPtr<ID3D12CommandAllocator> m_pCurrentAllocator;
237 
238  void* m_pCurPipelineState = nullptr;
239  ID3D12RootSignature* m_pCurGraphicsRootSignature = nullptr;
240  ID3D12RootSignature* m_pCurComputeRootSignature = nullptr;
241 
242  std::vector<D3D12_RESOURCE_BARRIER, STDAllocatorRawMem<D3D12_RESOURCE_BARRIER>> m_PendingResourceBarriers;
243 
245 
247 
249 
250  D3D12_PRIMITIVE_TOPOLOGY m_PrimitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
251 
253 };
254 
256 {
257 public:
258  // For compute and ray tracing.
259  void SetComputeRootSignature(ID3D12RootSignature* pRootSig)
260  {
261  if (pRootSig != m_pCurComputeRootSignature)
262  {
263  m_pCommandList->SetComputeRootSignature(m_pCurComputeRootSignature = pRootSig);
264  }
265  }
266 
267  void Dispatch(size_t GroupCountX = 1, size_t GroupCountY = 1, size_t GroupCountZ = 1)
268  {
270  m_pCommandList->Dispatch((UINT)GroupCountX, (UINT)GroupCountY, (UINT)GroupCountZ);
271  }
272 };
273 
275 {
276 public:
277  void ClearRenderTarget(D3D12_CPU_DESCRIPTOR_HANDLE RTV, const float* Color)
278  {
280  m_pCommandList->ClearRenderTargetView(RTV, Color, 0, nullptr);
281  }
282 
283  void ClearDepthStencil(D3D12_CPU_DESCRIPTOR_HANDLE DSV, D3D12_CLEAR_FLAGS ClearFlags, float Depth, UINT8 Stencil)
284  {
286  m_pCommandList->ClearDepthStencilView(DSV, ClearFlags, Depth, Stencil, 0, nullptr);
287  }
288 
289  void SetGraphicsRootSignature(ID3D12RootSignature* pRootSig)
290  {
291  if (pRootSig != m_pCurGraphicsRootSignature)
292  {
293  m_pCommandList->SetGraphicsRootSignature(m_pCurGraphicsRootSignature = pRootSig);
294  }
295  }
296 
297  void SetViewports(UINT NumVPs, const D3D12_VIEWPORT* pVPs)
298  {
299  m_pCommandList->RSSetViewports(NumVPs, pVPs);
300  }
301 
302  void SetScissorRects(UINT NumRects, const D3D12_RECT* pRects)
303  {
304  m_pCommandList->RSSetScissorRects(NumRects, pRects);
305  }
306 
307  void SetStencilRef(UINT StencilRef)
308  {
309  m_pCommandList->OMSetStencilRef(StencilRef);
310  }
311 
312  void SetBlendFactor(const float* BlendFactor)
313  {
314  m_pCommandList->OMSetBlendFactor(BlendFactor);
315  }
316 
317  void SetPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY Topology)
318  {
319  if (m_PrimitiveTopology != Topology)
320  {
321  m_PrimitiveTopology = Topology;
322  m_pCommandList->IASetPrimitiveTopology(Topology);
323  }
324  }
325 
326  void SetIndexBuffer(const D3D12_INDEX_BUFFER_VIEW& IBView)
327  {
328  m_pCommandList->IASetIndexBuffer(&IBView);
329  }
330 
331  void SetVertexBuffers(UINT StartSlot, UINT Count, const D3D12_VERTEX_BUFFER_VIEW VBViews[])
332  {
333  m_pCommandList->IASetVertexBuffers(StartSlot, Count, VBViews);
334  }
335 
336  void Draw(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation)
337  {
339  m_pCommandList->DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
340  }
341 
342  void DrawIndexed(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation)
343  {
345  m_pCommandList->DrawIndexedInstanced(IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation);
346  }
347 };
348 
350 {
351 };
352 
354 {
355 };
356 
358 {
359 };
360 
361 
363 {
364 public:
365  void BeginRenderPass(UINT NumRenderTargets,
366  const D3D12_RENDER_PASS_RENDER_TARGET_DESC* pRenderTargets,
367  const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC* pDepthStencil,
368  D3D12_RENDER_PASS_FLAGS Flags)
369  {
371  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->BeginRenderPass(NumRenderTargets, pRenderTargets, pDepthStencil, Flags);
372  }
373 
375  {
376  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->EndRenderPass();
377  }
378 
379  void SetRayTracingPipelineState(ID3D12StateObject* pPSO)
380  {
381  if (pPSO != m_pCurPipelineState)
382  {
383  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->SetPipelineState1(pPSO);
384  m_pCurPipelineState = pPSO;
385  }
386  }
387 
388  void BuildRaytracingAccelerationStructure(const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC& Desc,
389  UINT NumPostbuildInfoDescs,
390  const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC* pPostbuildInfoDescs)
391  {
393  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->BuildRaytracingAccelerationStructure(&Desc, NumPostbuildInfoDescs, pPostbuildInfoDescs);
394  }
395 
396  void EmitRaytracingAccelerationStructurePostbuildInfo(const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC& Desc,
397  D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureAddress)
398  {
400  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->EmitRaytracingAccelerationStructurePostbuildInfo(&Desc, 1, &SourceAccelerationStructureAddress);
401  }
402 
403  void CopyRaytracingAccelerationStructure(D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData,
404  D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData,
405  D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode)
406  {
408  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData, SourceAccelerationStructureData, Mode);
409  }
410 
411  void DispatchRays(const D3D12_DISPATCH_RAYS_DESC& Desc)
412  {
414  static_cast<ID3D12GraphicsCommandList4*>(m_pCommandList.p)->DispatchRays(&Desc);
415  }
416 };
417 
419 {
420 };
421 
423 {
424 public:
425  void DrawMesh(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ)
426  {
427 #ifdef D3D12_H_HAS_MESH_SHADER
429  static_cast<ID3D12GraphicsCommandList6*>(m_pCommandList.p)->DispatchMesh(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
430 #else
431  UNSUPPORTED("DrawMesh is not supported in current D3D12 header");
432 #endif
433  }
434 };
435 
437 {
438  return static_cast<GraphicsContext&>(*this);
439 }
440 
442 {
443  VERIFY(m_MaxInterfaceVer >= 1, "Maximum supported interface version is ", m_MaxInterfaceVer);
444  return static_cast<GraphicsContext1&>(*this);
445 }
446 
448 {
449  VERIFY(m_MaxInterfaceVer >= 2, "Maximum supported interface version is ", m_MaxInterfaceVer);
450  return static_cast<GraphicsContext2&>(*this);
451 }
452 
454 {
455  VERIFY(m_MaxInterfaceVer >= 3, "Maximum supported interface version is ", m_MaxInterfaceVer);
456  return static_cast<GraphicsContext3&>(*this);
457 }
458 
460 {
461  VERIFY(m_MaxInterfaceVer >= 4, "Maximum supported interface version is ", m_MaxInterfaceVer);
462  return static_cast<GraphicsContext4&>(*this);
463 }
464 
466 {
467  VERIFY(m_MaxInterfaceVer >= 5, "Maximum supported interface version is ", m_MaxInterfaceVer);
468  return static_cast<GraphicsContext5&>(*this);
469 }
470 
472 {
473  VERIFY(m_MaxInterfaceVer >= 6, "Maximum supported interface version is ", m_MaxInterfaceVer);
474  return static_cast<GraphicsContext6&>(*this);
475 }
476 
478 {
479  return static_cast<ComputeContext&>(*this);
480 }
481 
483 {
484 #ifdef DILIGENT_DEBUG
485  VERIFY(Heaps.pSrvCbvUavHeap != nullptr || Heaps.pSamplerHeap != nullptr, "At least one heap is expected to be set");
486  VERIFY(Heaps.pSrvCbvUavHeap == nullptr || Heaps.pSrvCbvUavHeap->GetDesc().Type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, "Invalid heap type provided in pSrvCbvUavHeap");
487  VERIFY(Heaps.pSamplerHeap == nullptr || Heaps.pSamplerHeap->GetDesc().Type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, "Invalid heap type provided in pSamplerHeap");
488 #endif
489 
490  if (!(Heaps == m_BoundDescriptorHeaps))
491  {
492  m_BoundDescriptorHeaps = Heaps;
493 
494  ID3D12DescriptorHeap** ppHeaps = reinterpret_cast<ID3D12DescriptorHeap**>(&Heaps);
495  UINT NumHeaps = (ppHeaps[0] != nullptr ? 1 : 0) + (ppHeaps[1] != nullptr ? 1 : 0);
496  if (ppHeaps[0] == nullptr)
497  ++ppHeaps;
498 
499  m_pCommandList->SetDescriptorHeaps(NumHeaps, ppHeaps);
500  }
501 }
502 
503 } // namespace Diligent
Diligent::GraphicsContext::SetBlendFactor
void SetBlendFactor(const float *BlendFactor)
Definition: CommandContext.hpp:312
D3D12ResourceBase.hpp
Diligent::GraphicsContext6::DrawMesh
void DrawMesh(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ)
Definition: CommandContext.hpp:425
Diligent::CommandContext::m_pCurrentAllocator
CComPtr< ID3D12CommandAllocator > m_pCurrentAllocator
Definition: CommandContext.hpp:236
Diligent::GraphicsContext4
Definition: CommandContext.hpp:362
Diligent::ComputeContext::SetComputeRootSignature
void SetComputeRootSignature(ID3D12RootSignature *pRootSig)
Definition: CommandContext.hpp:259
Diligent::CommandContext::ExecuteIndirect
void ExecuteIndirect(ID3D12CommandSignature *pCmdSignature, Uint32 MaxCommandCount, ID3D12Resource *pArgsBuff, Uint64 ArgsOffset, ID3D12Resource *pCountBuff, Uint64 CountOffset)
Definition: CommandContext.hpp:177
Diligent::Char
char Char
Definition: BasicTypes.h:64
Diligent::GraphicsContext::SetVertexBuffers
void SetVertexBuffers(UINT StartSlot, UINT Count, const D3D12_VERTEX_BUFFER_VIEW VBViews[])
Definition: CommandContext.hpp:331
Diligent::GraphicsContext::DrawIndexed
void DrawIndexed(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation)
Definition: CommandContext.hpp:342
DescriptorHeap.hpp
Diligent::DWParam::Float
FLOAT Float
Definition: CommandContext.hpp:59
Diligent::GraphicsContext4::EmitRaytracingAccelerationStructurePostbuildInfo
void EmitRaytracingAccelerationStructurePostbuildInfo(const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC &Desc, D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureAddress)
Definition: CommandContext.hpp:396
Diligent::DynamicSuballocationsManager::Allocate
virtual DescriptorHeapAllocation Allocate(Uint32 Count) override final
Diligent::ComputeContext
Definition: CommandContext.hpp:255
Diligent::GraphicsContext::SetPrimitiveTopology
void SetPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY Topology)
Definition: CommandContext.hpp:317
Diligent::CommandContext::ShaderDescriptorHeaps
Definition: CommandContext.hpp:149
Diligent::CommandContext::InsertAliasBarrier
void InsertAliasBarrier(D3D12ResourceBase &Before, D3D12ResourceBase &After, bool FlushImmediate=false)
Definition: CommandContext.cpp:371
Diligent::GraphicsContext4::BeginRenderPass
void BeginRenderPass(UINT NumRenderTargets, const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, D3D12_RENDER_PASS_FLAGS Flags)
Definition: CommandContext.hpp:365
Flags
Uint32 Flags
Definition: DXBCUtils.cpp:71
Diligent::CommandContext::AsGraphicsContext5
class GraphicsContext5 & AsGraphicsContext5()
Definition: CommandContext.hpp:465
Diligent::CommandContext::SetID
void SetID(const Char *ID)
Definition: CommandContext.hpp:183
Diligent::Uint64
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
Diligent::DWParam::Int
INT Int
Definition: CommandContext.hpp:61
Diligent::CommandContext::SetDescriptorHeaps
void SetDescriptorHeaps(ShaderDescriptorHeaps &Heaps)
Definition: CommandContext.hpp:482
Diligent::GraphicsContext::Draw
void Draw(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation)
Definition: CommandContext.hpp:336
Diligent::CommandContext::GetCommandList
ID3D12GraphicsCommandList * GetCommandList()
Definition: CommandContext.hpp:184
Diligent::CommandContext::ResourceBarrier
void ResourceBarrier(const D3D12_RESOURCE_BARRIER &Barrier)
Definition: CommandContext.hpp:193
Diligent::CommandContext::ResolveSubresource
void ResolveSubresource(ID3D12Resource *pDstResource, UINT DstSubresource, ID3D12Resource *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format)
Definition: CommandContext.hpp:129
Diligent::DWParam
Definition: CommandContext.hpp:45
DeviceContext.h
Diligent::GraphicsContext3
Definition: CommandContext.hpp:357
Diligent::GraphicsContext
Definition: CommandContext.hpp:274
Diligent::CommandContext::m_pCommandList
CComPtr< ID3D12GraphicsCommandList > m_pCommandList
Definition: CommandContext.hpp:235
Diligent::CommandContext::ExecuteIndirect
void ExecuteIndirect(ID3D12CommandSignature *pCmdSignature, ID3D12Resource *pBuff, Uint64 ArgsOffset)
Definition: CommandContext.hpp:171
UNSUPPORTED
#define UNSUPPORTED(...)
Definition: DebugUtilities.hpp:78
Diligent::CommandContext::ShaderDescriptorHeaps::ShaderDescriptorHeaps
ShaderDescriptorHeaps(ID3D12DescriptorHeap *_pSrvCbvUavHeap, ID3D12DescriptorHeap *_pSamplerHeap) noexcept
Definition: CommandContext.hpp:156
Diligent::CommandContext::ShaderDescriptorHeaps::pSrvCbvUavHeap
ID3D12DescriptorHeap * pSrvCbvUavHeap
Definition: CommandContext.hpp:151
Diligent::TextureD3D12Impl
Implementation of a texture object in Direct3D12 backend.
Definition: TextureD3D12Impl.hpp:42
Diligent::CommandContext
Definition: CommandContext.hpp:66
Diligent::GraphicsContext2
Definition: CommandContext.hpp:353
Diligent::BottomLevelASD3D12Impl
Bottom-level acceleration structure object implementation in Direct3D12 backend.
Definition: BottomLevelASD3D12Impl.hpp:41
Diligent::CommandContext::Reset
void Reset(CommandListManager &CmdListManager)
Definition: CommandContext.cpp:59
Diligent::CommandContext::m_MaxInterfaceVer
Uint32 m_MaxInterfaceVer
Definition: CommandContext.hpp:252
Diligent::CommandContext::m_pCurComputeRootSignature
ID3D12RootSignature * m_pCurComputeRootSignature
Definition: CommandContext.hpp:240
Diligent::CommandContext::BeginQuery
void BeginQuery(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, UINT Index)
Definition: CommandContext.hpp:212
Diligent::BufferD3D12Impl
Buffer object implementation in Direct3D12 backend.
Definition: BufferD3D12Impl.hpp:44
Diligent::CommandContext::~CommandContext
~CommandContext()
Definition: CommandContext.cpp:54
Diligent::CommandContext::CommandContext
CommandContext(class CommandListManager &CmdListManager)
Definition: CommandContext.cpp:47
Diligent::ComputeContext::Dispatch
void Dispatch(size_t GroupCountX=1, size_t GroupCountY=1, size_t GroupCountZ=1)
Definition: CommandContext.hpp:267
Diligent::StateTransitionDesc
Resource state transition barrier description.
Definition: DeviceContext.h:1333
Diligent::GraphicsContext4::DispatchRays
void DispatchRays(const D3D12_DISPATCH_RAYS_DESC &Desc)
Definition: CommandContext.hpp:411
Diligent::DescriptorType::Count
@ Count
Diligent::CommandContext::m_pCurGraphicsRootSignature
ID3D12RootSignature * m_pCurGraphicsRootSignature
Definition: CommandContext.hpp:239
Diligent::CommandContext::operator=
CommandContext & operator=(const CommandContext &)=delete
Diligent::CommandContext::SetPipelineState
void SetPipelineState(ID3D12PipelineState *pPSO)
Definition: CommandContext.hpp:198
Diligent::CommandContext::ResolveQueryData
void ResolveQueryData(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, UINT StartIndex, UINT NumQueries, ID3D12Resource *pDestinationBuffer, UINT64 AlignedDestinationBufferOffset)
Definition: CommandContext.hpp:222
Diligent::GraphicsContext4::EndRenderPass
void EndRenderPass()
Definition: CommandContext.hpp:374
Diligent::GraphicsContext::ClearRenderTarget
void ClearRenderTarget(D3D12_CPU_DESCRIPTOR_HANDLE RTV, const float *Color)
Definition: CommandContext.hpp:277
Diligent::GraphicsContext6
Definition: CommandContext.hpp:422
Diligent::CommandContext::SetDynamicGPUDescriptorAllocators
void SetDynamicGPUDescriptorAllocators(DynamicSuballocationsManager *Allocators)
Definition: CommandContext.hpp:207
Diligent::CommandContext::AllocateDynamicGPUVisibleDescriptor
DescriptorHeapAllocation AllocateDynamicGPUVisibleDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count=1)
Definition: CommandContext.hpp:186
Diligent::GraphicsContext::SetScissorRects
void SetScissorRects(UINT NumRects, const D3D12_RECT *pRects)
Definition: CommandContext.hpp:302
Diligent::GraphicsContext4::SetRayTracingPipelineState
void SetRayTracingPipelineState(ID3D12StateObject *pPSO)
Definition: CommandContext.hpp:379
Diligent::DynamicSuballocationsManager
Definition: DescriptorHeap.hpp:543
Type
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type
Definition: PipelineStateD3D12Impl.cpp:69
Diligent::CommandContext::ShaderDescriptorHeaps::operator==
bool operator==(const ShaderDescriptorHeaps &rhs) const
Definition: CommandContext.hpp:160
Diligent::GraphicsContext1
Definition: CommandContext.hpp:349
Diligent::CommandContext::CopyResource
void CopyResource(ID3D12Resource *pDstRes, ID3D12Resource *pSrcRes)
Definition: CommandContext.hpp:112
Diligent::CommandContext::ShaderDescriptorHeaps::ShaderDescriptorHeaps
ShaderDescriptorHeaps() noexcept
Definition: CommandContext.hpp:154
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Diligent::DWParam::Uint
UINT Uint
Definition: CommandContext.hpp:60
Diligent::CommandContext::ClearUAVUint
void ClearUAVUint(D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle, D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle, ID3D12Resource *pd3d12Resource, const UINT *Color)
Definition: CommandContext.hpp:103
Diligent::CommandContext::AsGraphicsContext4
class GraphicsContext4 & AsGraphicsContext4()
Definition: CommandContext.hpp:459
Diligent::DWParam::DWParam
DWParam(UINT u)
Definition: CommandContext.hpp:49
Diligent::GraphicsContext::SetStencilRef
void SetStencilRef(UINT StencilRef)
Definition: CommandContext.hpp:307
Diligent::GraphicsContext::ClearDepthStencil
void ClearDepthStencil(D3D12_CPU_DESCRIPTOR_HANDLE DSV, D3D12_CLEAR_FLAGS ClearFlags, float Depth, UINT8 Stencil)
Definition: CommandContext.hpp:283
Diligent::CommandContext::Close
ID3D12GraphicsCommandList * Close(CComPtr< ID3D12CommandAllocator > &pAllocator)
Definition: CommandContext.cpp:87
Diligent::GraphicsContext4::BuildRaytracingAccelerationStructure
void BuildRaytracingAccelerationStructure(const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC &Desc, UINT NumPostbuildInfoDescs, const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs)
Definition: CommandContext.hpp:388
Diligent::DWParam::operator=
void operator=(FLOAT f)
Definition: CommandContext.hpp:52
Diligent::GraphicsContext::SetViewports
void SetViewports(UINT NumVPs, const D3D12_VIEWPORT *pVPs)
Definition: CommandContext.hpp:297
Diligent::GraphicsContext4::CopyRaytracingAccelerationStructure
void CopyRaytracingAccelerationStructure(D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode)
Definition: CommandContext.hpp:403
Diligent::GraphicsContext5
Definition: CommandContext.hpp:418
Diligent::CommandContext::AsGraphicsContext3
class GraphicsContext3 & AsGraphicsContext3()
Definition: CommandContext.hpp:453
Diligent::CommandContext::ShaderDescriptorHeaps::pSamplerHeap
ID3D12DescriptorHeap * pSamplerHeap
Definition: CommandContext.hpp:152
Diligent::CommandContext::m_PrimitiveTopology
D3D12_PRIMITIVE_TOPOLOGY m_PrimitiveTopology
Definition: CommandContext.hpp:250
Diligent::CommandContext::m_pCurPipelineState
void * m_pCurPipelineState
Definition: CommandContext.hpp:238
Diligent::CommandContext::EndQuery
void EndQuery(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, UINT Index)
Definition: CommandContext.hpp:217
Diligent::GraphicsContext::SetIndexBuffer
void SetIndexBuffer(const D3D12_INDEX_BUFFER_VIEW &IBView)
Definition: CommandContext.hpp:326
Diligent::CommandContext::FlushResourceBarriers
void FlushResourceBarriers()
Definition: CommandContext.hpp:139
Diligent::String
std::basic_string< Char > String
String variable.
Definition: BasicTypes.h:66
Diligent::GraphicsContext::SetGraphicsRootSignature
void SetGraphicsRootSignature(ID3D12RootSignature *pRootSig)
Definition: CommandContext.hpp:289
Diligent::CommandContext::m_DynamicGPUDescriptorAllocators
DynamicSuballocationsManager * m_DynamicGPUDescriptorAllocators
Definition: CommandContext.hpp:246
VERIFY
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
Diligent::CommandContext::m_ID
String m_ID
Definition: CommandContext.hpp:248
Diligent::CommandContext::AsGraphicsContext6
class GraphicsContext6 & AsGraphicsContext6()
Definition: CommandContext.hpp:471
Diligent::DWParam::DWParam
DWParam(INT i)
Definition: CommandContext.hpp:50
Diligent::RESOURCE_STATE
RESOURCE_STATE
Resource usage state.
Definition: GraphicsTypes.h:2814
Diligent::CommandContext::m_PendingResourceBarriers
std::vector< D3D12_RESOURCE_BARRIER, STDAllocatorRawMem< D3D12_RESOURCE_BARRIER > > m_PendingResourceBarriers
Definition: CommandContext.hpp:242
Diligent::CommandContext::AsGraphicsContext
class GraphicsContext & AsGraphicsContext()
Definition: CommandContext.hpp:436
Diligent::TopLevelASD3D12Impl
Top-level acceleration structure object implementation in Direct3D12 backend.
Definition: TopLevelASD3D12Impl.hpp:43
Diligent::DescriptorHeapAllocation
Definition: DescriptorHeap.hpp:67
Diligent::CommandContext::AsGraphicsContext2
class GraphicsContext2 & AsGraphicsContext2()
Definition: CommandContext.hpp:447
Diligent::D3D12ResourceBase
Base implementation of a D3D12 resource.
Definition: D3D12ResourceBase.hpp:37
Diligent::CommandContext::AsComputeContext
class ComputeContext & AsComputeContext()
Definition: CommandContext.hpp:477
Diligent::CommandContext::TransitionResource
void TransitionResource(TextureD3D12Impl &Texture, RESOURCE_STATE NewState)
Definition: CommandContext.cpp:102
Diligent::CommandListManager
Definition: CommandListManager.hpp:39
Diligent::CommandContext::AsGraphicsContext1
class GraphicsContext1 & AsGraphicsContext1()
Definition: CommandContext.hpp:441
Diligent::CommandContext::ClearUAVFloat
void ClearUAVFloat(D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle, D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle, ID3D12Resource *pd3d12Resource, const float *Color)
Definition: CommandContext.hpp:94
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
Diligent::CommandContext::m_BoundDescriptorHeaps
ShaderDescriptorHeaps m_BoundDescriptorHeaps
Definition: CommandContext.hpp:244
Diligent::DWParam::DWParam
DWParam(FLOAT f)
Definition: CommandContext.hpp:48