Nameless Engine
|
#include <PipelineManager.h>
Classes | |
struct | ComputePipelines |
Public Member Functions | |
PipelineManager (Renderer *pRenderer) | |
virtual | ~PipelineManager () |
PipelineManager (const PipelineManager &)=delete | |
PipelineManager & | operator= (const PipelineManager &)=delete |
std::optional< Error > | bindBuffersToAllVulkanPipelinesIfUsed (const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &vResources, const std::string &sShaderResourceName, VkDescriptorType descriptorType) |
std::optional< Error > | bindImageToAllVulkanPipelinesIfUsed (GpuResource *pImageResourceToBind, const std::string &sShaderResourceName, VkDescriptorType descriptorType, VkImageLayout imageLayout, VkSampler pSampler) |
std::optional< Error > | recreateGraphicsPipelinesResources () |
std::variant< PipelineSharedPtr, Error > | getGraphicsPipelineForMaterial (std::unique_ptr< PipelineConfiguration > pPipelineConfiguration, 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::variant< PipelineSharedPtr, Error > | createGraphicsPipelineForMaterial (std::unordered_map< std::string, ShaderPipelines > &pipelines, const std::string &sShaderNames, const std::set< ShaderMacro > ¯osToUse, std::unique_ptr< PipelineConfiguration > pPipelineConfiguration, 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< PipelineConfiguration > pPipelineConfiguration, Material *pMaterial) |
Private Attributes | |
std::pair< std::recursive_mutex, GraphicsPipelineRegistry > | mtxGraphicsPipelines |
ComputePipelines | computePipelines |
Renderer *const | 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.
std::optional< Error > ne::PipelineManager::bindBuffersToAllVulkanPipelinesIfUsed | ( | const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> & | vResources, |
const std::string & | sShaderResourceName, | ||
VkDescriptorType | descriptorType | ||
) |
Binds the specified GPU resources (buffers, not images) to all Vulkan pipelines that use the specified shader resource.
vResources | Resources to bind. |
sShaderResourceName | Name of the shader resource (name from shader code) to bind to. |
descriptorType | Type of the descriptor to bind. |
std::optional< Error > ne::PipelineManager::bindImageToAllVulkanPipelinesIfUsed | ( | GpuResource * | pImageResourceToBind, |
const std::string & | sShaderResourceName, | ||
VkDescriptorType | descriptorType, | ||
VkImageLayout | imageLayout, | ||
VkSampler | pSampler | ||
) |
Binds the specified GPU image (not buffer) to all Vulkan pipelines that use the specified shader resource.
pImageResourceToBind | Image to bind. |
sShaderResourceName | Name of the shader resource (name from shader code) to bind to. |
descriptorType | Type of the descriptor to bind. |
imageLayout | Layout of the image. |
pSampler | Sampler to use for the image. |
|
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). |
pPipelineConfiguration | 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). |
pPipelineConfiguration | 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< PipelineConfiguration > | pPipelineConfiguration, |
Material * | pMaterial | ||
) |
Look for already created pipeline that uses the specified shaders and settings and returns it, otherwise creates a new pipeline.
pPipelineConfiguration | 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. |
std::optional< Error > ne::PipelineManager::recreateGraphicsPipelinesResources | ( | ) |
Releases all internal resources from all graphics graphics pipelines and then recreates them to reference new resources/parameters from the renderer.
|
private |
Stores all compute pipelines.
|
private |
Groups all graphics pipelines.
|
private |
Do not delete (free) this pointer. Renderer that owns this pipeline manager.