Nameless Engine
|
#include <Pipeline.h>
Classes | |
struct | ShaderConstantsData |
Public Member Functions | |
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::string | combineShaderNames (const std::string &sVertexShaderName, const std::string &sPixelShaderName) |
Protected Member Functions | |
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 | |
void | onMaterialUsingPipeline (Material *pMaterial) |
void | onMaterialNoLongerUsingPipeline (Material *pMaterial) |
void | onComputeShaderUsingPipeline (ComputeShaderInterface *pComputeShaderInterface) |
void | onComputeShaderNoLongerUsingPipeline (ComputeShaderInterface *pComputeShaderInterface) |
Static Private Member Functions | |
static std::variant< std::shared_ptr< Pipeline >, Error > | createGraphicsPipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, std::unique_ptr< PipelineCreationSettings > pPipelineCreationSettings) |
static std::variant< std::shared_ptr< Pipeline >, Error > | createComputePipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, const std::string &sComputeShaderName) |
Private Attributes | |
std::pair< std::mutex, std::unordered_set< Material * > > | mtxMaterialsThatUseThisPipeline |
std::pair< std::mutex, std::unordered_set< ComputeShaderInterface * > > | mtxComputeShadersThatUseThisPipeline |
std::pair< std::mutex, std::optional< ShaderConstantsData > > | mtxShaderConstantsData |
std::set< ShaderMacro > | additionalVertexShaderMacros |
std::set< ShaderMacro > | additionalPixelShaderMacros |
std::unordered_map< ShaderType, std::set< ShaderMacro > > | usedShaderConfiguration |
PipelineManager * | pPipelineManager = nullptr |
Renderer * | pRenderer = nullptr |
const std::string | sVertexShaderName |
const std::string | sPixelShaderName |
const std::string | sComputeShaderName |
bool | bIsUsingPixelBlending = false |
bool | bEnableDepthBias = false |
bool | bIsUsedForPointLightsShadowMapping = false |
Friends | |
class | PipelineManager |
class | PipelineSharedPtr |
Base class for render specific pipeline objects.
|
explicitprotected |
Creates a new empty (no internal GPU resource is created) pipeline.
pRenderer | Current 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. |
sPixelShaderName | Name of the compiled pixel shader to use (empty if not used). |
additionalPixelShaderMacros | Additional macros to enable for pixel 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). |
|
static |
Combines shader names into one string.
sVertexShaderName | Name of the vertex shader that pipeline is using. |
sPixelShaderName | Name of the pixel shader that pipeline is using. If empty only vertex shader name will be returned. |
|
staticprivate |
Assigns compute shader to create a render specific compute pipeline.
pRenderer | Parent renderer that owns this pipeline. |
pPipelineManager | Pipeline manager that owns this pipeline. |
sComputeShaderName | Name of the compiled compute shader (see ShaderManager::compileShaders). |
|
staticprivate |
Assigns vertex and pixel shaders to create a render specific graphics pipeline (for usual rendering).
pRenderer | Parent renderer that owns this pipeline. |
pPipelineManager | Pipeline manager that owns this pipeline. |
pPipelineCreationSettings | Settings that determine pipeline usage and usage details. |
std::set< ShaderMacro > ne::Pipeline::getAdditionalPixelShaderMacros | ( | ) | const |
Returns additional macros that were specified during pipeline creation to be enabled for pixel/fragment shader configuration.
std::set< ShaderMacro > ne::Pipeline::getAdditionalVertexShaderMacros | ( | ) | const |
Returns additional macros that were specified during pipeline creation to be enabled for vertex shader configuration.
std::string ne::Pipeline::getComputeShaderName | ( | ) |
Returns name of the compute shader that this pipeline is using.
std::optional< std::set< ShaderMacro > > ne::Pipeline::getCurrentShaderConfiguration | ( | ShaderType | shaderType | ) |
std::pair< std::mutex, std::unordered_set< Material * > > * ne::Pipeline::getMaterialsThatUseThisPipeline | ( | ) |
std::string ne::Pipeline::getPipelineIdentifier | ( | ) | const |
Constructs and returns a non unique identifier of this pipeline that contains used shader names.
std::string ne::Pipeline::getPixelShaderName | ( | ) |
Returns name of the pixel shader that this pipeline is using.
Renderer * ne::Pipeline::getRenderer | ( | ) | const |
std::pair< std::mutex, std::optional< Pipeline::ShaderConstantsData > > * ne::Pipeline::getShaderConstants | ( | ) |
Returns push/root constants used in the pipeline (if were specified in the shaders).
std::string ne::Pipeline::getVertexShaderName | ( | ) |
Returns name of the vertex shader that this pipeline is using.
bool ne::Pipeline::isDepthBiasEnabled | ( | ) | const |
Tells whether this pipeline has depth bias (offset) enabled.
bool ne::Pipeline::isUsedForPointLightsShadowMapping | ( | ) | const |
Tells whether this pipeline is used for shadow mapping of point lights.
true
if used, false
otherwise. bool ne::Pipeline::isUsingPixelBlending | ( | ) | const |
Tells whether this pipeline is using pixel blending or not.
|
private |
Called to notify this pipeline that the shared pointer to this pipeline (that compute shader interface stores) is now nullptr
.
nullptr
) the shared pointer, not before.pComputeShaderInterface | Compute shader interface that stopped using this pipeline. |
|
private |
Called to notify this pipeline that a compute shader interface started storing a shared pointer to this pipeline.
pComputeShaderInterface | Compute shader interface that started using this pipeline. |
|
private |
|
private |
Called to notify this pipeline that a material started storing a shared pointer to this pipeline.
pMaterial | Material that started using this pipeline. |
|
protectedpure virtual |
Releases internal resources such as root signature, internal Pipeline, etc.
Implemented in ne::DirectXPso, and ne::VulkanPipeline.
|
protectedpure virtual |
Creates internal resources using the current shader configuration.
Implemented in ne::DirectXPso, and ne::VulkanPipeline.
|
protected |
Saves shader configuration of the currently used shader.
shaderType | Type of the shader being currently used. |
fullConfiguration | Shader's full (might include renderer's configuration) configuration. |
|
protected |
Sets new push/root constants that will were found in the shaders of the pipeline.
uintConstantsOffsets | Empty if shader constants should not be used, otherwise pairs of: names of fields defined in GLSL as push constants or as root constants in HLSL (all with uint type) and offset of the constant from the beginning of the layout/struct. |
|
private |
Additional macros that were specified during pipeline creation to be enabled for pixel/fragment shader configuration.
|
private |
Additional macros that were specified during pipeline creation to be enabled for vertex shader configuration.
|
private |
Whether depth bias (offset) should be used or not (generally used for shadow map pipelines).
|
private |
Whether this pipeline is used for shadow mapping of point lights or not.
|
private |
Whether this Pipeline is using pixel blending or not.
|
private |
Array of compute shader interfaces that currently reference this compute pipeline.
|
private |
Array of materials that currently reference this graphics pipeline.
|
private |
Not empty if push/root constants are used.
|
private |
|
private |
Do not delete (free) this pointer. Current renderer.
|
private |
Name of the compiled compute shader that this Pipeline uses (empty if graphics pipeline).
|
private |
Name of the compiled pixel shader that this Pipeline uses (empty if compute pipeline).
|
private |
Name of the compiled vertex shader that this Pipeline uses (empty if compute pipeline).
|
private |
Full shader configuration (might include renderer's configuration) of a currently used shader.