VkAccelerationStructureBuildRangeInfoKHR(3)

# VkAccelerationStructureBuildRangeInfoKHR(3) Manual Page

## Name

VkAccelerationStructureBuildRangeInfoKHR - Structure specifying build offsets and counts for acceleration structure builds

Loading… please wait.

## C Specification

`VkAccelerationStructureBuildRangeInfoKHR` is defined as:

    // Provided by VK_KHR_acceleration_structure
    typedef struct VkAccelerationStructureBuildRangeInfoKHR {
        uint32_t    primitiveCount;
        uint32_t    primitiveOffset;
        uint32_t    firstVertex;
        uint32_t    transformOffset;
    } VkAccelerationStructureBuildRangeInfoKHR;

## Members

- `primitiveCount` defines the number of primitives for a corresponding acceleration structure geometry.

- `primitiveOffset` defines an offset in bytes into the memory where primitive data is defined.

- `firstVertex` is the index of the first vertex to build from for triangle geometry.

- `transformOffset` defines an offset in bytes into the memory where a transform matrix is defined.

## Description

The primitive count and primitive offset are interpreted differently depending on the VkGeometryTypeKHR used:

- For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, `primitiveCount` is the number of triangles to be built, where each triangle is treated as 3 vertices.

  - If the geometry uses indices, `primitiveCount` × 3 indices are consumed from VkAccelerationStructureGeometryTrianglesDataKHR::`indexData`, starting at an offset of `primitiveOffset`. The value of `firstVertex` is added to the index values before fetching vertices.

  - If the geometry does not use indices, `primitiveCount` × 3 vertices are consumed from VkAccelerationStructureGeometryTrianglesDataKHR::`vertexData`, starting at an offset of `primitiveOffset` + VkAccelerationStructureGeometryTrianglesDataKHR::`vertexStride` × `firstVertex`.

  - If VkAccelerationStructureGeometryTrianglesDataKHR::`transformData` is not `NULL`, a single VkTransformMatrixKHR structure is consumed from VkAccelerationStructureGeometryTrianglesDataKHR::`transformData`, at an offset of `transformOffset`. This matrix describes a transformation from the space in which the vertices for all triangles in this geometry are described to the space in which the acceleration structure is defined.

- For geometries of type VK_GEOMETRY_TYPE_AABBS_KHR, `primitiveCount` is the number of axis-aligned bounding boxes. `primitiveCount` VkAabbPositionsKHR structures are consumed from VkAccelerationStructureGeometryAabbsDataKHR::`data`, starting at an offset of `primitiveOffset`.

- For geometries of type VK_GEOMETRY_TYPE_SPHERES_NV, `primitiveCount` is the number of spheres to be built, where each sphere is treated as 1 vertex.

  - If the geometry uses indices, `primitiveCount` indices are consumed from VkAccelerationStructureGeometrySpheresDataNV::`indexData`, starting at an offset of `primitiveOffset`. The value of `firstVertex` is added to the index values before fetching vertices and radii.

  - If the geometry does not use indices, `primitiveCount` vertices and radii are consumed from VkAccelerationStructureGeometrySpheresDataNV::`vertexData`, starting at an offset of `primitiveOffset` + VkAccelerationStructureGeometrySpheresDataNV::`vertexStride` × `firstVertex` and VkAccelerationStructureGeometrySpheresDataNV::`radiusData`, starting at an offset of `primitiveOffset` + VkAccelerationStructureGeometrySpheresDataNV::`radiusStride` × `firstVertex` respectively.

- For geometries of type VK_GEOMETRY_TYPE_LINEAR_SWEPT_SPHERES_NV, `primitiveCount` is the number of LSS primitives to be built, where each LSS primitive is treated as 2 vertices.

  - If the geometry uses indices, `primitiveCount` × 2 indices are consumed from VkAccelerationStructureGeometryLinearSweptSpheresDataNV::`indexData`, starting at an offset of `primitiveOffset`. The value of `firstVertex` is added to the index values before fetching vertices and radii.

  - If the geometry does not use indices, `primitiveCount` × 2 vertices and radii are consumed from VkAccelerationStructureGeometryLinearSweptSpheresDataNV::`vertexData`, starting at an offset of `primitiveOffset` + VkAccelerationStructureGeometryLinearSweptSpheresDataNV::`vertexStride` × `firstVertex` and VkAccelerationStructureGeometryLinearSweptSpheresDataNV::`radiusData`, starting at an offset of `primitiveOffset` + VkAccelerationStructureGeometryLinearSweptSpheresDataNV::`radiusStride` × `firstVertex` respectively.

- For geometries of type VK_GEOMETRY_TYPE_INSTANCES_KHR, `primitiveCount` is the number of acceleration structures. `primitiveCount` VkAccelerationStructureInstanceKHR or VkAccelerationStructureMotionInstanceNV structures are consumed from VkAccelerationStructureGeometryInstancesDataKHR::`data`, starting at an offset of `primitiveOffset`.

Valid Usage

- VUID-VkAccelerationStructureBuildRangeInfoKHR-vertexData-10418
  The number of vertices consumed from VkAccelerationStructureGeometryTrianglesDataKHR::`vertexData` must be less than or equal to VkAccelerationStructureGeometryTrianglesDataKHR::`maxVertex` + 1

- VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03656
  For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the geometry uses indices, the offset `primitiveOffset` from VkAccelerationStructureGeometryTrianglesDataKHR::`indexData` must be a multiple of the element size of VkAccelerationStructureGeometryTrianglesDataKHR::`indexType`

- VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03657
  For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the geometry does not use indices, the offset `primitiveOffset` from VkAccelerationStructureGeometryTrianglesDataKHR::`vertexData` must be a multiple of:

  - the size of the format specified in VkAccelerationStructureGeometryTrianglesDataKHR::`vertexFormat`, if that format is a packed format

  - the component size of the VkAccelerationStructureGeometryTrianglesDataKHR::`vertexFormat`, if that format is not a packed format

- VUID-VkAccelerationStructureBuildRangeInfoKHR-maxVertex-10774
  For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the geometry uses indices, then VkAccelerationStructureGeometryTrianglesDataKHR::`maxVertex` must be greater than or equal to `firstVertex` plus the maximum index value found in the VkAccelerationStructureGeometryTrianglesDataKHR::`indexData` in the range [`primitiveOffset`, `primitiveOffset`
  `primitiveCount` x 3]

- VUID-VkAccelerationStructureBuildRangeInfoKHR-None-10775
  For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the geometry does not use indices, then VkAccelerationStructureGeometryTrianglesDataKHR::`maxVertex` must be greater than or equal to firstVertex + primitiveCount x 3 - 1

- VUID-VkAccelerationStructureBuildRangeInfoKHR-transformOffset-03658
  For geometries of type VK_GEOMETRY_TYPE_TRIANGLES_KHR, the offset `transformOffset` from VkAccelerationStructureGeometryTrianglesDataKHR::`transformData` must be a multiple of 16

- VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03659
  For geometries of type VK_GEOMETRY_TYPE_AABBS_KHR, the offset `primitiveOffset` from VkAccelerationStructureGeometryAabbsDataKHR::`data` must be a multiple of 8

- VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03660
  For geometries of type VK_GEOMETRY_TYPE_INSTANCES_KHR, the offset `primitiveOffset` from VkAccelerationStructureGeometryInstancesDataKHR::`data` must be a multiple of 16

## See Also

VK_KHR_acceleration_structure, vkBuildAccelerationStructuresKHR, vkCmdBuildAccelerationStructuresKHR

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

Copyright 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0