Registered Extension Number

371

Revision

1

Ratification Status

Not ratified

Extension and Version Dependencies

Contact

Extension Proposal

Other Extension Metadata

Last Modified Date

2021-05-27

Interactions and External Dependencies
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

New Structures

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 2014-2024 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0