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_maskVK_KHR_ray_tracing_pipeline and VK_KHR_synchronization2VK_KHR_ray_tracing_pipeline, which allow to bind an invocation mask image before the ray tracing commandVK_KHR_synchronization2, which allows new pipeline stage for the invocation mask image| Modifier and Type | Field and Description |
|---|---|
| public static final long | VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI
Extends |
| public static final String | VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME
The extension name. |
| public static final int | VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION
The extension specification version. |
| public static final int | VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI
Extends |
| public static final long | VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI
Extends |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI
Extends |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static void | vkCmdBindInvocationMaskHUAWEI(VkCommandBuffer
the command buffer into which the command will be recorded commandBuffer, long an image view handle specifying the invocation mask image imageView, int imageView may be set to NULL_HANDLE, which is equivalent to specifying a view of an image filled with ones value.the layout that the image subresources accessible from imageLayout)imageView will be in when the invocation mask image is accessedBind an invocation mask image on a command buffer. |
| VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI | back to summary |
|---|---|
| public static final long VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI Extends | |
| VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME | back to summary |
|---|---|
| public static final String VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME The extension name. | |
| VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION | back to summary |
|---|---|
| public static final int VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION The extension specification version. | |
| VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI | back to summary |
|---|---|
| public static final int VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI Extends | |
| VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI | back to summary |
|---|---|
| public static final long VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI Extends | |
| VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI Extends | |
| HUAWEIInvocationMask | back to summary |
|---|---|
| protected HUAWEIInvocationMask() | |
| vkCmdBindInvocationMaskHUAWEI | back to summary | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public static void vkCmdBindInvocationMaskHUAWEI(VkCommandBuffer commandBuffer, long imageView, int imageLayout) Bind an invocation mask image on a command buffer. C SpecificationWhen invocation mask image usage is enabled in the bound ray tracing pipeline, the pipeline uses an invocation mask image specified by the command:
Valid Usage
Valid Usage (Implicit)
Host Synchronization
Command Properties
| |||||||||||