SPIR-V Built-In

InstanceId

Id associated with an intersected instance
InstanceId

Decorating a variable in an intersection, any-hit, or closest hit shader with the InstanceId decoration will make that variable contain the index of the instance that intersects the current ray.

Valid Usage

VUID-InstanceId-InstanceId-04254

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

Execution Model

VUID-InstanceId-InstanceId-04255

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

VUID-InstanceId-InstanceId-04256

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