|
Nameless Engine
|
#include <VulkanPipeline.h>
Classes | |
| struct | InternalResources |
Public Member Functions | |
| VulkanPipeline (const VulkanPipeline &)=delete | |
| VulkanPipeline & | operator= (const VulkanPipeline &)=delete |
| std::optional< Error > | bindBuffersIfUsed (const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> &vResources, const std::string &sShaderResourceName, VkDescriptorType descriptorType) |
| std::optional< Error > | bindImageIfUsed (GpuResource *pImageResourceToBind, std::string_view sShaderResourceName, VkDescriptorType descriptorType, VkImageLayout imageLayout, VkSampler pSampler) |
| std::pair< std::recursive_mutex, InternalResources > * | getInternalResources () |
Public Member Functions inherited from ne::Pipeline | |
| Pipeline (const Pipeline &)=delete | |
| Pipeline & | operator= (const Pipeline &)=delete |
| std::variant< size_t, Error > | getUintConstantOffset (const std::string &sConstantName) |
| std::pair< std::mutex, std::unordered_set< Material * > > * | getMaterialsThatUseThisPipeline () |
| std::string | getPipelineIdentifier () const |
| Renderer * | getRenderer () const |
| const PipelineConfiguration * | getConfiguration () const |
| std::pair< std::mutex, std::optional< ShaderConstantsData > > * | getShaderConstants () |
Public Member Functions inherited from ne::ShaderUser | |
| ShaderUser (const ShaderUser &)=delete | |
| ShaderUser & | operator= (const ShaderUser &)=delete |
Static Public Member Functions | |
| static std::variant< std::shared_ptr< VulkanPipeline >, Error > | createGraphicsPipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, std::unique_ptr< PipelineConfiguration > pPipelineConfiguration) |
| static std::variant< std::shared_ptr< VulkanPipeline >, Error > | createComputePipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, const std::string &sComputeShaderName) |
Static Public Member Functions inherited from ne::Pipeline | |
| static std::string | combineShaderNames (std::string_view sVertexShaderName, std::string_view sPixelShaderName, std::string_view sComputeShaderName="") |
Protected Member Functions | |
| virtual std::optional< Error > | recreateInternalResources () override |
Protected Member Functions inherited from ne::Pipeline | |
| Pipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, std::unique_ptr< PipelineConfiguration > pPipelineConfiguration) | |
| virtual std::optional< Error > | recreateInternalResources ()=0 |
| void | setShaderConstants (const std::unordered_map< std::string, size_t > &uintConstantsOffsets) |
Protected Member Functions inherited from ne::ShaderUser | |
| ShaderUser (ShaderManager *pShaderManager) | |
| virtual | ~ShaderUser () |
| bool | addShader (const std::string &sShaderName) |
| ShaderPack * | findShader (ShaderType shaderType) |
Private Member Functions | |
| VulkanPipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, std::unique_ptr< PipelineConfiguration > pPipelineConfiguration) | |
| std::optional< Error > | generateGraphicsPipeline () |
| std::optional< Error > | generateComputePipelineForShader (const std::string &sComputeShaderName) |
| std::optional< Error > | createGraphicsPipeline (VulkanRenderer *pVulkanRenderer, GlslShader *pVertexShader, GlslShader *pFragmentShader, bool bUsePixelBlending) |
| std::optional< Error > | createComputePipeline (VulkanRenderer *pVulkanRenderer, GlslShader *pComputeShader) |
| std::optional< Error > | bindFrameDataDescriptors () |
| std::optional< Error > | releaseInternalResources () |
| std::variant< VkPushConstantRange, Error > | definePushConstants (const std::unordered_map< std::string, size_t > &pushConstantUintFieldOffsets, const std::unordered_map< std::string, uint32_t, StdStringHash, std::equal_to<> > &resourceBindings) |
Private Attributes | |
| std::pair< std::recursive_mutex, InternalResources > | mtxInternalResources |
VkPipeline object wrapper.
|
private |
Constructs uninitialized pipeline.
| pRenderer | Used renderer. |
| pPipelineManager | Pipeline manager that owns this pipeline. |
| pPipelineConfiguration | Settings and usage details. |
| std::optional< Error > ne::VulkanPipeline::bindBuffersIfUsed | ( | const std::array< GpuResource *, FrameResourceManager::getFrameResourceCount()> & | vResources, |
| const std::string & | sShaderResourceName, | ||
| VkDescriptorType | descriptorType | ||
| ) |
Binds the specified GPU resources (buffers, not images) to this pipeline if it uses 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. |
|
private |
Binds descriptors that reference "frameData" shader resource to frame resources' uniform buffers.
| std::optional< Error > ne::VulkanPipeline::bindImageIfUsed | ( | GpuResource * | pImageResourceToBind, |
| std::string_view | sShaderResourceName, | ||
| VkDescriptorType | descriptorType, | ||
| VkImageLayout | imageLayout, | ||
| VkSampler | pSampler | ||
| ) |
Binds the specified GPU resource (image, not buffer) to this pipeline if it uses 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. |
|
static |
Assigns compute shader to create a compute pipeline.
| pRenderer | Used renderer. |
| pPipelineManager | Pipeline manager that owns this pipeline. |
| sComputeShaderName | Name of the compiled compute shader (see ShaderManager::compileShaders). |
|
private |
Fully initializes mtxInternalResources by creating a compute pipeline for the specified shader.
| pVulkanRenderer | Vulkan renderer. |
| pComputeShader | Compute shader to use in the pipeline. |
|
static |
Assigns vertex and pixel shaders to create a graphics pipeline (for usual rendering).
| pRenderer | Used renderer. |
| pPipelineManager | Pipeline manager that owns this pipeline. |
| pPipelineConfiguration | Settings that determine pipeline usage and usage details. |
|
private |
Fully initializes mtxInternalResources by creating a graphics pipeline for the specified shaders.
| pVulkanRenderer | Vulkan renderer. |
| pVertexShader | Vertex shader to use in the pipeline. |
| pFragmentShader | Fragment shader to use in the pipeline. Specify nullptr if you want to create depth only pipeline (used for z-prepass). |
| bUsePixelBlending | Whether the pipeline should use blending or not (for transparency). |
|
private |
Initializes internal push constants manager and returns push constants description.
| pushConstantUintFieldOffsets | Stores pairs of "name of field defined in GLSL push constants" (all with uint type) and "offset from the beginning of the push constants struct
(in `uint`s not bytes)". |
| resourceBindings | Map of pairs "resource name" (from GLSL code) - "layout binding index". |
|
private |
(Re)generates Vulkan compute pipeline and pipeline layout for the specified shader.
| sComputeShaderName | Name of the compiled compute shader (see ShaderManager::compileShaders). |
|
private |
(Re)generates Vulkan pipeline and pipeline layout.
|
inline |
Returns internal resources that this pipeline uses.
|
overrideprotectedvirtual |
Releases all internal resources from this graphics pipeline and then recreates them to reference new resources/parameters from the renderer.
Implements ne::Pipeline.
|
private |
Releases all internal resources from this graphics pipeline.
|
private |
Internal resources. Must be used with mutex when changing.