GeometryIndex
Description
Returns the index of the geometry that was hit in an intersection, any-hit, or closest-hit shader.
Signature
uint GeometryIndex();
Return value
Zero-based index of the geometry in the current instance. On CUDA/OptiX, the SBT GAS index of the hit primitive, which equals the geometry index when every build input of the geometry acceleration structure has one shader binding table record (see “Geometry index” in the CUDA target documentation).
Remarks
Available in intersection, any-hit, and closest-hit shaders
Availability and Requirements
Defined for the following targets:
hlsl
Available in stages: intersection, closesthit, anyhit.
glsl
Available in stages: intersection, closesthit, anyhit.
cuda
Available in stages: intersection, closesthit, anyhit.
spirv
Available in stages: intersection, closesthit, anyhit.
Requires capability: spvRayTracingKHR.