ezEngine  Milestone 7
ezGPUResourcePool Class Reference

This class serves as a pool for GPU related resources (e.g. buffers and textures required for rendering). Note that the functions creating and returning render targets are thread safe (by using a mutex). More...

#include <GPUResourcePool.h>

Public Member Functions

ezGALTextureHandle GetRenderTarget (const ezGALTextureCreationDescription &TextureDesc)
 Returns a render target handle for the given texture description Note that you should return the handle to the pool and never destroy it directly with the device.
 
ezGALTextureHandle GetRenderTarget (ezUInt32 uiWidth, ezUInt32 uiHeight, ezGALResourceFormat::Enum eFormat)
 Convenience functions which creates a texture description fit for a 2d render target without a mip chains.
 
void ReturnRenderTarget (ezGALTextureHandle hRenderTarget)
 Returns a render target to the pool so other consumers can use it. Note that targets which are returned to the pool are susceptible to destruction due to garbage collection.
 
void RunGC ()
 Tries to free resources which are currently in the pool. Triggered automatically due to allocation number / size thresholds but can be triggered manually (e.g. after editor window resize)
 

Static Public Member Functions

static ezGPUResourcePoolGetDefaultInstance ()
 
static void SetDefaultInstance (ezGPUResourcePool *pDefaultInstance)
 

Protected Member Functions

void CheckAndPotentiallyRunGC ()
 
void UpdateMemoryStats () const
 

Protected Attributes

ezUInt64 m_uiMemoryThresholdForGC
 
ezUInt64 m_uiCurrentlyAllocatedMemory
 
ezUInt32 m_uiNumAllocationsThresholdForGC
 
ezUInt32 m_uiNumAllocationsSinceLastGC
 
ezDynamicArray
< ezGALTextureHandle
m_AvailableTextures
 
ezDynamicArray
< ezGALTextureHandle
m_TexturesInUse
 
ezMutex m_Lock
 
ezGALDevicem_pDevice
 

Static Private Attributes

static ezGPUResourcePools_pDefaultInstance = nullptr
 

Detailed Description

This class serves as a pool for GPU related resources (e.g. buffers and textures required for rendering). Note that the functions creating and returning render targets are thread safe (by using a mutex).


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