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_NV_ray_tracingExample ray generation GLSL shader
#version 450 core
#extension GL_NV_ray_tracing : require
layout(set = 0, binding = 0, rgba8) uniform image2D image;
layout(set = 0, binding = 1) uniform accelerationStructureNV as;
layout(location = 0) rayPayloadNV float payload;
void main()
{
vec4 col = vec4(0, 0, 0, 1);
vec3 origin = vec3(float(gl_LaunchIDNV.x)/float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y)/float(gl_LaunchSizeNV.y), 1.0);
vec3 dir = vec3(0.0, 0.0, -1.0);
traceNV(as, 0, 0xff, 0, 1, 0, origin, 0.0, dir, 1000.0, 0);
col.y = payload;
imageStore(image, ivec2(gl_LaunchIDNV.xy), col);
}
VK_NV_ray_tracingVK_KHR_get_physical_device_properties2 and VK_KHR_get_memory_requirements2SPV_NV_ray_tracingGL_NV_ray_tracing| Modifier and Type | Field and Description |
|---|---|
| public static final int | VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV
VkAccelerationStructureMemoryRequirementsTypeNV - Acceleration structure memory requirement type Description
|
| public static final int | VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV
VkAccelerationStructureMemoryRequirementsTypeNV - Acceleration structure memory requirement type Description
|
| public static final int | VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV
VkAccelerationStructureMemoryRequirementsTypeNV - Acceleration structure memory requirement type Description
|
| public static final int | VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV
Extends |
| public static final int | VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV
Extends |
| public static final int | VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV
Extends |
| public static final int | VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV
Extends |
| public static final int | VK_BUFFER_USAGE_RAY_TRACING_BIT_NV
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV
Extends |
| public static final int | VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV
Extends |
| public static final int | VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV
Extends |
| public static final int | VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
Extends |
| public static final int | VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT
Extends |
| public static final int | VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV
Extends |
| public static final int | VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV
Extends |
| public static final int | VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV
Extends |
| public static final int | VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV
Extends |
| public static final int | VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV
Extends |
| public static final int | VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV
Extends |
| public static final int | VK_GEOMETRY_OPAQUE_BIT_NV
Extends |
| public static final int | VK_GEOMETRY_TYPE_AABBS_NV
Extends |
| public static final int | VK_GEOMETRY_TYPE_TRIANGLES_NV
Extends |
| public static final int | VK_INDEX_TYPE_NONE_NV
Extends |
| public static final String | VK_NV_RAY_TRACING_EXTENSION_NAME
The extension name. |
| public static final int | VK_NV_RAY_TRACING_SPEC_VERSION
The extension specification version. |
| public static final int | VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV
Extends |
| public static final int | VK_PIPELINE_BIND_POINT_RAY_TRACING_NV
Extends |
| public static final int | VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV
Extends |
| public static final int | VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV
Extends |
| public static final int | VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV
Extends |
| public static final int | VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV
Extends |
| public static final int | VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV
Extends |
| public static final int | VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV
Extends |
| public static final int | VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV
Extends |
| public static final int | VK_SHADER_STAGE_ANY_HIT_BIT_NV
Extends |
| public static final int | VK_SHADER_STAGE_CALLABLE_BIT_NV
Extends |
| public static final int | VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV
Extends |
| public static final int | VK_SHADER_STAGE_INTERSECTION_BIT_NV
Extends |
| public static final int | VK_SHADER_STAGE_MISS_BIT_NV
Extends |
| public static final int | VK_SHADER_STAGE_RAYGEN_BIT_NV
Extends |
| public static final int | VK_SHADER_UNUSED_NV
VK_SHADER_UNUSED_NV |
| public static final int | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_GEOMETRY_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV
Extends |
| public static final int | VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV
Extends |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static int | nvkBindAccelerationStructureMemoryNV(VkDevice device, int
the number of elements in bindInfoCount, long pBindInfos)pBindInfos.Unsafe version of: |
| public static void | nvkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, long pInfo, long instanceData, long instanceOffset, int update, long dst, long src, long scratch, long scratchOffset)
Unsafe version of: |
| public static void | nvkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, int
the count of acceleration structures for which to query the property. accelerationStructureCount, long pAccelerationStructures, int queryType, long queryPool, int firstQuery)Unsafe version of: |
| public static int | nvkCreateAccelerationStructureNV(VkDevice device, long pCreateInfo, long pAllocator, long pAccelerationStructure)
Unsafe version of: |
| public static int | nvkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, int
the length of the createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)pCreateInfos and pPipelines arrays.Unsafe version of: |
| public static void | nvkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, long pAllocator)
Unsafe version of: |
| public static int | nvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long
the size in bytes of the buffer pointed to by dataSize, long pData)pData.Unsafe version of: |
| public static void | nvkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, long pInfo, long pMemoryRequirements)
Unsafe version of: |
| public static int | nvkGetRayTracingShaderGroupHandlesNV(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 | vkBindAccelerationStructureMemoryNV(VkDevice
the logical device that owns the acceleration structures and memory. device, VkBindAccelerationStructureMemoryInfoNV.a pointer to an array of pBindInfosVkBindAccelerationStructureMemoryInfoNV structures describing acceleration structures and memory to bind.Bind acceleration structure memory. |
| public static void | vkCmdBuildAccelerationStructureNV(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, VkAccelerationStructureInfoNV contains the shared information for the acceleration structure’s structure. pInfo, long the buffer containing an array of instanceData, long VkAccelerationStructureInstanceKHR structures defining acceleration structures. This parameter must be NULL for bottom level acceleration structures.the offset in bytes (relative to the start of instanceOffset, boolean instanceData) at which the instance data is located.specifies whether to update the update, long dst acceleration structure with the data in src.a pointer to the target acceleration structure for the build. dst, long a pointer to an existing acceleration structure that is to be used to update the src, long dst acceleration structure.the scratch, long VkBuffer that will be used as scratch memory for the build.the offset in bytes relative to the start of scratchOffset)scratch that will be used as a scratch memory.Build an acceleration structure. |
| public static void | vkCmdCopyAccelerationStructureNV(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, long the target acceleration structure for the copy. dst, long the source acceleration structure for the copy. src, int a mode)VkCopyAccelerationStructureModeKHR value specifying additional operations to perform during the copy.Copy an acceleration structure. |
| public static void | vkCmdTraceRaysNV(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, long the buffer object that holds the shader binding table data for the ray generation shader stage. raygenShaderBindingTableBuffer, long the offset in bytes (relative to raygenShaderBindingOffset, long raygenShaderBindingTableBuffer) of the ray generation shader being used for the trace.the buffer object that holds the shader binding table data for the miss shader stage. missShaderBindingTableBuffer, long the offset in bytes (relative to missShaderBindingOffset, long missShaderBindingTableBuffer) of the miss shader being used for the trace.the size in bytes of each shader binding table record in missShaderBindingStride, long missShaderBindingTableBuffer.the buffer object that holds the shader binding table data for the hit shader stages. hitShaderBindingTableBuffer, long the offset in bytes (relative to hitShaderBindingOffset, long hitShaderBindingTableBuffer) of the hit shader group being used for the trace.the size in bytes of each shader binding table record in hitShaderBindingStride, long hitShaderBindingTableBuffer.the buffer object that holds the shader binding table data for the callable shader stage. callableShaderBindingTableBuffer, long the offset in bytes (relative to callableShaderBindingOffset, long callableShaderBindingTableBuffer) of the callable shader being used for the trace.the size in bytes of each shader binding table record in callableShaderBindingStride, int callableShaderBindingTableBuffer.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 void | vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer
the command buffer into which the command will be recorded. commandBuffer, LongBuffer a pointer to an array of existing previously built acceleration structures. pAccelerationStructures, int a queryType, long VkQueryType value specifying the type of queries managed by the pool.the query pool that will manage the results of the query. queryPool, int the first query index within the query pool that will contain the firstQuery)accelerationStructureCount number of results.Write acceleration structure result parameters to query results. |
| public static void | vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, long[] pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Array version of: |
| public static int | vkCompileDeferredNV(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 shader to compile. shader)Deferred compilation of shaders. |
| public static int | vkCreateAccelerationStructureNV(VkDevice
the logical device that creates the buffer object. device, VkAccelerationStructureCreateInfoNV a pointer to a pCreateInfo, VkAllocationCallbacks VkAccelerationStructureCreateInfoNV structure containing parameters affecting creation of the acceleration structure.controls host memory allocation as described in the Memory Allocation chapter. pAllocator, LongBuffer a pointer to a pAccelerationStructure)VkAccelerationStructureNV handle in which the resulting acceleration structure object is returned.Create a new acceleration structure object. |
| public static int | vkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, long[] pAccelerationStructure)
Array version of: |
| public static int | vkCreateRayTracingPipelinesNV(VkDevice
the logical device that creates the ray tracing pipelines. device, long either pipelineCache, VkRayTracingPipelineCreateInfoNV.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,VkRayTracingPipelineCreateInfoNV 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 | vkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.
Array version of: |
| public static void | vkDestroyAccelerationStructureNV(VkDevice
the logical device that destroys the buffer. device, long the acceleration structure to destroy. accelerationStructure, VkAllocationCallbacks controls host memory allocation as described in the Memory Allocation chapter. pAllocator)Destroy an acceleration structure object. |
| public static int | vkGetAccelerationStructureHandleNV(VkDevice
the logical device that owns the acceleration structures. device, long the acceleration structure. accelerationStructure, ByteBuffer a pointer to a user-allocated buffer where the results will be written. pData)Get opaque acceleration structure handle. |
| public static int | vkGetAccelerationStructureHandleNV(VkDevice
the logical device that owns the acceleration structures. device, long the acceleration structure. accelerationStructure, LongBuffer a pointer to a user-allocated buffer where the results will be written. pData)Get opaque acceleration structure handle. |
| public static int | vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long[] pData)
Array version of: |
| public static void | vkGetAccelerationStructureMemoryRequirementsNV(VkDevice
the logical device on which the acceleration structure was created. device, VkAccelerationStructureMemoryRequirementsInfoNV a pointer to a pInfo, VkMemoryRequirements2KHR VkAccelerationStructureMemoryRequirementsInfoNV structure specifying the acceleration structure to get memory requirements for.a pointer to a pMemoryRequirements)VkMemoryRequirements2KHR structure in which the requested acceleration structure memory requirements are returned.Get acceleration structure memory requirements. |
| public static int | vkGetRayTracingShaderGroupHandlesNV(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) |