Go to the documentation of this file.
40 class TextureD3D12Impl;
41 class BufferD3D12Impl;
42 class BottomLevelASD3D12Impl;
43 class TopLevelASD3D12Impl;
82 ID3D12GraphicsCommandList*
Close(CComPtr<ID3D12CommandAllocator>& pAllocator);
95 D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle,
96 ID3D12Resource* pd3d12Resource,
100 m_pCommandList->ClearUnorderedAccessViewFloat(GpuHandle, CpuHandle, pd3d12Resource, Color, 0,
nullptr);
104 D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle,
105 ID3D12Resource* pd3d12Resource,
109 m_pCommandList->ClearUnorderedAccessViewUint(GpuHandle, CpuHandle, pd3d12Resource, Color, 0,
nullptr);
131 ID3D12Resource* pSrcResource,
136 m_pCommandList->ResolveSubresource(pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format);
164 explicit operator bool()
const
174 m_pCommandList->ExecuteIndirect(pCmdSignature, 1, pBuff, ArgsOffset,
nullptr, 0);
177 void ExecuteIndirect(ID3D12CommandSignature* pCmdSignature,
Uint32 MaxCommandCount, ID3D12Resource* pArgsBuff,
Uint64 ArgsOffset, ID3D12Resource* pCountBuff,
Uint64 CountOffset)
180 m_pCommandList->ExecuteIndirect(pCmdSignature, MaxCommandCount, pArgsBuff, ArgsOffset, pCountBuff, CountOffset);
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");
217 void EndQuery(ID3D12QueryHeap* pQueryHeap, D3D12_QUERY_TYPE
Type, UINT Index)
223 D3D12_QUERY_TYPE
Type,
226 ID3D12Resource* pDestinationBuffer,
227 UINT64 AlignedDestinationBufferOffset)
229 m_pCommandList->ResolveQueryData(pQueryHeap,
Type, StartIndex, NumQueries, pDestinationBuffer, AlignedDestinationBufferOffset);
267 void Dispatch(
size_t GroupCountX = 1,
size_t GroupCountY = 1,
size_t GroupCountZ = 1)
270 m_pCommandList->Dispatch((UINT)GroupCountX, (UINT)GroupCountY, (UINT)GroupCountZ);
283 void ClearDepthStencil(D3D12_CPU_DESCRIPTOR_HANDLE DSV, D3D12_CLEAR_FLAGS ClearFlags,
float Depth, UINT8 Stencil)
286 m_pCommandList->ClearDepthStencilView(DSV, ClearFlags, Depth, Stencil, 0,
nullptr);
331 void SetVertexBuffers(UINT StartSlot, UINT Count,
const D3D12_VERTEX_BUFFER_VIEW VBViews[])
336 void Draw(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation)
339 m_pCommandList->DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
342 void DrawIndexed(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation)
345 m_pCommandList->DrawIndexedInstanced(IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation);
366 const D3D12_RENDER_PASS_RENDER_TARGET_DESC* pRenderTargets,
367 const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC* pDepthStencil,
368 D3D12_RENDER_PASS_FLAGS
Flags)
383 static_cast<ID3D12GraphicsCommandList4*
>(
m_pCommandList.p)->SetPipelineState1(pPSO);
389 UINT NumPostbuildInfoDescs,
390 const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC* pPostbuildInfoDescs)
397 D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureAddress)
404 D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData,
405 D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode)
425 void DrawMesh(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ)
427 #ifdef D3D12_H_HAS_MESH_SHADER
429 static_cast<ID3D12GraphicsCommandList6*
>(
m_pCommandList.p)->DispatchMesh(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
431 UNSUPPORTED(
"DrawMesh is not supported in current D3D12 header");
484 #ifdef DILIGENT_DEBUG
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");
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)
void SetBlendFactor(const float *BlendFactor)
Definition: CommandContext.hpp:312
void DrawMesh(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ)
Definition: CommandContext.hpp:425
CComPtr< ID3D12CommandAllocator > m_pCurrentAllocator
Definition: CommandContext.hpp:236
Definition: CommandContext.hpp:362
void SetComputeRootSignature(ID3D12RootSignature *pRootSig)
Definition: CommandContext.hpp:259
void ExecuteIndirect(ID3D12CommandSignature *pCmdSignature, Uint32 MaxCommandCount, ID3D12Resource *pArgsBuff, Uint64 ArgsOffset, ID3D12Resource *pCountBuff, Uint64 CountOffset)
Definition: CommandContext.hpp:177
char Char
Definition: BasicTypes.h:64
void SetVertexBuffers(UINT StartSlot, UINT Count, const D3D12_VERTEX_BUFFER_VIEW VBViews[])
Definition: CommandContext.hpp:331
void DrawIndexed(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation)
Definition: CommandContext.hpp:342
FLOAT Float
Definition: CommandContext.hpp:59
void EmitRaytracingAccelerationStructurePostbuildInfo(const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC &Desc, D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureAddress)
Definition: CommandContext.hpp:396
virtual DescriptorHeapAllocation Allocate(Uint32 Count) override final
Definition: CommandContext.hpp:255
void SetPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY Topology)
Definition: CommandContext.hpp:317
Definition: CommandContext.hpp:149
void InsertAliasBarrier(D3D12ResourceBase &Before, D3D12ResourceBase &After, bool FlushImmediate=false)
Definition: CommandContext.cpp:371
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
Uint32 Flags
Definition: DXBCUtils.cpp:71
class GraphicsContext5 & AsGraphicsContext5()
Definition: CommandContext.hpp:465
void SetID(const Char *ID)
Definition: CommandContext.hpp:183
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
INT Int
Definition: CommandContext.hpp:61
void SetDescriptorHeaps(ShaderDescriptorHeaps &Heaps)
Definition: CommandContext.hpp:482
void Draw(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation)
Definition: CommandContext.hpp:336
ID3D12GraphicsCommandList * GetCommandList()
Definition: CommandContext.hpp:184
void ResourceBarrier(const D3D12_RESOURCE_BARRIER &Barrier)
Definition: CommandContext.hpp:193
void ResolveSubresource(ID3D12Resource *pDstResource, UINT DstSubresource, ID3D12Resource *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format)
Definition: CommandContext.hpp:129
Definition: CommandContext.hpp:45
Definition: CommandContext.hpp:357
Definition: CommandContext.hpp:274
CComPtr< ID3D12GraphicsCommandList > m_pCommandList
Definition: CommandContext.hpp:235
void ExecuteIndirect(ID3D12CommandSignature *pCmdSignature, ID3D12Resource *pBuff, Uint64 ArgsOffset)
Definition: CommandContext.hpp:171
#define UNSUPPORTED(...)
Definition: DebugUtilities.hpp:78
ShaderDescriptorHeaps(ID3D12DescriptorHeap *_pSrvCbvUavHeap, ID3D12DescriptorHeap *_pSamplerHeap) noexcept
Definition: CommandContext.hpp:156
ID3D12DescriptorHeap * pSrvCbvUavHeap
Definition: CommandContext.hpp:151
Implementation of a texture object in Direct3D12 backend.
Definition: TextureD3D12Impl.hpp:42
Definition: CommandContext.hpp:66
Definition: CommandContext.hpp:353
Bottom-level acceleration structure object implementation in Direct3D12 backend.
Definition: BottomLevelASD3D12Impl.hpp:41
void Reset(CommandListManager &CmdListManager)
Definition: CommandContext.cpp:59
Uint32 m_MaxInterfaceVer
Definition: CommandContext.hpp:252
ID3D12RootSignature * m_pCurComputeRootSignature
Definition: CommandContext.hpp:240
void BeginQuery(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, UINT Index)
Definition: CommandContext.hpp:212
Buffer object implementation in Direct3D12 backend.
Definition: BufferD3D12Impl.hpp:44
~CommandContext()
Definition: CommandContext.cpp:54
CommandContext(class CommandListManager &CmdListManager)
Definition: CommandContext.cpp:47
void Dispatch(size_t GroupCountX=1, size_t GroupCountY=1, size_t GroupCountZ=1)
Definition: CommandContext.hpp:267
Resource state transition barrier description.
Definition: DeviceContext.h:1333
void DispatchRays(const D3D12_DISPATCH_RAYS_DESC &Desc)
Definition: CommandContext.hpp:411
ID3D12RootSignature * m_pCurGraphicsRootSignature
Definition: CommandContext.hpp:239
CommandContext & operator=(const CommandContext &)=delete
void SetPipelineState(ID3D12PipelineState *pPSO)
Definition: CommandContext.hpp:198
void ResolveQueryData(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, UINT StartIndex, UINT NumQueries, ID3D12Resource *pDestinationBuffer, UINT64 AlignedDestinationBufferOffset)
Definition: CommandContext.hpp:222
void EndRenderPass()
Definition: CommandContext.hpp:374
void ClearRenderTarget(D3D12_CPU_DESCRIPTOR_HANDLE RTV, const float *Color)
Definition: CommandContext.hpp:277
Definition: CommandContext.hpp:422
void SetDynamicGPUDescriptorAllocators(DynamicSuballocationsManager *Allocators)
Definition: CommandContext.hpp:207
DescriptorHeapAllocation AllocateDynamicGPUVisibleDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count=1)
Definition: CommandContext.hpp:186
void SetScissorRects(UINT NumRects, const D3D12_RECT *pRects)
Definition: CommandContext.hpp:302
void SetRayTracingPipelineState(ID3D12StateObject *pPSO)
Definition: CommandContext.hpp:379
Definition: DescriptorHeap.hpp:543
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type
Definition: PipelineStateD3D12Impl.cpp:69
bool operator==(const ShaderDescriptorHeaps &rhs) const
Definition: CommandContext.hpp:160
Definition: CommandContext.hpp:349
void CopyResource(ID3D12Resource *pDstRes, ID3D12Resource *pSrcRes)
Definition: CommandContext.hpp:112
ShaderDescriptorHeaps() noexcept
Definition: CommandContext.hpp:154
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
UINT Uint
Definition: CommandContext.hpp:60
void ClearUAVUint(D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle, D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle, ID3D12Resource *pd3d12Resource, const UINT *Color)
Definition: CommandContext.hpp:103
class GraphicsContext4 & AsGraphicsContext4()
Definition: CommandContext.hpp:459
DWParam(UINT u)
Definition: CommandContext.hpp:49
void SetStencilRef(UINT StencilRef)
Definition: CommandContext.hpp:307
void ClearDepthStencil(D3D12_CPU_DESCRIPTOR_HANDLE DSV, D3D12_CLEAR_FLAGS ClearFlags, float Depth, UINT8 Stencil)
Definition: CommandContext.hpp:283
ID3D12GraphicsCommandList * Close(CComPtr< ID3D12CommandAllocator > &pAllocator)
Definition: CommandContext.cpp:87
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
void operator=(FLOAT f)
Definition: CommandContext.hpp:52
void SetViewports(UINT NumVPs, const D3D12_VIEWPORT *pVPs)
Definition: CommandContext.hpp:297
void CopyRaytracingAccelerationStructure(D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode)
Definition: CommandContext.hpp:403
Definition: CommandContext.hpp:418
class GraphicsContext3 & AsGraphicsContext3()
Definition: CommandContext.hpp:453
ID3D12DescriptorHeap * pSamplerHeap
Definition: CommandContext.hpp:152
D3D12_PRIMITIVE_TOPOLOGY m_PrimitiveTopology
Definition: CommandContext.hpp:250
void * m_pCurPipelineState
Definition: CommandContext.hpp:238
void EndQuery(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, UINT Index)
Definition: CommandContext.hpp:217
void SetIndexBuffer(const D3D12_INDEX_BUFFER_VIEW &IBView)
Definition: CommandContext.hpp:326
void FlushResourceBarriers()
Definition: CommandContext.hpp:139
std::basic_string< Char > String
String variable.
Definition: BasicTypes.h:66
void SetGraphicsRootSignature(ID3D12RootSignature *pRootSig)
Definition: CommandContext.hpp:289
DynamicSuballocationsManager * m_DynamicGPUDescriptorAllocators
Definition: CommandContext.hpp:246
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
String m_ID
Definition: CommandContext.hpp:248
class GraphicsContext6 & AsGraphicsContext6()
Definition: CommandContext.hpp:471
DWParam(INT i)
Definition: CommandContext.hpp:50
RESOURCE_STATE
Resource usage state.
Definition: GraphicsTypes.h:2814
std::vector< D3D12_RESOURCE_BARRIER, STDAllocatorRawMem< D3D12_RESOURCE_BARRIER > > m_PendingResourceBarriers
Definition: CommandContext.hpp:242
class GraphicsContext & AsGraphicsContext()
Definition: CommandContext.hpp:436
Top-level acceleration structure object implementation in Direct3D12 backend.
Definition: TopLevelASD3D12Impl.hpp:43
Definition: DescriptorHeap.hpp:67
class GraphicsContext2 & AsGraphicsContext2()
Definition: CommandContext.hpp:447
Base implementation of a D3D12 resource.
Definition: D3D12ResourceBase.hpp:37
class ComputeContext & AsComputeContext()
Definition: CommandContext.hpp:477
void TransitionResource(TextureD3D12Impl &Texture, RESOURCE_STATE NewState)
Definition: CommandContext.cpp:102
Definition: CommandListManager.hpp:39
class GraphicsContext1 & AsGraphicsContext1()
Definition: CommandContext.hpp:441
void ClearUAVFloat(D3D12_GPU_DESCRIPTOR_HANDLE GpuHandle, D3D12_CPU_DESCRIPTOR_HANDLE CpuHandle, ID3D12Resource *pd3d12Resource, const float *Color)
Definition: CommandContext.hpp:94
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
ShaderDescriptorHeaps m_BoundDescriptorHeaps
Definition: CommandContext.hpp:244
DWParam(FLOAT f)
Definition: CommandContext.hpp:48