Class KHRRayTracingPipeline
- java.lang.Object
-
- org.lwjgl.vulkan.KHRRayTracingPipeline
-
public class KHRRayTracingPipeline 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:
- A new ray tracing pipeline type with new shader domains: ray generation, intersection, any-hit, closest hit, miss, and callable
- A shader binding indirection table to link shader groups with acceleration structure items
- Ray tracing commands which initiate the ray pipeline traversal and invocation of the various new shader domains depending on which traversal conditions are met
This extension adds support for the following SPIR-V extension in Vulkan:
SPV_KHR_ray_tracing
Sample Code
Example ray generation GLSL shader
#version 450 core #extension GL_EXT_ray_tracing : require layout(set = 0, binding = 0, rgba8) uniform image2D image; layout(set = 0, binding = 1) uniform accelerationStructureEXT as; layout(location = 0) rayPayloadEXT float payload; void main() { vec4 col = vec4(0, 0, 0, 1); vec3 origin = vec3(float(gl_LaunchIDEXT.x)/float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y)/float(gl_LaunchSizeEXT.y), 1.0); vec3 dir = vec3(0.0, 0.0, -1.0); traceRayEXT(as, 0, 0xff, 0, 1, 0, origin, 0.0, dir, 1000.0, 0); col.y = payload; imageStore(image, ivec2(gl_LaunchIDEXT.xy), col); }VK_KHR_ray_tracing_pipeline
- Name String
VK_KHR_ray_tracing_pipeline- Extension Type
- Device extension
- Registered Extension Number
- 348
- Revision
- 1
- Extension and Version Dependencies
- Requires Vulkan 1.1
- Requires
VK_KHR_spirv_1_4 - Requires
VK_KHR_acceleration_structure
- Contact
- Daniel Koch dgkoch
Other Extension Metadata
- Last Modified Date
- 2020-11-12
- Interactions and External Dependencies
- This extension requires
SPV_KHR_ray_tracing - This extension provides API support for
GLSL_EXT_ray_tracing - This extension interacts with Vulkan 1.2 and
VK_KHR_vulkan_memory_model, adding the shader-call-related relation of invocations, shader-call-order partial order of dynamic instances of instructions, and theShaderCallKHRscope. - This extension interacts with
VK_KHR_pipeline_library, enabling pipeline libraries to be used with ray tracing pipelines and enabling usage ofVkRayTracingPipelineInterfaceCreateInfoKHR.
- This extension requires
- Contributors
- Matthäus Chajdas, AMD
- Greg Grebe, AMD
- Nicolai Hähnle, AMD
- Tobias Hector, AMD
- Dave Oldcorn, AMD
- Skyler Saleh, AMD
- Mathieu Robart, Arm
- Marius Bjorge, Arm
- Tom Olson, Arm
- Sebastian Tafuri, EA
- Henrik Rydgard, Embark
- Juan Cañada, Epic Games
- Patrick Kelly, Epic Games
- Yuriy O’Donnell, Epic Games
- Michael Doggett, Facebook/Oculus
- Andrew Garrard, Imagination
- Don Scorgie, Imagination
- Dae Kim, Imagination
- Joshua Barczak, Intel
- Slawek Grajewski, Intel
- Jeff Bolz, NVIDIA
- Pascal Gautron, NVIDIA
- Daniel Koch, NVIDIA
- Christoph Kubisch, NVIDIA
- Ashwin Lele, NVIDIA
- Robert Stepinski, NVIDIA
- Martin Stich, NVIDIA
- Nuno Subtil, NVIDIA
- Eric Werness, NVIDIA
- Jon Leech, Khronos
- Jeroen van Schijndel, OTOY
- Juul Joosten, OTOY
- Alex Bourd, Qualcomm
- Roman Larionov, Qualcomm
- David McAllister, Qualcomm
- Spencer Fricke, Samsung
- Lewis Gordon, Samsung
- Ralph Potter, Samsung
- Jasper Bekkers, Traverse Research
- Jesse Barker, Unity
- Baldur Karlsson, Valve
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidnvkCmdTraceRaysIndirectKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long pRaygenShaderBindingTable, long pMissShaderBindingTable, long pHitShaderBindingTable, long pCallableShaderBindingTable, long indirectDeviceAddress)Unsafe version of:CmdTraceRaysIndirectKHRstatic voidnvkCmdTraceRaysKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long pRaygenShaderBindingTable, long pMissShaderBindingTable, long pHitShaderBindingTable, long pCallableShaderBindingTable, int width, int height, int depth)Unsafe version of:CmdTraceRaysKHRstatic intnvkCreateRayTracingPipelinesKHR(org.lwjgl.vulkan.VkDevice device, long deferredOperation, long pipelineCache, int createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)Unsafe version of:CreateRayTracingPipelinesKHRstatic intnvkGetRayTracingCaptureReplayShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)Unsafe version of:GetRayTracingCaptureReplayShaderGroupHandlesKHRstatic intnvkGetRayTracingShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)Unsafe version of:GetRayTracingShaderGroupHandlesKHRstatic voidvkCmdSetRayTracingPipelineStackSizeKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int pipelineStackSize)Set the stack size dynamically for a ray tracing pipeline.static voidvkCmdTraceRaysIndirectKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, VkStridedDeviceAddressRegionKHR pRaygenShaderBindingTable, VkStridedDeviceAddressRegionKHR pMissShaderBindingTable, VkStridedDeviceAddressRegionKHR pHitShaderBindingTable, VkStridedDeviceAddressRegionKHR pCallableShaderBindingTable, long indirectDeviceAddress)Initialize an indirect ray tracing dispatch.static voidvkCmdTraceRaysKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, VkStridedDeviceAddressRegionKHR pRaygenShaderBindingTable, VkStridedDeviceAddressRegionKHR pMissShaderBindingTable, VkStridedDeviceAddressRegionKHR pHitShaderBindingTable, VkStridedDeviceAddressRegionKHR pCallableShaderBindingTable, int width, int height, int depth)Initialize a ray tracing dispatch.static intvkCreateRayTracingPipelinesKHR(org.lwjgl.vulkan.VkDevice device, long deferredOperation, long pipelineCache, VkRayTracingPipelineCreateInfoKHR.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, long[] pPipelines)Array version of:CreateRayTracingPipelinesKHRstatic intvkCreateRayTracingPipelinesKHR(org.lwjgl.vulkan.VkDevice device, long deferredOperation, long pipelineCache, VkRayTracingPipelineCreateInfoKHR.Buffer pCreateInfos, VkAllocationCallbacks pAllocator, java.nio.LongBuffer pPipelines)Creates a new ray tracing pipeline object.static intvkGetRayTracingCaptureReplayShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)Query ray tracing capture replay pipeline shader group handles.static intvkGetRayTracingShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)Query ray tracing pipeline shader group handles.static longvkGetRayTracingShaderGroupStackSizeKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int group, int groupShader)Query ray tracing pipeline shader group shader stack size.
-
-
-
Field Detail
-
VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION
The extension specification version.
-
VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME
The extension name.
-
VK_SHADER_UNUSED_KHR
VK_SHADER_UNUSED_KHR
-
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR, VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR, VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR
ExtendsVkStructureType.Enum values:
STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHRSTRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHRSTRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHRSTRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHRSTRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR
-
VK_SHADER_STAGE_RAYGEN_BIT_KHR, VK_SHADER_STAGE_ANY_HIT_BIT_KHR, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, VK_SHADER_STAGE_MISS_BIT_KHR, VK_SHADER_STAGE_INTERSECTION_BIT_KHR, VK_SHADER_STAGE_CALLABLE_BIT_KHR
ExtendsVkShaderStageFlagBits.Enum values:
-
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR
ExtendsVkPipelineStageFlagBits.
-
VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR
ExtendsVkBufferUsageFlagBits.
-
VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR
ExtendsVkPipelineBindPoint.
-
VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR, VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR, VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR, VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR
ExtendsVkPipelineCreateFlagBits.Enum values:
PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHRPIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHRPIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHRPIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHRPIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHRPIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHRPIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR
-
VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR
ExtendsVkDynamicState.
-
VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR, VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR
VkRayTracingShaderGroupTypeKHR - Shader group typesDescription
RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHRindicates a shader group with a singleSHADER_STAGE_RAYGEN_BIT_KHR,SHADER_STAGE_MISS_BIT_KHR, orSHADER_STAGE_CALLABLE_BIT_KHRshader in it.RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHRspecifies a shader group that only hits triangles and must not contain an intersection shader, only closest hit and any-hit shaders.RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHRspecifies 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
VkRayTracingShaderGroupCreateInfoKHR,VkRayTracingShaderGroupCreateInfoNV
-
VK_SHADER_GROUP_SHADER_GENERAL_KHR, VK_SHADER_GROUP_SHADER_CLOSEST_HIT_KHR, VK_SHADER_GROUP_SHADER_ANY_HIT_KHR, VK_SHADER_GROUP_SHADER_INTERSECTION_KHR
VkShaderGroupShaderKHR - Shader group shadersDescription
SHADER_GROUP_SHADER_GENERAL_KHRuses the shader specified in the group withVkRayTracingShaderGroupCreateInfoKHR::generalShaderSHADER_GROUP_SHADER_CLOSEST_HIT_KHRuses the shader specified in the group withVkRayTracingShaderGroupCreateInfoKHR::closestHitShaderSHADER_GROUP_SHADER_ANY_HIT_KHRuses the shader specified in the group withVkRayTracingShaderGroupCreateInfoKHR::anyHitShaderSHADER_GROUP_SHADER_INTERSECTION_KHRuses the shader specified in the group withVkRayTracingShaderGroupCreateInfoKHR::intersectionShader
See Also
-
-
Method Detail
-
nvkCmdTraceRaysKHR
public static void nvkCmdTraceRaysKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long pRaygenShaderBindingTable, long pMissShaderBindingTable, long pHitShaderBindingTable, long pCallableShaderBindingTable, int width, int height, int depth)Unsafe version of:CmdTraceRaysKHR
-
vkCmdTraceRaysKHR
public static void vkCmdTraceRaysKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, VkStridedDeviceAddressRegionKHR pRaygenShaderBindingTable, VkStridedDeviceAddressRegionKHR pMissShaderBindingTable, VkStridedDeviceAddressRegionKHR pHitShaderBindingTable, VkStridedDeviceAddressRegionKHR pCallableShaderBindingTable, int width, int height, int depth)Initialize a ray tracing dispatch.C Specification
To dispatch ray tracing use:
void vkCmdTraceRaysKHR( VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, 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
- This command must not cause a shader call instruction to be executed from a shader invocation with a recursion depth greater than the value of
maxPipelineRayRecursionDepthused to create the bound ray tracing pipeline - If the buffer from which
pRayGenShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pRayGenShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pRayGenShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
sizemember ofpRayGenShaderBindingTablemust be equal to itsstridemember - If the buffer from which
pMissShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pMissShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pMissShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
stridemember ofpMissShaderBindingTablemust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment - The
stridemember ofpMissShaderBindingTablemust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride - If the buffer from which
pHitShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pHitShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pHitShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
stridemember ofpHitShaderBindingTablemust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment - The
stridemember ofpHitShaderBindingTablemust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride - If the buffer from which
pCallableShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pCallableShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pCallableShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
stridemember ofpCallableShaderBindingTablemust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment - The
stridemember ofpCallableShaderBindingTablemust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR, thedeviceAddressmember ofpHitShaderBindingTablemust not be zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR, thedeviceAddressmember ofpHitShaderBindingTablemust not be zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR, the shader group handle identified bypMissShaderBindingTablemust not be set to zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR, entries inpHitShaderBindingTableaccessed as a result of this command in order to execute an any-hit shader must not be set to zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR, entries inpHitShaderBindingTableaccessed as a result of this command in order to execute a closest hit shader must not be set to zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR, entries inpHitShaderBindingTableaccessed as a result of this command in order to execute an intersection shader must not be set to zero - Any non-zero hit shader group entries in
pHitShaderBindingTableaccessed by this call from a geometry with ageometryTypeofGEOMETRY_TYPE_TRIANGLES_KHRmust have been created withRAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR - Any non-zero hit shader group entries in
pHitShaderBindingTableaccessed by this call from a geometry with ageometryTypeofGEOMETRY_TYPE_AABBS_KHRmust have been created withRAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR
commandBuffermust not be a protected command bufferwidthmust be less than or equal toVkPhysicalDeviceLimits::maxComputeWorkGroupCount[0] ×VkPhysicalDeviceLimits::maxComputeWorkGroupSize[0]heightmust be less than or equal toVkPhysicalDeviceLimits::maxComputeWorkGroupCount[1] ×VkPhysicalDeviceLimits::maxComputeWorkGroupSize[1]depthmust be less than or equal toVkPhysicalDeviceLimits::maxComputeWorkGroupCount[2] ×VkPhysicalDeviceLimits::maxComputeWorkGroupSize[2]width × height × depthmust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxRayDispatchInvocationCount
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlepRaygenShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurepMissShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurepHitShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurepCallableShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurecommandBuffermust 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
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.pRaygenShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the ray generation shader stage.pMissShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the miss shader stage.pHitShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the hit shader stage.pCallableShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the callable shader stage.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
-
nvkCreateRayTracingPipelinesKHR
public static int nvkCreateRayTracingPipelinesKHR(org.lwjgl.vulkan.VkDevice device, long deferredOperation, long pipelineCache, int createInfoCount, long pCreateInfos, long pAllocator, long pPipelines)Unsafe version of:CreateRayTracingPipelinesKHR- Parameters:
createInfoCount- the length of thepCreateInfosandpPipelinesarrays.
-
vkCreateRayTracingPipelinesKHR
public static int vkCreateRayTracingPipelinesKHR(org.lwjgl.vulkan.VkDevice device, long deferredOperation, long pipelineCache, VkRayTracingPipelineCreateInfoKHR.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 vkCreateRayTracingPipelinesKHR( VkDevice device, VkDeferredOperationKHR deferredOperation, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);Description
The
ERROR_INVALID_OPAQUE_CAPTURE_ADDRESSerror is returned if the implementation is unable to re-use the shader group handles provided inVkRayTracingShaderGroupCreateInfoKHR::pShaderGroupCaptureReplayHandlewhenVkPhysicalDeviceRayTracingPipelineFeaturesKHR::rayTracingPipelineShaderGroupHandleCaptureReplayis enabled.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
- If
deferredOperationis notNULL_HANDLE, it must be a validVkDeferredOperationKHRobject - Any previous deferred operation that was associated with
deferredOperationmust be complete - The
rayTracingPipelinefeature must be enabled - If
deferredOperationis notNULL_HANDLE, theflagsmember of elements ofpCreateInfosmust not includePIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT
Valid Usage (Implicit)
devicemust be a validVkDevicehandle- If
deferredOperationis notNULL_HANDLE,deferredOperationmust be a validVkDeferredOperationKHRhandle - If
pipelineCacheis notNULL_HANDLE,pipelineCachemust be a validVkPipelineCachehandle pCreateInfosmust be a valid pointer to an array ofcreateInfoCountvalidVkRayTracingPipelineCreateInfoKHRstructures- 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
deferredOperationis a valid handle, it must have been created, allocated, or retrieved fromdevice - 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.deferredOperation-NULL_HANDLEor the handle of a validVkDeferredOperationKHRrequest deferral object for this command.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 ofVkRayTracingPipelineCreateInfoKHRstructures.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
-
nvkGetRayTracingShaderGroupHandlesKHR
public static int nvkGetRayTracingShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)Unsafe version of:GetRayTracingShaderGroupHandlesKHR- Parameters:
dataSize- the size in bytes of the buffer pointed to bypData.
-
vkGetRayTracingShaderGroupHandlesKHR
public static int vkGetRayTracingShaderGroupHandlesKHR(org.lwjgl.vulkan.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 vkGetRayTracingShaderGroupHandlesKHR( VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData);or the equivalent command
VkResult vkGetRayTracingShaderGroupHandlesNV( VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData);Valid Usage
pipelinemust be a ray tracing pipelinefirstGroupmust be less than the number of shader groups inpipeline- The sum of
firstGroupandgroupCountmust be less than or equal to the number of shader groups inpipeline dataSizemust be at leastVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleSize × groupCountpipelinemust have not been created withPIPELINE_CREATE_LIBRARY_BIT_KHR
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 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.
-
nvkGetRayTracingCaptureReplayShaderGroupHandlesKHR
public static int nvkGetRayTracingCaptureReplayShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, long dataSize, long pData)Unsafe version of:GetRayTracingCaptureReplayShaderGroupHandlesKHR- Parameters:
dataSize- the size in bytes of the buffer pointed to bypData.
-
vkGetRayTracingCaptureReplayShaderGroupHandlesKHR
public static int vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int firstGroup, int groupCount, java.nio.ByteBuffer pData)Query ray tracing capture replay pipeline shader group handles.C Specification
To query the optional capture handle information of shaders in the ray tracing pipeline, call:
VkResult vkGetRayTracingCaptureReplayShaderGroupHandlesKHR( VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData);Valid Usage
pipelinemust be a ray tracing pipelinefirstGroupmust be less than the number of shader groups inpipeline- The sum of
firstGroupandgroupCountmust be less than or equal to the number of shader groups inpipeline dataSizemust be at leastVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleCaptureReplaySize × groupCountVkPhysicalDeviceRayTracingPipelineFeaturesKHR::rayTracingPipelineShaderGroupHandleCaptureReplaymust be enabled to call this functionpipelinemust have been created with aflagsthat includedPIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR
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 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::pGroupsarray.groupCount- the number of shader handles to retrieve.pData- a pointer to a user-allocated buffer where the results will be written.
-
nvkCmdTraceRaysIndirectKHR
public static void nvkCmdTraceRaysIndirectKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long pRaygenShaderBindingTable, long pMissShaderBindingTable, long pHitShaderBindingTable, long pCallableShaderBindingTable, long indirectDeviceAddress)Unsafe version of:CmdTraceRaysIndirectKHR
-
vkCmdTraceRaysIndirectKHR
public static void vkCmdTraceRaysIndirectKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, VkStridedDeviceAddressRegionKHR pRaygenShaderBindingTable, VkStridedDeviceAddressRegionKHR pMissShaderBindingTable, VkStridedDeviceAddressRegionKHR pHitShaderBindingTable, VkStridedDeviceAddressRegionKHR pCallableShaderBindingTable, long indirectDeviceAddress)Initialize an indirect ray tracing dispatch.C Specification
To dispatch ray tracing, with some parameters sourced on the device, use:
void vkCmdTraceRaysIndirectKHR( VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, VkDeviceAddress indirectDeviceAddress);Description
vkCmdTraceRaysIndirectKHRbehaves similarly toCmdTraceRaysKHRexcept that the ray trace query dimensions are read by the device fromindirectDeviceAddressduring execution.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
- This command must not cause a shader call instruction to be executed from a shader invocation with a recursion depth greater than the value of
maxPipelineRayRecursionDepthused to create the bound ray tracing pipeline - If the buffer from which
pRayGenShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pRayGenShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pRayGenShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
sizemember ofpRayGenShaderBindingTablemust be equal to itsstridemember - If the buffer from which
pMissShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pMissShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pMissShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
stridemember ofpMissShaderBindingTablemust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment - The
stridemember ofpMissShaderBindingTablemust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride - If the buffer from which
pHitShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pHitShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pHitShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
stridemember ofpHitShaderBindingTablemust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment - The
stridemember ofpHitShaderBindingTablemust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride - If the buffer from which
pCallableShaderBindingTable\u2192deviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which the
pCallableShaderBindingTable\u2192deviceAddressis queried must have been created with theBUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHRusage flag pCallableShaderBindingTable\u2192deviceAddressmust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment- The
stridemember ofpCallableShaderBindingTablemust be a multiple ofVkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment - The
stridemember ofpCallableShaderBindingTablemust be less than or equal toVkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR, thedeviceAddressmember ofpHitShaderBindingTablemust not be zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR, thedeviceAddressmember ofpHitShaderBindingTablemust not be zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR, the shader group handle identified bypMissShaderBindingTablemust not be set to zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR, entries inpHitShaderBindingTableaccessed as a result of this command in order to execute an any-hit shader must not be set to zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR, entries inpHitShaderBindingTableaccessed as a result of this command in order to execute a closest hit shader must not be set to zero - If the currently bound ray tracing pipeline was created with
flagsthat includedPIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR, entries inpHitShaderBindingTableaccessed as a result of this command in order to execute an intersection shader must not be set to zero - Any non-zero hit shader group entries in
pHitShaderBindingTableaccessed by this call from a geometry with ageometryTypeofGEOMETRY_TYPE_TRIANGLES_KHRmust have been created withRAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR - Any non-zero hit shader group entries in
pHitShaderBindingTableaccessed by this call from a geometry with ageometryTypeofGEOMETRY_TYPE_AABBS_KHRmust have been created withRAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR
- If the buffer from which
indirectDeviceAddresswas queried is non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject - The buffer from which
indirectDeviceAddresswas queried must have been created with theBUFFER_USAGE_INDIRECT_BUFFER_BITbit set indirectDeviceAddressmust be a multiple of 4commandBuffermust not be a protected command buffer- All device addresses between
indirectDeviceAddressandindirectDeviceAddress + sizeof(must be in the buffer device address range of the same bufferVkTraceRaysIndirectCommandKHR) - 1 - The
VkPhysicalDeviceRayTracingPipelineFeaturesKHR::rayTracingPipelineTraceRaysIndirectfeature must be enabled - If the bound ray tracing pipeline was created with
PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NVVkPhysicalDeviceRayTracingMotionBlurFeaturesNV::rayTracingMotionBlurPipelineTraceRaysIndirectfeature must be enabled
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlepRaygenShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurepMissShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurepHitShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurepCallableShaderBindingTablemust be a valid pointer to a validVkStridedDeviceAddressRegionKHRstructurecommandBuffermust 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
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.pRaygenShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the ray generation shader stage.pMissShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the miss shader stage.pHitShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the hit shader stage.pCallableShaderBindingTable- aVkStridedDeviceAddressRegionKHRthat holds the shader binding table data for the callable shader stage.indirectDeviceAddress- a buffer device address which is a pointer to aVkTraceRaysIndirectCommandKHRstructure containing the trace ray parameters.
- If a
-
vkGetRayTracingShaderGroupStackSizeKHR
public static long vkGetRayTracingShaderGroupStackSizeKHR(org.lwjgl.vulkan.VkDevice device, long pipeline, int group, int groupShader)Query ray tracing pipeline shader group shader stack size.C Specification
To query the pipeline stack size of shaders in a shader group in the ray tracing pipeline, call:
VkDeviceSize vkGetRayTracingShaderGroupStackSizeKHR( VkDevice device, VkPipeline pipeline, uint32_t group, VkShaderGroupShaderKHR groupShader);Description
The return value is the ray tracing pipeline stack size in bytes for the specified shader as called from the specified shader group.
Valid Usage
pipelinemust be a ray tracing pipeline- The value of
groupmust be less than the number of shader groups inpipeline - The shader identified by
groupShaderingroupmust not beSHADER_UNUSED_KHR
Valid Usage (Implicit)
devicemust be a validVkDevicehandlepipelinemust be a validVkPipelinehandlegroupShadermust be a validVkShaderGroupShaderKHRvaluepipelinemust have been created, allocated, or retrieved fromdevice
- Parameters:
device- the logical device containing the ray tracing pipeline.pipeline- the ray tracing pipeline object containing the shaders groups.group- the index of the shader group to query.groupShader- the type of shader from the group to query.
-
vkCmdSetRayTracingPipelineStackSizeKHR
public static void vkCmdSetRayTracingPipelineStackSizeKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int pipelineStackSize)Set the stack size dynamically for a ray tracing pipeline.C Specification
To dynamically set the stack size for a ray tracing pipeline, call:
void vkCmdSetRayTracingPipelineStackSizeKHR( VkCommandBuffer commandBuffer, uint32_t pipelineStackSize);Description
This command sets the stack size for subsequent ray tracing commands when the ray tracing pipeline is created with
DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHRset inVkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, the stack size is computed as described in Ray Tracing Pipeline Stack.Valid Usage
pipelineStackSizemust be large enough for any dynamic execution through the shaders in the ray tracing pipeline used by a subsequent trace call
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlecommandBuffermust 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
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.pipelineStackSize- the stack size to use for subsequent ray tracing trace commands.
-
vkCreateRayTracingPipelinesKHR
public static int vkCreateRayTracingPipelinesKHR(org.lwjgl.vulkan.VkDevice device, long deferredOperation, long pipelineCache, VkRayTracingPipelineCreateInfoKHR.Buffer pCreateInfos, @Nullable VkAllocationCallbacks pAllocator, long[] pPipelines)Array version of:CreateRayTracingPipelinesKHR
-
-