Diligent::BuildTLASAttribs struct

This structure is used by IDeviceContext::BuildTLAS().

Contents

Public variables

ITopLevelAS* pTLAS
Target top-level AS. Access to the TLAS must be externally synchronized.
RESOURCE_STATE_TRANSITION_MODE TLASTransitionMode
Top-level AS state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
RESOURCE_STATE_TRANSITION_MODE BLASTransitionMode
Bottom-level AS (in TLASBuildInstanceData::pBLAS) state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
TLASBuildInstanceData const * pInstances
A pointer to an array of InstanceCount TLASBuildInstanceData structures that contain instance data. If Update is true:
Uint32 InstanceCount
The number of instances. Must be less than or equal to TopLevelASDesc::MaxInstanceCount. If Update is true then count must be the same as used to build TLAS.
IBuffer* pInstanceBuffer
The buffer that will be used to store instance data during AS building. The buffer size must be at least TLAS_INSTANCE_DATA_SIZE * InstanceCount. The buffer must be created with BIND_RAY_TRACING flag.
Uint32 InstanceBufferOffset
Offset from the beginning of the buffer to the location of instance data.
RESOURCE_STATE_TRANSITION_MODE InstanceBufferTransitionMode
Instance buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
Uint32 HitGroupStride
The number of hit shaders that can be bound for a single geometry or an instance (depends on BindingMode).
Uint32 BaseContributionToHitGroupIndex
Base offset for the hit group location. Can be used to bind hit shaders for multiple acceleration structures, see IShaderBindingTable::BindHitGroupForGeometry().
HIT_GROUP_BINDING_MODE BindingMode
Hit shader binding mode, see Diligent::SHADER_BINDING_MODE. Used to calculate TLASBuildInstanceData::ContributionToHitGroupIndex.
IBuffer* pScratchBuffer
Buffer that is used for acceleration structure building. Must be created with BIND_RAY_TRACING. Call ITopLevelAS::GetScratchBufferSizes().Build to get the minimal size for the scratch buffer. Access to the TLAS must be externally synchronized.
Uint32 ScratchBufferOffset
Offset from the beginning of the buffer.
RESOURCE_STATE_TRANSITION_MODE ScratchBufferTransitionMode
Scratch buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
Bool Update
if false then TLAS will be built from scratch. If true then previous content of TLAS will be updated. pTLAS must be created with RAYTRACING_BUILD_AS_ALLOW_UPDATE flag. An update will be faster than building an acceleration structure from scratch.

Variable documentation

TLASBuildInstanceData const * Diligent::BuildTLASAttribs::pInstances

A pointer to an array of InstanceCount TLASBuildInstanceData structures that contain instance data. If Update is true:

  • Any instance data can be changed.
  • To disable an instance set TLASBuildInstanceData::Mask to zero or set empty TLASBuildInstanceData::BLAS to pBLAS.

Uint32 Diligent::BuildTLASAttribs::HitGroupStride

The number of hit shaders that can be bound for a single geometry or an instance (depends on BindingMode).

  • Used to calculate TLASBuildInstanceData::ContributionToHitGroupIndex.
  • Ignored if BindingMode is SHADER_BINDING_USER_DEFINED. You should use the same value in a shader: 'MultiplierForGeometryContributionToHitGroupIndex' argument in TraceRay() in HLSL, 'sbtRecordStride' argument in traceRay() in GLSL.

Uint32 Diligent::BuildTLASAttribs::BaseContributionToHitGroupIndex

Base offset for the hit group location. Can be used to bind hit shaders for multiple acceleration structures, see IShaderBindingTable::BindHitGroupForGeometry().