See Issues list in the Khronos SPIRV-Registry repository: https://github.com/KhronosGroup/SPIRV-Registry
This extension is written against the SPIR-V Specification, Version 1.1 Revision 4.
This extension requires SPIR-V 1.0.
This extension adds new functionality to support the Vulkan VK_NV_ray_tracing extension in SPIR-V.
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_NV_ray_tracing"
This extension introduces new execution models:
RayGenerationNV IntersectionNV AnyHitNV ClosestHitNV MissNV CallableNV
these depend on the RayTracingNV capability.
Storage classes added under the RayTracingNV capability
RayPayloadNV IncomingRayPayloadNV HitAttributeNV CallableDataNV IncomingCallableDataNV ShaderRecordBufferNV
Builtins added under the RayTracingNV capability
LaunchIdNV LaunchSizeNV InstanceCustomIndexNV WorldRayOriginNV WorldRayDirectionNV ObjectRayOriginNV ObjectRayDirectionNV RayTminNV RayTmaxNV ObjectToWorldNV WorldToObjectNV HitTNV HitKindNV IncomingRayFlagsNV
Instructions added under the RayTracingNV capability
OpReportIntersectionNV OpIgnoreIntersectionNV OpTerminateRayNV OpTraceNV OpTypeAccelerationStructureNV OpExecuteCallableNV
- (Modify Section 2.2.2, Types )
-
add OpTypeAccelerationStructureNV to list of opaque types
- (Modify Section 3.3, Execution Model, adding rows to the Execution Model table)
-
Execution Model Enabling Capabilities 5313
RayGenerationNV
Ray generation shading stage.RayTracingNV
5314
IntersectionNV
Intersection shading stage.RayTracingNV
5315
AnyHitNV
Any hit shading stage.RayTracingNV
5316
ClosestHitNV
Closest hit shading stage.RayTracingNV
5317
MissNV
Miss shading stage.RayTracingNV
5318
CallableNV
Ray callable shading stage.RayTracingNV
- (Modify Section 3.7, Storage Class, adding rows to the Storage Class table)
-
Storage Class Enabling Capabilities Enabled by Extension 5328
CallableDataNV
Used for storing arbitrary data associated with a ray to pass to callables. Visible across all functions in the current invocation. Not shared externally. Variables declared with this storage class can be both read and written to. Only allowed in RayGenerationNV, ClosestHitNV, CallableNV, and MissNV execution models.RayTracingNV
SPV_NV_ray_tracing
5329
IncomingCallableDataNV
Used for storing arbitrary data from parent sent to current callable stage invoked from an executeCallable call. Visible across all functions in current invocation. Not shared externally. Variables declared with the storage class are allowed only in CallableNV execution models. Can be both read and written to in above execution models.RayTracingNV
SPV_NV_ray_tracing
5338
RayPayloadNV
Used for storing payload data associated with a ray. Visible across all functions in the current invocation. Not shared externally. Variables declared with this storage class can be both read and written to. Only allowed in RayGenerationNV, AnyHitNV, ClosestHitNV and MissNV execution models.RayTracingNV
SPV_NV_ray_tracing
5339
HitAttributeNV
Used for storing attributes of geometry intersected by a ray. Visible across all functions in the current invocation. Not shared externally. Variables declared with this storage class are allowed only in IntersectionNV, AnyHitNV and ClosestHitNV execution models. They can be written to only in IntersectionNV execution model and read from only in AnyHitNV and ClosestHitNV execution models.RayTracingNV
SPV_NV_ray_tracing
5342
IncomingRayPayloadNV
Used for storing parent payload data associated with a ray in current stage invoked from a trace call. Visible across all functions in current invocation. Not shared externally. Variables declared with the storage class are allowed only in AnyHitNV, ClosestHitNV and MissNV execution models. Can be both read and written to in above execution models.RayTracingNV
SPV_NV_ray_tracing
5343
ShaderRecordBufferNV
Used for storing data in shader record associated with each unique shader in ray_tracing pipeline. Visible across all functions in current invocation. Can be initialized externally via API. Variables declared with this storage class are allowed in RayGenerationNV, IntersectionNV, AnyHitNV, ClosestHitNV, MissNV and CallableNV execution models and can be both read and written to but cannot have initializers. Refer to the Ray Tracing chapter of Vulkan API specification for details on shader records.RayTracingNV
SPV_NV_ray_tracing
- (Modify Section 3.20, Decoration)
-
Modify the definition of the Location decoration to add:
Location also forms the linkage between:
-
OpTraceNV and the RayPayloadKHR and IncomingRayPayloadKHR Storage Classes
-
OpExecuteCallableNV and the CallableDataKHR and IncomingCallableDataKHR Storage Classes
Add RayPayloadKHR, IncomingRayPayloadKHR, CallableDataKHR, and IncomingCallableDataKHR to the list of Storage Classes that Location is valid on.
-
- (Modify Section 3.21, Builtin, adding rows to the Builtin table)
-
Decoration Enabling Capabilities Extra Operands 5319
LaunchIdNV
Index of work item being processed in current invocation of ray tracing shader stage. Allowed in all ray tracing execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5320
LaunchSizeNV
Width and height dimensions passed to vkCmdTraceRaysNV call which resulted in invocation of current ray tracing shader stage. Allowed in all ray tracing execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5321
WorldRayOriginNV
World-space origin coordinates for the ray being traced in the IntersectionNV, AnyHitNV, ClosestHitNV, or MissNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5322
WorldRayDirectionNV
World-space direction for the ray being traced in the IntersectionNV, AnyHitNV, ClosestHitNV, or MissNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5323
ObjectRayOriginNV
Object-space origin coordinates for the ray being traced in the IntersectionNV, AnyHitNV, ClosestHitNV, or MissNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5324
ObjectRayDirectionNV
Object-space direction for the ray being traced in the IntersectionNV, AnyHitNV, ClosestHitNV, or MissNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5325
RayTminNV
The current Tmin parametric value for the ray being traced in the IntersectionNV, AnyHitNV, ClosestHitNV, or MissNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5326
RayTmaxNV
The current Tmax parametric value for the ray being traced in the IntersectionNV, AnyHitNV, ClosestHitNV, or MissNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5327
InstanceCustomIndexNV
Application specified value associated with the instance that was hit by the current ray in the IntersectionNV, AnyHitNV, ClosestHitNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5330
ObjectToWorldNV
The 4x3 object to world transformation matrix for the ray being traced in the IntersectionNV, AnyHitNV, or ClosestHitNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5331
WorldToObjectNV
The 4x3 world to object transformation matrix for the ray being traced in the IntersectionNV, AnyHitNV, or ClosestHitNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5332
HitTNV
The parametric value T for the ray resulting in a hit for the ray being traced in the AnyHitNV or ClosestHitNV execution models. This is an alias for RayTMaxNV for convenience.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5333
HitKindNV
The hit kind of the hit for the ray being traced in the AnyHitNV or ClosestHitNV execution models.Refer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
5351
IncomingRayFlagsNV
The ray flags in current stage as passed in through trace call in parent. Available in AnyHitNV, ClosestHitNV, IntersectionNV, and MissNV stageRefer to the Ray Tracing chapter of Vulkan API specification for more details.
RayTracingNV
- (Modify the definition of following BuiltIns, allowing them to be used in IntersectionNV, AnyHitNV, or ClosestHitNV Execution Models.)
-
BuiltIn Enabling Capabilities Enabled by Extension 6
InstanceId
Input Instance identifier. See the client API specifications for more detail.Instance ID in a Vertex Execution Model
Shader
Instance ID in an IntersectionNV, AnyHitNV, or ClosestHitNV Execution Model
RayTracingNV
SPV_NV_ray_tracing
7
PrimitiveId
Primitive identifier. See the client API specifications for more detail.Primitive ID in a Geometry Execution Model
Geometry
Primitive ID in a Tessellation Execution Model
Tessellation
Primitive ID in an IntersectionNV, AnyHitNV, or ClosestHitNV Execution Model
RayTracingNV
SPV_NV_ray_tracing
- (Modify Section 3.31, Capability, adding a row to the Capability table)
-
Capability Depends On Enabled by Extension 5340
RayTracingNV
Uses the RayGenerationNV, IntersectionNV, AnyHitNV, ClosestHitNV, MissNV, or CallableNV Execution ModelsSPV_NV_ray_tracing
- (Modify Section 3.32.6, Type-Declaration Instructions, adding a new table)
-
- (Add a new sub section 3.32.24, Ray Tracing Instructions, adding to end of list of instructions)
-
OpIgnoreIntersectionNV
Ignores the current potential intersection.This instruction is allowed only in AnyHitNV execution model.
Capability:
RayTracingNV1
5335
OpTerminateRayNV
Terminates further traversal of a ray.This instruction is allowed only in AnyHitNV execution model.
Capability:
RayTracingNV1
5336
An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:
OpExtension "SPV_NV_ray_tracing"
Rev | Date | Author | Changes |
---|---|---|---|
1 |
2018-09-12 |
Eric Werness |
Internal revisions |
2 |
2018-10-19 |
Ashwin Lele |
Rename from NVX_raytracing to NV_ray_tracing. Add IncomingRayFlagsNV, CallableDataNV, IncomingCallableDataNV, OpExecuteCallableNV |
3 |
2018-11-20 |
Daniel Koch |
Uses InstanceId not InstanceIndex for Intersection, Any Hit and Closest Hit shaders |
4 |
2019-03-25 |
Eric Werness |
Incoming ray flags shouldn’t be exposed in Callable shaders |
5 |
2020-09-17 |
Daniel Koch |
Add edits for the Location decoration (SPIR #583) |