C Specification

To build acceleration structures call:

// Provided by VK_KHR_ray_tracing
void vkCmdBuildAccelerationStructureKHR(
    VkCommandBuffer                             commandBuffer,
    uint32_t                                    infoCount,
    const VkAccelerationStructureBuildGeometryInfoKHR* pInfos,
    const VkAccelerationStructureBuildOffsetInfoKHR* const* ppOffsetInfos);


  • commandBuffer is the command buffer into which the command will be recorded.

  • infoCount is the number of acceleration structures to build. It specifies the number of the pInfos structures and ppOffsetInfos pointers that must be provided.

  • pInfos is an array of infoCount VkAccelerationStructureBuildGeometryInfoKHR structures defining the geometry used to build each acceleration structure.

  • ppOffsetInfos is an array of infoCount pointers to arrays of VkAccelerationStructureBuildOffsetInfoKHR structures. Each ppOffsetInfos[i] is an array of pInfos[i].geometryCount VkAccelerationStructureBuildOffsetInfoKHR structures defining dynamic offsets to the addresses where geometry data is stored, as defined by pInfos[i].


The vkCmdBuildAccelerationStructureKHR command provides the ability to initiate multiple acceleration structures builds, however there is no ordering or synchronization implied between any of the individual acceleration structure builds.


This means that an application cannot build a top-level acceleration structure in the same vkCmdBuildAccelerationStructureKHR call as the associated bottom-level or instance acceleration structures are being built. There also cannot be any memory aliasing between any acceleration structure memories or scratch memories being used by any of the builds.

Accesses to the acceleration structure scratch buffers as identified by the VkAccelerationStructureBuildGeometryInfoKHRscratchData buffer device addresses must be synchronized with the VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR pipeline stage and an access type of VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR or VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR.

Valid Usage
  • VUID-vkCmdBuildAccelerationStructureKHR-pOffsetInfos-03402
    Each element of ppOffsetInfos[i] must be a valid pointer to an array of pInfos[i].geometryCount VkAccelerationStructureBuildOffsetInfoKHR structures

  • VUID-vkCmdBuildAccelerationStructureKHR-pInfos-03403
    Each pInfos[i].srcAccelerationStructure must not refer to the same acceleration structure as any pInfos[i].dstAccelerationStructure that is provided to the same build command unless it is identical for an update

  • VUID-vkCmdBuildAccelerationStructureKHR-pInfos-03404
    For each pInfos[i], dstAccelerationStructure must have been created with compatible VkAccelerationStructureCreateInfoKHR where VkAccelerationStructureCreateInfoKHR::type and VkAccelerationStructureCreateInfoKHR::flags are identical to VkAccelerationStructureBuildGeometryInfoKHR::type and VkAccelerationStructureBuildGeometryInfoKHR::flags respectively, VkAccelerationStructureBuildGeometryInfoKHR::geometryCount for dstAccelerationStructure are greater than or equal to the build size, and each geometry in VkAccelerationStructureBuildGeometryInfoKHR::ppGeometries for dstAccelerationStructure has greater than or equal to the number of vertices, indices, and AABBs, VkAccelerationStructureGeometryTrianglesDataKHR::transformData is both 0 or both non-zero, and all other parameters are the same

  • VUID-vkCmdBuildAccelerationStructureKHR-pInfos-03405
    For each pInfos[i], if update is VK_TRUE, then objects that were previously active for that acceleration structure must not be made inactive as per [acceleration-structure-inactive-prims]

  • VUID-vkCmdBuildAccelerationStructureKHR-pInfos-03406
    For each pInfos[i], if update is VK_TRUE, then objects that were previously inactive for that acceleration structure must not be made active as per [acceleration-structure-inactive-prims]

  • VUID-vkCmdBuildAccelerationStructureKHR-None-03407
    Any acceleration structure instance in any top level build in this command must not reference any bottom level acceleration structure built by this command

  • VUID-vkCmdBuildAccelerationStructureKHR-pInfos-03408
    There must not be any memory aliasing between the scratch memories that are provided in all the pInfos[i].scratchData memories for the acceleration structure builds

  • VUID-vkCmdBuildAccelerationStructureKHR-None-03409
    There must not be any memory aliasing between memory bound to any top level, bottom level, or instance acceleration structure accessed by this command

Valid Usage (Implicit)
  • VUID-vkCmdBuildAccelerationStructureKHR-commandBuffer-parameter
    commandBuffer must be a valid VkCommandBuffer handle

  • VUID-vkCmdBuildAccelerationStructureKHR-pInfos-parameter
    pInfos must be a valid pointer to an array of infoCount valid VkAccelerationStructureBuildGeometryInfoKHR structures

  • VUID-vkCmdBuildAccelerationStructureKHR-ppOffsetInfos-parameter
    ppOffsetInfos must be a valid pointer to an array of infoCount VkAccelerationStructureBuildOffsetInfoKHR structures

  • VUID-vkCmdBuildAccelerationStructureKHR-commandBuffer-recording
    commandBuffer must be in the recording state

  • VUID-vkCmdBuildAccelerationStructureKHR-commandBuffer-cmdpool
    The VkCommandPool that commandBuffer was allocated from must support compute operations

  • VUID-vkCmdBuildAccelerationStructureKHR-renderpass
    This command must only be called outside of a render pass instance

  • VUID-vkCmdBuildAccelerationStructureKHR-infoCount-arraylength
    infoCount must be greater than 0

Host Synchronization
  • Host access to commandBuffer must be externally synchronized

  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type




See Also

Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright (c) 2014-2020 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0