29 #include "DeviceContextD3D12.h" 30 #include "DeviceContextBase.h" 31 #include "GenerateMips.h" 34 # define VERIFY_CONTEXT_BINDINGS 49 virtual void QueryInterface(
const Diligent::INTERFACE_ID &IID, IObject **ppInterface )
override final;
59 virtual void SetBlendFactors(
const float* pBlendFactors =
nullptr)
override final;
61 virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet,
IBuffer **ppBuffers, Uint32 *pStrides, Uint32 *pOffsets, Uint32 Flags )
override final;
67 virtual void SetViewports( Uint32 NumViewports,
const Viewport *pViewports, Uint32 RTWidth, Uint32 RTHeight )
override final;
69 virtual void SetScissorRects( Uint32 NumRects,
const Rect *pRects, Uint32 RTWidth, Uint32 RTHeight )
override final;
81 virtual void Flush()
override final;
99 void UpdateBufferRegion(
class BufferD3D12Impl *pBuffD3D12,
struct DynamicAllocation& Allocation, Uint64 DstOffset, Uint64 NumBytes);
100 void UpdateBufferRegion(
class BufferD3D12Impl *pBuffD3D12,
const void *pData, Uint64 DstOffset, Uint64 NumBytes);
101 void CopyBufferRegion(
class BufferD3D12Impl *pSrcBuffD3D12,
class BufferD3D12Impl *pDstBuffD3D12, Uint64 SrcOffset, Uint64 DstOffset, Uint64 NumBytes);
102 void CopyTextureRegion(
class TextureD3D12Impl *pSrcTexture, Uint32 SrcSubResIndex,
const D3D12_BOX *pD3D12SrcBox,
103 class TextureD3D12Impl *pDstTexture, Uint32 DstSubResIndex, Uint32 DstX, Uint32 DstY, Uint32 DstZ);
104 void CopyTextureRegion(
IBuffer *pSrcBuffer, Uint32 SrcStride, Uint32 SrcDepthStride,
class TextureD3D12Impl *pTextureD3D12, Uint32 DstSubResIndex,
const Box &DstBox);
108 struct DynamicAllocation AllocateDynamicSpace(size_t NumBytes);
110 Uint32 GetContextId()
const{
return m_ContextId;}
112 size_t GetNumCommandsInCtx()
const {
return m_NumCommandsInCurCtx; }
115 void CommitD3D12IndexBuffer(
VALUE_TYPE IndexType);
116 void CommitD3D12VertexBuffers(
class GraphicsContext &GraphCtx);
117 void TransitionD3D12VertexBuffers(
class GraphicsContext &GraphCtx);
118 void CommitRenderTargets();
119 void CommitViewports();
120 void CommitScissorRects();
121 void Flush(
bool RequestNewCmdCtx);
124 inline class CommandContext* RequestCmdContext()
128 m_NumCommandsInCurCtx = m_NumCommandsInCurCtx != 0 ? m_NumCommandsInCurCtx : 1;
129 return m_pCurrCmdCtx;
131 size_t m_NumCommandsInCurCtx = 0;
132 const Uint32 m_NumCommandsToFlush = 192;
133 CommandContext* m_pCurrCmdCtx =
nullptr;
135 CComPtr<ID3D12Resource> m_CommittedD3D12IndexBuffer;
137 Uint32 m_CommittedD3D12IndexDataStartOffset = 0;
139 CComPtr<ID3D12CommandSignature> m_pDrawIndirectSignature;
140 CComPtr<ID3D12CommandSignature> m_pDrawIndexedIndirectSignature;
141 CComPtr<ID3D12CommandSignature> m_pDispatchIndirectSignature;
143 GenerateMipsHelper m_MipsGenerator;
144 class DynamicUploadHeap* m_pUploadHeap =
nullptr;
147 bool m_bCommittedD3D12VBsUpToDate =
false;
150 bool m_bCommittedD3D12IBUpToDate =
false;
152 class ShaderResourceCacheD3D12 *m_pCommittedResourceCache =
nullptr;
155 const Uint32 m_ContextId;
virtual void ClearDepthStencil(ITextureView *pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil) override final
Clears a depth-stencil view.
Definition: DeviceContextD3D12Impl.cpp:459
Implementation of the Diligent::IBufferD3D12 interface.
Definition: BufferD3D12Impl.h:42
virtual void SetVertexBuffers(Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pStrides, Uint32 *pOffsets, Uint32 Flags) override final
Base implementation of IDeviceContext::SetVertexBuffers(); validates parameters and caches references...
Definition: DeviceContextD3D12Impl.cpp:552
Undefined type.
Definition: GraphicsTypes.h:41
virtual void FinishCommandList(class ICommandList **ppCommandList) override final
Finishes recording commands and generates a command list.
Definition: DeviceContextD3D12Impl.cpp:809
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
virtual void DispatchCompute(const DispatchComputeAttribs &DispatchAttrs) override final
Executes a dispatch compute command.
Definition: DeviceContextD3D12Impl.cpp:403
Base implementation of the device context.
Definition: DeviceContextBase.h:68
Implementation of the Diligent::IDeviceContext interface.
Definition: DeviceContextD3D12Impl.h:41
Implementation of the Diligent::ISwapChainD3D12 interface.
Definition: SwapChainD3D12Impl.h:39
Describes the viewport.
Definition: DeviceContext.h:376
virtual void CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags) override final
Commits shader resources to the device context.
Definition: DeviceContextD3D12Impl.cpp:182
virtual void TransitionTextureState(ITexture *pTexture, D3D12_RESOURCE_STATES State) override final
Transitions internal D3D12 texture object to a specified state.
Definition: DeviceContextD3D12Impl.cpp:836
virtual void ClearRenderTarget(ITextureView *pView, const float *RGBA) override final
Clears a render target view.
Definition: DeviceContextD3D12Impl.cpp:491
Shader resource binding interface.
Definition: ShaderResourceBinding.h:40
Describes dispatch command arguments.
Definition: DeviceContext.h:312
virtual void SetRenderTargets(Uint32 NumRenderTargets, ITextureView *ppRenderTargets[], ITextureView *pDepthStencil) override final
Binds one or more render targets and the depth-stencil buffer to the pipeline. It also sets the viewp...
Definition: DeviceContextD3D12Impl.cpp:666
Buffer interface.
Definition: Buffer.h:200
Box.
Definition: GraphicsTypes.h:1005
Texture view interface.
Definition: TextureView.h:163
VALUE_TYPE
Value type.
Definition: GraphicsTypes.h:39
Command list interface.
Definition: CommandList.h:42
virtual void TransitionShaderResources(IPipelineState *pPipelineState, IShaderResourceBinding *pShaderResourceBinding) override final
Transitions shader resources to the require states.
Definition: DeviceContextD3D12Impl.cpp:173
Memory allocator that allocates memory in a fixed-size chunks.
Definition: FixedBlockMemoryAllocator.h:50
virtual void SetPipelineState(IPipelineState *pPipelineState) override final
Base implementation of IDeviceContext::SetPipelineState(); caches references to the pipeline state ob...
Definition: DeviceContextD3D12Impl.cpp:117
virtual void ExecuteCommandList(class ICommandList *pCommandList) override final
Executes recorded commands in a command list.
Definition: DeviceContextD3D12Impl.cpp:820
Definition: PipelineState.h:209
virtual void SetViewports(Uint32 NumViewports, const Viewport *pViewports, Uint32 RTWidth, Uint32 RTHeight) override final
Sets an array of viewports.
Definition: DeviceContextD3D12Impl.cpp:596
Defines the draw command attributes.
Definition: DeviceContext.h:212
virtual void SetIndexBuffer(IBuffer *pIndexBuffer, Uint32 ByteOffset) override final
Base implementation of IDeviceContext::SetIndexBuffer(); caches the strong reference to the index buf...
Definition: DeviceContextD3D12Impl.cpp:571
virtual void SetBlendFactors(const float *pBlendFactors=nullptr) override final
Definition: DeviceContextD3D12Impl.cpp:206
virtual void Flush() override final
Flushes the command buffer.
Definition: DeviceContextD3D12Impl.cpp:546
Describes the rectangle.
Definition: DeviceContext.h:420
Implementation of the Diligent::ITextureViewD3D12 interface.
Definition: TextureViewD3D12Impl.h:39
Base implementation of the Diligent::ITextureD3D12 interface.
Definition: TextureD3D12Impl.h:42
virtual void Draw(DrawAttribs &DrawAttribs) override final
Executes a draw command.
Definition: DeviceContextD3D12Impl.cpp:318
virtual void TransitionBufferState(IBuffer *pBuffer, D3D12_RESOURCE_STATES State) override final
Transitions internal D3D12 buffer object to a specified state.
Definition: DeviceContextD3D12Impl.cpp:843
Attributes specific to D3D12 engine.
Definition: GraphicsTypes.h:965
virtual void InvalidateState() override final
Invalidates the cached context state.
Definition: DeviceContextD3D12Impl.cpp:558
virtual void QueryInterface(const Diligent::INTERFACE_ID &IID, IObject **ppInterface) override final
Queries the specific interface, see IObject::QueryInterface() for details.
virtual void SetScissorRects(Uint32 NumRects, const Rect *pRects, Uint32 RTWidth, Uint32 RTHeight) override final
Sets active scissor rects.
Definition: DeviceContextD3D12Impl.cpp:608
virtual void SetStencilRef(Uint32 StencilRef) override final
Sets the stencil reference value.
Definition: DeviceContextD3D12Impl.cpp:198
Texture inteface.
Definition: Texture.h:276
Implementation of the Diligent::IRenderDeviceD3D12 interface.
Definition: RenderDeviceD3D12Impl.h:43