Diligent::IPipelineState struct

Pipeline state interface.

Base classes

struct IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.

Derived classes

struct IPipelineStateD3D11
Exposes Direct3D11-specific functionality of a pipeline state object.
struct IPipelineStateD3D12
Exposes Direct3D12-specific functionality of a pipeline state object.
struct IPipelineStateGL
Exposes OpenGL-specific functionality of a pipeline state object.
class IPipelineStateMtl
Exposes Metal-specific functionality of a pipeline state object.
struct IPipelineStateVk
Exposes Vulkan-specific functionality of a pipeline state object.

Public functions

auto GetDesc() const -> const PipelineStateDesc&METHOD() override
Returns the pipeline description used to create the object.
auto GetGraphicsPipelineDesc() const -> const GraphicsPipelineDesc&METHOD() virtual
Returns the graphics pipeline description used to create the object. This method must only be called for a graphics or mesh pipeline.
auto GetRayTracingPipelineDesc() const -> const RayTracingPipelineDesc&METHOD() virtual
Returns the ray tracing pipeline description used to create the object. This method must only be called for a ray tracing pipeline.
auto BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResourceMapping, Uint32 Flags) -> void METHOD() virtual
Binds resources for all shaders in the pipeline state.
auto GetStaticVariableCount(SHADER_TYPE ShaderType) const -> Uint32 METHOD() virtual
Returns the number of static shader resource variables.
auto GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) -> IShaderResourceVariable*METHOD() virtual
Returns static shader resource variable. If the variable is not found, returns nullptr.
auto GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) -> IShaderResourceVariable*METHOD() virtual
Returns static shader resource variable by its index.
auto CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources = false) -> void METHOD() virtual
Creates a shader resource binding object.
auto InitializeStaticSRBResources(struct IShaderResourceBinding* pShaderResourceBinding) const -> void METHOD() virtual
Initializes static resources in the shader binding object.
auto IsCompatibleWith(const struct IPipelineState* pPSO) const -> bool METHOD() virtual
Checks if this pipeline state object is compatible with another PSO.
auto GetResourceSignatureCount() const -> Uint32 METHOD() virtual
Returns the number of pipeline resource signatures used by this pipeline.
auto GetResourceSignature(Uint32 Index) const -> IPipelineResourceSignature*METHOD() virtual
Returns pipeline resource signature at the give index.

Function documentation

void METHOD() Diligent::IPipelineState::BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResourceMapping, Uint32 Flags) virtual

Binds resources for all shaders in the pipeline state.

Parameters
ShaderFlags in - Flags that specify shader stages, for which resources will be bound. Any combination of Diligent::SHADER_TYPE may be used.
pResourceMapping in - Pointer to the resource mapping interface.
Flags in - Additional flags. See Diligent::BIND_SHADER_RESOURCES_FLAGS.

Uint32 METHOD() Diligent::IPipelineState::GetStaticVariableCount(SHADER_TYPE ShaderType) const virtual

Returns the number of static shader resource variables.

Parameters
ShaderType in - Type of the shader.

This metod is only allowed for pipelines that use implicit resource signature (e.g. shader resources are defined through ResourceLayout member of the pipeline desc). For pipelines that use explicit resource signatures, use IPipelineResourceSignature::GetStaticVariableCount() method.

IShaderResourceVariable*METHOD() Diligent::IPipelineState::GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) virtual

Returns static shader resource variable. If the variable is not found, returns nullptr.

Parameters
ShaderType in - The type of the shader to look up the variable. Must be one of Diligent::SHADER_TYPE.
Name in - Name of the variable.

This metod is only allowed for pipelines that use implicit resource signature (e.g. shader resources are defined through ResourceLayout member of the pipeline desc). For pipelines that use explicit resource signatures, use IPipelineResourceSignature::GetStaticVariableByName() method.

IShaderResourceVariable*METHOD() Diligent::IPipelineState::GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) virtual

Returns static shader resource variable by its index.

Parameters
ShaderType in - The type of the shader to look up the variable. Must be one of Diligent::SHADER_TYPE.
Index in - Shader variable index. The index must be between 0 and the total number of variables returned by GetStaticVariableCount().

This metod is only allowed for pipelines that use implicit resource signature (e.g. shader resources are defined through ResourceLayout member of the pipeline desc). For pipelines that use explicit resource signatures, use IPipelineResourceSignature::GetStaticVariableByIndex() method.

void METHOD() Diligent::IPipelineState::CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources = false) virtual

Creates a shader resource binding object.

Parameters
ppShaderResourceBinding out - Memory location where pointer to the new shader resource binding object is written.
InitStaticResources in - If set to true, the method will initialize static resources in the created object, which has the exact same effect as calling IPipelineState::InitializeStaticSRBResources().

void METHOD() Diligent::IPipelineState::InitializeStaticSRBResources(struct IShaderResourceBinding* pShaderResourceBinding) const virtual

Initializes static resources in the shader binding object.

Parameters
pShaderResourceBinding in - Shader resource binding object to initialize. The pipeline state must be compatible with the shader resource binding object.

If static shader resources were not initialized when the SRB was created, this method must be called to initialize them before the SRB can be used. The method should be called after all static variables have been initialized in the PSO.

bool METHOD() Diligent::IPipelineState::IsCompatibleWith(const struct IPipelineState* pPSO) const virtual

Checks if this pipeline state object is compatible with another PSO.

Parameters
pPSO in - Pointer to the pipeline state object to check compatibility with.
Returns true if this PSO is compatbile with pPSO. false otherwise.

If two pipeline state objects are compatible, they can use shader resource binding objects interchangebly, i.e. SRBs created by one PSO can be committed when another PSO is bound.

Technical details

PSOs may be partially compatible when some, but not all pipeline resource signatures are compatible. In Vulkan backend, switching PSOs that are partially compatible may increase performance as shader resource bindings (that map to descriptor sets) from compatible signatures may be preserved. In Direct3D12 backend, only switching between fully compatible PSOs preserves shader resource bindings, while switching partially compatible PSOs still requires re-binding all resource bindigns from all signatures. In other backends the behavior is emualted. Usually, the bindigs from the first N compatible resource signatures may be preserved.

Uint32 METHOD() Diligent::IPipelineState::GetResourceSignatureCount() const virtual

Returns the number of pipeline resource signatures used by this pipeline.

IPipelineResourceSignature*METHOD() Diligent::IPipelineState::GetResourceSignature(Uint32 Index) const virtual

Returns pipeline resource signature at the give index.

Parameters
Index in - Index of the resource signature, same as BindingIndex in PipelineResourceSignatureDesc.
Returns Pointer to pipeline resource signature interface.