C Specification
The VkClusterAccelerationStructureBuildTriangleClusterInfoNV structure is defined as:
// Provided by VK_NV_cluster_acceleration_structure
typedef struct VkClusterAccelerationStructureBuildTriangleClusterInfoNV {
uint32_t clusterID;
VkClusterAccelerationStructureClusterFlagsNV clusterFlags;
uint32_t triangleCount:9;
uint32_t vertexCount:9;
uint32_t positionTruncateBitCount:6;
uint32_t indexType:4;
uint32_t opacityMicromapIndexType:4;
VkClusterAccelerationStructureGeometryIndexAndGeometryFlagsNV baseGeometryIndexAndGeometryFlags;
uint16_t indexBufferStride;
uint16_t vertexBufferStride;
uint16_t geometryIndexAndFlagsBufferStride;
uint16_t opacityMicromapIndexBufferStride;
VkDeviceAddress indexBuffer;
VkDeviceAddress vertexBuffer;
VkDeviceAddress geometryIndexAndFlagsBuffer;
VkDeviceAddress opacityMicromapArray;
VkDeviceAddress opacityMicromapIndexBuffer;
} VkClusterAccelerationStructureBuildTriangleClusterInfoNV;
Members
-
clusterIDis a user specified identifier assigned to this cluster. -
clusterFlagsis a bitmask of VkClusterAccelerationStructureClusterFlagBitsNV values describing flags how the cluster should be built. -
triangleCountis the number of triangles in this cluster. -
vertexCountis the number of unique vertices in this cluster. -
positionTruncateBitCountis the number of bits starting at the lowest bit (i.e. the LSBs of the mantissa), of each vertex position that will be truncated to zero to improve floating-point compression. -
indexTypeis a single VkClusterAccelerationStructureIndexFormatFlagBitsNV value specifying the index type inindexBuffer. -
opacityMicromapIndexTypeis a single VkClusterAccelerationStructureIndexFormatFlagBitsNV value specifying the index type inopacityMicromapIndexBuffer. -
baseGeometryIndexAndGeometryFlagsis a VkClusterAccelerationStructureGeometryIndexAndGeometryFlagsNV value specifying the base geometry index and flags for all triangles in the cluster. -
indexBufferStrideis the stride in bytes inindexBufferwith0meaning the values are tightly-packed. -
vertexBufferStrideis the stride in bytes invertexBufferwith0meaning the values are tightly-packed. -
geometryIndexAndFlagsBufferStrideis the stride in bytes ingeometryIndexAndFlagsBufferwith0meaning the values are tightly-packed. -
opacityMicromapIndexBufferStrideis the stride in bytes inopacityMicromapIndexBufferwith0meaning the values are tightly-packed. -
indexBuffercontains the indices of vertices in the cluster and is of typeindexType. -
vertexBufferspecifies the vertex data of the triangles in the cluster with format specified in VkClusterAccelerationStructureTriangleClusterInputNV::vertexFormat. -
geometryIndexAndFlagsBufferis eitherNULLor an address containing strided VkClusterAccelerationStructureGeometryIndexAndGeometryFlagsNV values specifying the geometry index and flag for every triangle in the cluster. -
opacityMicromapArrayis eitherNULLor specifies the address of a valid opacity micromap array to reference from the cluster acceleration structure. If it isNULL, then opacity micromaps will be disabled for this cluster acceleration structure. -
opacityMicromapIndexBufferis eitherNULLor specifies the address of a strided array with size equal to the number of triangles or indices into the opacity micromap array.
Description
The C language specification does not define the ordering of bit-fields, but in practice, this structure produces the correct layout with existing compilers. The intended bit pattern is the following:
-
triangleCount,vertexCount,positionTruncateBitCount,indexTypeandopacityMicromapIndexTypeoccupy the same memory as if a singleuint32_twas specified in their place-
triangleCountoccupies the 9 least significant bits of that memory -
vertexCountoccupies the next 9 least significant bits of that memory -
positionTruncateBitCountoccupies the next 6 least significant bits of that memory -
indexTypeoccupies the next 4 least significant bits of that memory -
opacityMicromapIndexTypeoccupies the 4 most significant bits of that memory
-
If a compiler produces code that diverges from that pattern, applications must employ another method to set values according to the correct bit pattern.
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.