Diligent Engine
 
Loading...
Searching...
No Matches
Diligent.IShaderBindingTable Struct Referenceabstract

Shader binding table interface. More...

#include <ShaderBindingTable.h>

Inheritance diagram for Diligent.IShaderBindingTable:
Diligent::IDeviceObject Diligent.IObject Diligent::IShaderBindingTableD3D12 Diligent::IShaderBindingTableVk

Public Member Functions

virtual const ShaderBindingTableDesc &DILIGENT_CALL_TYPE GetDesc () const override=0
 Returns the shader binding table description that was used to create the object.
 
virtual Bool DILIGENT_CALL_TYPE Verify (VERIFY_SBT_FLAGS Flags) const =0
 Checks that all shaders are bound, instances and geometries have not changed, shader record data are initialized.
 
virtual void DILIGENT_CALL_TYPE Reset (IPipelineState *pPSO)=0
 Resets the SBT with the new pipeline state. This is more efficient than creating a new SBT.
 
virtual void DILIGENT_CALL_TYPE ResetHitGroups ()=0
 Resets hit groups in the SBT.
 
virtual void DILIGENT_CALL_TYPE BindRayGenShader (const Char *pShaderGroupName, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a ray-generation shader.
 
virtual void DILIGENT_CALL_TYPE BindMissShader (const Char *pShaderGroupName, Uint32 MissIndex, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a ray-miss shader.
 
virtual void DILIGENT_CALL_TYPE BindHitGroupForGeometry (ITopLevelAS *pTLAS, const Char *pInstanceName, const Char *pGeometryName, Uint32 RayOffsetInHitGroupIndex, const Char *pShaderGroupName, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a hit group for the the specified geometry in the instance.
 
virtual void DILIGENT_CALL_TYPE BindHitGroupByIndex (Uint32 BindingIndex, const Char *pShaderGroupName, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a hit group to the specified location in the table.
 
virtual void DILIGENT_CALL_TYPE BindHitGroupForInstance (ITopLevelAS *pTLAS, const Char *pInstanceName, Uint32 RayOffsetInHitGroupIndex, const Char *pShaderGroupName, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a hit group for all geometries in the specified instance.
 
virtual void DILIGENT_CALL_TYPE BindHitGroupForTLAS (ITopLevelAS *pTLAS, Uint32 RayOffsetInHitGroupIndex, const Char *pShaderGroupName, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a hit group for all instances in the given top-level AS.
 
virtual void DILIGENT_CALL_TYPE BindCallableShader (const Char *pShaderGroupName, Uint32 CallableIndex, const void *pData=nullptr, Uint32 DataSize=0)=0
 Binds a callable shader.
 
- Public Member Functions inherited from Diligent::IDeviceObject
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.
 
- Public Member Functions inherited from Diligent.IObject
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
 

Detailed Description

Shader binding table interface.

Defines the methods to manipulate an SBT object

Member Function Documentation

◆ BindCallableShader()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindCallableShader ( const Char * pShaderGroupName,
Uint32 CallableIndex,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a callable shader.

Parameters
[in]pShaderGroupName- Callable shader name that was specified in RayTracingGeneralShaderGroup::Name when the pipeline state was created. Can be null to make the shader inactive.
[in]CallableIndex- Callable shader offset in the shader binding table. This offset will correspond to 'ShaderIndex' argument of CallShader() function in HLSL, and 'callable' argument of executeCallable() function in GLSL.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT must be externally synchronized.

◆ BindHitGroupByIndex()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindHitGroupByIndex ( Uint32 BindingIndex,
const Char * pShaderGroupName,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a hit group to the specified location in the table.

Parameters
[in]BindingIndex- Location of the hit group in the table.
[in]pShaderGroupName- Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name or RayTracingProceduralHitShaderGroup::Name when the pipeline state was created. Can be null to make the shader group inactive.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Remarks
Use IBottomLevelAS::GetGeometryIndex(), ITopLevelAS::GetBuildInfo(), ITopLevelAS::GetInstanceDesc().ContributionToHitGroupIndex to calculate the binding index.
Note
Access to the SBT must be externally synchronized.

◆ BindHitGroupForGeometry()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindHitGroupForGeometry ( ITopLevelAS * pTLAS,
const Char * pInstanceName,
const Char * pGeometryName,
Uint32 RayOffsetInHitGroupIndex,
const Char * pShaderGroupName,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a hit group for the the specified geometry in the instance.

Parameters
[in]pTLAS- Top-level AS that contains the given instance.
[in]pInstanceName- Instance name that contains the geometry. This is the name that was used when the TLAS was created, see TLASBuildInstanceData::InstanceName.
[in]pGeometryName- Geometry name in the instance, for which to bind the hit group. This is the name that was given to geometry when BLAS was created, see BLASBuildTriangleData::GeometryName and BLASBuildBoundingBoxData::GeometryName.
[in]RayOffsetInHitGroupIndex- Ray offset in the shader binding table (aka ray type). This offset will correspond to 'RayContributionToHitGroupIndex' argument of TraceRay() function in HLSL, and 'sbtRecordOffset' argument of traceRay() function in GLSL. Must be less than HitShadersPerInstance.
[in]pShaderGroupName- Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name or RayTracingProceduralHitShaderGroup::Name when the pipeline state was created. Can be null to make the shader group inactive.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the BLAS that was used in the TLAS instance with name pInstanceName must be externally synchronized.
Access to the TLAS must be externally synchronized.
Access to the SBT must be externally synchronized.

◆ BindHitGroupForInstance()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindHitGroupForInstance ( ITopLevelAS * pTLAS,
const Char * pInstanceName,
Uint32 RayOffsetInHitGroupIndex,
const Char * pShaderGroupName,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a hit group for all geometries in the specified instance.

Parameters
[in]pTLAS- Top-level AS that contains the given instance.
[in]pInstanceName- Instance name, for which to bind the hit group. This is the name that was used when the TLAS was created, see TLASBuildInstanceData::InstanceName.
[in]RayOffsetInHitGroupIndex- Ray offset in the shader binding table (aka ray type). This offset will correspond to 'RayContributionToHitGroupIndex' argument of TraceRay() function in HLSL, and 'sbtRecordOffset' argument of traceRay() function in GLSL. Must be less than HitShadersPerInstance.
[in]pShaderGroupName- Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name or RayTracingProceduralHitShaderGroup::Name when the pipeline state was created. Can be null to make the shader group inactive.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT and TLAS must be externally synchronized.

◆ BindHitGroupForTLAS()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindHitGroupForTLAS ( ITopLevelAS * pTLAS,
Uint32 RayOffsetInHitGroupIndex,
const Char * pShaderGroupName,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a hit group for all instances in the given top-level AS.

Parameters
[in]pTLAS- Top-level AS, for which to bind the hit group.
[in]RayOffsetInHitGroupIndex- Ray offset in the shader binding table (aka ray type). This offset will correspond to 'RayContributionToHitGroupIndex' argument of TraceRay() function in HLSL, and 'sbtRecordOffset' argument of traceRay() function in GLSL. Must be less than HitShadersPerInstance.
[in]pShaderGroupName- Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name or RayTracingProceduralHitShaderGroup::Name when the pipeline state was created. Can be null to make the shader group inactive.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT and TLAS must be externally synchronized.

◆ BindMissShader()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindMissShader ( const Char * pShaderGroupName,
Uint32 MissIndex,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a ray-miss shader.

Parameters
[in]pShaderGroupName- Ray-miss shader name that was specified in RayTracingGeneralShaderGroup::Name when the pipeline state was created. Can be null to make the shader inactive.
[in]MissIndex- Miss shader offset in the shader binding table (aka ray type). This offset will correspond to 'MissShaderIndex' argument of TraceRay() function in HLSL, and 'missIndex' argument of traceRay() function in GLSL.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT must be externally synchronized.

◆ BindRayGenShader()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.BindRayGenShader ( const Char * pShaderGroupName,
const void * pData = nullptr,
Uint32 DataSize = 0 )
pure virtual

Binds a ray-generation shader.

Parameters
[in]pShaderGroupName- Ray-generation shader name that was specified in RayTracingGeneralShaderGroup::Name when the pipeline state was created.
[in]pData- Shader record data, can be null.
[in]DataSize- Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT must be externally synchronized.

◆ Reset()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.Reset ( IPipelineState * pPSO)
pure virtual

Resets the SBT with the new pipeline state. This is more efficient than creating a new SBT.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT must be externally synchronized.

◆ ResetHitGroups()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.ResetHitGroups ( )
pure virtual

Resets hit groups in the SBT.

After TLAS or BLAS was rebuilt or updated, hit group shader bindings may have become invalid, you can reset hit groups only and keep ray-gen, miss and callable shader bindings intact.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

Note
Access to the SBT must be externally synchronized.

◆ Verify()

virtual Bool DILIGENT_CALL_TYPE Diligent.IShaderBindingTable.Verify ( VERIFY_SBT_FLAGS Flags) const
pure virtual

Checks that all shaders are bound, instances and geometries have not changed, shader record data are initialized.

Parameters
[in]Flags- Flags that specify which type of validation to perform.
Returns
True if SBT content is valid, and false otherwise.

The function does not modify the data used by IDeviceContext::TraceRays() and IDeviceContext::TraceRaysIndirect() commands, so they can run in parallel.

This method is only implemented in development build and has no effect in release build.

Note
Access to the SBT must be externally synchronized.