Nameless Engine
Loading...
Searching...
No Matches
ne::HlslGlobalShaderResourceBinding Class Reference

#include <HlslGlobalShaderResourceBinding.h>

Inheritance diagram for ne::HlslGlobalShaderResourceBinding:
ne::GlobalShaderResourceBinding

Protected Member Functions

 HlslGlobalShaderResourceBinding (GlobalShaderResourceBindingManager *pManager, const std::string &sShaderResourceName, const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &vResourcesToBind)
 
virtual std::optional< ErrorbindToPipelines (Pipeline *pSpecificPipeline) override
 
- Protected Member Functions inherited from ne::GlobalShaderResourceBinding
 GlobalShaderResourceBinding (GlobalShaderResourceBindingManager *pManager, const std::string &sShaderResourceName, const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &vResourcesToBind)
 
virtual std::optional< ErrorbindToPipelines (Pipeline *pSpecificPipeline)=0
 
void unregisterBinding ()
 
const std::string & getShaderResourceName () const
 
std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> getBindedResources () const
 

Static Private Member Functions

static std::optional< ErrorbindResourceToGraphicsPipelines (PipelineManager *pPipelineManager, const std::function< std::optional< Error >(Pipeline *pPipeline)> &onBind)
 
static std::optional< ErrorbindResourcesToPipeline (const std::array< DirectXResource *, FrameResourceManager::getFrameResourceCount()> &vResourcesToBind, DirectXDescriptorType bindingType, Pipeline *pPipeline, const std::string &sShaderResourceName)
 

Friends

class GlobalShaderResourceBinding
 

Additional Inherited Members

- Public Member Functions inherited from ne::GlobalShaderResourceBinding
 GlobalShaderResourceBinding (const GlobalShaderResourceBinding &)=delete
 
GlobalShaderResourceBindingoperator= (const GlobalShaderResourceBinding &)=delete
 
 GlobalShaderResourceBinding (GlobalShaderResourceBinding &&)=delete
 
GlobalShaderResourceBindingoperator= (GlobalShaderResourceBinding &&)=delete
 
- Static Protected Member Functions inherited from ne::GlobalShaderResourceBinding
static std::optional< Errorcreate (Renderer *pRenderer, GlobalShaderResourceBindingManager *pManager, const std::string &sShaderResourceName, const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &vResourcesToBind)
 

Detailed Description

Used for binding GPU resources as "global" HLSL shader resources (that don't change on a per-object basis).

Constructor & Destructor Documentation

◆ HlslGlobalShaderResourceBinding()

ne::HlslGlobalShaderResourceBinding::HlslGlobalShaderResourceBinding ( GlobalShaderResourceBindingManager pManager,
const std::string &  sShaderResourceName,
const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &  vResourcesToBind 
)
protected

Initializes a new object, does not trigger bindToPipelines.

Parameters
pManagerManager that creates this object.
sShaderResourceNameName of the shader resource (name from shader code) to bind the resources.
vResourcesToBindResources to bind to pipelines. This can be the same resource for all frame resources (for example a texture) or a separate resource per frame (can be used for some CPU-write resources).

Member Function Documentation

◆ bindResourcesToPipeline()

std::optional< Error > ne::HlslGlobalShaderResourceBinding::bindResourcesToPipeline ( const std::array< DirectXResource *, FrameResourceManager::getFrameResourceCount()> &  vResourcesToBind,
DirectXDescriptorType  bindingType,
Pipeline pPipeline,
const std::string &  sShaderResourceName 
)
staticprivate

Binds the specified resources to the specified pipeline as a global SRV binding.

Parameters
vResourcesToBindResource per frame to bind.
bindingTypeType of the binding to create.
pPipelinePipeline to bind to.
sShaderResourceNameName of the shader resource to bind to.
Returns

◆ bindResourceToGraphicsPipelines()

std::optional< Error > ne::HlslGlobalShaderResourceBinding::bindResourceToGraphicsPipelines ( PipelineManager pPipelineManager,
const std::function< std::optional< Error >(Pipeline *pPipeline)> &  onBind 
)
staticprivate

Specify a callback that will be called for each graphics pipeline to bind your resource.

Parameters
pPipelineManagerManager to query graphics pipelines.
onBindCalled on each pipeline.
Returns
Error if something went wrong.

◆ bindToPipelines()

std::optional< Error > ne::HlslGlobalShaderResourceBinding::bindToPipelines ( Pipeline pSpecificPipeline)
overrideprotectedvirtual

Binds the resource to a specific pipeline or all graphics pipelines that use it.

Parameters
pSpecificPipelinenullptr if need to bind to all graphics pipelines, otherwise a valid pointer to bind only to that pipeline.
Returns
Error if something went wrong.

Implements ne::GlobalShaderResourceBinding.


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