VkAccelerationStructureCreateInfoKHR(3)

# VkAccelerationStructureCreateInfoKHR(3) Manual Page

## Name

VkAccelerationStructureCreateInfoKHR - Structure specifying the parameters of a newly created acceleration structure object

## C Specification

The `VkAccelerationStructureCreateInfoKHR` structure is defined as:

    typedef struct VkAccelerationStructureCreateInfoKHR {
        VkStructureType                                            sType;
        const void*                                                pNext;
        VkDeviceSize                                               compactedSize;
        VkAccelerationStructureTypeKHR                             type;
        VkBuildAccelerationStructureFlagsKHR                       flags;
        uint32_t                                                   maxGeometryCount;
        const VkAccelerationStructureCreateGeometryTypeInfoKHR*    pGeometryInfos;
        VkDeviceAddress                                            deviceAddress;
    } VkAccelerationStructureCreateInfoKHR;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `compactedSize` is the size from the result of vkCmdWriteAccelerationStructuresPropertiesKHR if this acceleration structure is going to be the target of a compacting copy.

- `type` is a VkAccelerationStructureTypeKHR value specifying the type of acceleration structure that will be created.

- `flags` is a bitmask of VkBuildAccelerationStructureFlagBitsKHR specifying additional parameters of the acceleration structure.

- `maxGeometryCount` specifies the number of geometries that will be in the new acceleration structure.

- `pGeometryInfos` is an array of `maxGeometryCount` VkAccelerationStructureCreateGeometryTypeInfoKHR structures, which describe the maximum size and format of the data that will be built into the acceleration structure.

- `deviceAddress` is the device address requested for the acceleration structure if the `rayTracingAccelerationStructureCaptureReplay` feature is being used.

## Description

If `deviceAddress` is zero, no specific address is requested.

If `deviceAddress` is not zero, `deviceAddress` must be an address retrieved from an identically created acceleration structure on the same implementation. The acceleration structure must also be bound to an identically created `VkDeviceMemory` object.

Apps should avoid creating acceleration structures with app-provided addresses and implementation-provided addresses in the same process, to reduce the likelihood of `VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR` errors.

Valid Usage

- If `compactedSize` is not `0` then `maxGeometryCount` must be `0`

- If `type` is `VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR` then `maxGeometryCount` must be less than or equal to VkPhysicalDeviceRayTracingPropertiesKHR::`maxGeometryCount`

- If `type` is `VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR` then `pGeometryInfos->pname`:maxPrimitiveCount must be less than or equal to VkPhysicalDeviceRayTracingPropertiesKHR::`maxInstanceCount`

- The total number of triangles in all geometries must be less than or equal to VkPhysicalDeviceRayTracingPropertiesKHR::`maxPrimitiveCount`

- The total number of AABBs in all geometries must be less than or equal to VkPhysicalDeviceRayTracingPropertiesKHR::`maxPrimitiveCount`

- If `type` is `VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR` and `compactedSize` is `0`, `maxGeometryCount` must be `1`

- If `type` is `VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR` and `compactedSize` is `0`, the `geometryType` member of elements of `pGeometryInfos` must be `VK_GEOMETRY_TYPE_INSTANCES_KHR`

- If `type` is `VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR` and `compactedSize` is `0`, the `geometryType` member of elements of `pGeometryInfos` must not be `VK_GEOMETRY_TYPE_INSTANCES_KHR`

- If `type` is `VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR` then the `geometryType` member of each geometry in `pGeometryInfos` must be the same

- If `flags` has the `VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR` bit set, then it must not have the `VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR` bit set

- If `deviceAddress` is not `0`, VkPhysicalDeviceRayTracingFeaturesKHR::`rayTracingAccelerationStructureCaptureReplay` must be `VK_TRUE`

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR`

- `pNext` must be `NULL`

- `type` must be a valid VkAccelerationStructureTypeKHR value

- `flags` must be a valid combination of VkBuildAccelerationStructureFlagBitsKHR values

- `pGeometryInfos` must be a valid pointer to an array of `maxGeometryCount` valid VkAccelerationStructureCreateGeometryTypeInfoKHR structures

- `maxGeometryCount` must be greater than `0`

## See Also

VkAccelerationStructureCreateGeometryTypeInfoKHR, VkAccelerationStructureTypeKHR, VkBuildAccelerationStructureFlagsKHR, `VkDeviceAddress`, `VkDeviceSize`, VkStructureType, vkCreateAccelerationStructureKHR

## 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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.