Pipeline state interface. More...
#include <PipelineState.h>
Public Member Functions | |
virtual const PipelineStateDesc &DILIGENT_CALL_TYPE | GetDesc () const override=0 |
Returns the pipeline description used to create the object. | |
virtual const GraphicsPipelineDesc &DILIGENT_CALL_TYPE | GetGraphicsPipelineDesc () const =0 |
Returns the graphics pipeline description used to create the object. | |
virtual const RayTracingPipelineDesc &DILIGENT_CALL_TYPE | GetRayTracingPipelineDesc () const =0 |
Returns the ray tracing pipeline description used to create the object. | |
virtual const TilePipelineDesc &DILIGENT_CALL_TYPE | GetTilePipelineDesc () const =0 |
Returns the tile pipeline description used to create the object. | |
virtual void DILIGENT_CALL_TYPE | BindStaticResources (SHADER_TYPE ShaderStages, IResourceMapping *pResourceMapping, BIND_SHADER_RESOURCES_FLAGS Flags)=0 |
Binds resources for all shaders in the pipeline state. | |
virtual Uint32 DILIGENT_CALL_TYPE | GetStaticVariableCount (SHADER_TYPE ShaderType) const =0 |
Returns the number of static shader resource variables. | |
virtual IShaderResourceVariable *DILIGENT_CALL_TYPE | GetStaticVariableByName (SHADER_TYPE ShaderType, const Char *Name)=0 |
Returns static shader resource variable. | |
virtual IShaderResourceVariable *DILIGENT_CALL_TYPE | GetStaticVariableByIndex (SHADER_TYPE ShaderType, Uint32 Index)=0 |
Returns static shader resource variable by its index. | |
virtual void DILIGENT_CALL_TYPE | CreateShaderResourceBinding (IShaderResourceBinding **ppShaderResourceBinding, Bool InitStaticResources=false)=0 |
Creates a shader resource binding object. | |
virtual void DILIGENT_CALL_TYPE | InitializeStaticSRBResources (struct IShaderResourceBinding *pShaderResourceBinding) const =0 |
Initializes static resources in the shader binding object. | |
virtual void DILIGENT_CALL_TYPE | CopyStaticResources (IPipelineState *pDstPipeline) const =0 |
Copies static resource bindings to the destination pipeline. | |
virtual bool DILIGENT_CALL_TYPE | IsCompatibleWith (const struct IPipelineState *pPSO) const =0 |
Checks if this pipeline state object is compatible with another PSO. | |
virtual Uint32 DILIGENT_CALL_TYPE | GetResourceSignatureCount () const =0 |
Returns the number of pipeline resource signatures used by this pipeline. | |
virtual IPipelineResourceSignature *DILIGENT_CALL_TYPE | GetResourceSignature (Uint32 Index) const =0 |
Returns pipeline resource signature at the give index. | |
virtual PIPELINE_STATE_STATUS DILIGENT_CALL_TYPE | GetStatus (bool WaitForCompletion=false)=0 |
Returns the pipeline state status, see Diligent::PIPELINE_STATE_STATUS. | |
![]() | |
virtual Int32 DILIGENT_CALL_TYPE | GetUniqueID () const =0 |
Returns unique identifier assigned to an object. | |
virtual void DILIGENT_CALL_TYPE | SetUserData (IObject *pUserData)=0 |
Stores a pointer to the user-provided data object. | |
virtual IObject *DILIGENT_CALL_TYPE | GetUserData () const =0 |
Returns a pointer to the user data object previously set with SetUserData() method. | |
![]() | |
virtual void DILIGENT_CALL_TYPE | QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0 |
Queries the specific interface. | |
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE | AddRef ()=0 |
Increments the number of strong references by 1. | |
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE | Release ()=0 |
virtual IReferenceCounters *DILIGENT_CALL_TYPE | GetReferenceCounters () const =0 |
Pipeline state interface.
|
pure virtual |
Binds resources for all shaders in the pipeline state.
[in] | ShaderStages | - Flags that specify shader stages, for which resources will be bound. Any combination of Diligent::SHADER_TYPE may be used. |
[in] | pResourceMapping | - Pointer to the resource mapping interface. |
[in] | Flags | - Additional flags. See Diligent::BIND_SHADER_RESOURCES_FLAGS. |
This method 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::BindStaticResources() method.
|
pure virtual |
Copies static resource bindings to the destination pipeline.
[in] | pDstPipeline | - Destination pipeline state. |
This method 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::CopyStaticResources() method.
|
pure virtual |
Creates a shader resource binding object.
[out] | ppShaderResourceBinding | - Memory location where pointer to the new shader resource binding object is written. |
[in] | InitStaticResources | - If set to true, the method will initialize static resources in the created object, which has the exact same effect as calling IPipelineState::InitializeStaticSRBResources(). |
This method 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::CreateShaderResourceBinding() method.
|
pure virtual |
Returns the graphics pipeline description used to create the object.
This method must only be called for a graphics or mesh pipeline.
|
pure virtual |
Returns the ray tracing pipeline description used to create the object.
This method must only be called for a ray tracing pipeline.
|
pure virtual |
Returns pipeline resource signature at the give index.
[in] | Index | - Index of the resource signature, same as BindingIndex in PipelineResourceSignatureDesc. |
|
pure virtual |
Returns the number of pipeline resource signatures used by this pipeline.
After the PSO is created, pipeline resource signatures are arranged by their binding indices. The value returned by this function is given by the maximum signature binding index plus one, and thus may not be equal to PipelineStateCreateInfo::ResourceSignaturesCount.
|
pure virtual |
Returns static shader resource variable by its index.
[in] | ShaderType | - The type of the shader to look up the variable. Must be one of Diligent::SHADER_TYPE. |
[in] | Index | - Shader variable index. The index must be between 0 and the total number of variables returned by GetStaticVariableCount(). |
Only static shader resource variables can be accessed through this method. Mutable and dynamic variables are accessed through Shader Resource Binding object.
This method 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.
|
pure virtual |
Returns static shader resource variable.
If the variable is not found, returns nullptr.
[in] | ShaderType | - The type of the shader to look up the variable. Must be one of Diligent::SHADER_TYPE. |
[in] | Name | - Name of the variable. |
The method does not increment the reference counter of the returned interface.
This method 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.
|
pure virtual |
Returns the number of static shader resource variables.
[in] | ShaderType | - Type of the shader. |
Only static variables (that can be accessed directly through the PSO) are counted. Mutable and dynamic variables are accessed through Shader Resource Binding object.
This method 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.
|
pure virtual |
Returns the pipeline state status, see Diligent::PIPELINE_STATE_STATUS.
[in] | WaitForCompletion | - If true, the method will wait until the pipeline state is compiled. If false, the method will return the pipeline state status without waiting. This parameter is ignored if the pipeline state was compiled synchronously. |
|
pure virtual |
Returns the tile pipeline description used to create the object.
This method must only be called for a tile pipeline.
|
pure virtual |
Initializes static resources in the shader 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.
[in] | pShaderResourceBinding | - Shader resource binding object to initialize. The pipeline state must be compatible with the shader resource binding object. |
This method 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::InitializeStaticSRBResources() method.
|
pure virtual |
Checks if this pipeline state object is compatible with another PSO.
If two pipeline state objects are compatible, they can use shader resource binding objects interchangeably, i.e. SRBs created by one PSO can be committed when another PSO is bound.
[in] | pPSO | - Pointer to the pipeline state object to check compatibility with. |
The function only checks that shader resource layouts are compatible, but does not check if resource types match. For instance, if a pixel shader in one PSO uses a texture at slot 0, and a pixel shader in another PSO uses texture array at slot 0, the pipelines will be compatible. However, if you try to use SRB object from the first pipeline to commit resources for the second pipeline, a runtime error will occur.
The function only checks compatibility of shader resource layouts. It does not take into account vertex shader input layout, number of outputs, etc.
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 bindings from all signatures. In other backends the behavior is emulated. Usually, the bindings from the first N compatible resource signatures may be preserved.