Class NVRayTracing
- java.lang.Object
-
- org.lwjgl.vulkan.NVRayTracing
-
public class NVRayTracing extends java.lang.Object
Rasterization has been the dominant method to produce interactive graphics, but increasing performance of graphics hardware has made ray tracing a viable option for interactive rendering. Being able to integrate ray tracing with traditional rasterization makes it easier for applications to incrementally add ray traced effects to existing applications or to do hybrid approaches with rasterization for primary visibility and ray tracing for secondary queries.To enable ray tracing, this extension adds a few different categories of new functionality:
- Acceleration structure objects and build commands
- A new pipeline type with new shader domains
- An indirection table to link shader groups with acceleration structure items
This extension adds support for the following SPIR-V extension in Vulkan:
SPV_NV_ray_tracing
Sample Code
Example 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); }
- Name String
VK_NV_ray_tracing
- Extension Type
- Device extension
- Registered Extension Number
- 166
- Revision
- 3
- Extension and Version Dependencies
- Requires Vulkan 1.0
- Requires
VK_KHR_get_physical_device_properties2
- Requires
VK_KHR_get_memory_requirements2
- Contact
- Eric Werness ewerness
- Last Modified Date
- 2018-11-20
- Interactions and External Dependencies
- This extension requires the
SPV_NV_ray_tracing
SPIR-V extension. - This extension requires the
GL_NV_ray_tracing
extension for GLSL source languages.
- This extension requires the
- Contributors
- Eric Werness, NVIDIA
- Ashwin Lele, NVIDIA
- Robert Stepinski, NVIDIA
- Nuno Subtil, NVIDIA
- Christoph Kubisch, NVIDIA
- Martin Stich, NVIDIA
- Daniel Koch, NVIDIA
- Jeff Bolz, NVIDIA
- Joshua Barczak, Intel
- Tobias Hector, AMD
- Henrik Rydgard, NVIDIA
- Pascal Gautron, NVIDIA
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
nvkBindAccelerationStructureMemoryNV(VkDevice device, int bindInfoCount, long pBindInfos)
Unsafe version of:BindAccelerationStructureMemoryNV
static void
nvkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, long pInfo, long instanceData, long instanceOffset, int update, long dst, long src, long scratch, long scratchOffset)
Unsafe version of:CmdBuildAccelerationStructureNV
static void
nvkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, int accelerationStructureCount, long pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Unsafe version of:CmdWriteAccelerationStructuresPropertiesNV
static int
nvkCreateAccelerationStructureNV(VkDevice device, long pCreateInfo, long pAllocator, long pAccelerationStructure)
Unsafe version of:CreateAccelerationStructureNV
static int
nvkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, int createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)
Unsafe version of:CreateRayTracingPipelinesNV
static void
nvkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, long pAllocator)
Unsafe version of:DestroyAccelerationStructureNV
static int
nvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long dataSize, long pData)
Unsafe version of:GetAccelerationStructureHandleNV
static void
nvkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, long pInfo, long pMemoryRequirements)
Unsafe version of:GetAccelerationStructureMemoryRequirementsNV
static int
nvkGetRayTracingShaderGroupHandlesNV(VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)
Unsafe version of:GetRayTracingShaderGroupHandlesNV
static int
vkBindAccelerationStructureMemoryNV(VkDevice device, VkBindAccelerationStructureMemoryInfoNV.Buffer pBindInfos)
Bind acceleration structure memory.static void
vkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureInfoNV pInfo, long instanceData, long instanceOffset, boolean update, long dst, long src, long scratch, long scratchOffset)
Build an acceleration structure.static void
vkCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, long dst, long src, int mode)
Copy an acceleration structure.static void
vkCmdTraceRaysNV(VkCommandBuffer commandBuffer, long raygenShaderBindingTableBuffer, long raygenShaderBindingOffset, long missShaderBindingTableBuffer, long missShaderBindingOffset, long missShaderBindingStride, long hitShaderBindingTableBuffer, long hitShaderBindingOffset, long hitShaderBindingStride, long callableShaderBindingTableBuffer, long callableShaderBindingOffset, long callableShaderBindingStride, int width, int height, int depth)
Initialize a ray tracing dispatch.static void
vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, long[] pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Array version of:CmdWriteAccelerationStructuresPropertiesNV
static void
vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, java.nio.LongBuffer pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Write acceleration structure result parameters to query results.static int
vkCompileDeferredNV(VkDevice device, long pipeline, int shader)
Deferred compilation of shaders.static int
vkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, long[] pAccelerationStructure)
Array version of:CreateAccelerationStructureNV
static int
vkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pAccelerationStructure)
Create a new acceleration structure object.static int
vkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, long[] pPipelines)
Array version of:CreateRayTracingPipelinesNV
static int
vkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pPipelines)
Creates a new ray tracing pipeline object.static void
vkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, VkAllocationCallbacks pAllocator)
Destroy an acceleration structure object.static int
vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long[] pData)
Array version of:GetAccelerationStructureHandleNV
static int
vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, java.nio.ByteBuffer pData)
Get opaque acceleration structure handle.static int
vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, java.nio.LongBuffer pData)
Get opaque acceleration structure handle.static void
vkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, VkAccelerationStructureMemoryRequirementsInfoNV pInfo, VkMemoryRequirements2KHR pMemoryRequirements)
Get acceleration structure memory requirements.static int
vkGetRayTracingShaderGroupHandlesNV(VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)
Query ray tracing pipeline shader group handles.
-
-
-
Field Detail
-
VK_NV_RAY_TRACING_SPEC_VERSION
The extension specification version.
-
VK_NV_RAY_TRACING_EXTENSION_NAME
The extension name.
-
VK_SHADER_UNUSED_NV
VK_SHADER_UNUSED_NV
-
VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV, VK_STRUCTURE_TYPE_GEOMETRY_NV, VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV, VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV, VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV, VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV
ExtendsVkStructureType
.Enum values:
STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV
STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV
STRUCTURE_TYPE_GEOMETRY_NV
STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV
STRUCTURE_TYPE_GEOMETRY_AABB_NV
STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV
STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV
STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV
STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV
STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV
STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV
-
VK_SHADER_STAGE_RAYGEN_BIT_NV, VK_SHADER_STAGE_ANY_HIT_BIT_NV, VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV, VK_SHADER_STAGE_MISS_BIT_NV, VK_SHADER_STAGE_INTERSECTION_BIT_NV, VK_SHADER_STAGE_CALLABLE_BIT_NV
ExtendsVkShaderStageFlagBits
.Enum values:
-
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV, VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV
ExtendsVkPipelineStageFlagBits
.Enum values:
-
VK_BUFFER_USAGE_RAY_TRACING_BIT_NV
ExtendsVkBufferUsageFlagBits
.
-
VK_PIPELINE_BIND_POINT_RAY_TRACING_NV
ExtendsVkPipelineBindPoint
.
-
VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV
ExtendsVkDescriptorType
.
-
VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV, VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV
ExtendsVkAccessFlagBits
.Enum values:
-
VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV
ExtendsVkQueryType
.
-
VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV
ExtendsVkPipelineCreateFlagBits
.
-
VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV
ExtendsVkObjectType
.
-
VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT
ExtendsVkDebugReportObjectTypeEXT
.
-
VK_INDEX_TYPE_NONE_NV
ExtendsVkIndexType
.
-
VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV, VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV
VkAccelerationStructureTypeNV - Type of acceleration structureDescription
ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV
is a top-level acceleration structure containing instance data referring to bottom-level level acceleration structures.ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV
is a bottom-level acceleration structure containing the AABBs or geometry to be intersected.
See Also
-
VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV, VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV, VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV
VkRayTracingShaderGroupTypeNV - Shader group typesDescription
RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV
indicates a shader group with a singleSHADER_STAGE_RAYGEN_BIT_NV
,SHADER_STAGE_MISS_BIT_NV
, orSHADER_STAGE_CALLABLE_BIT_NV
shader in it.RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV
specifies a shader group that only hits triangles and must not contain an intersection shader, only closest hit and any-hit.RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV
specifies a shader group that only intersects with custom geometry and must contain an intersection shader and may contain closest hit and any-hit shaders.
Note
For current group types, the hit group type could be inferred from the presence or absence of the intersection shader, but we provide the type explicitly for future hit groups that do not have that property.
See Also
-
VK_GEOMETRY_TYPE_TRIANGLES_NV, VK_GEOMETRY_TYPE_AABBS_NV
VkGeometryTypeNV - Enum specifying which type of geometry is providedDescription
GEOMETRY_TYPE_TRIANGLES_NV
indicates that thetriangles
ofVkGeometryDataNV
contains valid data.GEOMETRY_TYPE_AABBS_NV
indicates that theaabbs
ofVkGeometryDataNV
contains valid data.
See Also
-
VK_GEOMETRY_OPAQUE_BIT_NV, VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV
VkGeometryFlagBitsNV - Bitmask specifying additional parameters for a geometryDescription
GEOMETRY_OPAQUE_BIT_NV
indicates that this geometry does not invoke the any-hit shaders even if present in a hit group.GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV
indicates that the implementation must only call the any-hit shader a single time for each primitive in this geometry. If this bit is absent an implementation may invoke the any-hit shader more than once for this geometry.
See Also
VkGeometryFlagsNV
-
VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV, VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV, VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV
VkGeometryInstanceFlagBitsNV - Instance flag bitsDescription
GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV
disables face culling for this instance.GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV
indicates that the front face of the triangle for culling purposes is the face that is counter clockwise in object space relative to the ray origin. Because the facing is determined in object space, an instance transform matrix does not change the winding, but a geometry transform does.GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV
causes this instance to act as thoughGEOMETRY_OPAQUE_BIT_NV
were specified on all geometries referenced by this instance. This behavior can be overridden by the ray flaggl_RayFlagsNoOpaqueNV
.GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV
causes this instance to act as thoughGEOMETRY_OPAQUE_BIT_NV
were not specified on all geometries referenced by this instance. This behavior can be overridden by the ray flaggl_RayFlagsOpaqueNV
.
GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV
andGEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV
must not be used in the same flag.See Also
VkGeometryInstanceFlagsNV
-
VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV, VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV
VkBuildAccelerationStructureFlagBitsNV - Bitmask specifying additional parameters for acceleration structure buildsDescription
BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV
indicates that the specified acceleration structure can be updated withupdate
ofTRUE
inCmdBuildAccelerationStructureNV
.BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV
indicates that the specified acceleration structure can act as the source forCmdCopyAccelerationStructureNV
withmode
ofCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
to produce a compacted acceleration structure.BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV
indicates that the given acceleration structure build should prioritize trace performance over build time.BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV
indicates that the given acceleration structure build should prioritize build time over trace performance.BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV
indicates that this acceleration structure should minimize the size of the scratch memory and the final result build, potentially at the expense of build time or trace performance.
Note
BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV
andBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV
may take more time and memory than a normal build, and so should only be used when those features are used.See Also
VkBuildAccelerationStructureFlagsNV
-
VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV, VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
VkCopyAccelerationStructureModeNV - Acceleration structure copy modeDescription
COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV
creates a direct copy of the acceleration structure specified insrc
into the one specified bydst
. Thedst
acceleration structure must have been created with the same parameters assrc
.COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
creates a more compact version of an acceleration structuresrc
intodst
. The acceleration structuredst
must have been created with acompactedSize
corresponding to the one returned byCmdWriteAccelerationStructuresPropertiesNV
after the build of the acceleration structure specified bysrc
.
See Also
-
VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV, VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV, VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV
VkAccelerationStructureMemoryRequirementsTypeNV - Acceleration structure memory requirement typeDescription
ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV
requests the memory requirement for theVkAccelerationStructureNV
backing store.ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV
requests the memory requirement for scratch space during the initial build.ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV
requests the memory requirement for scratch space during an update.
See Also
-
-
Method Detail
-
nvkCreateAccelerationStructureNV
public static int nvkCreateAccelerationStructureNV(VkDevice device, long pCreateInfo, long pAllocator, long pAccelerationStructure)
Unsafe version of:CreateAccelerationStructureNV
-
vkCreateAccelerationStructureNV
public static int vkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, @Nullable VkAllocationCallbacks pAllocator, java.nio.LongBuffer pAccelerationStructure)
Create a new acceleration structure object.C Specification
To create acceleration structures, call:
VkResult vkCreateAccelerationStructureNV( VkDevice device, const VkAccelerationStructureCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureNV* pAccelerationStructure);
Description
Similar to other objects in Vulkan, the acceleration structure creation merely creates an object with a specific "
shape
" as specified by the information inVkAccelerationStructureInfoNV
andcompactedSize
inpCreateInfo
. Populating the data in the object after allocating and binding memory is done withCmdBuildAccelerationStructureNV
andCmdCopyAccelerationStructureNV
.Acceleration structure creation uses the count and type information from the geometries, but does not use the data references in the structures.
Valid Usage (Implicit)
device
must be a validVkDevice
handlepCreateInfo
must be a valid pointer to a validVkAccelerationStructureCreateInfoNV
structure- If
pAllocator
is notNULL
,pAllocator
must be a valid pointer to a validVkAllocationCallbacks
structure pAccelerationStructure
must be a valid pointer to aVkAccelerationStructureNV
handle
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
device
- the logical device that creates the buffer object.pCreateInfo
- a pointer to an instance of theVkAccelerationStructureCreateInfoNV
structure containing parameters affecting creation of the acceleration structure.pAllocator
- controls host memory allocation as described in the Memory Allocation chapter.pAccelerationStructure
- points to aVkAccelerationStructureNV
handle in which the resulting acceleration structure object is returned.
-
nvkDestroyAccelerationStructureNV
public static void nvkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, long pAllocator)
Unsafe version of:DestroyAccelerationStructureNV
-
vkDestroyAccelerationStructureNV
public static void vkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, @Nullable VkAllocationCallbacks pAllocator)
Destroy an acceleration structure object.C Specification
To destroy an acceleration structure, call:
void vkDestroyAccelerationStructureNV( VkDevice device, VkAccelerationStructureNV accelerationStructure, const VkAllocationCallbacks* pAllocator);
Valid Usage
- All submitted commands that refer to
accelerationStructure
must have completed execution - If
VkAllocationCallbacks
were provided whenaccelerationStructure
was created, a compatible set of callbacks must be provided here - If no
VkAllocationCallbacks
were provided whenaccelerationStructure
was created,pAllocator
must beNULL
Valid Usage (Implicit)
device
must be a validVkDevice
handleaccelerationStructure
must be a validVkAccelerationStructureNV
handle- If
pAllocator
is notNULL
,pAllocator
must be a valid pointer to a validVkAllocationCallbacks
structure accelerationStructure
must have been created, allocated, or retrieved fromdevice
See Also
- Parameters:
device
- the logical device that destroys the buffer.accelerationStructure
- the acceleration structure to destroy.pAllocator
- controls host memory allocation as described in the Memory Allocation chapter.
- All submitted commands that refer to
-
nvkGetAccelerationStructureMemoryRequirementsNV
public static void nvkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, long pInfo, long pMemoryRequirements)
Unsafe version of:GetAccelerationStructureMemoryRequirementsNV
-
vkGetAccelerationStructureMemoryRequirementsNV
public static void vkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, VkAccelerationStructureMemoryRequirementsInfoNV pInfo, VkMemoryRequirements2KHR pMemoryRequirements)
Get acceleration structure memory requirements.C Specification
An acceleration structure has memory requirements for the structure object itself, scratch space for the build, and scratch space for the update.
To query the memory requirements call:
void vkGetAccelerationStructureMemoryRequirementsNV( VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNV* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements);
Valid Usage (Implicit)
device
must be a validVkDevice
handlepInfo
must be a valid pointer to a validVkAccelerationStructureMemoryRequirementsInfoNV
structurepMemoryRequirements
must be a valid pointer to aVkMemoryRequirements2KHR
structure
See Also
VkAccelerationStructureMemoryRequirementsInfoNV
,VkMemoryRequirements2KHR
- Parameters:
device
- the logical device on which the acceleration structure was created.pInfo
- specifies the acceleration structure to get memory requirements for.pMemoryRequirements
- returns the requested acceleration structure memory requirements.
-
nvkBindAccelerationStructureMemoryNV
public static int nvkBindAccelerationStructureMemoryNV(VkDevice device, int bindInfoCount, long pBindInfos)
Unsafe version of:BindAccelerationStructureMemoryNV
- Parameters:
bindInfoCount
- the number of elements inpBindInfos
.
-
vkBindAccelerationStructureMemoryNV
public static int vkBindAccelerationStructureMemoryNV(VkDevice device, VkBindAccelerationStructureMemoryInfoNV.Buffer pBindInfos)
Bind acceleration structure memory.C Specification
To attach memory to one or more acceleration structures at a time, call:
VkResult vkBindAccelerationStructureMemoryNV( VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNV* pBindInfos);
Valid Usage (Implicit)
device
must be a validVkDevice
handlepBindInfos
must be a valid pointer to an array ofbindInfoCount
validVkBindAccelerationStructureMemoryInfoNV
structuresbindInfoCount
must be greater than 0
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
device
- the logical device that owns the acceleration structures and memory.pBindInfos
- a pointer to an array of structures of typeVkBindAccelerationStructureMemoryInfoNV
, describing images and memory to bind.
-
nvkCmdBuildAccelerationStructureNV
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:CmdBuildAccelerationStructureNV
-
vkCmdBuildAccelerationStructureNV
public static void vkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureInfoNV pInfo, long instanceData, long instanceOffset, boolean update, long dst, long src, long scratch, long scratchOffset)
Build an acceleration structure.C Specification
To build an acceleration structure call:
void vkCmdBuildAccelerationStructureNV( VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV* pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset);
Valid Usage
geometryCount
must be less than or equal toVkPhysicalDeviceRayTracingPropertiesNV
::maxGeometryCount
dst
must have been created with compatibleVkAccelerationStructureInfoNV
whereVkAccelerationStructureInfoNV
::type
andVkAccelerationStructureInfoNV
::flags
are identical,VkAccelerationStructureInfoNV
::instanceCount
andVkAccelerationStructureInfoNV
::geometryCount
fordst
are greater than or equal to the build size and each geometry inVkAccelerationStructureInfoNV
::pGeometries
fordst
has greater than or equal to the number of vertices, indices, and AABBs.- If
update
isTRUE
,src
must not beNULL_HANDLE
- If
update
isTRUE
,src
must have been built before withBUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV
set inVkAccelerationStructureInfoNV
::flags
- If
update
isFALSE
, Thesize
member of theVkMemoryRequirements
structure returned from a call toGetAccelerationStructureMemoryRequirementsNV
withVkAccelerationStructureMemoryRequirementsInfoNV
::accelerationStructure
set todst
andVkAccelerationStructureMemoryRequirementsInfoNV
::type
set toACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV
must be less than or equal to the size ofscratch
minusscratchOffset
- If
update
isTRUE
, Thesize
member of theVkMemoryRequirements
structure returned from a call toGetAccelerationStructureMemoryRequirementsNV
withVkAccelerationStructureMemoryRequirementsInfoNV
::accelerationStructure
set todst
andVkAccelerationStructureMemoryRequirementsInfoNV
::type
set toACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV
must be less than or equal to the size ofscratch
minusscratchOffset
Valid Usage (Implicit)
commandBuffer
must be a validVkCommandBuffer
handlepInfo
must be a valid pointer to a validVkAccelerationStructureInfoNV
structure- If
instanceData
is notNULL_HANDLE
,instanceData
must be a validVkBuffer
handle dst
must be a validVkAccelerationStructureNV
handle- If
src
is notNULL_HANDLE
,src
must be a validVkAccelerationStructureNV
handle scratch
must be a validVkBuffer
handlecommandBuffer
must be in the recording state- The
VkCommandPool
thatcommandBuffer
was allocated from must support compute operations - This command must only be called outside of a render pass instance
- Each of
commandBuffer
,dst
,instanceData
,scratch
, andsrc
that are valid handles must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPool
thatcommandBuffer
was allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type Primary Secondary Outside Compute See Also
- Parameters:
commandBuffer
- the command buffer into which the command will be recorded.pInfo
- contains the shared information for the acceleration structure’s structure.instanceData
- the buffer containing instance data that will be used to build the acceleration structure as described in Accelerator structure instances. This parameter must beNULL
for bottom level acceleration structures.instanceOffset
- the offset in bytes (relative to the start ofinstanceData
) at which the instance data is located.update
- specifies whether to update thedst
acceleration structure with the data insrc
.dst
- points to the target acceleration structure for the build.src
- points to an existing acceleration structure that is to be used to update thedst
acceleration structure.scratch
- theVkBuffer
that will be used as scratch memory for the build.scratchOffset
- the offset in bytes relative to the start ofscratch
that will be used as a scratch memory.
-
vkCmdCopyAccelerationStructureNV
public static void vkCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, long dst, long src, int mode)
Copy an acceleration structure.C Specification
To copy an acceleration structure call:
void vkCmdCopyAccelerationStructureNV( VkCommandBuffer commandBuffer, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkCopyAccelerationStructureModeNV mode);
Valid Usage
mode
must beCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
orCOPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV
src
must have been built withBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV
ifmode
isCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
Valid Usage (Implicit)
commandBuffer
must be a validVkCommandBuffer
handledst
must be a validVkAccelerationStructureNV
handlesrc
must be a validVkAccelerationStructureNV
handlemode
must be a validVkCopyAccelerationStructureModeNV
valuecommandBuffer
must be in the recording state- The
VkCommandPool
thatcommandBuffer
was allocated from must support compute operations - This command must only be called outside of a render pass instance
- Each of
commandBuffer
,dst
, andsrc
must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPool
thatcommandBuffer
was allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type Primary Secondary Outside Compute - Parameters:
commandBuffer
- the command buffer into which the command will be recorded.dst
- points to the target acceleration structure for the copy.src
- points to the source acceleration structure for the copy.mode
- aVkCopyAccelerationStructureModeNV
value that specifies additional operations to perform during the copy.
-
vkCmdTraceRaysNV
public static void vkCmdTraceRaysNV(VkCommandBuffer commandBuffer, long raygenShaderBindingTableBuffer, long raygenShaderBindingOffset, long missShaderBindingTableBuffer, long missShaderBindingOffset, long missShaderBindingStride, long hitShaderBindingTableBuffer, long hitShaderBindingOffset, long hitShaderBindingStride, long callableShaderBindingTableBuffer, long callableShaderBindingOffset, long callableShaderBindingStride, int width, int height, int depth)
Initialize a ray tracing dispatch.C Specification
To dispatch a ray tracing call use:
void vkCmdTraceRaysNV( VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, uint32_t width, uint32_t height, uint32_t depth);
Description
When the command is executed, a ray generation group of
width × height × depth
rays is assembled.Valid Usage
- If a
VkImageView
is sampled withFILTER_LINEAR
as a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
- If a
VkImageView
is accessed using atomic operations as a result of this command, then the image view’s format features must containFORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT
- If a
VkImageView
is sampled withFILTER_CUBIC_EXT
as a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT
- Any
VkImageView
being sampled withFILTER_CUBIC_EXT
as a result of this command must have aVkImageViewType
and format that supports cubic filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT
::filterCubic
returned byvkGetPhysicalDeviceImageFormatProperties2
- Any
VkImageView
being sampled withFILTER_CUBIC_EXT
with a reduction mode of eitherSAMPLER_REDUCTION_MODE_MIN_EXT
orSAMPLER_REDUCTION_MODE_MAX_EXT
as a result of this command must have aVkImageViewType
and format that supports cubic filtering together with minmax filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT
::filterCubicMinmax
returned byvkGetPhysicalDeviceImageFormatProperties2
- Any
VkImage
created with aVkImageCreateInfo
::flags
containingIMAGE_CREATE_CORNER_SAMPLED_BIT_NV
sampled as a result of this command must only be sampled using aVkSamplerAddressMode
ofSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
. - For each set n that is statically used by the
VkPipeline
bound to the pipeline bind point used by this command, a descriptor set must have been bound to n at the same pipeline bind point, with aVkPipelineLayout
that is compatible for set n, with theVkPipelineLayout
used to create the currentVkPipeline
, as described in Pipeline Layout Compatibility - For each push constant that is statically used by the
VkPipeline
bound to the pipeline bind point used by this command, a push constant value must have been set for the same pipeline bind point, with aVkPipelineLayout
that is compatible for push constants, with theVkPipelineLayout
used to create the currentVkPipeline
, as described in Pipeline Layout Compatibility - Descriptors in each bound descriptor set, specified via
vkCmdBindDescriptorSets
, must be valid if they are statically used by theVkPipeline
bound to the pipeline bind point used by this command - A valid pipeline must be bound to the pipeline bind point used by this command
- If the
VkPipeline
object bound to the pipeline bind point used by this command requires any dynamic state, that state must have been set forcommandBuffer
- If the
VkPipeline
object bound to the pipeline bind point used by this command accesses aVkSampler
object that uses unnormalized coordinates, that sampler must not be used to sample from anyVkImage
with aVkImageView
of the typeIMAGE_VIEW_TYPE_3D
,IMAGE_VIEW_TYPE_CUBE
,IMAGE_VIEW_TYPE_1D_ARRAY
,IMAGE_VIEW_TYPE_2D_ARRAY
orIMAGE_VIEW_TYPE_CUBE_ARRAY
, in any shader stage - If the
VkPipeline
object bound to the pipeline bind point used by this command accesses aVkSampler
object that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-VOpImageSample*
orOpImageSparseSample*
instructions withImplicitLod
,Dref
orProj
in their name, in any shader stage - If the
VkPipeline
object bound to the pipeline bind point used by this command accesses aVkSampler
object that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-VOpImageSample*
orOpImageSparseSample*
instructions that includes a LOD bias or any offset values, in any shader stage - If the robust buffer access feature is not enabled, and if the
VkPipeline
object bound to the pipeline bind point used by this command accesses a uniform buffer, it must not access values outside of the range of the buffer as specified in the descriptor set bound to the same pipeline bind point - If the robust buffer access feature is not enabled, and if the
VkPipeline
object bound to the pipeline bind point used by this command accesses a storage buffer, it must not access values outside of the range of the buffer as specified in the descriptor set bound to the same pipeline bind point - If
commandBuffer
is an unprotected command buffer, any resource accessed by theVkPipeline
object bound to the pipeline bind point used by this command must not be a protected resource - If
commandBuffer
is a protected command buffer, any resource written to by theVkPipeline
object bound to the pipeline bind point used by this command must not be an unprotected resource - If
commandBuffer
is a protected command buffer, pipeline stages other than the framebuffer-space and compute stages in theVkPipeline
object bound to the pipeline bind point must not write to any resource raygenShaderBindingOffset
must be less than the size ofraygenShaderBindingTableBuffer
raygenShaderBindingOffset
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupBaseAlignment
missShaderBindingOffset
must be less than the size ofmissShaderBindingTableBuffer
missShaderBindingOffset
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupBaseAlignment
hitShaderBindingOffset
must be less than the size ofhitShaderBindingTableBuffer
hitShaderBindingOffset
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupBaseAlignment
callableShaderBindingOffset
must be less than the size ofcallableShaderBindingTableBuffer
callableShaderBindingOffset
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupBaseAlignment
missShaderBindingStride
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupHandleSize
hitShaderBindingStride
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupHandleSize
callableShaderBindingStride
must be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupHandleSize
missShaderBindingStride
must be a less than or equal toVkPhysicalDeviceRayTracingPropertiesNV
::maxShaderGroupStride
hitShaderBindingStride
must be a less than or equal toVkPhysicalDeviceRayTracingPropertiesNV
::maxShaderGroupStride
callableShaderBindingStride
must be a less than or equal toVkPhysicalDeviceRayTracingPropertiesNV
::maxShaderGroupStride
width
must be less than or equal toVkPhysicalDeviceLimits
::maxComputeWorkGroupCount
[0]height
must be less than or equal toVkPhysicalDeviceLimits
::maxComputeWorkGroupCount
[1]depth
must be less than or equal toVkPhysicalDeviceLimits
::maxComputeWorkGroupCount
[2]
Valid Usage (Implicit)
commandBuffer
must be a validVkCommandBuffer
handleraygenShaderBindingTableBuffer
must be a validVkBuffer
handle- If
missShaderBindingTableBuffer
is notNULL_HANDLE
,missShaderBindingTableBuffer
must be a validVkBuffer
handle - If
hitShaderBindingTableBuffer
is notNULL_HANDLE
,hitShaderBindingTableBuffer
must be a validVkBuffer
handle - If
callableShaderBindingTableBuffer
is notNULL_HANDLE
,callableShaderBindingTableBuffer
must be a validVkBuffer
handle commandBuffer
must be in the recording state- The
VkCommandPool
thatcommandBuffer
was allocated from must support compute operations - This command must only be called outside of a render pass instance
- Each of
callableShaderBindingTableBuffer
,commandBuffer
,hitShaderBindingTableBuffer
,missShaderBindingTableBuffer
, andraygenShaderBindingTableBuffer
that are valid handles must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPool
thatcommandBuffer
was allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type Primary Secondary Outside Compute - Parameters:
commandBuffer
- the command buffer into which the command will be recorded.raygenShaderBindingTableBuffer
- the buffer object that holds the shader binding table data for the ray generation shader stage.raygenShaderBindingOffset
- the offset in bytes (relative toraygenShaderBindingTableBuffer
) of the ray generation shader being used for the trace.missShaderBindingTableBuffer
- the buffer object that holds the shader binding table data for the miss shader stage.missShaderBindingOffset
- the offset in bytes (relative tomissShaderBindingTableBuffer
) of the miss shader being used for the trace.missShaderBindingStride
- the size in bytes of each shader binding table record inmissShaderBindingTableBuffer
.hitShaderBindingTableBuffer
- the buffer object that holds the shader binding table data for the hit shader stages.hitShaderBindingOffset
- the offset in bytes (relative tohitShaderBindingTableBuffer
) of the hit shader group being used for the trace.hitShaderBindingStride
- the size in bytes of each shader binding table record inhitShaderBindingTableBuffer
.callableShaderBindingTableBuffer
- the buffer object that holds the shader binding table data for the callable shader stage.callableShaderBindingOffset
- the offset in bytes (relative tocallableShaderBindingTableBuffer
) of the callable shader being used for the trace.callableShaderBindingStride
- the size in bytes of each shader binding table record incallableShaderBindingTableBuffer
.width
- the width of the ray trace query dimensions.height
- height of the ray trace query dimensions.depth
- depth of the ray trace query dimensions.
- If a
-
nvkCreateRayTracingPipelinesNV
public static int nvkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, int createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)
Unsafe version of:CreateRayTracingPipelinesNV
- Parameters:
createInfoCount
- the length of thepCreateInfos
andpPipelines
arrays.
-
vkCreateRayTracingPipelinesNV
public static int vkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, @Nullable VkAllocationCallbacks pAllocator, java.nio.LongBuffer pPipelines)
Creates a new ray tracing pipeline object.C Specification
To create ray tracing pipelines, call:
VkResult vkCreateRayTracingPipelinesNV( VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoNV* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
Valid Usage
- If the
flags
member of any element ofpCreateInfos
contains thePIPELINE_CREATE_DERIVATIVE_BIT
flag, and thebasePipelineIndex
member of that same element is not-1
,basePipelineIndex
must be less than the index intopCreateInfos
that corresponds to that element - If the
flags
member of any element ofpCreateInfos
contains thePIPELINE_CREATE_DERIVATIVE_BIT
flag, the base pipeline must have been created with thePIPELINE_CREATE_ALLOW_DERIVATIVES_BIT
flag set
Valid Usage (Implicit)
device
must be a validVkDevice
handle- If
pipelineCache
is notNULL_HANDLE
,pipelineCache
must be a validVkPipelineCache
handle pCreateInfos
must be a valid pointer to an array ofcreateInfoCount
validVkRayTracingPipelineCreateInfoNV
structures- If
pAllocator
is notNULL
,pAllocator
must be a valid pointer to a validVkAllocationCallbacks
structure pPipelines
must be a valid pointer to an array ofcreateInfoCount
VkPipeline
handlescreateInfoCount
must be greater than 0- If
pipelineCache
is a valid handle, it must have been created, allocated, or retrieved fromdevice
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
device
- the logical device that creates the ray tracing pipelines.pipelineCache
- eitherNULL_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.pCreateInfos
- an array ofVkRayTracingPipelineCreateInfoNV
structures.pAllocator
- controls host memory allocation as described in the Memory Allocation chapter.pPipelines
- a pointer to an array in which the resulting ray tracing pipeline objects are returned.
- If the
-
nvkGetRayTracingShaderGroupHandlesNV
public static int nvkGetRayTracingShaderGroupHandlesNV(VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)
Unsafe version of:GetRayTracingShaderGroupHandlesNV
- Parameters:
dataSize
- the size in bytes of the buffer pointed to bypData
.
-
vkGetRayTracingShaderGroupHandlesNV
public static int vkGetRayTracingShaderGroupHandlesNV(VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)
Query ray tracing pipeline shader group handles.C Specification
To query the opaque handles of shaders in the ray tracing pipeline, call:
VkResult vkGetRayTracingShaderGroupHandlesNV( VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData);
Valid Usage
- The sum of
firstGroup
andgroupCount
must be less than the number of shader groups inpipeline
. dataSize
must be at leastVkPhysicalDeviceRayTracingPropertiesNV
::shaderGroupHandleSize × groupCount
Valid Usage (Implicit)
device
must be a validVkDevice
handlepipeline
must be a validVkPipeline
handlepData
must be a valid pointer to an array ofdataSize
bytesdataSize
must be greater than 0pipeline
must have been created, allocated, or retrieved fromdevice
Return Codes
- On success, this command returns
- On failure, this command returns
- Parameters:
device
- the logical device that contains the ray tracing pipeline.pipeline
- the ray tracing pipeline object that contains the shaders.firstGroup
- the index of the first group to retrieve a handle for from theVkRayTracingShaderGroupCreateInfoNV
::pGroups
array.groupCount
- the number of shader handles to retrieve.pData
- a pointer to a user-allocated buffer where the results will be written.
- The sum of
-
nvkGetAccelerationStructureHandleNV
public static int nvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long dataSize, long pData)
Unsafe version of:GetAccelerationStructureHandleNV
- Parameters:
dataSize
- the size in bytes of the buffer pointed to bypData
.
-
vkGetAccelerationStructureHandleNV
public static int vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, java.nio.ByteBuffer pData) public static int vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, java.nio.LongBuffer pData)
Get opaque acceleration structure handle.C Specification
To allow constructing geometry instances with device code if desired, we need to be able to query a opaque handle for an acceleration structure. This handle is a value of 8 bytes. To get this handle, call:
VkResult vkGetAccelerationStructureHandleNV( VkDevice device, VkAccelerationStructureNV accelerationStructure, size_t dataSize, void* pData);
Valid Usage
dataSize
must be large enough to contain the result of the query, as described aboveaccelerationStructure
must be bound completely and contiguously to a singleVkDeviceMemory
object viaBindAccelerationStructureMemoryNV
Valid Usage (Implicit)
device
must be a validVkDevice
handleaccelerationStructure
must be a validVkAccelerationStructureNV
handlepData
must be a valid pointer to an array ofdataSize
bytesdataSize
must be greater than 0accelerationStructure
must have been created, allocated, or retrieved fromdevice
Return Codes
- On success, this command returns
- On failure, this command returns
- Parameters:
device
- the logical device that owns the acceleration structures.accelerationStructure
- the acceleration structure.pData
- a pointer to a user-allocated buffer where the results will be written.
-
nvkCmdWriteAccelerationStructuresPropertiesNV
public static void nvkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, int accelerationStructureCount, long pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Unsafe version of:CmdWriteAccelerationStructuresPropertiesNV
- Parameters:
accelerationStructureCount
- the count of acceleration structures for which to query the property.
-
vkCmdWriteAccelerationStructuresPropertiesNV
public static void vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, java.nio.LongBuffer pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Write acceleration structure result parameters to query results.C Specification
To query acceleration structure size parameters call:
void vkCmdWriteAccelerationStructuresPropertiesNV( VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV* pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery);
Valid Usage
queryType
must beQUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV
queryPool
must have been created with aqueryType
matchingqueryType
- The queries identified by
queryPool
andfirstQuery
must be unavailable - All acceleration structures in
accelerationStructures
must have been built withBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV
ifqueryType
isQUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV
Valid Usage (Implicit)
commandBuffer
must be a validVkCommandBuffer
handlepAccelerationStructures
must be a valid pointer to an array ofaccelerationStructureCount
validVkAccelerationStructureNV
handlesqueryType
must be a validVkQueryType
valuequeryPool
must be a validVkQueryPool
handlecommandBuffer
must be in the recording state- The
VkCommandPool
thatcommandBuffer
was allocated from must support compute operations - This command must only be called outside of a render pass instance
accelerationStructureCount
must be greater than 0- Each of
commandBuffer
,queryPool
, and the elements ofpAccelerationStructures
must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPool
thatcommandBuffer
was allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type Primary Secondary Outside Compute - Parameters:
commandBuffer
- the command buffer into which the command will be recorded.pAccelerationStructures
- points to an array of existing previously built acceleration structures.queryType
- aVkQueryType
value specifying the type of queries managed by the pool.queryPool
- the query pool that will manage the results of the query.firstQuery
- the first query index within the query pool that will contain theaccelerationStructureCount
number of results.
-
vkCompileDeferredNV
public static int vkCompileDeferredNV(VkDevice device, long pipeline, int shader)
Deferred compilation of shaders.C Specification
To compile a deferred shader in a pipeline call:
VkResult vkCompileDeferredNV( VkDevice device, VkPipeline pipeline, uint32_t shader);
Valid Usage
pipeline
must have been created withPIPELINE_CREATE_DEFER_COMPILE_BIT_NV
shader
must not have been called as a deferred compile before
Valid Usage (Implicit)
device
must be a validVkDevice
handlepipeline
must be a validVkPipeline
handlepipeline
must have been created, allocated, or retrieved fromdevice
Return Codes
- On success, this command returns
- On failure, this command returns
- Parameters:
device
- the logical device that contains the ray tracing pipeline.pipeline
- the ray tracing pipeline object that contains the shaders.shader
- the index of the shader to compile.
-
vkCreateAccelerationStructureNV
public static int vkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, @Nullable VkAllocationCallbacks pAllocator, long[] pAccelerationStructure)
Array version of:CreateAccelerationStructureNV
-
vkCreateRayTracingPipelinesNV
public static int vkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, @Nullable VkAllocationCallbacks pAllocator, long[] pPipelines)
Array version of:CreateRayTracingPipelinesNV
-
vkGetAccelerationStructureHandleNV
public static int vkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long[] pData)
Array version of:GetAccelerationStructureHandleNV
-
vkCmdWriteAccelerationStructuresPropertiesNV
public static void vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, long[] pAccelerationStructures, int queryType, long queryPool, int firstQuery)
Array version of:CmdWriteAccelerationStructuresPropertiesNV
-
-