Class NVRayTracing
- java.lang.Object
-
- org.lwjgl.vulkan.NVRayTracing
-
public class NVRayTracing extends java.lang.ObjectRasterization 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_tracingSPIR-V extension. - This extension requires the
GL_NV_ray_tracingextension 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 intnvkBindAccelerationStructureMemoryNV(VkDevice device, int bindInfoCount, long pBindInfos)Unsafe version of:BindAccelerationStructureMemoryNVstatic voidnvkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, long pInfo, long instanceData, long instanceOffset, int update, long dst, long src, long scratch, long scratchOffset)Unsafe version of:CmdBuildAccelerationStructureNVstatic voidnvkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, int accelerationStructureCount, long pAccelerationStructures, int queryType, long queryPool, int firstQuery)Unsafe version of:CmdWriteAccelerationStructuresPropertiesNVstatic intnvkCreateAccelerationStructureNV(VkDevice device, long pCreateInfo, long pAllocator, long pAccelerationStructure)Unsafe version of:CreateAccelerationStructureNVstatic intnvkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, int createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)Unsafe version of:CreateRayTracingPipelinesNVstatic voidnvkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, long pAllocator)Unsafe version of:DestroyAccelerationStructureNVstatic intnvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long dataSize, long pData)Unsafe version of:GetAccelerationStructureHandleNVstatic voidnvkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, long pInfo, long pMemoryRequirements)Unsafe version of:GetAccelerationStructureMemoryRequirementsNVstatic intnvkGetRayTracingShaderGroupHandlesNV(VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)Unsafe version of:GetRayTracingShaderGroupHandlesNVstatic intvkBindAccelerationStructureMemoryNV(VkDevice device, VkBindAccelerationStructureMemoryInfoNV.Buffer pBindInfos)Bind acceleration structure memory.static voidvkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureInfoNV pInfo, long instanceData, long instanceOffset, boolean update, long dst, long src, long scratch, long scratchOffset)Build an acceleration structure.static voidvkCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, long dst, long src, int mode)Copy an acceleration structure.static voidvkCmdTraceRaysNV(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 voidvkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, long[] pAccelerationStructures, int queryType, long queryPool, int firstQuery)Array version of:CmdWriteAccelerationStructuresPropertiesNVstatic voidvkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, java.nio.LongBuffer pAccelerationStructures, int queryType, long queryPool, int firstQuery)Write acceleration structure result parameters to query results.static intvkCompileDeferredNV(VkDevice device, long pipeline, int shader)Deferred compilation of shaders.static intvkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, long[] pAccelerationStructure)Array version of:CreateAccelerationStructureNVstatic intvkCreateAccelerationStructureNV(VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pAccelerationStructure)Create a new acceleration structure object.static intvkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, long[] pPipelines)Array version of:CreateRayTracingPipelinesNVstatic intvkCreateRayTracingPipelinesNV(VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pPipelines)Creates a new ray tracing pipeline object.static voidvkDestroyAccelerationStructureNV(VkDevice device, long accelerationStructure, VkAllocationCallbacks pAllocator)Destroy an acceleration structure object.static intvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, long[] pData)Array version of:GetAccelerationStructureHandleNVstatic intvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, java.nio.ByteBuffer pData)Get opaque acceleration structure handle.static intvkGetAccelerationStructureHandleNV(VkDevice device, long accelerationStructure, java.nio.LongBuffer pData)Get opaque acceleration structure handle.static voidvkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, VkAccelerationStructureMemoryRequirementsInfoNV pInfo, VkMemoryRequirements2KHR pMemoryRequirements)Get acceleration structure memory requirements.static intvkGetRayTracingShaderGroupHandlesNV(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_NVSTRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NVSTRUCTURE_TYPE_GEOMETRY_NVSTRUCTURE_TYPE_GEOMETRY_TRIANGLES_NVSTRUCTURE_TYPE_GEOMETRY_AABB_NVSTRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NVSTRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NVSTRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NVSTRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NVSTRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NVSTRUCTURE_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_NVis a top-level acceleration structure containing instance data referring to bottom-level level acceleration structures.ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NVis 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_NVindicates a shader group with a singleSHADER_STAGE_RAYGEN_BIT_NV,SHADER_STAGE_MISS_BIT_NV, orSHADER_STAGE_CALLABLE_BIT_NVshader in it.RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NVspecifies 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_NVspecifies 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_NVindicates that thetrianglesofVkGeometryDataNVcontains valid data.GEOMETRY_TYPE_AABBS_NVindicates that theaabbsofVkGeometryDataNVcontains 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_NVindicates that this geometry does not invoke the any-hit shaders even if present in a hit group.GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NVindicates 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_NVdisables face culling for this instance.GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NVindicates 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_NVcauses this instance to act as thoughGEOMETRY_OPAQUE_BIT_NVwere specified on all geometries referenced by this instance. This behavior can be overridden by the ray flaggl_RayFlagsNoOpaqueNV.GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NVcauses this instance to act as thoughGEOMETRY_OPAQUE_BIT_NVwere 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_NVandGEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NVmust 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_NVindicates that the specified acceleration structure can be updated withupdateofTRUEinCmdBuildAccelerationStructureNV.BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVindicates that the specified acceleration structure can act as the source forCmdCopyAccelerationStructureNVwithmodeofCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVto produce a compacted acceleration structure.BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NVindicates that the given acceleration structure build should prioritize trace performance over build time.BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NVindicates that the given acceleration structure build should prioritize build time over trace performance.BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NVindicates 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_NVandBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVmay 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_NVcreates a direct copy of the acceleration structure specified insrcinto the one specified bydst. Thedstacceleration structure must have been created with the same parameters assrc.COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVcreates a more compact version of an acceleration structuresrcintodst. The acceleration structuredstmust have been created with acompactedSizecorresponding to the one returned byCmdWriteAccelerationStructuresPropertiesNVafter 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_NVrequests the memory requirement for theVkAccelerationStructureNVbacking store.ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NVrequests the memory requirement for scratch space during the initial build.ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NVrequests 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 inVkAccelerationStructureInfoNVandcompactedSizeinpCreateInfo. Populating the data in the object after allocating and binding memory is done withCmdBuildAccelerationStructureNVandCmdCopyAccelerationStructureNV.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)
devicemust be a validVkDevicehandlepCreateInfomust be a valid pointer to a validVkAccelerationStructureCreateInfoNVstructure- If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validVkAllocationCallbacksstructure pAccelerationStructuremust be a valid pointer to aVkAccelerationStructureNVhandle
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 theVkAccelerationStructureCreateInfoNVstructure containing parameters affecting creation of the acceleration structure.pAllocator- controls host memory allocation as described in the Memory Allocation chapter.pAccelerationStructure- points to aVkAccelerationStructureNVhandle 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
accelerationStructuremust have completed execution - If
VkAllocationCallbackswere provided whenaccelerationStructurewas created, a compatible set of callbacks must be provided here - If no
VkAllocationCallbackswere provided whenaccelerationStructurewas created,pAllocatormust beNULL
Valid Usage (Implicit)
devicemust be a validVkDevicehandleaccelerationStructuremust be a validVkAccelerationStructureNVhandle- If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validVkAllocationCallbacksstructure accelerationStructuremust 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)
devicemust be a validVkDevicehandlepInfomust be a valid pointer to a validVkAccelerationStructureMemoryRequirementsInfoNVstructurepMemoryRequirementsmust be a valid pointer to aVkMemoryRequirements2KHRstructure
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)
devicemust be a validVkDevicehandlepBindInfosmust be a valid pointer to an array ofbindInfoCountvalidVkBindAccelerationStructureMemoryInfoNVstructuresbindInfoCountmust 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
geometryCountmust be less than or equal toVkPhysicalDeviceRayTracingPropertiesNV::maxGeometryCountdstmust have been created with compatibleVkAccelerationStructureInfoNVwhereVkAccelerationStructureInfoNV::typeandVkAccelerationStructureInfoNV::flagsare identical,VkAccelerationStructureInfoNV::instanceCountandVkAccelerationStructureInfoNV::geometryCountfordstare greater than or equal to the build size and each geometry inVkAccelerationStructureInfoNV::pGeometriesfordsthas greater than or equal to the number of vertices, indices, and AABBs.- If
updateisTRUE,srcmust not beNULL_HANDLE - If
updateisTRUE,srcmust have been built before withBUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NVset inVkAccelerationStructureInfoNV::flags - If
updateisFALSE, Thesizemember of theVkMemoryRequirementsstructure returned from a call toGetAccelerationStructureMemoryRequirementsNVwithVkAccelerationStructureMemoryRequirementsInfoNV::accelerationStructureset todstandVkAccelerationStructureMemoryRequirementsInfoNV::typeset toACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NVmust be less than or equal to the size ofscratchminusscratchOffset - If
updateisTRUE, Thesizemember of theVkMemoryRequirementsstructure returned from a call toGetAccelerationStructureMemoryRequirementsNVwithVkAccelerationStructureMemoryRequirementsInfoNV::accelerationStructureset todstandVkAccelerationStructureMemoryRequirementsInfoNV::typeset toACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NVmust be less than or equal to the size ofscratchminusscratchOffset
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlepInfomust be a valid pointer to a validVkAccelerationStructureInfoNVstructure- If
instanceDatais notNULL_HANDLE,instanceDatamust be a validVkBufferhandle dstmust be a validVkAccelerationStructureNVhandle- If
srcis notNULL_HANDLE,srcmust be a validVkAccelerationStructureNVhandle scratchmust be a validVkBufferhandlecommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support compute operations - This command must only be called outside of a render pass instance
- Each of
commandBuffer,dst,instanceData,scratch, andsrcthat are valid handles must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPoolthatcommandBufferwas 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 beNULLfor 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 thedstacceleration 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 thedstacceleration structure.scratch- theVkBufferthat will be used as scratch memory for the build.scratchOffset- the offset in bytes relative to the start ofscratchthat 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
modemust beCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NVorCOPY_ACCELERATION_STRUCTURE_MODE_CLONE_NVsrcmust have been built withBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVifmodeisCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandledstmust be a validVkAccelerationStructureNVhandlesrcmust be a validVkAccelerationStructureNVhandlemodemust be a validVkCopyAccelerationStructureModeNVvaluecommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support compute operations - This command must only be called outside of a render pass instance
- Each of
commandBuffer,dst, andsrcmust have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPoolthatcommandBufferwas 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- aVkCopyAccelerationStructureModeNVvalue 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 × depthrays is assembled.Valid Usage
- If a
VkImageViewis sampled withFILTER_LINEARas a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT - If a
VkImageViewis 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
VkImageViewis sampled withFILTER_CUBIC_EXTas a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT - Any
VkImageViewbeing sampled withFILTER_CUBIC_EXTas a result of this command must have aVkImageViewTypeand format that supports cubic filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicreturned byvkGetPhysicalDeviceImageFormatProperties2 - Any
VkImageViewbeing sampled withFILTER_CUBIC_EXTwith a reduction mode of eitherSAMPLER_REDUCTION_MODE_MIN_EXTorSAMPLER_REDUCTION_MODE_MAX_EXTas a result of this command must have aVkImageViewTypeand format that supports cubic filtering together with minmax filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicMinmaxreturned byvkGetPhysicalDeviceImageFormatProperties2 - Any
VkImagecreated with aVkImageCreateInfo::flagscontainingIMAGE_CREATE_CORNER_SAMPLED_BIT_NVsampled as a result of this command must only be sampled using aVkSamplerAddressModeofSAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE. - For each set n that is statically used by the
VkPipelinebound 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 aVkPipelineLayoutthat is compatible for set n, with theVkPipelineLayoutused to create the currentVkPipeline, as described in Pipeline Layout Compatibility - For each push constant that is statically used by the
VkPipelinebound to the pipeline bind point used by this command, a push constant value must have been set for the same pipeline bind point, with aVkPipelineLayoutthat is compatible for push constants, with theVkPipelineLayoutused 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 theVkPipelinebound 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
VkPipelineobject bound to the pipeline bind point used by this command requires any dynamic state, that state must have been set forcommandBuffer - If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerobject that uses unnormalized coordinates, that sampler must not be used to sample from anyVkImagewith aVkImageViewof the typeIMAGE_VIEW_TYPE_3D,IMAGE_VIEW_TYPE_CUBE,IMAGE_VIEW_TYPE_1D_ARRAY,IMAGE_VIEW_TYPE_2D_ARRAYorIMAGE_VIEW_TYPE_CUBE_ARRAY, in any shader stage - If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerobject that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-VOpImageSample*orOpImageSparseSample*instructions withImplicitLod,DreforProjin their name, in any shader stage - If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerobject 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
VkPipelineobject 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
VkPipelineobject 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
commandBufferis an unprotected command buffer, any resource accessed by theVkPipelineobject bound to the pipeline bind point used by this command must not be a protected resource - If
commandBufferis a protected command buffer, any resource written to by theVkPipelineobject bound to the pipeline bind point used by this command must not be an unprotected resource - If
commandBufferis a protected command buffer, pipeline stages other than the framebuffer-space and compute stages in theVkPipelineobject bound to the pipeline bind point must not write to any resource raygenShaderBindingOffsetmust be less than the size ofraygenShaderBindingTableBufferraygenShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignmentmissShaderBindingOffsetmust be less than the size ofmissShaderBindingTableBuffermissShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignmenthitShaderBindingOffsetmust be less than the size ofhitShaderBindingTableBufferhitShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignmentcallableShaderBindingOffsetmust be less than the size ofcallableShaderBindingTableBuffercallableShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignmentmissShaderBindingStridemust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSizehitShaderBindingStridemust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSizecallableShaderBindingStridemust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSizemissShaderBindingStridemust be a less than or equal toVkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStridehitShaderBindingStridemust be a less than or equal toVkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStridecallableShaderBindingStridemust be a less than or equal toVkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStridewidthmust be less than or equal toVkPhysicalDeviceLimits::maxComputeWorkGroupCount[0]heightmust be less than or equal toVkPhysicalDeviceLimits::maxComputeWorkGroupCount[1]depthmust be less than or equal toVkPhysicalDeviceLimits::maxComputeWorkGroupCount[2]
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandleraygenShaderBindingTableBuffermust be a validVkBufferhandle- If
missShaderBindingTableBufferis notNULL_HANDLE,missShaderBindingTableBuffermust be a validVkBufferhandle - If
hitShaderBindingTableBufferis notNULL_HANDLE,hitShaderBindingTableBuffermust be a validVkBufferhandle - If
callableShaderBindingTableBufferis notNULL_HANDLE,callableShaderBindingTableBuffermust be a validVkBufferhandle commandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support compute operations - This command must only be called outside of a render pass instance
- Each of
callableShaderBindingTableBuffer,commandBuffer,hitShaderBindingTableBuffer,missShaderBindingTableBuffer, andraygenShaderBindingTableBufferthat are valid handles must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPoolthatcommandBufferwas 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 thepCreateInfosandpPipelinesarrays.
-
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
flagsmember of any element ofpCreateInfoscontains thePIPELINE_CREATE_DERIVATIVE_BITflag, and thebasePipelineIndexmember of that same element is not-1,basePipelineIndexmust be less than the index intopCreateInfosthat corresponds to that element - If the
flagsmember of any element ofpCreateInfoscontains thePIPELINE_CREATE_DERIVATIVE_BITflag, the base pipeline must have been created with thePIPELINE_CREATE_ALLOW_DERIVATIVES_BITflag set
Valid Usage (Implicit)
devicemust be a validVkDevicehandle- If
pipelineCacheis notNULL_HANDLE,pipelineCachemust be a validVkPipelineCachehandle pCreateInfosmust be a valid pointer to an array ofcreateInfoCountvalidVkRayTracingPipelineCreateInfoNVstructures- If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validVkAllocationCallbacksstructure pPipelinesmust be a valid pointer to an array ofcreateInfoCountVkPipelinehandlescreateInfoCountmust be greater than 0- If
pipelineCacheis 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 ofVkRayTracingPipelineCreateInfoNVstructures.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
firstGroupandgroupCountmust be less than the number of shader groups inpipeline. dataSizemust be at leastVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSize × groupCount
Valid Usage (Implicit)
devicemust be a validVkDevicehandlepipelinemust be a validVkPipelinehandlepDatamust be a valid pointer to an array ofdataSizebytesdataSizemust be greater than 0pipelinemust 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::pGroupsarray.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
dataSizemust be large enough to contain the result of the query, as described aboveaccelerationStructuremust be bound completely and contiguously to a singleVkDeviceMemoryobject viaBindAccelerationStructureMemoryNV
Valid Usage (Implicit)
devicemust be a validVkDevicehandleaccelerationStructuremust be a validVkAccelerationStructureNVhandlepDatamust be a valid pointer to an array ofdataSizebytesdataSizemust be greater than 0accelerationStructuremust 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
queryTypemust beQUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NVqueryPoolmust have been created with aqueryTypematchingqueryType- The queries identified by
queryPoolandfirstQuerymust be unavailable - All acceleration structures in
accelerationStructuresmust have been built withBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NVifqueryTypeisQUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlepAccelerationStructuresmust be a valid pointer to an array ofaccelerationStructureCountvalidVkAccelerationStructureNVhandlesqueryTypemust be a validVkQueryTypevaluequeryPoolmust be a validVkQueryPoolhandlecommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support compute operations - This command must only be called outside of a render pass instance
accelerationStructureCountmust be greater than 0- Each of
commandBuffer,queryPool, and the elements ofpAccelerationStructuresmust have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to the
VkCommandPoolthatcommandBufferwas 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- aVkQueryTypevalue 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 theaccelerationStructureCountnumber 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
pipelinemust have been created withPIPELINE_CREATE_DEFER_COMPILE_BIT_NVshadermust not have been called as a deferred compile before
Valid Usage (Implicit)
devicemust be a validVkDevicehandlepipelinemust be a validVkPipelinehandlepipelinemust 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
-
-