Name Strings
SPV_EXT_shader_invocation_reorder
Contact
See Issues list in the Khronos SPIRV-Registry repository: https://github.com/KhronosGroup/SPIRV-Registry
Contributors
-
Ashwin Lele, NVIDIA
-
Eric Werness, NVIDIA
-
Daniel Koch, NVIDIA
-
Pankaj Mistry, NVIDIA
-
Aaron Hagan, AMD
-
Stu Smith, AMD
-
Sebastian Neubauer, AMD
-
Alan Baker, Google
-
Sven Woop, Intel
-
Ben Ashbaugh, Intel
-
Baldur Karlsson, Valve
-
Matthew Moulton, Samsung
-
Tim Kong, Samsung
-
Members of Vulkan Ray Tracing TSG
Status
-
Approved by the SPIR-V Working Group: 2025-09-03
-
Ratified by the Khronos Board: 2025-10-17
Version
Last Modified Date |
2025-01-27 |
Revision |
2 |
Dependencies
This extension is written against the Unified SPIR-V Specification, Version 1.6, Revision 1.
This extension requires SPIR-V 1.4.
This extension requires SPV_KHR_ray_tracing.
This extension requires SPV_EXT_physical_storage_buffer, SPV_KHR_physical_storage_buffer or SPIR-V 1.5.
This extension interacts with SPV_NV_ray_tracing_motion_blur.
This extension interacts with SPV_KHR_ray_tracing_position_fetch.
This extension interacts with SPV_KHR_ray_query.
Overview
This extension adds hit objects and reordering builtins to provide finer grain control over traversal during ray tracing.
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_EXT_shader_invocation_reorder"
New Capabilities
This extension introduces new capabilities:
ShaderInvocationReorderEXT
New Storage Classes
Storage classes added under the ShaderInvocationReorderEXT capability
HitObjectAttributeEXT
New Decorations
This extension introduces new decorations:
HitObjectShaderRecordBufferEXT
New Instructions
Instructions added under the ShaderInvocationReorderEXT capability
OpTypeHitObjectEXT OpReorderThreadWithHintEXT OpReorderThreadWithHitObjectEXT OpHitObjectIsMissEXT OpHitObjectIsHitEXT OpHitObjectIsEmptyEXT OpHitObjectGetRayTMinEXT OpHitObjectGetRayTMaxEXT OpHitObjectGetRayFlagsEXT OpHitObjectGetObjectRayOriginEXT OpHitObjectGetObjectRayDirectionEXT OpHitObjectGetWorldRayOriginEXT OpHitObjectGetWorldRayDirectionEXT OpHitObjectGetObjectToWorldEXT OpHitObjectGetWorldToObjectEXT OpHitObjectGetIntersectionTriangleVertexPositionsEXT OpHitObjectGetInstanceCustomIndexEXT OpHitObjectGetInstanceIdEXT OpHitObjectGetGeometryIndexEXT OpHitObjectGetPrimitiveIndexEXT OpHitObjectGetHitKindEXT OpHitObjectGetAttributesEXT OpHitObjectGetCurrentTimeEXT OpHitObjectGetShaderBindingTableRecordIndexEXT OpHitObjectSetShaderBindingTableRecordIndexEXT OpHitObjectGetShaderRecordBufferHandleEXT OpHitObjectExecuteShaderEXT OpHitObjectRecordFromQueryEXT OpHitObjectRecordMissEXT OpHitObjectRecordMissMotionEXT OpHitObjectRecordEmptyEXT OpHitObjectTraceRayEXT OpHitObjectTraceRayMotionEXT OpHitObjectReorderExecuteShaderEXT OpHitObjectTraceReorderExecuteEXT OpHitObjectTraceMotionReorderExecuteEXT
Modifications to the SPIR-V Specification
- (Modify Section 2.2.1, Instructions )
-
Add OpTraceRayWithHitObjectEXT, OpHitObjectExecuteShaderEXT, *OpHitObjectReorderExecuteShaderEXT, *OpHitObjectTraceReorderExecuteEXT to the list of shader call instructions.
- (Add the following terminology to section 2.2.2, Types)
-
Hit object type: The type returned by OpTypeHitObjectEXT.
- (Add to the list of opaque types in section 2.2.2, Types)
-
-
OpTypeHitObjectEXT
-
- (Modify Section 3.2, Decorations, adding a row to the Decoration table)
-
Decoration Requires 5389
HitObjectShaderRecordBufferEXT
Apply to a variable to indicate that it represents a shader record buffer address obtained from a hit object. This decoration marks variables that store physical storage buffer pointers returned by OpHitObjectGetShaderRecordBufferHandleEXT.
Valid targets: OpVariableShaderInvocationReorderEXT
- (Modify Section 3.7, Storage Class, adding rows to the Storage Class table)
-
Storage Class Enabling Capabilities Enabled by Extension 5411
HitObjectAttributeEXT
Used for storing attributes of geometry intersected by a ray to be passed on to hit object instructions. Visible across all functions in the current invocation. Not shared externally. Variables declared with this storage class can be both read and written to, but cannot have initializers. Only allowed in RayGenerationKHR, ClosestHitKHR, and MissKHR execution models.ShaderInvocationReorderEXT
SPV_EXT_shader_invocation_reorder
- (Modify Section 3.31, Capability, adding a row to the Capability table)
-
Capability Implicitly Declares 5388
ShaderInvocationReorderEXT
RayTracingKHR
- (Add the following line to the description of OpTypePointer, in Section 3.32.6, Type-Declaration Instructions)
-
If Type is OpTypeHitObjectEXT, Storage Class must be Private or Function.
- (Add the following line to the description of OpStore and OpLoad, in Section 3.32.8, Memory Instructions)
-
The Type operand to the OpTypePointer used for Pointer must not be OpTypeHitObjectEXT.
- (Add the following line to the description of OpCopyMemory and OpCopyMemorySized, in Section 3.32.8, Memory Instructions)
-
The Type operand to the OpTypePointer used for Target or Source must not be OpTypeHitObjectEXT.
- (Modify Section 2.16.1, Universal Validation Rules)
-
Add the following instructions to the list of instructions that may have a pointer as an operand:
-
OpReorderThreadWithHitObjectEXT
-
OpHitObjectTraceRayEXT
-
OpHitObjectTraceRayMotionEXT
-
OpHitObjectRecordFromQueryEXT
-
OpHitObjectRecordMissEXT
-
OpHitObjectRecordMissMotionEXT
-
OpHitObjectRecordEmptyEXT
-
OpHitObjectExecuteShaderEXT
-
OpHitObjectGetCurrentTimeEXT
-
OpHitObjectGetAttributesEXT
-
OpHitObjectGetHitKindEXT
-
OpHitObjectGetPrimitiveIndexEXT
-
OpHitObjectGetGeometryIndexEXT
-
OpHitObjectGetInstanceIdEXT
-
OpHitObjectGetInstanceCustomIndexEXT
-
OpHitObjectGetObjectRayOriginEXT
-
OpHitObjectGetObjectRayDirectionEXT
-
OpHitObjectGetWorldRayDirectionEXT
-
OpHitObjectGetWorldRayOriginEXT
-
OpHitObjectGetObjectToWorldEXT
-
OpHitObjectGetWorldToObjectEXT
-
OpHitObjectGetIntersectionTriangleVertexPositionsEXT
-
OpHitObjectGetRayTMaxEXT
-
OpHitObjectGetRayTMinEXT
-
OpHitObjectGetRayFlagsEXT
-
OpHitObjectGetShaderBindingTableRecordIndexEXT
-
OpHitObjectSetShaderBindingTableRecordIndexEXT
-
OpHitObjectGetShaderRecordBufferHandleEXT
-
OpHitObjectIsEmptyEXT
-
OpHitObjectIsHitEXT
-
OpHitObjectIsMissEXT
-
OpHitObjectReorderExecuteShaderEXT
-
OpHitObjectTraceReorderExecuteEXT
-
OpHitObjectTraceMotionReorderExecuteEXT
-
- (Add a new sub section 3.36.Reorder Instructions)
-
For reorder instructions providing a hint, the hint value used for reordering is the specified number of bits from the LSBs of the hint value interpreted as an unsigned integer. The higher bits of that hint value are higher priority than the lower bits. If both the hint and the hit object are provided, the implementation should prioritize the hint bits lower in the reorder priority than the shader referenced by the hit object but higher than any other information in the hit object.
- (Add a new sub section 3.36.Hit Object Instructions)
-
The semantics of the arguments of OpHitObjectTraceRayEXT and OpHitObjectTraceRayMotionEXT are same as those with the same names of OpTraceRayKHR and OpTraceRayMotionNV as defined in the SPV_KHR_ray_tracing and SPV_NV_ray_tracing_motion_blur extensions, respectively. The sequence OpHitObjectTraceRayEXT, OpReorderThreadWithHitObjectEXT, OpHitObjectExecuteShaderEXT is equivalent to OpTraceRayKHR instruction.
- (Add a new sub section 3.36.Fused Hit Object Instructions)
-
- (Modify Section 3.36.6, Type-Declaration Instructions, adding a new table)
Validation Rules
An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:
OpExtension "SPV_EXT_shader_invocation_reorder"
Interactions with SPV_NV_ray_tracing_motion_blur
If the SPV_NV_ray_tracing_motion_blur extension is not supported, the OpHitObjectTraceRayMotionEXT, OpHitObjectRecordMissMotionEXT, and OpHitObjectTraceMotionReorderExecuteEXT instructions are not supported.
Interactions with SPV_KHR_ray_tracing_position_fetch
If the SPV_KHR_ray_tracing_position_fetch extension is not supported the OpHitObjectGetIntersectionTriangleVertexPositionsEXT instruction is not supported.
Interactions with SPV_KHR_ray_query
If the SPV_KHR_ray_query extension is not supported the OpHitObjectRecordFromQueryEXT instruction is not supported.
Issues
None
Revision History
| Rev | Date | Author | Changes |
|---|---|---|---|
1 |
2024-05-08 |
Eric Werness |
Port to EXT |
2 |
2025-01-27 |
Ashwin Lele |
Renumber enums |