Nameless Engine
|
#include <ShaderTextureResourceBindingManager.h>
Public Member Functions | |
ShaderTextureResourceBindingManager (const ShaderTextureResourceBindingManager &)=delete | |
ShaderTextureResourceBindingManager & | operator= (const ShaderTextureResourceBindingManager &)=delete |
~ShaderTextureResourceBindingManager () | |
std::variant< ShaderTextureResourceBindingUniquePtr, Error > | createShaderTextureResource (const std::string &sShaderResourceName, const std::string &sResourceAdditionalInfo, const std::unordered_set< Pipeline * > &pipelinesToUse, std::unique_ptr< TextureHandle > pTextureToUse) |
std::pair< std::recursive_mutex, std::unordered_map< ShaderTextureResourceBinding *, std::unique_ptr< ShaderTextureResourceBinding > > > * | getResources () |
Private Member Functions | |
ShaderTextureResourceBindingManager (Renderer *pRenderer) | |
std::variant< ShaderTextureResourceBindingUniquePtr, Error > | handleResourceCreation (std::variant< std::unique_ptr< ShaderTextureResourceBinding >, Error > result) |
void | destroyResource (ShaderTextureResourceBinding *pResourceToDestroy) |
Private Attributes | |
Renderer * | pRenderer = nullptr |
std::pair< std::recursive_mutex, std::unordered_map< ShaderTextureResourceBinding *, std::unique_ptr< ShaderTextureResourceBinding > > > | mtxShaderTextureResources |
Friends | |
class | Renderer |
class | ShaderTextureResourceBindingUniquePtr |
Owns all shader resources that references texture resource.
ShaderResourceBase::onAfterAllPipelinesRefreshedResources
from pipeline manager (to avoid running this function on not fully initialized shader resources or shader resources that are being destroyed because this could happen if instead of this manager we just had some notifications on ShaderResourceBase
constructor/destructor). ne::ShaderTextureResourceBindingManager::~ShaderTextureResourceBindingManager | ( | ) |
Makes sure that no resource exists.
|
private |
Initializes manager.
pRenderer |
std::variant< ShaderTextureResourceBindingUniquePtr, Error > ne::ShaderTextureResourceBindingManager::createShaderTextureResource | ( | const std::string & | sShaderResourceName, |
const std::string & | sResourceAdditionalInfo, | ||
const std::unordered_set< Pipeline * > & | pipelinesToUse, | ||
std::unique_ptr< TextureHandle > | pTextureToUse | ||
) |
Creates a new render-specific shader resource.
sShaderResourceName | Name of the resource we are referencing (should be exactly the same as the resource name written in the shader file we are referencing). |
sResourceAdditionalInfo | Additional text that we will append to created resource name (used for logging). |
pipelinesToUse | Pipelines that use shader/parameters we are referencing. |
pTextureToUse | Texture that should be binded to a descriptor. |
|
private |
Called by shader texture resource unique pointers to destroy the specified resource because it will no longer be used.
pResourceToDestroy | Resource to destroy. |
std::pair< std::recursive_mutex, std::unordered_map< ShaderTextureResourceBinding *, std::unique_ptr< ShaderTextureResourceBinding > > > * ne::ShaderTextureResourceBindingManager::getResources | ( | ) |
Returns all shader resources that reference textures.
|
private |
Processes resource creation.
result | Result of resource creation function. |
|
private |
Shader texture resources.
|
private |
Renderer that owns this manager.