Nameless Engine
|
#include <VulkanPipeline.h>
Classes | |
struct | InternalResources |
Public Member Functions | |
VulkanPipeline (const VulkanPipeline &)=delete | |
VulkanPipeline & | operator= (const VulkanPipeline &)=delete |
std::pair< std::recursive_mutex, InternalResources > * | getInternalResources () |
![]() | |
Pipeline (const Pipeline &)=delete | |
Pipeline & | operator= (const Pipeline &)=delete |
std::string | getVertexShaderName () |
std::string | getPixelShaderName () |
std::string | getComputeShaderName () |
std::optional< std::set< ShaderMacro > > | getCurrentShaderConfiguration (ShaderType shaderType) |
bool | isUsingPixelBlending () const |
bool | isDepthBiasEnabled () const |
bool | isUsedForPointLightsShadowMapping () const |
std::pair< std::mutex, std::unordered_set< Material * > > * | getMaterialsThatUseThisPipeline () |
std::string | getPipelineIdentifier () const |
Renderer * | getRenderer () const |
std::set< ShaderMacro > | getAdditionalVertexShaderMacros () const |
std::set< ShaderMacro > | getAdditionalPixelShaderMacros () const |
std::pair< std::mutex, std::optional< ShaderConstantsData > > * | getShaderConstants () |
![]() | |
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< PipelineCreationSettings > pPipelineCreationSettings) |
static std::variant< std::shared_ptr< VulkanPipeline >, Error > | createComputePipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, const std::string &sComputeShaderName) |
![]() | |
static std::string | combineShaderNames (const std::string &sVertexShaderName, const std::string &sPixelShaderName) |
Protected Member Functions | |
virtual std::optional< Error > | releaseInternalResources () override |
virtual std::optional< Error > | restoreInternalResources () override |
![]() | |
Pipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, const std::string &sVertexShaderName, const std::set< ShaderMacro > &additionalVertexShaderMacros, const std::string &sPixelShaderName="", const std::set< ShaderMacro > &additionalPixelShaderMacros={}, const std::string &sComputeShaderName="", bool bEnableDepthBias=false, bool bIsUsedForPointLightsShadowMapping=false, bool bUsePixelBlending=false) | |
void | saveUsedShaderConfiguration (ShaderType shaderType, std::set< ShaderMacro > &&fullConfiguration) |
virtual std::optional< Error > | releaseInternalResources ()=0 |
virtual std::optional< Error > | restoreInternalResources ()=0 |
void | setShaderConstants (const std::unordered_map< std::string, size_t > &uintConstantsOffsets) |
![]() | |
ShaderUser (ShaderManager *pShaderManager) | |
virtual | ~ShaderUser () |
bool | addShader (const std::string &sShaderName) |
std::optional< ShaderPack * > | getShader (ShaderType shaderType) |
Private Member Functions | |
VulkanPipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, const std::string &sVertexShaderName, const std::set< ShaderMacro > &additionalVertexShaderMacros, const std::string &sFragmentShaderName, const std::set< ShaderMacro > &additionalFragmentShaderMacros={}, const std::string &sComputeShaderName="", bool bEnableDepthBias=false, bool bIsUsedForPointLightsShadowMapping=false, bool bUsePixelBlending=false) | |
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::variant< VkPushConstantRange, Error > | definePushConstants (const std::unordered_map< std::string, size_t > &pushConstantUintFieldOffsets, const std::unordered_map< std::string, uint32_t > &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. |
sVertexShaderName | Name of the compiled vertex shader to use (empty if not used). |
additionalVertexShaderMacros | Additional macros to enable for vertex shader configuration. |
sFragmentShaderName | Name of the compiled pixel shader to use (empty if not used). |
additionalFragmentShaderMacros | Additional macros to enable for fragment shader configuration. |
sComputeShaderName | Name of the compiled compute shader to use (empty if not used). |
bEnableDepthBias | Whether depth bias (offset) is enabled or not. |
bIsUsedForPointLightsShadowMapping | Whether this pipeline is used for shadow mapping of point lights or not. |
bUsePixelBlending | Whether the pixels of the mesh that uses this pipeline should blend with existing pixels on back buffer or not (for transparency). |
|
private |
Binds descriptors that reference "frameData" shader resource to frame resources' uniform buffers.
|
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. |
pPipelineCreationSettings | Settings that determine pipeline usage and usage details. configuration. |
|
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 internal resources such as pipeline layout, internal pipeline, descriptor layout, etc.
Implements ne::Pipeline.
|
overrideprotectedvirtual |
Creates internal resources using the current shader configuration.
Implements ne::Pipeline.
|
private |
Internal resources. Must be used with mutex when changing.