Nameless Engine
|
#include <GlobalShaderResourceBindingManager.h>
Public Member Functions | |
std::optional< Error > | createGlobalShaderResourceBindingResourcePerFrame (const std::string &sShaderResourceName, std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> vResourcesToBind) |
std::optional< Error > | createGlobalShaderResourceBindingSingleResource (const std::string &sShaderResourceName, GpuResource *pResourceToBind) |
~GlobalShaderResourceBindingManager () | |
Private Member Functions | |
GlobalShaderResourceBindingManager (PipelineManager *pPipelineManager) | |
std::optional< Error > | onNewGraphicsPipelineCreated (Pipeline *pNewPipeline) |
std::optional< Error > | onAllGraphicsPipelinesRecreatedInternalResources () |
std::optional< Error > | registerNewBinding (GlobalShaderResourceBinding *pBinding) |
void | unregisterBinding (GlobalShaderResourceBinding *pBinding) |
Private Attributes | |
std::pair< std::recursive_mutex, std::unordered_set< GlobalShaderResourceBinding * > > | mtxActiveBindings |
PipelineManager *const | pPipelineManager = nullptr |
Friends | |
class | Renderer |
class | PipelineManager |
class | GlobalShaderResourceBinding |
Manages bindings of GPU resources as global shader resources (that don't change on a per-object basis).
ne::GlobalShaderResourceBindingManager::~GlobalShaderResourceBindingManager | ( | ) |
Makes sure no active binding exists.
|
private |
Initializes a new manager.
pPipelineManager | Manager used to interact with pipelines. |
std::optional< Error > ne::GlobalShaderResourceBindingManager::createGlobalShaderResourceBindingResourcePerFrame | ( | const std::string & | sShaderResourceName, |
std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> | vResourcesToBind | ||
) |
Creates a new global shader resource binding (that don't change on a per-object basis) and assigns it to the specified resources (one resource per frame). When resources will be destroyed the binding will also be removed.
cbuffer
shader resource you need to pass a resource that already has a CBV bound and in Vulkan in order to bind a uniform
you need to make sure that your resource was created with the "uniform" hint/flag.sShaderResourceName | Name of the shader resource (name from shader code) to bind the resources. |
vResourcesToBind | Resources to bind to pipelines. |
std::optional< Error > ne::GlobalShaderResourceBindingManager::createGlobalShaderResourceBindingSingleResource | ( | const std::string & | sShaderResourceName, |
GpuResource * | pResourceToBind | ||
) |
Creates a new global shader resource binding (that don't change on a per-object basis) and assigns it to the specified resources. When resources will be destroyed the binding will also be removed.
sShaderResourceName | Name of the shader resource (name from shader code) to bind the resource. |
pResourceToBind | Resources to bind to pipelines. |
|
private |
Called by pipeline manager after all graphics pipelines re-created their internal state to re-bind all global shader resources to all pipelines.
|
private |
Should be called by bindings upon construction.
Registers the binding and binds it to all graphics pipelines that might need that binding.
pBinding | Binding to register. |
|
private |
Should be called by bindings in their destructor.
Unregisters a binding that was previously registered using registerNewBinding.
pBinding | Binding to unregister. |
|
private |
Set of all currently existing (active) bindings.
|
private |
Manager used to interact with pipelines.