CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RendererTextureManager Class Reference

A manager class that creates, manages and handles GPU images for images and textures used by the renderer. More...

#include <CeresEngine/Renderer/Resources/RendererTexture.hpp>

Classes

struct  TextureInfo
 

Public Member Functions

 RendererTextureManager (Renderer &renderer, GPUDevice &device)
 Creates a new instance of the RendererTextureManager.
 
 ~RendererTextureManager ()
 Destroys the RendererTextureManager and releases all GPU resources managed and allocated by it.
 
void prepare ()
 
GPUImagePtr getImage (const TexturePtr &image)
 Tries to locate a GPU Image for the given image.
 
RendererTexturePtr get (const TexturePtr &image)
 Gets a renderer texture object.
 
GPUResourceSetgetResourceSet () const
 Gets the resource set for the global texture table.
 
RenderergetRenderer () const
 The renderer that owns this manager instance.
 

Private Member Functions

RendererTexturePtr getOrCreate (const TexturePtr &image)
 Gets an existing or creates a new renderer texture instance for the given engine image.
 
RendererTexturePtr create (const TexturePtr &image)
 Creates a new renderer texture instance for the given engine image.
 
void notifyDestroy (RendererTexture *texture) noexcept
 Notifies the manager that the renderer texture is being destroyed.
 

Private Attributes

RenderermRenderer
 The renderer that owns this manager instance.
 
GPUDevicemDevice
 The device to which the textures will be uploaded to.
 
HashMap< Texture *, TextureInfomTexturesByResource
 A map that holds texture information for each engine texture used by the renderer.
 
Vector< RendererTexture * > mTextures
 A vector that holds all renderer texture instances.
 
bool mDirty = false
 Determines if the bindless resource set set is empty.
 
GPUResourceSetDescriptor mResourceSetDescriptor
 
GPUResourceSetPtr mResourceSet
 A pointer to the global texture resource set.
 

Friends

class RendererTexture
 

Detailed Description

A manager class that creates, manages and handles GPU images for images and textures used by the renderer.

Constructor & Destructor Documentation

◆ RendererTextureManager()

CeresEngine::RendererTextureManager::RendererTextureManager ( Renderer renderer,
GPUDevice device 
)
explicit

Creates a new instance of the RendererTextureManager.

◆ ~RendererTextureManager()

CeresEngine::RendererTextureManager::~RendererTextureManager ( )

Destroys the RendererTextureManager and releases all GPU resources managed and allocated by it.

Member Function Documentation

◆ create()

RendererTexturePtr CeresEngine::RendererTextureManager::create ( const TexturePtr image)
private

Creates a new renderer texture instance for the given engine image.

◆ get()

RendererTexturePtr CeresEngine::RendererTextureManager::get ( const TexturePtr image)
inline

Gets a renderer texture object.

The renderer texture is a renderer usable representation of an image resource. This exture begins in the pending state but will eventually be uploaded to GPU and be usable by renderables and other objects in the renderer scene.

If a renderer texture object for the given image resource already exists, the existing instance is returned to the user. If no existing instance is found, a new one is created and returned to the user.

Parameters
imageThe image resource to get or create a new renderer texture for.

◆ getImage()

GPUImagePtr CeresEngine::RendererTextureManager::getImage ( const TexturePtr image)

Tries to locate a GPU Image for the given image.

If no such image exists, the manager might schedule an asynchronous upload of data to the GPU and return once the GPU image becomes available.

Parameters
imageThe image to return a GPU image resource for.
Returns
A GPU Image for the image“. If no such GPU image exists, the manager might returnnullptr` until the GPU data upload is complete.

◆ getOrCreate()

RendererTexturePtr CeresEngine::RendererTextureManager::getOrCreate ( const TexturePtr image)
private

Gets an existing or creates a new renderer texture instance for the given engine image.

◆ getRenderer()

Renderer & CeresEngine::RendererTextureManager::getRenderer ( ) const
inline

The renderer that owns this manager instance.

◆ getResourceSet()

GPUResourceSet & CeresEngine::RendererTextureManager::getResourceSet ( ) const
inline

Gets the resource set for the global texture table.

This is a resource that binds all loaded textures and allows dynamically indexing the resources from the GPU.

◆ notifyDestroy()

void CeresEngine::RendererTextureManager::notifyDestroy ( RendererTexture texture)
privatenoexcept

Notifies the manager that the renderer texture is being destroyed.

◆ prepare()

void CeresEngine::RendererTextureManager::prepare ( )

Friends And Related Symbol Documentation

◆ RendererTexture

Member Data Documentation

◆ mDevice

GPUDevice& CeresEngine::RendererTextureManager::mDevice
private

The device to which the textures will be uploaded to.

◆ mDirty

bool CeresEngine::RendererTextureManager::mDirty = false
private

Determines if the bindless resource set set is empty.

◆ mRenderer

Renderer& CeresEngine::RendererTextureManager::mRenderer
private

The renderer that owns this manager instance.

◆ mResourceSet

GPUResourceSetPtr CeresEngine::RendererTextureManager::mResourceSet
private

A pointer to the global texture resource set.

◆ mResourceSetDescriptor

GPUResourceSetDescriptor CeresEngine::RendererTextureManager::mResourceSetDescriptor
private

◆ mTextures

Vector<RendererTexture*> CeresEngine::RendererTextureManager::mTextures
private

A vector that holds all renderer texture instances.

The order they appear in the vector corresponds to their IDs and positions in the bindless resource set.

◆ mTexturesByResource

HashMap<Texture*, TextureInfo> CeresEngine::RendererTextureManager::mTexturesByResource
private

A map that holds texture information for each engine texture used by the renderer.


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