C Specification
The VkAccelerationStructureBuildGeometryInfoKHR structure is defined
as:
// Provided by VK_KHR_acceleration_structure
typedef struct VkAccelerationStructureBuildGeometryInfoKHR {
VkStructureType sType;
const void* pNext;
VkAccelerationStructureTypeKHR type;
VkBuildAccelerationStructureFlagsKHR flags;
VkBuildAccelerationStructureModeKHR mode;
VkAccelerationStructureKHR srcAccelerationStructure;
VkAccelerationStructureKHR dstAccelerationStructure;
uint32_t geometryCount;
const VkAccelerationStructureGeometryKHR* pGeometries;
const VkAccelerationStructureGeometryKHR* const* ppGeometries;
VkDeviceOrHostAddressKHR scratchData;
} VkAccelerationStructureBuildGeometryInfoKHR;
Members
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
typeis a VkAccelerationStructureTypeKHR value specifying the type of acceleration structure being built. -
flagsis a bitmask of VkBuildAccelerationStructureFlagBitsKHR specifying additional parameters of the acceleration structure. -
modeis a VkBuildAccelerationStructureModeKHR value specifying the type of operation to perform. -
srcAccelerationStructureis a pointer to an existing acceleration structure that is to be used to update thedstAccelerationStructureacceleration structure whenmodeisVK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR. -
dstAccelerationStructureis a pointer to the target acceleration structure for the build. -
geometryCountspecifies the number of geometries that will be built intodstAccelerationStructure. -
pGeometriesis a pointer to an array of VkAccelerationStructureGeometryKHR structures. -
ppGeometriesis a pointer to an array of pointers to VkAccelerationStructureGeometryKHR structures. -
scratchDatais the device or host address to memory that will be used as scratch memory for the build.
Description
Only one of pGeometries or ppGeometries can be a valid pointer,
the other must be NULL.
Each element of the non-NULL array describes the data used to build each
acceleration structure geometry.
The index of each element of the pGeometries or ppGeometries
members of VkAccelerationStructureBuildGeometryInfoKHR is used as the
geometry index during ray traversal.
The geometry index is available in ray shaders via the
RayGeometryIndexKHR
built-in, and is used to
determine hit and intersection shaders executed during traversal.
The geometry index is available to ray queries via the
OpRayQueryGetIntersectionGeometryIndexKHR instruction.
Setting VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in flags
indicates that this build is a motion top level acceleration structure.
A motion top level uses instances of format
VkAccelerationStructureMotionInstanceNV if
VkAccelerationStructureGeometryInstancesDataKHR::arrayOfPointers
is VK_FALSE.
If
VkAccelerationStructureGeometryInstancesDataKHR::arrayOfPointers
is VK_TRUE, the pointer for each element of the array of instance
pointers consists of 4 bits of
VkAccelerationStructureMotionInstanceTypeNV in the low 4 bits of the
pointer identifying the type of structure at the pointer.
The device address accessed is the value in the array with the low 4 bits
set to zero.
The structure at the pointer is one of
VkAccelerationStructureInstanceKHR,
VkAccelerationStructureMatrixMotionInstanceNV or
VkAccelerationStructureSRTMotionInstanceNV, depending on the type
value encoded in the low 4 bits.
A top level acceleration structure with either motion instances or vertex
motion in its instances must set
VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in flags.
Members srcAccelerationStructure and dstAccelerationStructure
may be the same or different for an update operation (when mode is
VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR).
If they are the same, the update happens in-place.
Otherwise, the target acceleration structure is updated and the source is
not modified.
See Also
VK_KHR_acceleration_structure, VkAccelerationStructureGeometryKHR, VkAccelerationStructureKHR, VkAccelerationStructureTypeKHR, VkBuildAccelerationStructureFlagsKHR, VkBuildAccelerationStructureModeKHR, VkDeviceOrHostAddressKHR, VkStructureType, vkBuildAccelerationStructuresKHR, vkCmdBuildAccelerationStructuresIndirectKHR, vkCmdBuildAccelerationStructuresKHR, vkGetAccelerationStructureBuildSizesKHR
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.