Nameless Engine
Loading...
Searching...
No Matches
ne::PipelineManager::ComputePipelines Struct Reference

Classes

struct  Resources
 

Public Member Functions

 ComputePipelines (const ComputePipelines &)=delete
 
ComputePipelinesoperator= (const ComputePipelines &)=delete
 
std::variant< PipelineSharedPtr, ErrorgetComputePipelineForShader (PipelineManager *pPipelineManager, ComputeShaderInterface *pComputeShaderInterface)
 
std::optional< ErroronPipelineNoLongerUsedByComputeShaderInterface (const std::string &sComputeShaderName, ComputeShaderInterface *pComputeShaderInterface)
 
std::optional< ErrorqueueShaderExecutionOnGraphicsQueue (ComputeShaderInterface *pComputeShaderInterface)
 
size_t getComputePipelineCount ()
 
std::pair< std::recursive_mutex *, QueuedForExecutionComputeShaders * > getComputeShadersForGraphicsQueueExecution ()
 

Static Private Member Functions

static std::optional< ErrorqueueComputeShaderInterfaceForExecution (std::unordered_map< Pipeline *, std::unordered_set< ComputeShaderInterface * > > &pipelineShaders, ComputeShaderInterface *pComputeShaderInterface)
 

Private Attributes

std::pair< std::recursive_mutex, ResourcesmtxResources
 

Detailed Description

Groups information about compute pipelines.

Member Function Documentation

◆ getComputePipelineCount()

size_t ne::PipelineManager::ComputePipelines::getComputePipelineCount ( )

Returns the total number of existing compute pipelines.

Returns
Number of compute pipelines.

◆ getComputePipelineForShader()

std::variant< PipelineSharedPtr, Error > ne::PipelineManager::ComputePipelines::getComputePipelineForShader ( PipelineManager pPipelineManager,
ComputeShaderInterface pComputeShaderInterface 
)

Look for already created pipeline that uses the specified shader and returns it, otherwise creates a new pipeline.

Remarks
If creating a new pipeline, loads the specified shader from disk into the memory, it will be released from the memory once the pipeline object is destroyed (not the shared pointer) and no other object is using it.
Parameters
pPipelineManagerPipeline manager.
pComputeShaderInterfaceCompute shader interface to add.
Returns
Error if something went wrong, otherwise compute pipeline.

◆ getComputeShadersForGraphicsQueueExecution()

std::pair< std::recursive_mutex *, QueuedForExecutionComputeShaders * > ne::PipelineManager::ComputePipelines::getComputeShadersForGraphicsQueueExecution ( )
inline

Returns all compute shaders and their pipelines to be executed on the graphics queue.

Warning
Do not delete (free) returned pointers.
Returns
Shaders and pipelines.

◆ onPipelineNoLongerUsedByComputeShaderInterface()

std::optional< Error > ne::PipelineManager::ComputePipelines::onPipelineNoLongerUsedByComputeShaderInterface ( const std::string &  sComputeShaderName,
ComputeShaderInterface pComputeShaderInterface 
)

Removes the specified compute shader interface and if no other interface references the compute pipeline (that the shader used) also destroys the pipeline.

Remarks
If you used getComputePipelineForShader to get a compute pipeline for your shader you don't need to call this function as it will be automatically called by PipelineSharedPtr's destructor.
Parameters
sComputeShaderNameName of the compute shader that compute pipeline uses.
pComputeShaderInterfaceCompute shader interface to remove.
Returns
Error if something went wrong.

◆ queueComputeShaderInterfaceForExecution()

std::optional< Error > ne::PipelineManager::ComputePipelines::queueComputeShaderInterfaceForExecution ( std::unordered_map< Pipeline *, std::unordered_set< ComputeShaderInterface * > > &  pipelineShaders,
ComputeShaderInterface pComputeShaderInterface 
)
staticprivate

Adds a compute shader interface to the specified map to be executed.

Warning
Expects that mtxResources is locked during the function call.
Parameters
pipelineShadersMap to add the new interface to.
pComputeShaderInterfaceInterface to add.
Returns
Error if something went wrong.

◆ queueShaderExecutionOnGraphicsQueue()

std::optional< Error > ne::PipelineManager::ComputePipelines::queueShaderExecutionOnGraphicsQueue ( ComputeShaderInterface pComputeShaderInterface)

Adds a compute shader interface to be executed on the graphics queue according to shader's execution stage and group.

Remarks
Added shader will be executed only once, if you want your shader to be executed again you would need to call this function again but later after a frame was submitted (if you call it right now nothing will happen as it's already queued).
Parameters
pComputeShaderInterfaceCompute shader interface to queue for execution.
Returns
Error if something went wrong.

Member Data Documentation

◆ mtxResources

std::pair<std::recursive_mutex, Resources> ne::PipelineManager::ComputePipelines::mtxResources
private

Pipeline data.


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