SPIR-V Built-In

RayGeometryIndexKHR

Geometry index in a ray shader
RayGeometryIndexKHR

A variable decorated with the RayGeometryIndexKHR decoration will contain the geometry index for the acceleration structure geometry currently being shaded.

Valid Usage

VUID-RayGeometryIndexKHR-RayGeometryIndexKHR-04345

The RayGeometryIndexKHR decoration must be used only within the IntersectionKHR, AnyHitKHR, or ClosestHitKHR

Execution Model

VUID-RayGeometryIndexKHR-RayGeometryIndexKHR-04346

The variable decorated with RayGeometryIndexKHR must be declared using the Input Storage Class

VUID-RayGeometryIndexKHR-RayGeometryIndexKHR-04347

The variable decorated with RayGeometryIndexKHR must be declared as a scalar 32-bit integer value