C Specification
To get the build sizes for an acceleration structure, call:
// Provided by VK_KHR_acceleration_structure
void vkGetAccelerationStructureBuildSizesKHR(
VkDevice device,
VkAccelerationStructureBuildTypeKHR buildType,
const VkAccelerationStructureBuildGeometryInfoKHR* pBuildInfo,
const uint32_t* pMaxPrimitiveCounts,
VkAccelerationStructureBuildSizesInfoKHR* pSizeInfo);
Parameters
-
device
is the logical device that will be used for creating the acceleration structure. -
buildType
defines whether host or device operations (or both) are being queried for. -
pBuildInfo
is a pointer to a VkAccelerationStructureBuildGeometryInfoKHR structure describing parameters of a build operation. -
pMaxPrimitiveCounts
is a pointer to an array ofpBuildInfo->geometryCount
uint32_t
values defining the number of primitives built into each geometry. -
pSizeInfo
is a pointer to a VkAccelerationStructureBuildSizesInfoKHR structure which returns the size required for an acceleration structure and the sizes required for the scratch buffers, given the build parameters.
Description
The srcAccelerationStructure
, dstAccelerationStructure
, and
mode
members of pBuildInfo
are ignored.
Any VkDeviceOrHostAddressKHR members of pBuildInfo
are ignored
by this command, except that the hostAddress
member of
VkAccelerationStructureGeometryTrianglesDataKHR::transformData
will be examined to check if it is NULL
.
An acceleration structure created with the accelerationStructureSize
returned by this command supports any build or update with a
VkAccelerationStructureBuildGeometryInfoKHR structure and array of
VkAccelerationStructureBuildRangeInfoKHR structures subject to the
following properties:
-
The build command is a host build command, and
buildType
isVK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR
orVK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR
-
The build command is a device build command, and
buildType
isVK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR
orVK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR
-
For VkAccelerationStructureBuildGeometryInfoKHR:
-
Its
type
, andflags
members are equal topBuildInfo->type
andpBuildInfo->flags
, respectively. -
geometryCount
is less than or equal topBuildInfo->geometryCount
. -
For each element of either
pGeometries
orppGeometries
at a given index, itsgeometryType
member is equal topBuildInfo->geometryType
. -
For each element of either
pGeometries
orppGeometries
at a given index, itsflags
member is equal to the corresponding member of the same element inpBuildInfo
. -
For each element of either
pGeometries
orppGeometries
at a given index, with ageometryType
member equal toVK_GEOMETRY_TYPE_TRIANGLES_KHR
, thevertexFormat
andindexType
members ofgeometry.triangles
are equal to the corresponding members of the same element inpBuildInfo
. -
For each element of either
pGeometries
orppGeometries
at a given index, with ageometryType
member equal toVK_GEOMETRY_TYPE_TRIANGLES_KHR
, themaxVertex
member ofgeometry.triangles
is less than or equal to the corresponding member of the same element inpBuildInfo
. -
For each element of either
pGeometries
orppGeometries
at a given index, with ageometryType
member equal toVK_GEOMETRY_TYPE_TRIANGLES_KHR
, if the applicable address in thetransformData
member ofgeometry.triangles
is notNULL
, the correspondingtransformData.hostAddress
parameter inpBuildInfo
is notNULL
.
-
-
For each VkAccelerationStructureBuildRangeInfoKHR corresponding to the VkAccelerationStructureBuildGeometryInfoKHR:
-
Its
primitiveCount
member is less than or equal to the corresponding element ofpMaxPrimitiveCounts
. -
For each element of either
pGeometries
orppGeometries
at a given index, with ageometryType
member equal toVK_GEOMETRY_TYPE_TRIANGLES_KHR
, if thepNext
chain contains VkAccelerationStructureTrianglesOpacityMicromapEXT the corresponding member ofpBuildInfo
also contains VkAccelerationStructureTrianglesOpacityMicromapEXT and with an equivalentmicromap
. -
For each element of either
pGeometries
orppGeometries
at a given index, with ageometryType
member equal toVK_GEOMETRY_TYPE_TRIANGLES_KHR
, if thepNext
chain contains VkAccelerationStructureTrianglesDisplacementMicromapNV the corresponding member ofpBuildInfo
also contains VkAccelerationStructureTrianglesDisplacementMicromapNV and with an equivalentmicromap
.
-
Similarly, the updateScratchSize
value will support any build command
specifying the VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR
mode
under the above conditions, and the buildScratchSize
value
will support any build command specifying the
VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR
mode
under the
above conditions.
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.