ezEngine  Milestone 7
ezGALContext Class Referenceabstract
Inheritance diagram for ezGALContext:

Public Member Functions

void Clear (const ezColor &ClearColor, ezUInt32 uiRenderTargetClearMask=0xFFFFFFFFu, bool bClearDepth=true, bool bClearStencil=true, float fDepthClear=1.0f, ezUInt8 uiStencilClear=0x0u)
 Clears active rendertargets. More...
 
void Draw (ezUInt32 uiVertexCount, ezUInt32 uiStartVertex)
 
void DrawIndexed (ezUInt32 uiIndexCount, ezUInt32 uiStartIndex)
 
void DrawIndexedInstanced (ezUInt32 uiIndexCountPerInstance, ezUInt32 uiInstanceCount, ezUInt32 uiStartIndex)
 
void DrawIndexedInstancedIndirect (ezGALBufferHandle hIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)
 
void DrawInstanced (ezUInt32 uiVertexCountPerInstance, ezUInt32 uiInstanceCount, ezUInt32 uiStartVertex)
 
void DrawInstancedIndirect (ezGALBufferHandle hIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)
 
void DrawAuto ()
 
void BeginStreamOut ()
 
void EndStreamOut ()
 
void Dispatch (ezUInt32 uiThreadGroupCountX, ezUInt32 uiThreadGroupCountY, ezUInt32 uiThreadGroupCountZ)
 
void DispatchIndirect (ezGALBufferHandle hIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)
 
void SetShader (ezGALShaderHandle hShader)
 
void SetIndexBuffer (ezGALBufferHandle hIndexBuffer)
 
void SetVertexBuffer (ezUInt32 uiSlot, ezGALBufferHandle hVertexBuffer)
 
void SetVertexDeclaration (ezGALVertexDeclarationHandle hVertexDeclaration)
 
void SetPrimitiveTopology (ezGALPrimitiveTopology::Enum Topology)
 
void SetConstantBuffer (ezUInt32 uiSlot, ezGALBufferHandle hBuffer)
 
void SetSamplerState (ezGALShaderStage::Enum Stage, ezUInt32 uiSlot, ezGALSamplerStateHandle hSamplerState)
 
void SetResourceView (ezGALShaderStage::Enum Stage, ezUInt32 uiSlot, ezGALResourceViewHandle hResourceView)
 
void SetRenderTargetSetup (const ezGALRenderTagetSetup &RenderTargetSetup)
 
void SetUnorderedAccessView (ezUInt32 uiSlot, ezGALResourceViewHandle hResourceView)
 
void SetBlendState (ezGALBlendStateHandle hBlendState, const ezColor &BlendFactor=ezColor::White, ezUInt32 uiSampleMask=0xFFFFFFFFu)
 
void SetDepthStencilState (ezGALDepthStencilStateHandle hDepthStencilState, ezUInt8 uiStencilRefValue=0xFFu)
 
void SetRasterizerState (ezGALRasterizerStateHandle hRasterizerState)
 
void SetViewport (float fX, float fY, float fWidth, float fHeight, float fMinDepth, float fMaxDepth)
 
void SetScissorRect (ezUInt32 uiX, ezUInt32 uiY, ezUInt32 uiWidth, ezUInt32 uiHeight)
 
void SetStreamOutBuffer (ezUInt32 uiSlot, ezGALBufferHandle hBuffer, ezUInt32 uiOffset)
 
void InsertFence (ezGALFenceHandle hFence)
 
bool IsFenceReached (ezGALFenceHandle hFence)
 
void WaitForFence (ezGALFenceHandle hFence)
 
void BeginQuery (ezGALQueryHandle hQuery)
 
void EndQuery (ezGALQueryHandle hQuery)
 
void CopyBuffer (ezGALBufferHandle hDest, ezGALBufferHandle hSource)
 
void CopyBufferRegion (ezGALBufferHandle hDest, ezUInt32 uiDestOffset, ezGALBufferHandle hSource, ezUInt32 uiSourceOffset, ezUInt32 uiByteCount)
 
void UpdateBuffer (ezGALBufferHandle hDest, ezUInt32 uiDestOffset, const void *pSourceData, ezUInt32 uiByteCount)
 
void CopyTexture (ezGALTextureHandle hDest, ezGALTextureHandle hSource)
 
void CopyTextureRegion (ezGALTextureHandle hDest, const ezGALTextureSubresource &DestinationSubResource, const ezVec3U32 &DestinationPoint, ezGALTextureHandle hSource, const ezGALTextureSubresource &SourceSubResource, const ezBoundingBoxu32 &Box)
 
void UpdateTexture (ezGALTextureHandle hDest, const ezGALTextureSubresource &DestinationSubResource, const ezBoundingBoxu32 &DestinationBox, const void *pSourceData, ezUInt32 uiSourceRowPitch, ezUInt32 uiSourceDepthPitch)
 
void ResolveTexture (ezGALTextureHandle hDest, const ezGALTextureSubresource &DestinationSubResource, ezGALTextureHandle hSource, const ezGALTextureSubresource &SourceSubResource)
 
void ReadbackTexture (ezGALTextureHandle hTexture)
 
void CopyTextureReadbackResult (ezGALTextureHandle hTexture, const ezArrayPtr< ezGALSystemMemoryDescription > *pData)
 
void PushMarker (const char *Marker)
 
void PopMarker ()
 
void InsertEventMarker (const char *Marker)
 
void ClearStatisticsCounters ()
 

Protected Member Functions

 ezGALContext (ezGALDevice *pDevice)
 
virtual void ClearPlatform (const ezColor &ClearColor, ezUInt32 uiRenderTargetClearMask, bool bClearDepth, bool bClearStencil, float fDepthClear, ezUInt8 uiStencilClear)=0
 
virtual void DrawPlatform (ezUInt32 uiVertexCount, ezUInt32 uiStartVertex)=0
 
virtual void DrawIndexedPlatform (ezUInt32 uiIndexCount, ezUInt32 uiStartIndex)=0
 
virtual void DrawIndexedInstancedPlatform (ezUInt32 uiIndexCountPerInstance, ezUInt32 uiInstanceCount, ezUInt32 uiStartIndex)=0
 
virtual void DrawIndexedInstancedIndirectPlatform (ezGALBuffer *pIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)=0
 
virtual void DrawInstancedPlatform (ezUInt32 uiVertexCountPerInstance, ezUInt32 uiInstanceCount, ezUInt32 uiStartVertex)=0
 
virtual void DrawInstancedIndirectPlatform (ezGALBuffer *pIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)=0
 
virtual void DrawAutoPlatform ()=0
 
virtual void BeginStreamOutPlatform ()=0
 
virtual void EndStreamOutPlatform ()=0
 
virtual void DispatchPlatform (ezUInt32 uiThreadGroupCountX, ezUInt32 uiThreadGroupCountY, ezUInt32 uiThreadGroupCountZ)=0
 
virtual void DispatchIndirectPlatform (ezGALBuffer *pIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)=0
 
virtual void SetShaderPlatform (ezGALShader *pShader)=0
 
virtual void SetIndexBufferPlatform (ezGALBuffer *pIndexBuffer)=0
 
virtual void SetVertexBufferPlatform (ezUInt32 uiSlot, ezGALBuffer *pVertexBuffer)=0
 
virtual void SetVertexDeclarationPlatform (ezGALVertexDeclaration *pVertexDeclaration)=0
 
virtual void SetPrimitiveTopologyPlatform (ezGALPrimitiveTopology::Enum Topology)=0
 
virtual void SetConstantBufferPlatform (ezUInt32 uiSlot, ezGALBuffer *pBuffer)=0
 
virtual void SetSamplerStatePlatform (ezGALShaderStage::Enum Stage, ezUInt32 uiSlot, ezGALSamplerState *pSamplerState)=0
 
virtual void SetResourceViewPlatform (ezGALShaderStage::Enum Stage, ezUInt32 uiSlot, ezGALResourceView *pResourceView)=0
 
virtual void SetRenderTargetSetupPlatform (ezGALRenderTargetView **ppRenderTargetViews, ezUInt32 uiRenderTargetCount, ezGALRenderTargetView *pDepthStencilView)=0
 
virtual void SetUnorderedAccessViewPlatform (ezUInt32 uiSlot, ezGALResourceView *pResourceView)=0
 
virtual void SetBlendStatePlatform (ezGALBlendState *pBlendState, const ezColor &BlendFactor, ezUInt32 uiSampleMask)=0
 
virtual void SetDepthStencilStatePlatform (ezGALDepthStencilState *pDepthStencilState, ezUInt8 uiStencilRefValue)=0
 
virtual void SetRasterizerStatePlatform (ezGALRasterizerState *pRasterizerState)=0
 
virtual void SetViewportPlatform (float fX, float fY, float fWidth, float fHeight, float fMinDepth, float fMaxDepth)=0
 
virtual void SetScissorRectPlatform (ezUInt32 uiX, ezUInt32 uiY, ezUInt32 uiWidth, ezUInt32 uiHeight)=0
 
virtual void SetStreamOutBufferPlatform (ezUInt32 uiSlot, ezGALBuffer *pBuffer, ezUInt32 uiOffset)=0
 
virtual void InsertFencePlatform (ezGALFence *pFence)=0
 
virtual bool IsFenceReachedPlatform (ezGALFence *pFence)=0
 
virtual void BeginQueryPlatform (ezGALQuery *pQuery)=0
 
virtual void EndQueryPlatform (ezGALQuery *pQuery)=0
 
virtual void CopyBufferPlatform (ezGALBuffer *pDestination, ezGALBuffer *pSource)=0
 
virtual void CopyBufferRegionPlatform (ezGALBuffer *pDestination, ezUInt32 uiDestOffset, ezGALBuffer *pSource, ezUInt32 uiSourceOffset, ezUInt32 uiByteCount)=0
 
virtual void UpdateBufferPlatform (ezGALBuffer *pDestination, ezUInt32 uiDestOffset, const void *pSourceData, ezUInt32 uiByteCount)=0
 
virtual void CopyTexturePlatform (ezGALTexture *pDestination, ezGALTexture *pSource)=0
 
virtual void CopyTextureRegionPlatform (ezGALTexture *pDestination, const ezGALTextureSubresource &DestinationSubResource, const ezVec3U32 &DestinationPoint, ezGALTexture *pSource, const ezGALTextureSubresource &SourceSubResource, const ezBoundingBoxu32 &Box)=0
 
virtual void UpdateTexturePlatform (ezGALTexture *pDestination, const ezGALTextureSubresource &DestinationSubResource, const ezBoundingBoxu32 &DestinationBox, const void *pSourceData, ezUInt32 uiSourceRowPitch, ezUInt32 uiSourceDepthPitch)=0
 
virtual void ResolveTexturePlatform (ezGALTexture *pDestination, const ezGALTextureSubresource &DestinationSubResource, ezGALTexture *pSource, const ezGALTextureSubresource &SourceSubResource)=0
 
virtual void ReadbackTexturePlatform (ezGALTexture *pTexture)=0
 
virtual void CopyTextureReadbackResultPlatform (ezGALTexture *pTexture, const ezArrayPtr< ezGALSystemMemoryDescription > *pData)=0
 
virtual void PushMarkerPlatform (const char *Marker)=0
 
virtual void PopMarkerPlatform ()=0
 
virtual void InsertEventMarkerPlatform (const char *Marker)=0
 
void InvalidateState ()
 

Private Member Functions

void CountDrawCall ()
 
void CountDispatchCall ()
 
void CountStateChange ()
 
void CountRedundantStateChange ()
 
void AssertRenderingThread ()
 

Private Attributes

ezGALDevicem_pDevice
 
ezGALContextState m_State
 
ezUInt32 m_uiDrawCalls
 
ezUInt32 m_uiDispatchCalls
 
ezUInt32 m_uiStateChanges
 
ezUInt32 m_uiRedundantStateChanges
 

Friends

class ezGALDevice
 
class ezMemoryUtils
 

Member Function Documentation

void ezGALContext::AssertRenderingThread ( )
inlineprivate
void ezGALContext::BeginQuery ( ezGALQueryHandle  hQuery)
Todo:
Assert on query support?
void ezGALContext::BeginStreamOut ( )
Todo:
Assert for streamout support
void ezGALContext::Clear ( const ezColor ClearColor,
ezUInt32  uiRenderTargetClearMask = 0xFFFFFFFFu,
bool  bClearDepth = true,
bool  bClearStencil = true,
float  fDepthClear = 1.0f,
ezUInt8  uiStencilClear = 0x0u 
)

Clears active rendertargets.

Parameters
uiRenderTargetClearMaskEach bit represents a bound color target. If all bits are set, all bound color targets will be cleared.
virtual void ezGALContext::CopyTextureReadbackResultPlatform ( ezGALTexture pTexture,
const ezArrayPtr< ezGALSystemMemoryDescription > *  pData 
)
protectedpure virtual
Todo:
add parameters for mip level & count selection?

Implemented in ezGALContextGL, and ezGALContextDX11.

void ezGALContext::CopyTextureRegion ( ezGALTextureHandle  hDest,
const ezGALTextureSubresource DestinationSubResource,
const ezVec3U32 DestinationPoint,
ezGALTextureHandle  hSource,
const ezGALTextureSubresource SourceSubResource,
const ezBoundingBoxu32 Box 
)
void ezGALContext::Dispatch ( ezUInt32  uiThreadGroupCountX,
ezUInt32  uiThreadGroupCountY,
ezUInt32  uiThreadGroupCountZ 
)
Todo:
Assert for compute
void ezGALContext::DispatchIndirect ( ezGALBufferHandle  hIndirectArgumentBuffer,
ezUInt32  uiArgumentOffsetInBytes 
)
Todo:
Assert for compute
Todo:
Assert for indirect dispatch
Todo:
Assert offset < buffer size
Todo:
Assert that the buffer can be used for indirect arguments (flag in desc)
void ezGALContext::Draw ( ezUInt32  uiVertexCount,
ezUInt32  uiStartVertex 
)
Todo:
If platform indicates that non-indexed rendering is not possible bind a helper index buffer which contains continuous indices (0, 1, 2, ..)
void ezGALContext::DrawAuto ( )
Todo:
Assert for draw auto support
void ezGALContext::DrawIndexedInstanced ( ezUInt32  uiIndexCountPerInstance,
ezUInt32  uiInstanceCount,
ezUInt32  uiStartIndex 
)
Todo:
Assert for instancing
void ezGALContext::DrawIndexedInstancedIndirect ( ezGALBufferHandle  hIndirectArgumentBuffer,
ezUInt32  uiArgumentOffsetInBytes 
)
Todo:
Assert for instancing
Todo:
Assert for indirect draw
Todo:
Assert offset < buffer size
Todo:
Assert that the buffer can be used for indirect arguments (flag in desc)
void ezGALContext::DrawInstanced ( ezUInt32  uiVertexCountPerInstance,
ezUInt32  uiInstanceCount,
ezUInt32  uiStartVertex 
)
Todo:
Assert for instancing
Todo:
If platform indicates that non-indexed rendering is not possible bind a helper index buffer which contains continuous indices (0, 1, 2, ..)
void ezGALContext::DrawInstancedIndirect ( ezGALBufferHandle  hIndirectArgumentBuffer,
ezUInt32  uiArgumentOffsetInBytes 
)
Todo:
Assert for instancing
Todo:
Assert for indirect draw
Todo:
Assert offset < buffer size
Todo:
Assert that the buffer can be used for indirect arguments (flag in desc)
void ezGALContext::EndQuery ( ezGALQueryHandle  hQuery)
Todo:
Assert on query support?
Todo:
Assert on query started
void ezGALContext::SetConstantBuffer ( ezUInt32  uiSlot,
ezGALBufferHandle  hBuffer 
)
Todo:
Get buffer by handle
void ezGALContext::SetIndexBuffer ( ezGALBufferHandle  hIndexBuffer)
Todo:
Assert on index buffer type (if non nullptr)
void ezGALContext::SetResourceView ( ezGALShaderStage::Enum  Stage,
ezUInt32  uiSlot,
ezGALResourceViewHandle  hResourceView 
)
Todo:
Check if the device supports the stage / the slot index
void ezGALContext::SetShader ( ezGALShaderHandle  hShader)
Todo:
Assert for shader capabilities (supported shader stages etc.)
void ezGALContext::SetUnorderedAccessView ( ezUInt32  uiSlot,
ezGALResourceViewHandle  hResourceView 
)
void ezGALContext::WaitForFence ( ezGALFenceHandle  hFence)
Todo:
  • make this toggle-able
Todo:
Spin lock count perhaps?

The documentation for this class was generated from the following files: