Nameless Engine
|
#include <PipelineManager.h>
Classes | |
struct | ComputePipelines |
struct | GraphicsPipelineRegistry |
struct | ShaderPipelines |
Public Member Functions | |
PipelineManager (Renderer *pRenderer) | |
virtual | ~PipelineManager () |
PipelineManager (const PipelineManager &)=delete | |
PipelineManager & | operator= (const PipelineManager &)=delete |
DelayedPipelineResourcesCreation | clearGraphicsPipelinesInternalResourcesAndDelayRestoring () |
std::variant< PipelineSharedPtr, Error > | getGraphicsPipelineForMaterial (std::unique_ptr< PipelineCreationSettings > pPipelineCreationSettings, Material *pMaterial) |
std::pair< std::recursive_mutex *, QueuedForExecutionComputeShaders * > | getComputeShadersForGraphicsQueueExecution () |
std::pair< std::recursive_mutex, GraphicsPipelineRegistry > * | getGraphicsPipelines () |
size_t | getCurrentGraphicsPipelineCount () |
size_t | getCurrentComputePipelineCount () |
Renderer * | getRenderer () const |
Private Member Functions | |
std::optional< Error > | releaseInternalGraphicsPipelinesResources () |
std::optional< Error > | restoreInternalGraphicsPipelinesResources () |
std::variant< PipelineSharedPtr, Error > | createGraphicsPipelineForMaterial (std::unordered_map< std::string, ShaderPipelines > &pipelines, const std::string &sShaderNames, const std::set< ShaderMacro > ¯osToUse, std::unique_ptr< PipelineCreationSettings > pPipelineCreationSettings, Material *pMaterial) |
void | onPipelineNoLongerUsedByMaterial (const std::string &sPipelineIdentifier) |
void | onPipelineNoLongerUsedByComputeShaderInterface (const std::string &sComputeShaderName, ComputeShaderInterface *pComputeShaderInterface) |
std::variant< PipelineSharedPtr, Error > | findOrCreatePipeline (std::unordered_map< std::string, ShaderPipelines > &pipelines, const std::string &sKeyToLookFor, const std::set< ShaderMacro > ¯osToLookFor, std::unique_ptr< PipelineCreationSettings > pPipelineCreationSettings, Material *pMaterial) |
Private Attributes | |
std::pair< std::recursive_mutex, GraphicsPipelineRegistry > | mtxGraphicsPipelines |
ComputePipelines | computePipelines |
Renderer * | pRenderer = nullptr |
Friends | |
class | Pipeline |
class | DelayedPipelineResourcesCreation |
class | ComputeShaderInterface |
Base class for managing render specific pipelines.
ne::PipelineManager::PipelineManager | ( | Renderer * | pRenderer | ) |
Creates a new pipeline manager.
pRenderer | Renderer that owns this pipeline manager. |
|
virtual |
Checks that there are no existing pipelines left.
DelayedPipelineResourcesCreation ne::PipelineManager::clearGraphicsPipelinesInternalResourcesAndDelayRestoring | ( | ) |
Returns a RAII object that once acquired waits for the GPU to finish work up to this point, pauses the rendering, releases all internal resources from all graphics pipelines, then in destructor restores them.
|
private |
Assigns vertex and pixel shaders to create a render specific graphics pipeline (for usual rendering).
pipelines | Pipelines of specific type to look in. |
sShaderNames | Shader or shaders (map key value) for target pipeline. |
macrosToUse | Macros that are set (can be only vertex or combined). |
pPipelineCreationSettings | Settings that determine pipeline usage and usage details. |
pMaterial | Material that requests the pipeline. |
|
private |
Looks for a pipeline and returns it if found, otherwise creates and return it.
pipelines | Pipelines of specific type to look in. |
sKeyToLookFor | Shader or shaders (map key value) for target pipeline. |
macrosToLookFor | Macros that are set (can be only vertex or combined). |
pPipelineCreationSettings | Settings that determine pipeline usage and usage details. |
pMaterial | Material that requests the pipeline. |
|
inline |
Returns all compute shaders and their pipelines to be executed on the graphics queue.
size_t ne::PipelineManager::getCurrentComputePipelineCount | ( | ) |
Returns the total number of currently existing compute pipelines.
size_t ne::PipelineManager::getCurrentGraphicsPipelineCount | ( | ) |
Returns the total number of currently existing graphics pipelines.
std::variant< PipelineSharedPtr, Error > ne::PipelineManager::getGraphicsPipelineForMaterial | ( | std::unique_ptr< PipelineCreationSettings > | pPipelineCreationSettings, |
Material * | pMaterial | ||
) |
Look for already created pipeline that uses the specified shaders and settings and returns it, otherwise creates a new pipeline.
pPipelineCreationSettings | Settings that determine pipeline usage and usage details. |
pMaterial | Material that requests the pipeline. |
|
inline |
Returns all vertex/pixel shaders and their graphics pipelines.
Renderer * ne::PipelineManager::getRenderer | ( | ) | const |
Returns renderer that owns this pipeline manager.
|
private |
Called from a pipeline when a compute shader interface is no longer using a pipeline.
sComputeShaderName | Name of the compute shader that the pipeline uses. |
pComputeShaderInterface | Compute shader interface that stopped using the pipeline. |
|
private |
Called from a pipeline when a material is no longer using a pipeline (for ex. because changing shaders).
sPipelineIdentifier | Pipeline identifier. |
|
private |
Releases internal resources (such as root signature, internal pipeline, etc.) from all created graphics pipelines.
|
private |
Creates internal resources for all created graphics pipelines using their current configuration.
|
private |
Stores all compute pipelines.
|
private |
Groups all graphics pipelines.
|
private |
Do not delete (free) this pointer. Renderer that owns this pipeline manager.