Nameless Engine
|
#include <Pipeline.h>
Classes | |
struct | ShaderConstantsData |
Public Member Functions | |
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::string | combineShaderNames (std::string_view sVertexShaderName, std::string_view sPixelShaderName, std::string_view sComputeShaderName="") |
Protected Member Functions | |
Pipeline (Renderer *pRenderer, PipelineManager *pPipelineManager, std::unique_ptr< PipelineConfiguration > pPipelineConfiguration) | |
virtual std::optional< Error > | releaseInternalResources ()=0 |
virtual std::optional< Error > | restoreInternalResources ()=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 | |
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< PipelineConfiguration > pPipelineConfiguration) |
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 |
const std::unique_ptr< PipelineConfiguration > | pPipelineConfiguration |
PipelineManager *const | pPipelineManager = nullptr |
Renderer *const | pRenderer = nullptr |
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. |
pPipelineConfiguration | Settings and usage details. |
|
static |
Combines shader names into a 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. |
sComputeShaderName | Name of the compute shader that pipeline is using. Can be empty. |
|
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. |
pPipelineConfiguration | Settings that determine pipeline usage and usage details. |
const PipelineConfiguration * ne::Pipeline::getConfiguration | ( | ) | const |
Returns pipeline's settings and usage details.
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.
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::variant< size_t, Error > ne::Pipeline::getUintConstantOffset | ( | const std::string & | sConstantName | ) |
Looks for an offset of a uint
field in root/push constants of the specified name.
sConstantName | Name of the push/root constant. |
uint
s) of the field from the start of the root/push constants struct.
|
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 or descriptor layout, internal pipeline object and 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 |
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 |
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 |
Usage details of this pipeline.
|
private |
|
private |
Do not delete (free) this pointer. Current renderer.