class render::GpuResourcePool

Contains a pool of textures and buffers meant to accommodate reuse of such resources for the main purpose of using them as write targets on the GPU.

Public

Constructors

GpuResourcePool

GpuResourcePool()

Methods

Get

Attempts to find the unused render texture with the specified parameters in the pool, or creates a new texture otherwise.

desc
Descriptor structure that describes what kind of texture to retrieve.

Get

void Get(SPtr<PooledRenderTexture> &texture, const PooledRenderTextureCreateInformation &desc)

Attempts to find the unused render texture with the specified parameters in the pool, or creates a new texture otherwise.

Use this variant of the method if you are already holding a reference to a pooled texture which you want to reuse - this is more efficient than releasing the old texture and calling the other Get() variant.

texture
Existing reference to a pooled texture that you would prefer to reuse. If it matches the provided descriptor the system will return the unchanged texture, otherwise it will try to find another unused texture, or allocate a new one. New value will be output through this parameter.
desc
Descriptor structure that describes what kind of texture to retrieve.

Get

Attempts to find the unused storage buffer with the specified parameters in the pool, or creates a new buffer otherwise.

desc
Descriptor structure that describes what kind of buffer to retrieve.

Get

void Get(SPtr<PooledStorageBuffer> &buffer, const POOLED_STORAGE_BUFFER_DESC &desc)

Attempts to find the unused storage buffer with the specified parameters in the pool, or creates a new buffer otherwise.

Use this variant of the method if you are already holding a reference to a pooled buffer which you want to reuse - this is more efficient than releasing the old buffer and calling the other Get() variant.

buffer
Existing reference to a pooled buffer that you would prefer to reuse. If it matches the provided descriptor the system will return the unchanged buffer, otherwise it will try to find another unused buffer, or allocate a new one. New value will be output through this parameter.
desc
Descriptor structure that describes what kind of buffer to retrieve.

Update

void Update()

Lets the pool know that another frame has passed.

Prune

void Prune(u32 age)

Destroys all unreferenced resources with that were last used frames ago.

Specify 0 to destroy all unreferenced resources.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

staticMatches

static bool Matches(const SPtr<Texture> &texture, const PooledRenderTextureCreateInformation &desc)

Checks does the provided texture match the parameters.

texture
Texture to check.
desc
Descriptor structure that describes what kind of texture to match.

Returns: True if the texture matches the descriptor, false otherwise.

staticMatches

static bool Matches(const SPtr<GpuBuffer> &buffer, const POOLED_STORAGE_BUFFER_DESC &desc)

Checks does the provided buffer match the parameters.

buffer
Buffer to check.
desc
Descriptor structure that describes what kind of buffer to match.

Returns: True if the buffer matches the descriptor, false otherwise.

Fields

mDevice

SPtr<GpuDevice> mDevice

mTextures

TArray<SPtr<PooledRenderTexture>> mTextures

mBuffers

TArray<SPtr<PooledStorageBuffer>> mBuffers

mCurrentFrame

u32 mCurrentFrame