To enable ray tracing, this extension adds a few different categories of new functionality:
This extension adds support for the following SPIR-V extension in Vulkan:
SPV_KHR_ray_tracingExample ray generation GLSL shader
#version 450 core
#extension GL_EXT_ray_tracing : require
layout(set = 0, binding = 0, rgba8) uniform image2D image;
layout(set = 0, binding = 1) uniform accelerationStructureEXT as;
layout(location = 0) rayPayloadEXT float payload;
void main()
{
vec4 col = vec4(0, 0, 0, 1);
vec3 origin = vec3(float(gl_LaunchIDEXT.x)/float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y)/float(gl_LaunchSizeEXT.y), 1.0);
vec3 dir = vec3(0.0, 0.0, -1.0);
traceRayEXT(as, 0, 0xff, 0, 1, 0, origin, 0.0, dir, 1000.0, 0);
col.y = payload;
imageStore(image, ivec2(gl_LaunchIDEXT.xy), col);
}
VK_KHR_ray_tracing_pipelineVK_KHR_spirv_1_4 and VK_KHR_acceleration_structureSPV_KHR_ray_tracingGLSL_EXT_ray_tracingVK_KHR_vulkan_memory_model, adding the shader-call-related relation of invocations, shader-call-order partial order of dynamic instances of instructions, and the ShaderCallKHR scope.VK_KHR_pipeline_library, enabling pipeline libraries to be used with ray tracing pipelines and enabling usage of VkRayTracingPipelineInterfaceCreateInfoKHR.| Modifier and Type | Field and Description |
|---|---|
| public static final int | VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR
Extends |
| public static final int | VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR
Extends |
| public static final String | VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME
The extension name. |
| public static final int | VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION
The extension specification version. |
| public static final int | VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR
Extends |
| public static final int | VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR
Extends |
| public static final int | VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR
VkRayTracingShaderGroupTypeKHR - Shader group types Description
|
| public static final int | VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR
VkRayTracingShaderGroupTypeKHR - Shader group types Description
|
| public static final int | VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR
VkRayTracingShaderGroupTypeKHR - Shader group types Description
|
| public static final int | VK_SHADER_GROUP_SHADER_ANY_HIT_KHR
VkShaderGroupShaderKHR - Shader group shaders Description
|
| public static final int | VK_SHADER_GROUP_SHADER_CLOSEST_HIT_KHR
VkShaderGroupShaderKHR - Shader group shaders Description
|
| public static final int | VK_SHADER_GROUP_SHADER_GENERAL_KHR
VkShaderGroupShaderKHR - Shader group shaders Description
|
| public static final int | VK_SHADER_GROUP_SHADER_INTERSECTION_KHR
VkShaderGroupShaderKHR - Shader group shaders Description
|
| public static final int | VK_SHADER_STAGE_ANY_HIT_BIT_KHR
Extends |
| public static final int | VK_SHADER_STAGE_CALLABLE_BIT_KHR
Extends |
| public static final int | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR
Extends |
| public static final int | VK_SHADER_STAGE_INTERSECTION_BIT_KHR
Extends |
| public static final int | VK_SHADER_STAGE_MISS_BIT_KHR
Extends |
| public static final int | VK_SHADER_STAGE_RAYGEN_BIT_KHR
Extends |
| public static final int | VK_SHADER_UNUSED_KHR
VK_SHADER_UNUSED_KHR |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR
Extends |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static void | nvkCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer, long pRaygenShaderBindingTable, long pMissShaderBindingTable, long pHitShaderBindingTable, long pCallableShaderBindingTable, long indirectDeviceAddress)
Unsafe version of: |
| public static void | nvkCmdTraceRaysKHR(VkCommandBuffer commandBuffer, long pRaygenShaderBindingTable, long pMissShaderBindingTable, long pHitShaderBindingTable, long pCallableShaderBindingTable, int width, int height, int depth)
Unsafe version of: |
| public static int | nvkCreateRayTracingPipelinesKHR(VkDevice device, long deferredOperation, long pipelineCache, int
the length of the createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)pCreateInfos and pPipelines arrays.Unsafe version of: |
| public static int | nvkGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, long pipeline, int firstGroup, int groupCount, long
the size in bytes of the buffer pointed to by dataSize, long pData)pData.Unsafe version of: |
| public static int | nvkGetRayTracingShaderGroupHandlesKHR(VkDevice device, long pipeline, int firstGroup, int groupCount, long
the size in bytes of the buffer pointed to by dataSize, long pData)pData.Unsafe version of: |
| public static void | vkCmdSetRayTracingPipelineStackSizeKHR(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, int the stack size to use for subsequent ray tracing trace commands. pipelineStackSize)Set the stack size dynamically for a ray tracing pipeline. |
| public static void | vkCmdTraceRaysIndirectKHR(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkStridedDeviceAddressRegionKHR a pRaygenShaderBindingTable, VkStridedDeviceAddressRegionKHR VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the ray generation shader stage.a pMissShaderBindingTable, VkStridedDeviceAddressRegionKHR VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the miss shader stage.a pHitShaderBindingTable, VkStridedDeviceAddressRegionKHR VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the hit shader stage.a pCallableShaderBindingTable, long VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the callable shader stage.a buffer device address which is a pointer to a indirectDeviceAddress)VkTraceRaysIndirectCommandKHR structure containing the trace ray parameters.Initialize an indirect ray tracing dispatch. |
| public static void | vkCmdTraceRaysKHR(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkStridedDeviceAddressRegionKHR a pRaygenShaderBindingTable, VkStridedDeviceAddressRegionKHR VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the ray generation shader stage.a pMissShaderBindingTable, VkStridedDeviceAddressRegionKHR VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the miss shader stage.a pHitShaderBindingTable, VkStridedDeviceAddressRegionKHR VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the hit shader stage.a pCallableShaderBindingTable, int VkStridedDeviceAddressRegionKHR that holds the shader binding table data for the callable shader stage.the width of the ray trace query dimensions. width, int height of the ray trace query dimensions. height, int depth of the ray trace query dimensions. depth)Initialize a ray tracing dispatch. |
| public static int | vkCreateRayTracingPipelinesKHR(VkDevice
the logical device that creates the ray tracing pipelines. device, long NULL_HANDLE or the handle of a valid VkDeferredOperationKHR request deferral object for this command.either pipelineCache, VkRayTracingPipelineCreateInfoKHR.NULL_HANDLE, indicating that pipeline caching is disabled, or the handle of a valid pipeline cache object, in which case use of that cache is enabled for the duration of the command.a pointer to an array of pCreateInfos,VkRayTracingPipelineCreateInfoKHR structures.controls host memory allocation as described in the Memory Allocation chapter. pAllocator, LongBuffer a pointer to an array in which the resulting ray tracing pipeline objects are returned. pPipelines)Creates a new ray tracing pipeline object. |
| public static int | vkCreateRayTracingPipelinesKHR(VkDevice device, long deferredOperation, long pipelineCache, VkRayTracingPipelineCreateInfoKHR.
Array version of: |
| public static int | vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice
the logical device containing the ray tracing pipeline. device, long the ray tracing pipeline object containing the shaders. pipeline, int the index of the first group to retrieve a handle for from the firstGroup, int VkRayTracingPipelineCreateInfoKHR::pGroups array.the number of shader handles to retrieve. groupCount, ByteBuffer a pointer to a user-allocated buffer where the results will be written. pData)Query opaque capture replay data for pipeline shader group handles. |
| public static int | vkGetRayTracingShaderGroupHandlesKHR(VkDevice
the logical device containing the ray tracing pipeline. device, long the ray tracing pipeline object containing the shaders. pipeline, int the index of the first group to retrieve a handle for from the firstGroup, int VkRayTracingPipelineCreateInfoKHR::pGroups or VkRayTracingPipelineCreateInfoNV::pGroups array.the number of shader handles to retrieve. groupCount, ByteBuffer a pointer to a user-allocated buffer where the results will be written. pData)Query ray tracing pipeline shader group handles. |
| public static long | vkGetRayTracingShaderGroupStackSizeKHR(VkDevice
the logical device containing the ray tracing pipeline. device, long the ray tracing pipeline object containing the shaders groups. pipeline, int the index of the shader group to query. group, int the type of shader from the group to query. groupShader)Query ray tracing pipeline shader group shader stack size. |