Package org.lwjgl.vulkan
Class HUAWEIInvocationMask
- java.lang.Object
-
- org.lwjgl.vulkan.HUAWEIInvocationMask
-
public class HUAWEIInvocationMask extends java.lang.ObjectThe rays to trace may be sparse in some use cases. For example, the scene only have a few regions to reflect. Providing an invocation mask image to the ray tracing commands could potentially give the hardware the hint to do certain optimization without invoking an additional pass to compact the ray buffer.Examples
RT mask is updated before each traceRay.
Step 1. Generate InvocationMask.
//the rt mask image bind as color attachment in the fragment shader Layout(location = 2) out vec4 outRTmask vec4 mask = vec4(x,x,x,x); outRTmask = mask;Step 2. traceRay with InvocationMask
vkCmdBindPipeline( commandBuffers[imageIndex], VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, m_rtPipeline); vkCmdBindDescriptorSets(commandBuffers[imageIndex], VK_PIPELINE_BIND_POINT_RAY_TRACING_NV, m_rtPipelineLayout, 0, 1, &m_rtDescriptorSet, 0, nullptr); vkCmdBindInvocationMaskHUAWEI( commandBuffers[imageIndex], InvocationMaskimageView, InvocationMaskimageLayout); vkCmdTraceRaysKHR(commandBuffers[imageIndex], pRaygenShaderBindingTable, pMissShaderBindingTable, swapChainExtent.width, swapChainExtent.height, 1);VK_HUAWEI_invocation_mask
- Name String
VK_HUAWEI_invocation_mask- Extension Type
- Device extension
- Registered Extension Number
- 371
- Revision
- 1
- Extension and Version Dependencies
- Requires Vulkan 1.0
- Requires
VK_KHR_ray_tracing_pipeline - Requires
VK_KHR_synchronization2
- Contact
- Yunpeng Zhu yunxingzhu
- Extension Proposal
- VK_HUAWEI_invocation_mask
Other Extension Metadata
- Last Modified Date
- 2021-05-27
- Interactions and External Dependencies
- This extension requires
VK_KHR_ray_tracing_pipeline, which allow to bind an invocation mask image before the ray tracing command - This extension requires
VK_KHR_synchronization2, which allows new pipeline stage for the invocation mask image
- This extension requires
- Contributors
- Yunpeng Zhu, HuaWei
-
-
Field Summary
Fields Modifier and Type Field Description static longVK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEIExtendsVkAccessFlagBits2.static java.lang.StringVK_HUAWEI_INVOCATION_MASK_EXTENSION_NAMEThe extension name.static intVK_HUAWEI_INVOCATION_MASK_SPEC_VERSIONThe extension specification version.static intVK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEIExtendsVkImageUsageFlagBits.static longVK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEIExtendsVkPipelineStageFlagBits2.static intVK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEIExtendsVkStructureType.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidvkCmdBindInvocationMaskHUAWEI(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long imageView, int imageLayout)Bind an invocation mask image on a command buffer.
-
-
-
Field Detail
-
VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION
public static final int VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION
The extension specification version.- See Also:
- Constant Field Values
-
VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME
public static final java.lang.String VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME
The extension name.- See Also:
- Constant Field Values
-
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI
public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI
ExtendsVkStructureType.- See Also:
- Constant Field Values
-
VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI
public static final long VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI
ExtendsVkAccessFlagBits2.- See Also:
- Constant Field Values
-
VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI
public static final int VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI
ExtendsVkImageUsageFlagBits.- See Also:
- Constant Field Values
-
VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI
public static final long VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI
ExtendsVkPipelineStageFlagBits2.- See Also:
- Constant Field Values
-
-
Method Detail
-
vkCmdBindInvocationMaskHUAWEI
public static void vkCmdBindInvocationMaskHUAWEI(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long imageView, int imageLayout)Bind an invocation mask image on a command buffer.C Specification
When invocation mask image usage is enabled in the bound ray tracing pipeline, the pipeline uses an invocation mask image specified by the command:
void vkCmdBindInvocationMaskHUAWEI( VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout);Valid Usage
- The invocation mask image feature must be enabled
- If
imageViewis notNULL_HANDLE, it must be a validVkImageViewhandle of typeIMAGE_VIEW_TYPE_2D - If
imageViewis notNULL_HANDLE, it must have a format ofFORMAT_R8_UINT - If
imageViewis notNULL_HANDLE, it must have been created withIMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEIset - If
imageViewis notNULL_HANDLE,imageLayoutmust beIMAGE_LAYOUT_GENERAL - Thread mask image resolution must match the
widthandheightinCmdTraceRaysKHR - Each element in the invocation mask image must have the value 0 or 1. The value 1 means the invocation is active
widthinCmdTraceRaysKHRshould be 1
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandle- If
imageViewis notNULL_HANDLE,imageViewmust be a validVkImageViewhandle imageLayoutmust be a validVkImageLayoutvaluecommandBuffermust 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
- Both of
commandBuffer, andimageViewthat 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 recordedimageView- an image view handle specifying the invocation mask imageimageViewmay be set toNULL_HANDLE, which is equivalent to specifying a view of an image filled with ones value.imageLayout- the layout that the image subresources accessible fromimageViewwill be in when the invocation mask image is accessed
-
-