Diligent Engine API Reference
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Diligent::DeviceContextBase< BaseInterface > Class Template Referenceabstract

Base implementation of the device context. More...

Inheritance diagram for Diligent::DeviceContextBase< BaseInterface >:
Diligent::ObjectBase< BaseInterface, IMemoryAllocator > Diligent::RefCountedObject< BaseInterface, IMemoryAllocator >

Public Member Functions

 DeviceContextBase (IMemoryAllocator &RawMemAllocator, IRenderDevice *pRenderDevice, bool bIsDeferred)
 
virtual void SetVertexBuffers (Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pStrides, Uint32 *pOffsets, Uint32 Flags)=0
 Base implementation of IDeviceContext::SetVertexBuffers(); validates parameters and caches references to the buffers.
 
virtual void SetPipelineState (IPipelineState *pPipelineState)=0
 Base implementation of IDeviceContext::SetPipelineState(); caches references to the pipeline state object.
 
bool CommitShaderResources (IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags, int)
 Base implementation of IDeviceContext::CommitShaderResources(); validates parameters.
 
virtual void SetIndexBuffer (IBuffer *pIndexBuffer, Uint32 ByteOffset)=0
 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.
 
bool SetRenderTargets (Uint32 NumRenderTargets, ITextureView *ppRenderTargets[], ITextureView *pDepthStencil, Uint32 Dummy=0)
 Caches the render target and depth stencil views. Returns true if any view is different from the cached value and false otherwise.
 
void SetSwapChain (ISwapChain *pSwapChain)
 Sets the strong pointer to the swap chain.
 
ISwapChainGetSwapChain ()
 Returns the swap chain.
 
bool IsDefaultFBBound ()
 Returns true if currently bound frame buffer is the default frame buffer.
 
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.
 
IRenderDeviceGetDevice ()
 Returns the render device.
 

Protected Member Functions

void GetRenderTargetSize (Uint32 &RTWidth, Uint32 &RTHeight)
 Returns the size of the currently bound render target.
 
void ClearStateCache ()
 Clears all cached resources. More...
 

Protected Attributes

RefCntAutoPtr< IRenderDevicem_pDevice
 Strong reference to the device.
 
RefCntAutoPtr< ISwapChainm_pSwapChain
 Strong reference to the swap chain. Swap chain holds weak reference to the immediate context.
 
VertexStreamInfo m_VertexStreams [MaxBufferSlots]
 Vertex streams. Every stream holds strong reference to the buffer.
 
Uint32 m_NumVertexStreams = 0
 Number of bound vertex streams.
 
RefCntAutoPtr< IPipelineStatem_pPipelineState
 Strong reference to the bound pipeline state object.
 
RefCntAutoPtr< IBufferm_pIndexBuffer
 Strong reference to the bound index buffer.
 
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 [4]
 Curent blend factors.
 
Viewport m_Viewports [MaxRenderTargets]
 Current viewports.
 
Uint32 m_NumViewports = 0
 Number of current viewports.
 
Rect m_ScissorRects [MaxRenderTargets]
 Current scissor rects.
 
Uint32 m_NumScissorRects = 0
 Number of current scissor rects.
 
RefCntAutoPtr< ITextureViewm_pBoundRenderTargets [MaxRenderTargets]
 Vector of strong references to the bound render targets.
 
Uint32 m_NumBoundRenderTargets = 0
 Number of bound render targets.
 
RefCntAutoPtr< ITextureViewm_pBoundDepthStencil
 Strong references to the bound depth stencil view.
 

Detailed Description

template<typename BaseInterface>
class Diligent::DeviceContextBase< BaseInterface >

Base implementation of the device context.

Template Parameters
BaseInterface- base interface that this class will inheret.
Remarks
Device context keeps strong references to all objects currently bound to the pipeline: buffers, states, samplers, shaders, etc. The context also keeps strong references to the device and the swap chain.

Constructor & Destructor Documentation

template<typename BaseInterface>
Diligent::DeviceContextBase< BaseInterface >::DeviceContextBase ( IMemoryAllocator RawMemAllocator,
IRenderDevice pRenderDevice,
bool  bIsDeferred 
)
inline
Parameters
RawMemAllocator- allocator that was used to allocate memory for this instance of the device context object.
pRenderDevice- render device.
bIsDeferred- flag indicating if this instance is a deferred context

Member Function Documentation

template<typename BaseInterface >
void Diligent::DeviceContextBase< BaseInterface >::ClearStateCache ( )
inlineprotected

Clears all cached resources.

Vector of strong references to bound render targets