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); }VK_NV_ray_tracing
- 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-nv
Other Extension Metadata
- Last Modified Date
- 2018-11-20
- Interactions and External Dependencies
- This extension requires
SPV_NV_ray_tracing - This extension provides API support for
GL_NV_ray_tracing
- This extension requires
- 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(org.lwjgl.vulkan.VkDevice device, int bindInfoCount, long pBindInfos)Unsafe version of:BindAccelerationStructureMemoryNVstatic voidnvkCmdBuildAccelerationStructureNV(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long pInfo, long instanceData, long instanceOffset, int update, long dst, long src, long scratch, long scratchOffset)Unsafe version of:CmdBuildAccelerationStructureNVstatic voidnvkCmdWriteAccelerationStructuresPropertiesNV(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int accelerationStructureCount, long pAccelerationStructures, int queryType, long queryPool, int firstQuery)Unsafe version of:CmdWriteAccelerationStructuresPropertiesNVstatic intnvkCreateAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, long pCreateInfo, long pAllocator, long pAccelerationStructure)Unsafe version of:CreateAccelerationStructureNVstatic intnvkCreateRayTracingPipelinesNV(org.lwjgl.vulkan.VkDevice device, long pipelineCache, int createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)Unsafe version of:CreateRayTracingPipelinesNVstatic voidnvkDestroyAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, long pAllocator)Unsafe version of:DestroyAccelerationStructureNVstatic intnvkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, long dataSize, long pData)Unsafe version of:GetAccelerationStructureHandleNVstatic voidnvkGetAccelerationStructureMemoryRequirementsNV(org.lwjgl.vulkan.VkDevice device, long pInfo, long pMemoryRequirements)Unsafe version of:GetAccelerationStructureMemoryRequirementsNVstatic intnvkGetRayTracingShaderGroupHandlesNV(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)Unsafe version of:GetRayTracingShaderGroupHandlesNVstatic intvkBindAccelerationStructureMemoryNV(org.lwjgl.vulkan.VkDevice device, VkBindAccelerationStructureMemoryInfoNV.Buffer pBindInfos)Bind acceleration structure memory.static voidvkCmdBuildAccelerationStructureNV(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, VkAccelerationStructureInfoNV pInfo, long instanceData, long instanceOffset, boolean update, long dst, long src, long scratch, long scratchOffset)Build an acceleration structure.static voidvkCmdCopyAccelerationStructureNV(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long dst, long src, int mode)Copy an acceleration structure.static voidvkCmdTraceRaysNV(org.lwjgl.vulkan.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(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long[] pAccelerationStructures, int queryType, long queryPool, int firstQuery)Array version of:CmdWriteAccelerationStructuresPropertiesNVstatic voidvkCmdWriteAccelerationStructuresPropertiesNV(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, java.nio.LongBuffer pAccelerationStructures, int queryType, long queryPool, int firstQuery)Write acceleration structure result parameters to query results.static intvkCompileDeferredNV(org.lwjgl.vulkan.VkDevice device, long pipeline, int shader)Deferred compilation of shaders.static intvkCreateAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, long[] pAccelerationStructure)Array version of:CreateAccelerationStructureNVstatic intvkCreateAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pAccelerationStructure)Create a new acceleration structure object.static intvkCreateRayTracingPipelinesNV(org.lwjgl.vulkan.VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, long[] pPipelines)Array version of:CreateRayTracingPipelinesNVstatic intvkCreateRayTracingPipelinesNV(org.lwjgl.vulkan.VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pPipelines)Creates a new ray tracing pipeline object.static voidvkDestroyAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, VkAllocationCallbacks pAllocator)Destroy an acceleration structure object.static intvkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, long[] pData)Array version of:GetAccelerationStructureHandleNVstatic intvkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, java.nio.ByteBuffer pData)Get opaque acceleration structure handle.static intvkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, java.nio.LongBuffer pData)Get opaque acceleration structure handle.static voidvkGetAccelerationStructureMemoryRequirementsNV(org.lwjgl.vulkan.VkDevice device, VkAccelerationStructureMemoryRequirementsInfoNV pInfo, VkMemoryRequirements2KHR pMemoryRequirements)Get acceleration structure memory requirements.static intvkGetRayTracingShaderGroupHandlesNV(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)
-
-
-
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_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
ExtendsVkRayTracingShaderGroupTypeKHR.Enum values:
-
VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV, VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV
ExtendsVkAccelerationStructureTypeKHR.Enum values:
-
VK_GEOMETRY_OPAQUE_BIT_NV, VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV
ExtendsVkGeometryFlagBitsKHR.Enum values:
-
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
ExtendsVkGeometryInstanceFlagBitsKHR.Enum values:
-
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
ExtendsVkBuildAccelerationStructureFlagBitsKHR.Enum values:
-
VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV, VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV
ExtendsVkCopyAccelerationStructureModeKHR.Enum values:
-
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(org.lwjgl.vulkan.VkDevice device, long pCreateInfo, long pAllocator, long pAccelerationStructure)Unsafe version of:CreateAccelerationStructureNV
-
vkCreateAccelerationStructureNV
public static int vkCreateAccelerationStructureNV(org.lwjgl.vulkan.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
Similarly 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 aVkAccelerationStructureCreateInfoNVstructure containing parameters affecting creation of the acceleration structure.pAllocator- controls host memory allocation as described in the Memory Allocation chapter.pAccelerationStructure- a pointer to aVkAccelerationStructureNVhandle in which the resulting acceleration structure object is returned.
-
nvkDestroyAccelerationStructureNV
public static void nvkDestroyAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, long pAllocator)Unsafe version of:DestroyAccelerationStructureNV
-
vkDestroyAccelerationStructureNV
public static void vkDestroyAccelerationStructureNV(org.lwjgl.vulkan.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 validVkDevicehandle- If
accelerationStructureis notNULL_HANDLE,accelerationStructuremust be a validVkAccelerationStructureNVhandle - If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validVkAllocationCallbacksstructure - If
accelerationStructureis a valid handle, it must have been created, allocated, or retrieved fromdevice
Host Synchronization
- Host access to
accelerationStructuremust be externally synchronized
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(org.lwjgl.vulkan.VkDevice device, long pInfo, long pMemoryRequirements)Unsafe version of:GetAccelerationStructureMemoryRequirementsNV
-
vkGetAccelerationStructureMemoryRequirementsNV
public static void vkGetAccelerationStructureMemoryRequirementsNV(org.lwjgl.vulkan.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.
Scratch space is allocated as a
VkBuffer, so forACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NVandACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NVthepMemoryRequirements\u2192alignmentandpMemoryRequirements\u2192memoryTypeBitsvalues returned by this call must be filled with zero, and should be ignored by the application.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- a pointer to aVkAccelerationStructureMemoryRequirementsInfoNVstructure specifying the acceleration structure to get memory requirements for.pMemoryRequirements- a pointer to aVkMemoryRequirements2KHRstructure in which the requested acceleration structure memory requirements are returned.
-
nvkBindAccelerationStructureMemoryNV
public static int nvkBindAccelerationStructureMemoryNV(org.lwjgl.vulkan.VkDevice device, int bindInfoCount, long pBindInfos)Unsafe version of:BindAccelerationStructureMemoryNV- Parameters:
bindInfoCount- the number of elements inpBindInfos.
-
vkBindAccelerationStructureMemoryNV
public static int vkBindAccelerationStructureMemoryNV(org.lwjgl.vulkan.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 ofVkBindAccelerationStructureMemoryInfoNVstructures describing acceleration structures and memory to bind.
-
nvkCmdBuildAccelerationStructureNV
public static void nvkCmdBuildAccelerationStructureNV(org.lwjgl.vulkan.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(org.lwjgl.vulkan.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);Description
Accesses to
dst,src, andscratchmust be synchronized with thePIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHRpipeline stage and an access type ofACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHRorACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR.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 previously been constructed withBUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NVset inVkAccelerationStructureInfoNV::flagsin the original build - 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 scratchmust have been created withBUFFER_USAGE_RAY_TRACING_BIT_NVusage flag- If
instanceDatais notNULL_HANDLE,instanceDatamust have been created withBUFFER_USAGE_RAY_TRACING_BIT_NVusage flag - Each
VkAccelerationStructureInstanceKHR::accelerationStructureReferencevalue ininstanceDatamust be a valid device address containing a value obtained fromGetAccelerationStructureHandleNV - If
updateisTRUE, then objects that were previously active must not be made inactive as per Inactive Primitives and Instances - If
updateisTRUE, then objects that were previously inactive must not be made active as per Inactive Primitives and Instances - If
updateisTRUE, thesrcanddstobjects must either be the same object or not have any memory aliasing
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 of non-ignored parameters must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types 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 an array ofVkAccelerationStructureInstanceKHRstructures defining acceleration structures. 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- a pointer to the target acceleration structure for the build.src- a pointer 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(org.lwjgl.vulkan.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, VkCopyAccelerationStructureModeKHR mode);Description
Accesses to
srcanddstmust be synchronized with thePIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHRpipeline stage and an access type ofACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHRorACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHRas appropriate.Valid Usage
modemust beCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHRorCOPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR- The source acceleration structure
srcmust have been constructed prior to the execution of this command - If
modeisCOPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR,srcmust have been constructed withBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHRin the build - The
bufferused to createsrcmust be bound to device memory - The
bufferused to createdstmust be bound to device memory
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandledstmust be a validVkAccelerationStructureNVhandlesrcmust be a validVkAccelerationStructureNVhandlemodemust be a validVkCopyAccelerationStructureModeKHRvaluecommandBuffermust 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
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Primary Secondary Outside Compute - Parameters:
commandBuffer- the command buffer into which the command will be recorded.dst- the target acceleration structure for the copy.src- the source acceleration structure for the copy.mode- aVkCopyAccelerationStructureModeKHRvalue specifying additional operations to perform during the copy.
-
vkCmdTraceRaysNV
public static void vkCmdTraceRaysNV(org.lwjgl.vulkan.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 ray tracing 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
VkSamplercreated withmagFilterorminFilterequal toFILTER_LINEARandcompareEnableequal toFALSEis used to sample aVkImageViewas a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT - If a
VkSamplercreated withmipmapModeequal toSAMPLER_MIPMAP_MODE_LINEARandcompareEnableequal toFALSEis used to sample aVkImageViewas a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT - If a
VkImageViewis sampled with depth comparison, the image view’s format features must containFORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_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_MINorSAMPLER_REDUCTION_MODE_MAXas 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 - Any
VkImageVieworVkBufferViewbeing written as a storage image or storage texel buffer where the image format field of theOpTypeImageisUnknownthen the view’s format feature must containFORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT - Any
VkImageVieworVkBufferViewbeing read as a storage image or storage texel buffer where the image format field of theOpTypeImageisUnknownthen the view’s format feature must containFORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT - 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 - If the
maintenance4feature is not enabled, then for each push constant that is statically used by theVkPipelinebound 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 or inherited (if theVK_NV_inherited_viewport_scissorextension is enabled) forcommandBuffer, and done so after any previously bound pipeline with the corresponding state not specified as dynamic - There must not have been any calls to dynamic state setting commands for any state not specified as dynamic in the
VkPipelineobject bound to the pipeline bind point used by this command, since that pipeline was bound - 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 andprotectedNoFaultis not supported, any resource accessed by theVkPipelineobject bound to the pipeline bind point used by this command must not be a protected resource - If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerorVkImageViewobject that enables sampler Y′CBCR conversion, that object must only be used withOpImageSample*orOpImageSparseSample*instructions - If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerorVkImageViewobject that enables sampler Y′CBCR conversion, that object must not use theConstOffsetandOffsetoperands - If a
VkImageViewis accessed usingOpImageWriteas a result of this command, then theTypeof theTexeloperand of that instruction must have at least as many components as the image view’s format - If a
VkBufferViewis accessed usingOpImageWriteas a result of this command, then theTypeof theTexeloperand of that instruction must have at least as many components as the buffer view’s format - If a
VkImageViewwith aVkFormatthat has a 64-bit component width is accessed as a result of this command, theSampledTypeof theOpTypeImageoperand of that instruction must have aWidthof 64 - If a
VkImageViewwith aVkFormatthat has a component width less than 64-bit is accessed as a result of this command, theSampledTypeof theOpTypeImageoperand of that instruction must have aWidthof 32 - If a
VkBufferViewwith aVkFormatthat has a 64-bit component width is accessed as a result of this command, theSampledTypeof theOpTypeImageoperand of that instruction must have aWidthof 64 - If a
VkBufferViewwith aVkFormatthat has a component width less than 64-bit is accessed as a result of this command, theSampledTypeof theOpTypeImageoperand of that instruction must have aWidthof 32 - If the
sparseImageInt64Atomicsfeature is not enabled,VkImageobjects created with theIMAGE_CREATE_SPARSE_RESIDENCY_BITflag must not be accessed by atomic instructions through anOpTypeImagewith aSampledTypewith aWidthof 64 by this command - If the
sparseImageInt64Atomicsfeature is not enabled,VkBufferobjects created with theBUFFER_CREATE_SPARSE_RESIDENCY_BITflag must not be accessed by atomic instructions through anOpTypeImagewith aSampledTypewith aWidthof 64 by this command - Any shader group handle referenced by this call must have been queried from the currently bound ray tracing pipeline
commandBuffermust not be a protected command buffer- This command must not cause a pipeline trace ray instruction to be executed from a shader invocation with a recursion depth greater than the value of
maxRecursionDepthused to create the bound ray tracing pipeline - If
raygenShaderBindingTableBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject raygenShaderBindingOffsetmust be less than the size ofraygenShaderBindingTableBufferraygenShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment- If
missShaderBindingTableBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject missShaderBindingOffsetmust be less than the size ofmissShaderBindingTableBuffermissShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment- If
hitShaderBindingTableBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject hitShaderBindingOffsetmust be less than the size ofhitShaderBindingTableBufferhitShaderBindingOffsetmust be a multiple ofVkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment- If
callableShaderBindingTableBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject callableShaderBindingOffsetmust 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 less than or equal toVkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStridehitShaderBindingStridemust be less than or equal toVkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStridecallableShaderBindingStridemust be 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 of non-ignored parameters must have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types 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(org.lwjgl.vulkan.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(org.lwjgl.vulkan.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 flagsmust not contain thePIPELINE_CREATE_DISPATCH_BASEflag- If
pipelineCachewas created withPIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT, host access topipelineCachemust be externally synchronized
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- a pointer to 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(org.lwjgl.vulkan.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(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)- Parameters:
device- the logical device containing the ray tracing pipeline.pipeline- the ray tracing pipeline object containing the shaders.firstGroup- the index of the first group to retrieve a handle for from theVkRayTracingPipelineCreateInfoKHR::pGroupsorVkRayTracingPipelineCreateInfoNV::pGroupsarray.groupCount- the number of shader handles to retrieve.pData- a pointer to a user-allocated buffer where the results will be written.
-
nvkGetAccelerationStructureHandleNV
public static int nvkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.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(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, java.nio.ByteBuffer pData) public static int vkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.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(org.lwjgl.vulkan.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(org.lwjgl.vulkan.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);Description
Accesses to any of the acceleration structures listed in
pAccelerationStructuresmust be synchronized with thePIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHRpipeline stage and an access type ofACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR.Valid Usage
queryPoolmust have been created with aqueryTypematchingqueryType- The queries identified by
queryPoolandfirstQuerymust be unavailable accelerationStructuremust be bound completely and contiguously to a singleVkDeviceMemoryobject viaBindAccelerationStructureMemoryNV- All acceleration structures in
pAccelerationStructuresmust have been built prior to the execution of this command - All acceleration structures in
pAccelerationStructuresmust have been built withBUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHRifqueryTypeisQUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV queryTypemust beQUERY_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
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Primary Secondary Outside Compute - Parameters:
commandBuffer- the command buffer into which the command will be recorded.pAccelerationStructures- a pointer 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(org.lwjgl.vulkan.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 be a ray tracing pipelinepipelinemust 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 containing the ray tracing pipeline.pipeline- the ray tracing pipeline object containing the shaders.shader- the index of the shader to compile.
-
vkCreateAccelerationStructureNV
public static int vkCreateAccelerationStructureNV(org.lwjgl.vulkan.VkDevice device, VkAccelerationStructureCreateInfoNV pCreateInfo, @Nullable VkAllocationCallbacks pAllocator, long[] pAccelerationStructure)Array version of:CreateAccelerationStructureNV
-
vkCreateRayTracingPipelinesNV
public static int vkCreateRayTracingPipelinesNV(org.lwjgl.vulkan.VkDevice device, long pipelineCache, VkRayTracingPipelineCreateInfoNV.Buffer pCreateInfos, @Nullable VkAllocationCallbacks pAllocator, long[] pPipelines)Array version of:CreateRayTracingPipelinesNV
-
vkGetAccelerationStructureHandleNV
public static int vkGetAccelerationStructureHandleNV(org.lwjgl.vulkan.VkDevice device, long accelerationStructure, long[] pData)Array version of:GetAccelerationStructureHandleNV
-
vkCmdWriteAccelerationStructuresPropertiesNV
public static void vkCmdWriteAccelerationStructuresPropertiesNV(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long[] pAccelerationStructures, int queryType, long queryPool, int firstQuery)Array version of:CmdWriteAccelerationStructuresPropertiesNV
-
-