ezEngine  Release 25.03
ezGALCommandEncoder Class Reference

Public Member Functions

 ezGALCommandEncoder (ezGALDevice &ref_device, ezGALCommandEncoderCommonPlatformInterface &ref_commonImpl)
 
void SetShader (ezGALShaderHandle hShader)
 
void SetConstantBuffer (const ezShaderResourceBinding &binding, ezGALBufferHandle hBuffer)
 
void SetSamplerState (const ezShaderResourceBinding &binding, ezGALSamplerStateHandle hSamplerState)
 
void SetResourceView (const ezShaderResourceBinding &binding, ezGALTextureResourceViewHandle hResourceView)
 
void SetResourceView (const ezShaderResourceBinding &binding, ezGALBufferResourceViewHandle hResourceView)
 
void SetUnorderedAccessView (const ezShaderResourceBinding &binding, ezGALTextureUnorderedAccessViewHandle hUnorderedAccessView)
 
void SetUnorderedAccessView (const ezShaderResourceBinding &binding, ezGALBufferUnorderedAccessViewHandle hUnorderedAccessView)
 
void SetPushConstants (ezArrayPtr< const ezUInt8 > data)
 
ezGALTimestampHandle InsertTimestamp ()
 
ezGALOcclusionHandle BeginOcclusionQuery (ezEnum< ezGALQueryType > type)
 Starts an occlusion query. This function must be called within a render scope and EndOcclusionQuery must be called within the same scope. Only one occlusion query can be active at any given time. More...
 
void EndOcclusionQuery (ezGALOcclusionHandle hOcclusion)
 Ends an occlusion query. The given handle must afterwards be passed into the ezGALDevice::GetOcclusionQueryResult function, which needs to be repeated every frame until results are ready. More...
 
ezGALFenceHandle InsertFence ()
 
void ClearUnorderedAccessView (ezGALTextureUnorderedAccessViewHandle hUnorderedAccessView, ezVec4 vClearValues)
 Clears an unordered access view with a float value.
 
void ClearUnorderedAccessView (ezGALBufferUnorderedAccessViewHandle hUnorderedAccessView, ezVec4 vClearValues)
 
void ClearUnorderedAccessView (ezGALTextureUnorderedAccessViewHandle hUnorderedAccessView, ezVec4U32 vClearValues)
 Clears an unordered access view with an int value.
 
void ClearUnorderedAccessView (ezGALBufferUnorderedAccessViewHandle hUnorderedAccessView, ezVec4U32 vClearValues)
 
void CopyBuffer (ezGALBufferHandle hDest, ezGALBufferHandle hSource)
 
void CopyBufferRegion (ezGALBufferHandle hDest, ezUInt32 uiDestOffset, ezGALBufferHandle hSource, ezUInt32 uiSourceOffset, ezUInt32 uiByteCount)
 
void UpdateBuffer (ezGALBufferHandle hDest, ezUInt32 uiDestOffset, ezArrayPtr< const ezUInt8 > sourceData, ezGALUpdateMode::Enum updateMode=ezGALUpdateMode::TransientConstantBuffer)
 
void CopyTexture (ezGALTextureHandle hDest, ezGALTextureHandle hSource)
 
void CopyTextureRegion (ezGALTextureHandle hDest, const ezGALTextureSubresource &destinationSubResource, const ezVec3U32 &vDestinationPoint, ezGALTextureHandle hSource, const ezGALTextureSubresource &sourceSubResource, const ezBoundingBoxu32 &box)
 
void UpdateTexture (ezGALTextureHandle hDest, const ezGALTextureSubresource &destinationSubResource, const ezBoundingBoxu32 &destinationBox, const ezGALSystemMemoryDescription &sourceData)
 
void ResolveTexture (ezGALTextureHandle hDest, const ezGALTextureSubresource &destinationSubResource, ezGALTextureHandle hSource, const ezGALTextureSubresource &sourceSubResource)
 
void ReadbackTexture (ezGALReadbackTextureHandle hDestination, ezGALTextureHandle hSource)
 
void ReadbackBuffer (ezGALReadbackBufferHandle hDestination, ezGALBufferHandle hSource)
 
void GenerateMipMaps (ezGALTextureResourceViewHandle hResourceView)
 
void Flush ()
 Submits all pending work to the GPU. Call this if you want to wait for a fence or some other kind of GPU synchronization to take place to ensure the work is actually submitted to the GPU.
 
void PushMarker (const char *szMarker)
 
void PopMarker ()
 
void InsertEventMarker (const char *szMarker)
 
void BeginCompute (const char *szName="")
 
void EndCompute ()
 
ezResult Dispatch (ezUInt32 uiThreadGroupCountX, ezUInt32 uiThreadGroupCountY, ezUInt32 uiThreadGroupCountZ)
 
ezResult DispatchIndirect (ezGALBufferHandle hIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)
 
void BeginRendering (const ezGALRenderingSetup &renderingSetup, const char *szName="")
 
void EndRendering ()
 
bool IsInRenderingScope () const
 
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...
 
ezResult Draw (ezUInt32 uiVertexCount, ezUInt32 uiStartVertex)
 
ezResult DrawIndexed (ezUInt32 uiIndexCount, ezUInt32 uiStartIndex)
 
ezResult DrawIndexedInstanced (ezUInt32 uiIndexCountPerInstance, ezUInt32 uiInstanceCount, ezUInt32 uiStartIndex)
 
ezResult DrawIndexedInstancedIndirect (ezGALBufferHandle hIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)
 
ezResult DrawInstanced (ezUInt32 uiVertexCountPerInstance, ezUInt32 uiInstanceCount, ezUInt32 uiStartVertex)
 
ezResult DrawInstancedIndirect (ezGALBufferHandle hIndirectArgumentBuffer, ezUInt32 uiArgumentOffsetInBytes)
 
void SetIndexBuffer (ezGALBufferHandle hIndexBuffer)
 
void SetVertexBuffer (ezUInt32 uiSlot, ezGALBufferHandle hVertexBuffer)
 
void SetVertexDeclaration (ezGALVertexDeclarationHandle hVertexDeclaration)
 
ezGALPrimitiveTopology::Enum GetPrimitiveTopology () const
 
void SetPrimitiveTopology (ezGALPrimitiveTopology::Enum topology)
 
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 (const ezRectFloat &rect, float fMinDepth=0.0f, float fMaxDepth=1.0f)
 
void SetScissorRect (const ezRectU32 &rect)
 
EZ_ALWAYS_INLINE ezGALDeviceGetDevice ()
 
void InvalidateState ()
 

Protected Member Functions

void GALStaticDeviceEventHandler (const ezGALDeviceEvent &e)
 
void AssertRenderingThread ()
 
void AssertOutsideRenderingScope ()
 

Friends

class ezGALDevice
 
class ezMemoryUtils
 

Member Function Documentation

◆ BeginOcclusionQuery()

ezGALOcclusionHandle ezGALCommandEncoder::BeginOcclusionQuery ( ezEnum< ezGALQueryType type)

Starts an occlusion query. This function must be called within a render scope and EndOcclusionQuery must be called within the same scope. Only one occlusion query can be active at any given time.

Parameters
typeThe type of the occlusion query.
Returns
A handle to be passed into EndOcclusionQuery.
See also
EndOcclusionQuery

◆ Clear()

void ezGALCommandEncoder::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.

◆ EndOcclusionQuery()

void ezGALCommandEncoder::EndOcclusionQuery ( ezGALOcclusionHandle  hOcclusion)

Ends an occlusion query. The given handle must afterwards be passed into the ezGALDevice::GetOcclusionQueryResult function, which needs to be repeated every frame until results are ready.

Parameters
hOcclusionValue returned by the previous call to BeginOcclusionQuery.
See also
ezGALDevice::GetOcclusionQueryResult

◆ InsertFence()

ezGALFenceHandle ezGALCommandEncoder::InsertFence ( )

Inserts a fence. You need to flush commands to the GPU in order to be able to wait for a fence by either ending a frame or calling ezCommandEncoder::Flush explicitly.

Returns
A handle to be passed into ezGALDevice::GetFenceResult.
See also
ezGALDevice::GetFenceResult

◆ InsertTimestamp()

ezGALTimestampHandle ezGALCommandEncoder::InsertTimestamp ( )

Inserts a timestamp.

Returns
A handle to be passed into ezGALDevice::GetTimestampResult.

◆ SetIndexBuffer()

void ezGALCommandEncoder::SetIndexBuffer ( ezGALBufferHandle  hIndexBuffer)
Todo:
Assert on index buffer type (if non nullptr)

◆ SetShader()

void ezGALCommandEncoder::SetShader ( ezGALShaderHandle  hShader)
Todo:
Assert for shader capabilities (supported shader stages etc.)

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