ezEngine  Release 25.03
ezGALDevice Class Referenceabstract

The ezRenderDevice class is the primary interface for interactions with rendering APIs It contains a set of (non-virtual) functions to set state, create resources etc. which rely on API specific implementations provided by protected virtual functions. Redundant state changes are prevented at the platform independent level in the non-virtual functions. More...

#include <Device.h>

Inheritance diagram for ezGALDevice:

Classes

struct  DeadObject
 

Public Types

using SwapChainFactoryFunction = ezDelegate< ezGALSwapChain *(ezAllocator *)>
 

Public Member Functions

ezResult Init ()
 
ezResult Shutdown ()
 
ezStringView GetRenderer ()
 
ezGALCommandEncoderBeginCommands (const char *szName)
 Begin recording GPU commands on the returned command encoder.
 
void EndCommands (ezGALCommandEncoder *pCommandEncoder)
 Stop recording commands on the command encoder. More...
 
ezGALBlendStateHandle CreateBlendState (const ezGALBlendStateCreationDescription &description)
 
void DestroyBlendState (ezGALBlendStateHandle hBlendState)
 
ezGALDepthStencilStateHandle CreateDepthStencilState (const ezGALDepthStencilStateCreationDescription &description)
 
void DestroyDepthStencilState (ezGALDepthStencilStateHandle hDepthStencilState)
 
ezGALRasterizerStateHandle CreateRasterizerState (const ezGALRasterizerStateCreationDescription &description)
 
void DestroyRasterizerState (ezGALRasterizerStateHandle hRasterizerState)
 
ezGALSamplerStateHandle CreateSamplerState (const ezGALSamplerStateCreationDescription &description)
 
void DestroySamplerState (ezGALSamplerStateHandle hSamplerState)
 
ezGALShaderHandle CreateShader (const ezGALShaderCreationDescription &description)
 
void DestroyShader (ezGALShaderHandle hShader)
 
ezGALBufferHandle CreateBuffer (const ezGALBufferCreationDescription &description, ezArrayPtr< const ezUInt8 > initialData=ezArrayPtr< const ezUInt8 >())
 
void DestroyBuffer (ezGALBufferHandle hBuffer)
 
ezGALDynamicBufferHandle CreateDynamicBuffer (const ezGALBufferCreationDescription &description, ezStringView sDebugName)
 
void DestroyDynamicBuffer (ezGALDynamicBufferHandle &inout_hBuffer)
 
ezGALBufferHandle CreateVertexBuffer (ezUInt32 uiVertexSize, ezUInt32 uiVertexCount, ezArrayPtr< const ezUInt8 > initialData=ezArrayPtr< const ezUInt8 >(), bool bDataIsMutable=false)
 
ezGALBufferHandle CreateIndexBuffer (ezGALIndexType::Enum indexType, ezUInt32 uiIndexCount, ezArrayPtr< const ezUInt8 > initialData=ezArrayPtr< const ezUInt8 >(), bool bDataIsMutable=false)
 
ezGALBufferHandle CreateConstantBuffer (ezUInt32 uiBufferSize)
 
ezGALTextureHandle CreateTexture (const ezGALTextureCreationDescription &description, ezArrayPtr< ezGALSystemMemoryDescription > initialData=ezArrayPtr< ezGALSystemMemoryDescription >())
 
void DestroyTexture (ezGALTextureHandle hTexture)
 
ezGALTextureHandle CreateProxyTexture (ezGALTextureHandle hParentTexture, ezUInt32 uiSlice)
 
void DestroyProxyTexture (ezGALTextureHandle hProxyTexture)
 
ezGALTextureHandle CreateSharedTexture (const ezGALTextureCreationDescription &description, ezArrayPtr< ezGALSystemMemoryDescription > initialData={})
 
ezGALTextureHandle OpenSharedTexture (const ezGALTextureCreationDescription &description, ezGALPlatformSharedHandle hSharedHandle)
 
void DestroySharedTexture (ezGALTextureHandle hTexture)
 
ezGALReadbackBufferHandle CreateReadbackBuffer (const ezGALBufferCreationDescription &description)
 
void DestroyReadbackBuffer (ezGALReadbackBufferHandle hBuffer)
 
ezGALReadbackTextureHandle CreateReadbackTexture (const ezGALTextureCreationDescription &description)
 
void DestroyReadbackTexture (ezGALReadbackTextureHandle hTexture)
 
void UpdateBufferForNextFrame (ezGALBufferHandle hBuffer, ezConstByteArrayPtr sourceData, ezUInt32 uiDestOffset=0)
 Ensures that the given buffer is updated at the beginning of the next frame.
 
void UpdateTextureForNextFrame (ezGALTextureHandle hTexture, const ezGALSystemMemoryDescription &sourceData, const ezGALTextureSubresource &destinationSubResource={}, const ezBoundingBoxu32 &destinationBox=ezBoundingBoxu32::MakeZero())
 Ensures that the given texture is updated at the beginning of the next frame.
 
ezGALTextureResourceViewHandle GetDefaultResourceView (ezGALTextureHandle hTexture)
 
ezGALBufferResourceViewHandle GetDefaultResourceView (ezGALBufferHandle hBuffer)
 
ezGALTextureResourceViewHandle CreateResourceView (const ezGALTextureResourceViewCreationDescription &description)
 
void DestroyResourceView (ezGALTextureResourceViewHandle hResourceView)
 
ezGALBufferResourceViewHandle CreateResourceView (const ezGALBufferResourceViewCreationDescription &description)
 
void DestroyResourceView (ezGALBufferResourceViewHandle hResourceView)
 
ezGALRenderTargetViewHandle GetDefaultRenderTargetView (ezGALTextureHandle hTexture)
 
ezGALRenderTargetViewHandle CreateRenderTargetView (const ezGALRenderTargetViewCreationDescription &description)
 
void DestroyRenderTargetView (ezGALRenderTargetViewHandle hRenderTargetView)
 
ezGALTextureUnorderedAccessViewHandle CreateUnorderedAccessView (const ezGALTextureUnorderedAccessViewCreationDescription &description)
 
void DestroyUnorderedAccessView (ezGALTextureUnorderedAccessViewHandle hUnorderedAccessView)
 
ezGALBufferUnorderedAccessViewHandle CreateUnorderedAccessView (const ezGALBufferUnorderedAccessViewCreationDescription &description)
 
void DestroyUnorderedAccessView (ezGALBufferUnorderedAccessViewHandle hUnorderedAccessView)
 
ezGALSwapChainHandle CreateSwapChain (const SwapChainFactoryFunction &func)
 
ezResult UpdateSwapChain (ezGALSwapChainHandle hSwapChain, ezEnum< ezGALPresentMode > newPresentMode)
 
void DestroySwapChain (ezGALSwapChainHandle hSwapChain)
 
ezGALVertexDeclarationHandle CreateVertexDeclaration (const ezGALVertexDeclarationCreationDescription &description)
 
void DestroyVertexDeclaration (ezGALVertexDeclarationHandle hVertexDeclaration)
 
ezEnum< ezGALAsyncResultGetTimestampResult (ezGALTimestampHandle hTimestamp, ezTime &out_result)
 Queries the result of a timestamp. Should be called every frame until ezGALAsyncResult::Ready is returned. More...
 
ezEnum< ezGALAsyncResultGetOcclusionQueryResult (ezGALOcclusionHandle hOcclusion, ezUInt64 &out_uiResult)
 Queries the result of an occlusion query. Should be called every frame until ezGALAsyncResult::Ready is returned. More...
 
ezEnum< ezGALAsyncResultGetFenceResult (ezGALFenceHandle hFence, ezTime timeout=ezTime::MakeZero())
 Queries the result of a fence. Fences can never expire as they are just monotonically increasing numbers over time. More...
 
ezReadbackBufferLock LockBuffer (ezGALReadbackBufferHandle hReadbackBuffer, ezArrayPtr< const ezUInt8 > &out_memory)
 Tries to lock a readback buffer for reading. Only fails if the handle is invalid. More...
 
ezReadbackTextureLock LockTexture (ezGALReadbackTextureHandle hReadbackTexture, const ezArrayPtr< const ezGALTextureSubresource > &subResources, ezDynamicArray< ezGALSystemMemoryDescription > &out_memory)
 Tries to lock a readback texture for reading. Only fails if the handle is invalid. More...
 
ezGALTextureHandle GetBackBufferTextureFromSwapChain (ezGALSwapChainHandle hSwapChain)
 
void EnqueueFrameSwapChain (ezGALSwapChainHandle hSwapChain)
 Adds a swap-chain to be used for the next frame. Must be called before or during the ezGALDeviceEvent::BeforeBeginFrame event (BeginFrame function) and repeated for every frame the swap-chain is to be used. This approach guarantees that all swap-chains of a frame acquire and present at the same time, which improves frame pacing. More...
 
void BeginFrame (const ezUInt64 uiAppFrame=0)
 Begins rendering of a frame. This needs to be called first before any rendering function can be called. More...
 
void EndFrame ()
 Ends rendering of a frame and submits all data to the GPU. No further rendering calls are allowed until BeginFrame is called again.
 
ezUInt64 GetCurrentFrame () const
 The current rendering frame. This is a monotonically increasing number which changes +1 every time EndFrame is called. You can use this to synchronize read/writes between CPU and GPU, see GetSafeFrame. More...
 
ezUInt64 GetSafeFrame () const
 The latest frame that has been fully executed on the GPU. Whenever you execute any work that requires synchronization between CPU and GPU, remember the GetCurrentFrame result in which the operation was done. When GetSafeFrame reaches this number, you know for sure that the GPU has completed all operations of that frame. More...
 
const ezGALDeviceCreationDescriptionGetDescription () const
 
const ezGALSwapChainGetSwapChain (ezGALSwapChainHandle hSwapChain) const
 
template<typename T >
const T * GetSwapChain (ezGALSwapChainHandle hSwapChain) const
 
const ezGALShaderGetShader (ezGALShaderHandle hShader) const
 
const ezGALTextureGetTexture (ezGALTextureHandle hTexture) const
 
virtual const ezGALSharedTextureGetSharedTexture (ezGALTextureHandle hTexture) const =0
 
const ezGALBufferGetBuffer (ezGALBufferHandle hBuffer) const
 
const ezGALDynamicBufferGetDynamicBuffer (ezGALDynamicBufferHandle hBuffer) const
 
ezGALDynamicBufferGetDynamicBuffer (ezGALDynamicBufferHandle hBuffer)
 
const ezGALReadbackBufferGetReadbackBuffer (ezGALReadbackBufferHandle hBuffer) const
 
const ezGALReadbackTextureGetReadbackTexture (ezGALReadbackTextureHandle hTexture) const
 
const ezGALDepthStencilStateGetDepthStencilState (ezGALDepthStencilStateHandle hDepthStencilState) const
 
const ezGALBlendStateGetBlendState (ezGALBlendStateHandle hBlendState) const
 
const ezGALRasterizerStateGetRasterizerState (ezGALRasterizerStateHandle hRasterizerState) const
 
const ezGALVertexDeclarationGetVertexDeclaration (ezGALVertexDeclarationHandle hVertexDeclaration) const
 
const ezGALSamplerStateGetSamplerState (ezGALSamplerStateHandle hSamplerState) const
 
const ezGALTextureResourceViewGetResourceView (ezGALTextureResourceViewHandle hResourceView) const
 
const ezGALBufferResourceViewGetResourceView (ezGALBufferResourceViewHandle hResourceView) const
 
const ezGALRenderTargetViewGetRenderTargetView (ezGALRenderTargetViewHandle hRenderTargetView) const
 
const ezGALTextureUnorderedAccessViewGetUnorderedAccessView (ezGALTextureUnorderedAccessViewHandle hUnorderedAccessView) const
 
const ezGALBufferUnorderedAccessViewGetUnorderedAccessView (ezGALBufferUnorderedAccessViewHandle hUnorderedAccessView) const
 
const ezGALDeviceCapabilitiesGetCapabilities () const
 
virtual ezUInt64 GetMemoryConsumptionForTexture (const ezGALTextureCreationDescription &description) const
 
virtual ezUInt64 GetMemoryConsumptionForBuffer (const ezGALBufferCreationDescription &description) const
 
void Flush ()
 
void WaitIdle ()
 Waits for the GPU to be idle and destroys any pending resources and GPU objects.
 
ezAllocatorGetAllocator ()
 Internal: Returns the allocator used by the device.
 
template<typename IdTableType , typename ReturnType >
EZ_ALWAYS_INLINE ReturnType * Get (typename IdTableType::TypeOfId hHandle, const IdTableType &IdTable) const
 
template<typename HandleType >
EZ_FORCE_INLINE void AddDeadObject (ezUInt32 uiType, HandleType handle)
 

Static Public Member Functions

static void SetDefaultDevice (ezGALDevice *pDefaultDevice)
 
static ezGALDeviceGetDefaultDevice ()
 
static bool HasDefaultDevice ()
 

Public Attributes

ezMutex m_Mutex
 

Static Public Attributes

static ezEvent< const ezGALDeviceEvent &, ezMutexs_Events
 

Protected Types

using ShaderTable = ezIdTable< ezGALShaderHandle::IdType, ezGALShader *, ezLocalAllocatorWrapper >
 
using BlendStateTable = ezIdTable< ezGALBlendStateHandle::IdType, ezGALBlendState *, ezLocalAllocatorWrapper >
 
using DepthStencilStateTable = ezIdTable< ezGALDepthStencilStateHandle::IdType, ezGALDepthStencilState *, ezLocalAllocatorWrapper >
 
using RasterizerStateTable = ezIdTable< ezGALRasterizerStateHandle::IdType, ezGALRasterizerState *, ezLocalAllocatorWrapper >
 
using BufferTable = ezIdTable< ezGALBufferHandle::IdType, ezGALBuffer *, ezLocalAllocatorWrapper >
 
using DynamicBufferTable = ezIdTable< ezGALDynamicBufferHandle::IdType, ezGALDynamicBuffer *, ezLocalAllocatorWrapper >
 
using TextureTable = ezIdTable< ezGALTextureHandle::IdType, ezGALTexture *, ezLocalAllocatorWrapper >
 
using ReadbackBufferTable = ezIdTable< ezGALReadbackBufferHandle::IdType, ezGALReadbackBuffer *, ezLocalAllocatorWrapper >
 
using ReadbackTextureTable = ezIdTable< ezGALReadbackTextureHandle::IdType, ezGALReadbackTexture *, ezLocalAllocatorWrapper >
 
using TextureResourceViewTable = ezIdTable< ezGALTextureResourceViewHandle::IdType, ezGALTextureResourceView *, ezLocalAllocatorWrapper >
 
using BufferResourceViewTable = ezIdTable< ezGALBufferResourceViewHandle::IdType, ezGALBufferResourceView *, ezLocalAllocatorWrapper >
 
using SamplerStateTable = ezIdTable< ezGALSamplerStateHandle::IdType, ezGALSamplerState *, ezLocalAllocatorWrapper >
 
using RenderTargetViewTable = ezIdTable< ezGALRenderTargetViewHandle::IdType, ezGALRenderTargetView *, ezLocalAllocatorWrapper >
 
using TextureUnorderedAccessViewTable = ezIdTable< ezGALTextureUnorderedAccessViewHandle::IdType, ezGALTextureUnorderedAccessView *, ezLocalAllocatorWrapper >
 
using BufferUnorderedAccessViewTable = ezIdTable< ezGALBufferUnorderedAccessViewHandle::IdType, ezGALBufferUnorderedAccessView *, ezLocalAllocatorWrapper >
 
using SwapChainTable = ezIdTable< ezGALSwapChainHandle::IdType, ezGALSwapChain *, ezLocalAllocatorWrapper >
 
using VertexDeclarationTable = ezIdTable< ezGALVertexDeclarationHandle::IdType, ezGALVertexDeclaration *, ezLocalAllocatorWrapper >
 

Protected Member Functions

 ezGALDevice (const ezGALDeviceCreationDescription &Description)
 
template<typename IdTableType , typename ReturnType >
ReturnType * Get (typename IdTableType::TypeOfId hHandle, const IdTableType &IdTable) const
 
void DestroyViews (ezGALTexture *pResource)
 
void DestroyViews (ezGALBuffer *pResource)
 
template<typename HandleType >
void AddDeadObject (ezUInt32 uiType, HandleType handle)
 
template<typename HandleType >
void ReviveDeadObject (ezUInt32 uiType, HandleType handle)
 
void DestroyDeadObjects ()
 
void VerifyMultithreadedAccess () const
 Asserts that either this device supports multi-threaded resource creation, or that this function is executed on the main thread.
 
const ezGALSwapChainGetSwapChainInternal (ezGALSwapChainHandle hSwapChain, const ezRTTI *pRequestedType) const
 
ezGALTextureHandle FinalizeTextureInternal (const ezGALTextureCreationDescription &desc, ezGALTexture *pTexture)
 
ezGALBufferHandle FinalizeBufferInternal (const ezGALBufferCreationDescription &desc, ezGALBuffer *pBuffer)
 

Protected Attributes

ezProxyAllocator m_Allocator
 
ezLocalAllocatorWrapper m_AllocatorWrapper
 
ShaderTable m_Shaders
 
BlendStateTable m_BlendStates
 
DepthStencilStateTable m_DepthStencilStates
 
RasterizerStateTable m_RasterizerStates
 
BufferTable m_Buffers
 
DynamicBufferTable m_DynamicBuffers
 
TextureTable m_Textures
 
ReadbackBufferTable m_ReadbackBuffers
 
ReadbackTextureTable m_ReadbackTextures
 
TextureResourceViewTable m_TextureResourceViews
 
BufferResourceViewTable m_BufferResourceViews
 
SamplerStateTable m_SamplerStates
 
RenderTargetViewTable m_RenderTargetViews
 
TextureUnorderedAccessViewTable m_TextureUnorderedAccessViews
 
BufferUnorderedAccessViewTable m_BufferUnorderedAccessViews
 
SwapChainTable m_SwapChains
 
VertexDeclarationTable m_VertexDeclarations
 
ezHashTable< ezUInt32, ezGALBlendStateHandle, ezHashHelper< ezUInt32 >, ezLocalAllocatorWrapperm_BlendStateTable
 
ezHashTable< ezUInt32, ezGALDepthStencilStateHandle, ezHashHelper< ezUInt32 >, ezLocalAllocatorWrapperm_DepthStencilStateTable
 
ezHashTable< ezUInt32, ezGALRasterizerStateHandle, ezHashHelper< ezUInt32 >, ezLocalAllocatorWrapperm_RasterizerStateTable
 
ezHashTable< ezUInt32, ezGALSamplerStateHandle, ezHashHelper< ezUInt32 >, ezLocalAllocatorWrapperm_SamplerStateTable
 
ezHashTable< ezUInt32, ezGALVertexDeclarationHandle, ezHashHelper< ezUInt32 >, ezLocalAllocatorWrapperm_VertexDeclarationTable
 
ezDynamicArray< DeadObject, ezLocalAllocatorWrapperm_DeadObjects
 
ezGALDeviceCreationDescription m_Description
 
ezGALDeviceCapabilities m_Capabilities
 

Detailed Description

The ezRenderDevice class is the primary interface for interactions with rendering APIs It contains a set of (non-virtual) functions to set state, create resources etc. which rely on API specific implementations provided by protected virtual functions. Redundant state changes are prevented at the platform independent level in the non-virtual functions.

Member Function Documentation

◆ BeginFrame()

void ezGALDevice::BeginFrame ( const ezUInt64  uiAppFrame = 0)

Begins rendering of a frame. This needs to be called first before any rendering function can be called.

Parameters
uiAppFrameFrame index for debugging purposes, has no effect on GetCurrentFrame.

◆ CreateBuffer()

ezGALBufferHandle ezGALDevice::CreateBuffer ( const ezGALBufferCreationDescription description,
ezArrayPtr< const ezUInt8 >  initialData = ezArrayPtr<const ezUInt8>() 
)
Todo:
Platform independent validation (buffer type supported)

◆ CreateRenderTargetView()

ezGALRenderTargetViewHandle ezGALDevice::CreateRenderTargetView ( const ezGALRenderTargetViewCreationDescription description)
Todo:
Platform independent validation

◆ CreateSamplerState()

ezGALSamplerStateHandle ezGALDevice::CreateSamplerState ( const ezGALSamplerStateCreationDescription description)
Todo:
Platform independent validation

◆ CreateSharedTexture()

ezGALTextureHandle ezGALDevice::CreateSharedTexture ( const ezGALTextureCreationDescription description,
ezArrayPtr< ezGALSystemMemoryDescription initialData = {} 
)
Todo:
Platform independent validation (desc width & height < platform maximum, format, etc.)

◆ CreateTexture()

ezGALTextureHandle ezGALDevice::CreateTexture ( const ezGALTextureCreationDescription description,
ezArrayPtr< ezGALSystemMemoryDescription initialData = ezArrayPtr<ezGALSystemMemoryDescription>() 
)
Todo:
Platform independent validation (desc width & height < platform maximum, format, etc.)

◆ CreateVertexDeclaration()

ezGALVertexDeclarationHandle ezGALDevice::CreateVertexDeclaration ( const ezGALVertexDeclarationCreationDescription description)
Todo:
Platform independent validation

◆ EndCommands()

void ezGALDevice::EndCommands ( ezGALCommandEncoder pCommandEncoder)

Stop recording commands on the command encoder.

Parameters
pCommandEncoderMust match the command encoder returned by BeginCommands.

◆ EnqueueFrameSwapChain()

void ezGALDevice::EnqueueFrameSwapChain ( ezGALSwapChainHandle  hSwapChain)

Adds a swap-chain to be used for the next frame. Must be called before or during the ezGALDeviceEvent::BeforeBeginFrame event (BeginFrame function) and repeated for every frame the swap-chain is to be used. This approach guarantees that all swap-chains of a frame acquire and present at the same time, which improves frame pacing.

Parameters
hSwapChainSwap-chain used in this frame. The device will ensure to acquire an image from the swap-chain during BeginFrame and present it when calling EndFrame.

◆ GetCurrentFrame()

EZ_ALWAYS_INLINE ezUInt64 ezGALDevice::GetCurrentFrame ( ) const

The current rendering frame. This is a monotonically increasing number which changes +1 every time EndFrame is called. You can use this to synchronize read/writes between CPU and GPU, see GetSafeFrame.

See also
GetSafeFrame

◆ GetFenceResult()

ezEnum< ezGALAsyncResult > ezGALDevice::GetFenceResult ( ezGALFenceHandle  hFence,
ezTime  timeout = ezTime::MakeZero() 
)

Queries the result of a fence. Fences can never expire as they are just monotonically increasing numbers over time.

Parameters
hFenceThe fence handle to query.
timeoutIf set to > 0, the function will block until the fence is ready or the timeout is reached.
Returns
Returns either Ready or Pending.
See also
ezCommandEncoder::InsertFence

◆ GetOcclusionQueryResult()

EZ_ALWAYS_INLINE ezEnum< ezGALAsyncResult > ezGALDevice::GetOcclusionQueryResult ( ezGALOcclusionHandle  hOcclusion,
ezUInt64 &  out_uiResult 
)

Queries the result of an occlusion query. Should be called every frame until ezGALAsyncResult::Ready is returned.

Parameters
hOcclusionThe occlusion query handle to query.
out_uiResultIf ezGALAsyncResult::Ready is returned, this will be the number of pixels of the occlusion query.
Returns
If ezGALAsyncResult::Expired is returned, the result was in a ready state for more than 4 frames and was thus deleted.
See also
ezCommandEncoder::BeginOcclusionQuery, ezCommandEncoder::EndOcclusionQuery

◆ GetSafeFrame()

EZ_ALWAYS_INLINE ezUInt64 ezGALDevice::GetSafeFrame ( ) const

The latest frame that has been fully executed on the GPU. Whenever you execute any work that requires synchronization between CPU and GPU, remember the GetCurrentFrame result in which the operation was done. When GetSafeFrame reaches this number, you know for sure that the GPU has completed all operations of that frame.

See also
GetCurrentFrame

◆ GetTimestampResult()

EZ_ALWAYS_INLINE ezEnum< ezGALAsyncResult > ezGALDevice::GetTimestampResult ( ezGALTimestampHandle  hTimestamp,
ezTime out_result 
)

Queries the result of a timestamp. Should be called every frame until ezGALAsyncResult::Ready is returned.

Parameters
hTimestampThe timestamp handle to query.
out_resultIf ezGALAsyncResult::Ready is returned, this will be the timestamp at which this handle was inserted into the command encoder.
Returns
If ezGALAsyncResult::Expired is returned, the result was in a ready state for more than 4 frames and was thus deleted.
See also
ezCommandEncoder::InsertTimestamp

◆ LockBuffer()

ezReadbackBufferLock ezGALDevice::LockBuffer ( ezGALReadbackBufferHandle  hReadbackBuffer,
ezArrayPtr< const ezUInt8 > &  out_memory 
)

Tries to lock a readback buffer for reading. Only fails if the handle is invalid.

Parameters
hReadbackBufferThe buffer to lock.
out_memoryIf successful, contains the memory of the buffer. Only allowed to be accessed within the lifetime of the returns lock object.
Returns
Returns the lock. ezReadbackBufferLock::IsValid needs to be called to ensure the locking was successful.

◆ LockTexture()

ezReadbackTextureLock ezGALDevice::LockTexture ( ezGALReadbackTextureHandle  hReadbackTexture,
const ezArrayPtr< const ezGALTextureSubresource > &  subResources,
ezDynamicArray< ezGALSystemMemoryDescription > &  out_memory 
)

Tries to lock a readback texture for reading. Only fails if the handle is invalid.

Parameters
hReadbackTextureThe texture to lock.
subResourcesThe sub-resources that should to be locked.
out_memoryIf successful, contains the memory locations of each sub-resource. Only allowed to be accessed within the lifetime of the returns lock object.
Returns
Returns the lock. ezReadbackTextureLock::IsValid needs to be called to ensure the locking was successful.

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