template<typename EngineImplTraits>
DeviceContextBase class
Base implementation of the device context.
| Template parameters | |
|---|---|
| EngineImplTraits | - Engine implementation traits that define specific implementation details (texture implemenation type, buffer implementation type, etc.) |
Contents
Base classes
-
template<typename BaseInterface>class ObjectBase<EngineImplTraits::DeviceContextInterface>
- Template class implementing base functionality for an object.
Derived classes
-
template<typename EngineImplTraits>class DeviceContextNextGenBase
- Base implementation of the device context for next-generation backends.
Constructors, destructors, conversion operators
- DeviceContextBase(IReferenceCounters* pRefCounters, DeviceImplType* pRenderDevice, bool bIsDeferred)
Public functions
-
void SetVertexBuffers(Uint32 StartSlot,
Uint32 NumBuffersSet,
IBuffer** ppBuffers,
Uint32* pOffsets,
RESOURCE_
STATE_ TRANSITION_ MODE StateTransitionMode, SET_ VERTEX_ BUFFERS_ FLAGS Flags) override - Base implementation of IDeviceContext::
SetVertexBuffers(); validates parameters and caches references to the buffers. -
void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding,
RESOURCE_
STATE_ TRANSITION_ MODE StateTransitionMode, int) - Base implementation of IDeviceContext::
CommitShaderResources(); validates parameters. -
void SetIndexBuffer(IBuffer* pIndexBuffer,
Uint32 ByteOffset,
RESOURCE_
STATE_ TRANSITION_ MODE StateTransitionMode) override - Base implementation of IDeviceContext::
SetIndexBuffer(); caches the strong reference to the index buffer. - void SetViewports(Uint32 NumViewports, const Viewport* pViewports, Uint32& RTWidth, Uint32& RTHeight)
- Caches the viewports.
- void SetScissorRects(Uint32 NumRects, const Rect* pRects, Uint32& RTWidth, Uint32& RTHeight)
- Caches the scissor rects.
-
void UpdateBuffer(IBuffer* pBuffer,
Uint32 Offset,
Uint32 Size,
const void* pData,
RESOURCE_
STATE_ TRANSITION_ MODE StateTransitionMode) override - Base implementation of IDeviceContext::
UpdateBuffer(); validates input parameters. -
void CopyBuffer(IBuffer* pSrcBuffer,
Uint32 SrcOffset,
RESOURCE_
STATE_ TRANSITION_ MODE SrcBufferTransitionMode, IBuffer* pDstBuffer, Uint32 DstOffset, Uint32 Size, RESOURCE_ STATE_ TRANSITION_ MODE DstBufferTransitionMode) override - Base implementation of IDeviceContext::
CopyBuffer(); validates input parameters. -
void MapBuffer(IBuffer* pBuffer,
MAP_
TYPE MapType, MAP_ FLAGS MapFlags, PVoid& pMappedData) override - Base implementation of IDeviceContext::
MapBuffer(); validates input parameters. -
void UnmapBuffer(IBuffer* pBuffer,
MAP_
TYPE MapType) override - Base implementation of IDeviceContext::
UnmapBuffer() -
void UpdateTexture(ITexture* pTexture,
Uint32 MipLevel,
Uint32 Slice,
const Box& DstBox,
const TextureSubResData& SubresData,
RESOURCE_
STATE_ TRANSITION_ MODE SrcBufferTransitionMode, RESOURCE_ STATE_ TRANSITION_ MODE TextureTransitionMode) override - Base implementaiton of IDeviceContext::UpdateData(); validates input parameters.
- void CopyTexture(const CopyTextureAttribs& CopyAttribs) override
- Base implementaiton of IDeviceContext::
CopyTexture(); validates input parameters. -
void MapTextureSubresource(ITexture* pTexture,
Uint32 MipLevel,
Uint32 ArraySlice,
MAP_
TYPE MapType, MAP_ FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData) override - Base implementaiton of IDeviceContext::
MapTextureSubresource() - void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) override
- Base implementaiton of IDeviceContext::
UnmapTextureSubresource() - void GetPipelineState(IPipelineState** ppPSO, float* BlendFactors, Uint32& StencilRef)
- Returns currently bound pipeline state and blend factors.
- void GetRenderTargets(Uint32& NumRenderTargets, ITextureView** ppRTVs, ITextureView** ppDSV)
- Returns currently bound render targets.
- void GetViewports(Uint32& NumViewports, Viewport* pViewports)
- Returns currently set viewports.
- auto GetDevice() -> IRenderDevice*
- Returns the render device.
- auto UnbindTextureFromFramebuffer(TextureImplType* pTexture, bool bShowMessage) -> bool
- Checks if a texture is bound as a render target or depth-stencil buffer and resets render targets if it is.
Protected types
- struct CommittedShaderResources
- Committed shader resources for each resource signature.
Protected functions
- auto SetRenderTargets(Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil) -> bool
- Caches the render target and depth stencil views. Returns true if any view is different from the cached value and false otherwise.
- auto SetSubpassRenderTargets() -> bool
- Initializes render targets for the current subpass.
- void ClearStateCache()
- Clears all cached resources.
- auto CheckIfBoundAsRenderTarget(TextureImplType* pTexture) -> bool
- Checks if the texture is currently bound as a render target.
- auto CheckIfBoundAsDepthStencil(TextureImplType* pTexture) -> bool
- Checks if the texture is currently bound as depth-stencil buffer.
- void UpdateAttachmentStates(Uint32 SubpassIndex)
- Updates the states of render pass attachments to match states within the gievn subpass.
Protected variables
- RefCntAutoPtr<DeviceImplType> m_pDevice
- Strong reference to the device.
- VertexStreamInfo<BufferImplType> m_VertexStreams
- Vertex streams. Every stream holds strong reference to the buffer.
- Uint32 m_NumVertexStreams
- Number of bound vertex streams.
- RefCntAutoPtr<PipelineStateImplType> m_pPipelineState
- Strong reference to the bound pipeline state object. Use final PSO implementation type to avoid virtual calls to AddRef()/Release(). We need to keep strong reference as we examine previous pipeline state in SetPipelineState()
- RefCntAutoPtr<BufferImplType> m_pIndexBuffer
- Strong reference to the bound index buffer. Use final buffer implementation type to avoid virtual calls to AddRef()/Release()
- Uint32 m_IndexDataStartOffset
- Offset from the beginning of the index buffer to the start of the index data, in bytes.
- Uint32 m_StencilRef
- Current stencil reference value.
- Float32 m_BlendFactors
- Curent blend factors.
- Viewport m_Viewports
- Current viewports.
- Uint32 m_NumViewports
- Number of current viewports.
- Rect m_ScissorRects
- Current scissor rects.
- Uint32 m_NumScissorRects
- Number of current scissor rects.
- RefCntAutoPtr<TextureViewImplType> m_pBoundRenderTargets
- Vector of strong references to the bound render targets. Use final texture view implementation type to avoid virtual calls to AddRef()/Release()
- Uint32 m_NumBoundRenderTargets
- Number of bound render targets.
- Uint32 m_FramebufferWidth
- Width of the currently bound framebuffer.
- Uint32 m_FramebufferHeight
- Height of the currently bound framebuffer.
- Uint32 m_FramebufferSlices
- Number of array slices in the currently bound framebuffer.
- Uint32 m_FramebufferSamples
- Number of samples in the currently bound framebuffer.
- RefCntAutoPtr<TextureViewImplType> m_pBoundDepthStencil
- Strong references to the bound depth stencil view. Use final texture view implementation type to avoid virtual calls to AddRef()/Release()
- RefCntAutoPtr<FramebufferImplType> m_pBoundFramebuffer
- Strong reference to the bound framebuffer.
- RefCntAutoPtr<RenderPassImplType> m_pActiveRenderPass
- Strong reference to the render pass.
- Uint32 m_SubpassIndex
- Current subpass index.
-
RESOURCE_
STATE_ TRANSITION_ MODE m_RenderPassAttachmentsTransitionMode - Render pass attachments transition mode.
Function documentation
template<typename EngineImplTraits>
Diligent:: DeviceContextBase<EngineImplTraits>:: DeviceContextBase(IReferenceCounters* pRefCounters,
DeviceImplType* pRenderDevice,
bool bIsDeferred)
| Parameters | |
|---|---|
| pRefCounters | - Reference counters object that controls the lifetime of this device context. |
| pRenderDevice | - Render device. |
| bIsDeferred | - Flag indicating if this instance is a deferred context |