29 #include "RenderDeviceD3D12.h" 30 #include "RenderDeviceD3DBase.h" 31 #include "DescriptorHeap.h" 32 #include "CommandListManager.h" 33 #include "CommandContext.h" 34 #include "DynamicUploadHeap.h" 36 #include "CommandQueueD3D12.h" 46 typedef RenderDeviceD3DBase<IRenderDeviceD3D12> TRenderDeviceBase;
51 virtual void QueryInterface(
const Diligent::INTERFACE_ID &IID, IObject **ppInterface )
override final;
65 virtual ID3D12Device* GetD3D12Device()
override final{
return m_pd3d12Device;}
67 virtual void CreateTextureFromD3DResource(ID3D12Resource *pd3d12Texture,
ITexture **ppTexture)
override final;
69 virtual void CreateBufferFromD3DResource(ID3D12Resource *pd3d12Buffer,
const BufferDesc& BuffDesc,
IBuffer **ppBuffer)
override final;
71 DescriptorHeapAllocation AllocateDescriptor( D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count = 1 );
72 DescriptorHeapAllocation AllocateGPUDescriptors( D3D12_DESCRIPTOR_HEAP_TYPE Type, UINT Count = 1 );
74 Uint64 GetCompletedFenceValue();
75 virtual Uint64 GetNextFenceValue()
override final 77 return m_pCommandQueue->GetNextFenceValue();
80 Uint64 GetCurrentFrameNumber()
const {
return static_cast<Uint64
>(m_FrameNumber);}
81 virtual Bool IsFenceSignaled(Uint64 FenceValue)
override final;
85 void IdleGPU(
bool ReleaseStaleObjects);
86 CommandContext* AllocateCommandContext(
const Char *ID =
"");
87 void CloseAndExecuteCommandContext(CommandContext *pCtx,
bool DiscardStaleObjects);
88 void DisposeCommandContext(CommandContext*);
90 void SafeReleaseD3D12Object(ID3D12Object* pObj);
91 void FinishFrame(
bool ReleaseAllResources);
92 virtual void FinishFrame()
override final { FinishFrame(
false); }
94 DynamicUploadHeap* RequestUploadHeap();
95 void ReleaseUploadHeap(DynamicUploadHeap* pUploadHeap);
99 void ProcessReleaseQueue(Uint64 CompletedFenceValue);
100 void DiscardStaleD3D12Objects(Uint64 CmdListNumber, Uint64 FenceValue);
103 CComPtr<ID3D12Device> m_pd3d12Device;
108 CPUDescriptorHeap m_CPUDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES];
109 GPUDescriptorHeap m_GPUDescriptorHeaps[2];
112 const Uint32 m_DynamicDescriptorAllocationChunkSize[2];
114 std::mutex m_CmdQueueMutex;
116 Atomics::AtomicInt64 m_FrameNumber;
117 Atomics::AtomicInt64 m_NextCmdListNumber;
147 CommandListManager m_CmdListManager;
149 typedef std::unique_ptr<CommandContext, STDDeleterRawMem<CommandContext> > ContextPoolElemType;
150 std::vector< ContextPoolElemType, STDAllocatorRawMem<ContextPoolElemType> > m_ContextPool;
152 std::deque<CommandContext*, STDAllocatorRawMem<CommandContext*> > m_AvailableContexts;
153 std::mutex m_ContextAllocationMutex;
155 std::mutex m_ReleaseQueueMutex;
156 typedef std::pair<Uint64, CComPtr<ID3D12Object> > ReleaseQueueElemType;
157 std::deque< ReleaseQueueElemType, STDAllocatorRawMem<ReleaseQueueElemType> > m_D3D12ObjReleaseQueue;
159 std::mutex m_StaleObjectsMutex;
160 std::deque< ReleaseQueueElemType, STDAllocatorRawMem<ReleaseQueueElemType> > m_StaleD3D12Objects;
162 std::mutex m_UploadHeapMutex;
163 typedef std::unique_ptr<DynamicUploadHeap, STDDeleterRawMem<DynamicUploadHeap> > UploadHeapPoolElemType;
164 std::vector< UploadHeapPoolElemType, STDAllocatorRawMem<UploadHeapPoolElemType> > m_UploadHeaps;
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
Texture description.
Definition: Texture.h:82
Shader interface.
Definition: Shader.h:288
Describes the buffer initial data.
Definition: Buffer.h:176
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Describes the initial data to store in the texture.
Definition: Texture.h:243
Sampler description.
Definition: Sampler.h:52
Buffer interface.
Definition: Buffer.h:200
Buffer description.
Definition: Buffer.h:57
Command queue interface.
Definition: CommandQueueD3D12.h:37
Definition: PipelineState.h:209
Template class that implements reference counting.
Definition: RefCntAutoPtr.h:71
Texture sampler interface.
Definition: Sampler.h:180
Base implementation of the Diligent::ITextureD3D12 interface.
Definition: TextureD3D12Impl.h:42
Attributes specific to D3D12 engine.
Definition: GraphicsTypes.h:965
Pipeline state description.
Definition: PipelineState.h:179
Shader creation attributes.
Definition: Shader.h:204
Texture inteface.
Definition: Texture.h:276
Implementation of the Diligent::IRenderDeviceD3D12 interface.
Definition: RenderDeviceD3D12Impl.h:43