VK_HUAWEI_invocation_mask(3)

# VK_HUAWEI_invocation_mask(3) Manual Page

## Name

VK_HUAWEI_invocation_mask - device extension

Loading… please wait.

## Registered Extension Number

371

## Revision

1

## Ratification Status

Not ratified

## Extension and Version Dependencies

VK_KHR_ray_tracing_pipeline
and
VK_KHR_synchronization2
or
Vulkan Version 1.3

## Contact

- Pan Gao [GitHub]PanGao-h

## 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

Contributors

  - Yunpeng Zhu

  - Juntao Li, Huawei

  - Liang Chen, Huawei

  - Shaozhuang Shi, Huawei

  - Hailong Chu, Huawei

## Description

The 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.

## New Commands

- vkCmdBindInvocationMaskHUAWEI

## New Structures

- Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo:

  - VkPhysicalDeviceInvocationMaskFeaturesHUAWEI

## New Enum Constants

- `VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME`

- `VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION`

- Extending VkAccessFlagBits2:

  - VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI

- Extending VkImageUsageFlagBits:

  - VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI

- Extending VkPipelineStageFlagBits2:

  - VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI

- Extending VkStructureType:

  - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI

## 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);

## Version History

- Revision 1, 2021-05-27 (Yunpeng Zhu)

  - Initial draft.

## See Also

No cross-references are available

## Document Notes

For more information, see the Vulkan Specification.

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.

## Copyright

Copyright 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0