1e5c31af7Sopenharmony_ci// Copyright 2020-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[acceleration-structure]] 6e5c31af7Sopenharmony_ci= Acceleration Structures 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ci 9e5c31af7Sopenharmony_ci[[acceleration-structure-def]] 10e5c31af7Sopenharmony_ci== Acceleration Structures 11e5c31af7Sopenharmony_ci 12e5c31af7Sopenharmony_ci_Acceleration structures_ are data structures used by the implementation to 13e5c31af7Sopenharmony_ciefficiently manage scene geometry as it is <<ray-traversal, traversed during 14e5c31af7Sopenharmony_cia ray tracing query>>. 15e5c31af7Sopenharmony_ciThe application is responsible for managing acceleration structure objects 16e5c31af7Sopenharmony_ci(see <<resources-acceleration-structures,Acceleration Structures>>), 17e5c31af7Sopenharmony_ciincluding allocation, destruction, executing builds or updates, and 18e5c31af7Sopenharmony_cisynchronizing resources used during ray tracing queries. 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_ciThere are two types of acceleration structures, _top level acceleration 21e5c31af7Sopenharmony_cistructures_ and _bottom level acceleration structures_. 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_ciAn acceleration structure is considered to be constructed if an 24e5c31af7Sopenharmony_ci<<acceleration-structure-building,acceleration structure build command>> or 25e5c31af7Sopenharmony_ci<<acceleration-structure-copying,copy command>> has been executed with the 26e5c31af7Sopenharmony_cigiven acceleration structure as the destination. 27e5c31af7Sopenharmony_ci 28e5c31af7Sopenharmony_ci[[fig-accelstruct]] 29e5c31af7Sopenharmony_ciimage::{images}/accelstruct.svg[align="center",title="Acceleration Structure",opts="{imageopts}"] 30e5c31af7Sopenharmony_ci 31e5c31af7Sopenharmony_ci.Caption 32e5c31af7Sopenharmony_ci**** 33e5c31af7Sopenharmony_ciThe diagram shows the relationship between top and bottom level acceleration 34e5c31af7Sopenharmony_cistructures. 35e5c31af7Sopenharmony_ci**** 36e5c31af7Sopenharmony_ci 37e5c31af7Sopenharmony_ci 38e5c31af7Sopenharmony_ci[[acceleration-structure-geometry]] 39e5c31af7Sopenharmony_ci=== Geometry 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_ci_Geometries_ refer to a triangle or axis-aligned bounding box. 42e5c31af7Sopenharmony_ci 43e5c31af7Sopenharmony_ci 44e5c31af7Sopenharmony_ci[[acceleration-structure-top-level]] 45e5c31af7Sopenharmony_ci=== Top Level Acceleration Structures 46e5c31af7Sopenharmony_ci 47e5c31af7Sopenharmony_ciOpaque acceleration structure for an array of instances. 48e5c31af7Sopenharmony_ciThe descriptor or device address referencing this is the starting point for 49e5c31af7Sopenharmony_citraversal. 50e5c31af7Sopenharmony_ci 51e5c31af7Sopenharmony_ciThe top level acceleration structure takes a reference to any bottom level 52e5c31af7Sopenharmony_ciacceleration structure referenced by its instances. 53e5c31af7Sopenharmony_ciThose bottom level acceleration structure objects must: be valid when the 54e5c31af7Sopenharmony_citop level acceleration structure is accessed. 55e5c31af7Sopenharmony_ci 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_ci[[acceleration-structure-bottom-level]] 58e5c31af7Sopenharmony_ci=== Bottom Level Acceleration Structures 59e5c31af7Sopenharmony_ci 60e5c31af7Sopenharmony_ciOpaque acceleration structure for an array of geometries. 61e5c31af7Sopenharmony_ci 62e5c31af7Sopenharmony_ci 63e5c31af7Sopenharmony_ci[[acceleration-structure-update]] 64e5c31af7Sopenharmony_ci=== Acceleration Structure Update Rules 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ciThe API defines two types of operations to produce acceleration structures 67e5c31af7Sopenharmony_cifrom geometry: 68e5c31af7Sopenharmony_ci 69e5c31af7Sopenharmony_ci * A _build_ operation is used to construct an acceleration structure. 70e5c31af7Sopenharmony_ci * An _update_ operation is used to modify an existing acceleration 71e5c31af7Sopenharmony_ci structure. 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ciAn update operation imposes certain constraints on the input, in exchange 74e5c31af7Sopenharmony_cifor considerably faster execution. 75e5c31af7Sopenharmony_ciWhen performing an update, the application is required to provide a full 76e5c31af7Sopenharmony_cidescription of the acceleration structure, but is prohibited from changing 77e5c31af7Sopenharmony_cianything other than instance definitions, transform matrices, and vertex or 78e5c31af7Sopenharmony_ciAABB positions. 79e5c31af7Sopenharmony_ciAll other aspects of the description must: exactly match the one from the 80e5c31af7Sopenharmony_cioriginal build. 81e5c31af7Sopenharmony_ci 82e5c31af7Sopenharmony_ciMore precisely, the application must: not use an update operation to do any 83e5c31af7Sopenharmony_ciof the following: 84e5c31af7Sopenharmony_ci 85e5c31af7Sopenharmony_ci * Change primitives or instances from _active_ to _inactive_, or vice 86e5c31af7Sopenharmony_ci versa (as defined in <<acceleration-structure-inactive-prims>>). 87e5c31af7Sopenharmony_ci * Change the index or vertex formats of triangle geometry. 88e5c31af7Sopenharmony_ci * Change triangle geometry transform pointers from null to non-null or 89e5c31af7Sopenharmony_ci vice versa. 90e5c31af7Sopenharmony_ci * Change the number of geometries or instances in the structure. 91e5c31af7Sopenharmony_ci * Change the geometry flags for any geometry in the structure. 92e5c31af7Sopenharmony_ci * Change the number of vertices or primitives for any geometry in the 93e5c31af7Sopenharmony_ci structure. 94e5c31af7Sopenharmony_ci 95e5c31af7Sopenharmony_ciifdef::VK_EXT_opacity_micromap[] 96e5c31af7Sopenharmony_ci 97e5c31af7Sopenharmony_ciIf the original acceleration structure was built using opacity micromaps and 98e5c31af7Sopenharmony_ciename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT 99e5c31af7Sopenharmony_ciwas set in pname:flags, the application must: provide the corresponding 100e5c31af7Sopenharmony_cimicromap information to the update operation. 101e5c31af7Sopenharmony_ciThe application is prohibited from changing anything other than the specific 102e5c31af7Sopenharmony_ciopacity values assigned to the triangles. 103e5c31af7Sopenharmony_ci 104e5c31af7Sopenharmony_ciMore precisely, the application must: not use an update operation to do any 105e5c31af7Sopenharmony_ciof the following: 106e5c31af7Sopenharmony_ci 107e5c31af7Sopenharmony_ci * Remove micromaps or elink:VkOpacityMicromapSpecialIndexEXT values from a 108e5c31af7Sopenharmony_ci geometry which previously had them, or vice versa. 109e5c31af7Sopenharmony_ci * Change between use of elink:VkOpacityMicromapSpecialIndexEXT values and 110e5c31af7Sopenharmony_ci explicit micro-map triangles. 111e5c31af7Sopenharmony_ci * Change the subdivision level or format of the micromap triangle 112e5c31af7Sopenharmony_ci associated with any acceleration-structure triangle. 113e5c31af7Sopenharmony_ci 114e5c31af7Sopenharmony_ciIf the original acceleration structure was built using opacity micromaps and 115e5c31af7Sopenharmony_ciename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT was 116e5c31af7Sopenharmony_ciset in pname:flags, the application must: provide a micromap to the update 117e5c31af7Sopenharmony_cioperation. 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_ciIf the original acceleration structure was built using opacity micromaps and 120e5c31af7Sopenharmony_cineither opacity micromap update flag is set the application must: provide 121e5c31af7Sopenharmony_cithe original micromap to the update operation. 122e5c31af7Sopenharmony_ci 123e5c31af7Sopenharmony_ciendif::VK_EXT_opacity_micromap[] 124e5c31af7Sopenharmony_ci 125e5c31af7Sopenharmony_ciifdef::VK_NV_displacement_micromap[] 126e5c31af7Sopenharmony_ciIf the original acceleration structure was built using displacement 127e5c31af7Sopenharmony_cimicromaps and 128e5c31af7Sopenharmony_ciename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISPLACEMENT_MICROMAP_UPDATE_NV 129e5c31af7Sopenharmony_ciwas set in pname:flags, the application must: provide a displacement 130e5c31af7Sopenharmony_cimicromap to the update operation. 131e5c31af7Sopenharmony_ci 132e5c31af7Sopenharmony_ciIf the original acceleration structure was built using displacement 133e5c31af7Sopenharmony_cimicromaps and the displacement micromap update flag is not set the 134e5c31af7Sopenharmony_ciapplication must: provide the original micromap to the update operation. 135e5c31af7Sopenharmony_ciendif::VK_NV_displacement_micromap[] 136e5c31af7Sopenharmony_ci 137e5c31af7Sopenharmony_ci[[acceleration-structure-inactive-prims]] 138e5c31af7Sopenharmony_ci=== Inactive Primitives and Instances 139e5c31af7Sopenharmony_ci 140e5c31af7Sopenharmony_ciAcceleration structures allow the use of particular input values to signal 141e5c31af7Sopenharmony_ci_inactive_ primitives or instances. 142e5c31af7Sopenharmony_ci 143e5c31af7Sopenharmony_ciAn _inactive_ triangle is one for which the first (X) component of any 144e5c31af7Sopenharmony_civertex is NaN. 145e5c31af7Sopenharmony_ciIf any other vertex component is NaN, and the first is not, the behavior is 146e5c31af7Sopenharmony_ciundefined:. 147e5c31af7Sopenharmony_ciIf the vertex format does not have a NaN representation, then all triangles 148e5c31af7Sopenharmony_ciare considered active. 149e5c31af7Sopenharmony_ci 150e5c31af7Sopenharmony_ciAn _inactive_ instance is one whose acceleration structure reference is `0`. 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ciAn _inactive_ AABB is one for which the minimum X coordinate is NaN. 153e5c31af7Sopenharmony_ciIf any other component is NaN, and the first is not, the behavior is 154e5c31af7Sopenharmony_ciundefined:. 155e5c31af7Sopenharmony_ci 156e5c31af7Sopenharmony_ciIn the above definitions, "`NaN`" refers to any type of NaN. 157e5c31af7Sopenharmony_ciSignaling, non-signaling, quiet, loud, or otherwise. 158e5c31af7Sopenharmony_ci 159e5c31af7Sopenharmony_ciAn inactive object is considered invisible to all rays, and should: not be 160e5c31af7Sopenharmony_cirepresented in the acceleration structure. 161e5c31af7Sopenharmony_ciImplementations should: ensure that the presence of inactive objects does 162e5c31af7Sopenharmony_cinot seriously degrade traversal performance. 163e5c31af7Sopenharmony_ci 164e5c31af7Sopenharmony_ciInactive objects are counted in the auto-generated index sequences which are 165e5c31af7Sopenharmony_ciprovided to shaders via code:InstanceId and code:PrimitiveId SPIR-V 166e5c31af7Sopenharmony_cidecorations. 167e5c31af7Sopenharmony_ciThis allows objects in the scene to change freely between the active and 168e5c31af7Sopenharmony_ciinactive states, without affecting the layout of any arrays which are being 169e5c31af7Sopenharmony_ciindexed using the ID values. 170e5c31af7Sopenharmony_ci 171e5c31af7Sopenharmony_ciAny transition between the active and inactive states requires a full 172e5c31af7Sopenharmony_ciacceleration structure rebuild. 173e5c31af7Sopenharmony_ciApplications must: not perform an acceleration structure update where an 174e5c31af7Sopenharmony_ciobject is active in the source acceleration structure but would be inactive 175e5c31af7Sopenharmony_ciin the destination, or vice versa. 176e5c31af7Sopenharmony_ci 177e5c31af7Sopenharmony_ci 178e5c31af7Sopenharmony_ci[[acceleration-structure-building]] 179e5c31af7Sopenharmony_ci=== Building Acceleration Structures 180e5c31af7Sopenharmony_ci 181e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 182e5c31af7Sopenharmony_ci[open,refpage='vkCmdBuildAccelerationStructureNV',desc='Build an acceleration structure',type='protos'] 183e5c31af7Sopenharmony_ci-- 184e5c31af7Sopenharmony_ci:refpage: vkCmdBuildAccelerationStructureNV 185e5c31af7Sopenharmony_ci 186e5c31af7Sopenharmony_ciTo build an acceleration structure call: 187e5c31af7Sopenharmony_ci 188e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBuildAccelerationStructureNV.adoc[] 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 191e5c31af7Sopenharmony_ci recorded. 192e5c31af7Sopenharmony_ci * pname:pInfo contains the shared information for the acceleration 193e5c31af7Sopenharmony_ci structure's structure. 194e5c31af7Sopenharmony_ci * pname:instanceData is the buffer containing an array of 195e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInstanceKHR structures defining 196e5c31af7Sopenharmony_ci acceleration structures. 197e5c31af7Sopenharmony_ci This parameter must: be `NULL` for bottom level acceleration structures. 198e5c31af7Sopenharmony_ci * pname:instanceOffset is the offset in bytes (relative to the start of 199e5c31af7Sopenharmony_ci pname:instanceData) at which the instance data is located. 200e5c31af7Sopenharmony_ci * pname:update specifies whether to update the pname:dst acceleration 201e5c31af7Sopenharmony_ci structure with the data in pname:src. 202e5c31af7Sopenharmony_ci * pname:dst is a pointer to the target acceleration structure for the 203e5c31af7Sopenharmony_ci build. 204e5c31af7Sopenharmony_ci * pname:src is a pointer to an existing acceleration structure that is to 205e5c31af7Sopenharmony_ci be used to update the pname:dst acceleration structure. 206e5c31af7Sopenharmony_ci * pname:scratch is the slink:VkBuffer that will be used as scratch memory 207e5c31af7Sopenharmony_ci for the build. 208e5c31af7Sopenharmony_ci * pname:scratchOffset is the offset in bytes relative to the start of 209e5c31af7Sopenharmony_ci pname:scratch that will be used as a scratch memory. 210e5c31af7Sopenharmony_ci 211e5c31af7Sopenharmony_ciAccesses to pname:dst, pname:src, and pname:scratch must: be 212e5c31af7Sopenharmony_ci<<synchronization-dependencies,synchronized>> with the 213e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 214e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> and an 215e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 216e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR or 217e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR. 218e5c31af7Sopenharmony_ci 219e5c31af7Sopenharmony_ci.Valid Usage 220e5c31af7Sopenharmony_ci**** 221e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-geometryCount-02241]] 222e5c31af7Sopenharmony_ci pname:geometryCount must: be less than or equal to 223e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceRayTracingPropertiesNV::pname:maxGeometryCount 224e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-dst-02488]] 225e5c31af7Sopenharmony_ci pname:dst must: have been created with compatible 226e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV where 227e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV::pname:type and 228e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV::pname:flags are identical, 229e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV::pname:instanceCount and 230e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV::pname:geometryCount for pname:dst 231e5c31af7Sopenharmony_ci are greater than or equal to the build size and each geometry in 232e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV::pname:pGeometries for pname:dst has 233e5c31af7Sopenharmony_ci greater than or equal to the number of vertices, indices, and AABBs 234e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-02489]] 235e5c31af7Sopenharmony_ci If pname:update is ename:VK_TRUE, pname:src must: not be 236e5c31af7Sopenharmony_ci dlink:VK_NULL_HANDLE 237e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-02490]] 238e5c31af7Sopenharmony_ci If pname:update is ename:VK_TRUE, pname:src must: have previously been 239e5c31af7Sopenharmony_ci constructed with 240e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV set in 241e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInfoNV::pname:flags in the original build 242e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-02491]] 243e5c31af7Sopenharmony_ci If pname:update is ename:VK_FALSE, the pname:size member of the 244e5c31af7Sopenharmony_ci slink:VkMemoryRequirements structure returned from a call to 245e5c31af7Sopenharmony_ci flink:vkGetAccelerationStructureMemoryRequirementsNV with 246e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMemoryRequirementsInfoNV::pname:accelerationStructure 247e5c31af7Sopenharmony_ci set to pname:dst and 248e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMemoryRequirementsInfoNV::pname:type set to 249e5c31af7Sopenharmony_ci ename:VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV 250e5c31af7Sopenharmony_ci must: be less than or equal to the size of pname:scratch minus 251e5c31af7Sopenharmony_ci pname:scratchOffset 252e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-02492]] 253e5c31af7Sopenharmony_ci If pname:update is ename:VK_TRUE, the pname:size member of the 254e5c31af7Sopenharmony_ci slink:VkMemoryRequirements structure returned from a call to 255e5c31af7Sopenharmony_ci flink:vkGetAccelerationStructureMemoryRequirementsNV with 256e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMemoryRequirementsInfoNV::pname:accelerationStructure 257e5c31af7Sopenharmony_ci set to pname:dst and 258e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMemoryRequirementsInfoNV::pname:type set to 259e5c31af7Sopenharmony_ci ename:VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV 260e5c31af7Sopenharmony_ci must: be less than or equal to the size of pname:scratch minus 261e5c31af7Sopenharmony_ci pname:scratchOffset 262e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-scratch-03522]] 263e5c31af7Sopenharmony_ci pname:scratch must: have been created with 264e5c31af7Sopenharmony_ci ename:VK_BUFFER_USAGE_RAY_TRACING_BIT_NV usage flag 265e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-instanceData-03523]] 266e5c31af7Sopenharmony_ci If pname:instanceData is not dlink:VK_NULL_HANDLE, pname:instanceData 267e5c31af7Sopenharmony_ci must: have been created with ename:VK_BUFFER_USAGE_RAY_TRACING_BIT_NV 268e5c31af7Sopenharmony_ci usage flag 269e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-accelerationStructureReference-03786]] 270e5c31af7Sopenharmony_ci Each 271e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInstanceKHR::pname:accelerationStructureReference 272e5c31af7Sopenharmony_ci value in pname:instanceData must: be a valid device address containing a 273e5c31af7Sopenharmony_ci value obtained from flink:vkGetAccelerationStructureHandleNV 274e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-03524]] 275e5c31af7Sopenharmony_ci If pname:update is ename:VK_TRUE, then objects that were previously 276e5c31af7Sopenharmony_ci active must: not be made inactive as per 277e5c31af7Sopenharmony_ci <<acceleration-structure-inactive-prims>> 278e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-03525]] 279e5c31af7Sopenharmony_ci If pname:update is ename:VK_TRUE, then objects that were previously 280e5c31af7Sopenharmony_ci inactive must: not be made active as per 281e5c31af7Sopenharmony_ci <<acceleration-structure-inactive-prims>> 282e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-update-03526]] 283e5c31af7Sopenharmony_ci If pname:update is ename:VK_TRUE, the pname:src and pname:dst objects 284e5c31af7Sopenharmony_ci must: either be the same object or not have any 285e5c31af7Sopenharmony_ci <<resources-memory-aliasing, memory aliasing>> 286e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructureNV-dst-07787]] 287e5c31af7Sopenharmony_ci pname:dst must: be bound completely and contiguously to a single 288e5c31af7Sopenharmony_ci sname:VkDeviceMemory object via 289e5c31af7Sopenharmony_ci flink:vkBindAccelerationStructureMemoryNV 290e5c31af7Sopenharmony_ci 291e5c31af7Sopenharmony_ci**** 292e5c31af7Sopenharmony_ci 293e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBuildAccelerationStructureNV.adoc[] 294e5c31af7Sopenharmony_ci-- 295e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 296e5c31af7Sopenharmony_ci 297e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 298e5c31af7Sopenharmony_ci[open,refpage='vkCmdBuildAccelerationStructuresKHR',desc='Build an acceleration structure',type='protos'] 299e5c31af7Sopenharmony_ci-- 300e5c31af7Sopenharmony_ci:refpage: vkCmdBuildAccelerationStructuresKHR 301e5c31af7Sopenharmony_ci 302e5c31af7Sopenharmony_ciTo build acceleration structures call: 303e5c31af7Sopenharmony_ci 304e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBuildAccelerationStructuresKHR.adoc[] 305e5c31af7Sopenharmony_ci 306e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 307e5c31af7Sopenharmony_ci recorded. 308e5c31af7Sopenharmony_ci * pname:infoCount is the number of acceleration structures to build. 309e5c31af7Sopenharmony_ci It specifies the number of the pname:pInfos structures and 310e5c31af7Sopenharmony_ci pname:ppBuildRangeInfos pointers that must: be provided. 311e5c31af7Sopenharmony_ci * pname:pInfos is a pointer to an array of pname:infoCount 312e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildGeometryInfoKHR structures defining 313e5c31af7Sopenharmony_ci the geometry used to build each acceleration structure. 314e5c31af7Sopenharmony_ci * pname:ppBuildRangeInfos is a pointer to an array of pname:infoCount 315e5c31af7Sopenharmony_ci pointers to arrays of slink:VkAccelerationStructureBuildRangeInfoKHR 316e5c31af7Sopenharmony_ci structures. 317e5c31af7Sopenharmony_ci Each pname:ppBuildRangeInfos[i] is a pointer to an array of 318e5c31af7Sopenharmony_ci pname:pInfos[i].pname:geometryCount 319e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildRangeInfoKHR structures defining 320e5c31af7Sopenharmony_ci dynamic offsets to the addresses where geometry data is stored, as 321e5c31af7Sopenharmony_ci defined by pname:pInfos[i]. 322e5c31af7Sopenharmony_ci 323e5c31af7Sopenharmony_ciThe fname:vkCmdBuildAccelerationStructuresKHR command provides the ability 324e5c31af7Sopenharmony_cito initiate multiple acceleration structures builds, however there is no 325e5c31af7Sopenharmony_ciordering or synchronization implied between any of the individual 326e5c31af7Sopenharmony_ciacceleration structure builds. 327e5c31af7Sopenharmony_ci 328e5c31af7Sopenharmony_ci[NOTE] 329e5c31af7Sopenharmony_ci.Note 330e5c31af7Sopenharmony_ci==== 331e5c31af7Sopenharmony_ciThis means that an application cannot: build a top-level acceleration 332e5c31af7Sopenharmony_cistructure in the same flink:vkCmdBuildAccelerationStructuresKHR call as the 333e5c31af7Sopenharmony_ciassociated bottom-level or instance acceleration structures are being built. 334e5c31af7Sopenharmony_ciThere also cannot: be any memory aliasing between any acceleration structure 335e5c31af7Sopenharmony_cimemories or scratch memories being used by any of the builds. 336e5c31af7Sopenharmony_ci==== 337e5c31af7Sopenharmony_ci 338e5c31af7Sopenharmony_ci[[acceleration-structure-scratch]] 339e5c31af7Sopenharmony_ciAccesses to the acceleration structure scratch buffers as identified by the 340e5c31af7Sopenharmony_cislink:VkAccelerationStructureBuildGeometryInfoKHR::pname:scratchData buffer 341e5c31af7Sopenharmony_cidevice addresses must: be <<synchronization-dependencies,synchronized>> with 342e5c31af7Sopenharmony_cithe ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 343e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> and an 344e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 345e5c31af7Sopenharmony_ci(ename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR | 346e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR). 347e5c31af7Sopenharmony_ciAccesses to each 348e5c31af7Sopenharmony_cislink:VkAccelerationStructureBuildGeometryInfoKHR::pname:srcAccelerationStructure 349e5c31af7Sopenharmony_ciand 350e5c31af7Sopenharmony_cislink:VkAccelerationStructureBuildGeometryInfoKHR::pname:dstAccelerationStructure 351e5c31af7Sopenharmony_cimust: be <<synchronization-dependencies,synchronized>> with the 352e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 353e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> and an 354e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 355e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR or 356e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR, as appropriate. 357e5c31af7Sopenharmony_ci 358e5c31af7Sopenharmony_ciAccesses to other input buffers as identified by any used values of 359e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 360e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryMotionTrianglesDataNV::pname:vertexData, 361e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 362e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:vertexData, 363e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:indexData, 364e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:transformData, 365e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryAabbsDataKHR::pname:data, and 366e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryInstancesDataKHR::pname:data must: be 367e5c31af7Sopenharmony_ci<<synchronization-dependencies,synchronized>> with the 368e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 369e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> and an 370e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 371e5c31af7Sopenharmony_ciename:VK_ACCESS_SHADER_READ_BIT. 372e5c31af7Sopenharmony_ci 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_ci.Valid Usage 375e5c31af7Sopenharmony_ci**** 376e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresKHR-accelerationStructure-08923]] 377e5c31af7Sopenharmony_ci The <<features-accelerationStructure, 378e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructure>> 379e5c31af7Sopenharmony_ci feature must: be enabled 380e5c31af7Sopenharmony_ci 381e5c31af7Sopenharmony_ci:maxinstancecheck: pname:ppBuildRangeInfos[i][j].pname:primitiveCount 382e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_common.adoc[] 383e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_device_common.adoc[] 384e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_nonindirect_common.adoc[] 385e5c31af7Sopenharmony_ci**** 386e5c31af7Sopenharmony_ci 387e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBuildAccelerationStructuresKHR.adoc[] 388e5c31af7Sopenharmony_ci-- 389e5c31af7Sopenharmony_ci 390e5c31af7Sopenharmony_ci[open,refpage='vkCmdBuildAccelerationStructuresIndirectKHR',desc='Build an acceleration structure with some parameters provided on the device',type='protos'] 391e5c31af7Sopenharmony_ci-- 392e5c31af7Sopenharmony_ci:refpage: vkCmdBuildAccelerationStructuresIndirectKHR 393e5c31af7Sopenharmony_ci 394e5c31af7Sopenharmony_ciTo build acceleration structures with some parameters sourced on the device 395e5c31af7Sopenharmony_cicall: 396e5c31af7Sopenharmony_ci 397e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBuildAccelerationStructuresIndirectKHR.adoc[] 398e5c31af7Sopenharmony_ci 399e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 400e5c31af7Sopenharmony_ci recorded. 401e5c31af7Sopenharmony_ci * pname:infoCount is the number of acceleration structures to build. 402e5c31af7Sopenharmony_ci * pname:pInfos is a pointer to an array of pname:infoCount 403e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildGeometryInfoKHR structures defining 404e5c31af7Sopenharmony_ci the geometry used to build each acceleration structure. 405e5c31af7Sopenharmony_ci * pname:pIndirectDeviceAddresses is a pointer to an array of 406e5c31af7Sopenharmony_ci pname:infoCount buffer device addresses which point to 407e5c31af7Sopenharmony_ci pname:pInfos[i].pname:geometryCount 408e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildRangeInfoKHR structures defining 409e5c31af7Sopenharmony_ci dynamic offsets to the addresses where geometry data is stored, as 410e5c31af7Sopenharmony_ci defined by pname:pInfos[i]. 411e5c31af7Sopenharmony_ci * pname:pIndirectStrides is a pointer to an array of pname:infoCount byte 412e5c31af7Sopenharmony_ci strides between elements of pname:pIndirectDeviceAddresses. 413e5c31af7Sopenharmony_ci * pname:ppMaxPrimitiveCounts is a pointer to an array of pname:infoCount 414e5c31af7Sopenharmony_ci pointers to arrays of pname:pInfos[i].pname:geometryCount values 415e5c31af7Sopenharmony_ci indicating the maximum number of primitives that will be built by this 416e5c31af7Sopenharmony_ci command for each geometry. 417e5c31af7Sopenharmony_ci 418e5c31af7Sopenharmony_ciAccesses to acceleration structures, scratch buffers, vertex buffers, index 419e5c31af7Sopenharmony_cibuffers, and instance buffers must be synchronized as with 420e5c31af7Sopenharmony_ci<<acceleration-structure-scratch,vkCmdBuildAccelerationStructuresKHR>>. 421e5c31af7Sopenharmony_ci 422e5c31af7Sopenharmony_ciAccesses to any element of pname:pIndirectDeviceAddresses must: be 423e5c31af7Sopenharmony_ci<<synchronization-dependencies,synchronized>> with the 424e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 425e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> and an 426e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 427e5c31af7Sopenharmony_ciename:VK_ACCESS_INDIRECT_COMMAND_READ_BIT. 428e5c31af7Sopenharmony_ci 429e5c31af7Sopenharmony_ci 430e5c31af7Sopenharmony_ci.Valid Usage 431e5c31af7Sopenharmony_ci**** 432e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-accelerationStructureIndirectBuild-03650]] 433e5c31af7Sopenharmony_ci The <<features-accelerationStructureIndirectBuild, 434e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructureIndirectBuild>> 435e5c31af7Sopenharmony_ci feature must: be enabled 436e5c31af7Sopenharmony_ci 437e5c31af7Sopenharmony_ci:maxinstancecheck: pname:ppMaxPrimitiveCounts[i][j] 438e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_common.adoc[] 439e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_device_common.adoc[] 440e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pIndirectDeviceAddresses-03645]] 441e5c31af7Sopenharmony_ci For any element of pname:pIndirectDeviceAddresses, if the buffer from 442e5c31af7Sopenharmony_ci which it was queried is non-sparse then it must: be bound completely and 443e5c31af7Sopenharmony_ci contiguously to a single slink:VkDeviceMemory object 444e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pIndirectDeviceAddresses-03646]] 445e5c31af7Sopenharmony_ci For any element of pname:pIndirectDeviceAddresses[i], all device 446e5c31af7Sopenharmony_ci addresses between pname:pIndirectDeviceAddresses[i] and 447e5c31af7Sopenharmony_ci [eq]#pname:pIndirectDeviceAddresses[i] {plus} 448e5c31af7Sopenharmony_ci (pname:pInfos[i].pname:geometryCount {times} pname:pIndirectStrides[i]) - 449e5c31af7Sopenharmony_ci 1# must: be in the buffer device address range of the same buffer 450e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pIndirectDeviceAddresses-03647]] 451e5c31af7Sopenharmony_ci For any element of pname:pIndirectDeviceAddresses, the buffer from which 452e5c31af7Sopenharmony_ci it was queried must: have been created with the 453e5c31af7Sopenharmony_ci ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set 454e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pIndirectDeviceAddresses-03648]] 455e5c31af7Sopenharmony_ci Each element of pname:pIndirectDeviceAddresses must: be a multiple of 456e5c31af7Sopenharmony_ci `4` 457e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pIndirectStrides-03787]] 458e5c31af7Sopenharmony_ci Each element of pname:pIndirectStrides must: be a multiple of `4` 459e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-commandBuffer-03649]] 460e5c31af7Sopenharmony_ci pname:commandBuffer must: not be a protected command buffer 461e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pIndirectDeviceAddresses-03651]] 462e5c31af7Sopenharmony_ci Each slink:VkAccelerationStructureBuildRangeInfoKHR structure referenced 463e5c31af7Sopenharmony_ci by any element of pname:pIndirectDeviceAddresses must: be a valid 464e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildRangeInfoKHR structure 465e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03652]] 466e5c31af7Sopenharmony_ci pname:pInfos[i].pname:dstAccelerationStructure must: have been created 467e5c31af7Sopenharmony_ci with a value of slink:VkAccelerationStructureCreateInfoKHR::pname:size 468e5c31af7Sopenharmony_ci greater than or equal to the memory size required by the build 469e5c31af7Sopenharmony_ci operation, as returned by flink:vkGetAccelerationStructureBuildSizesKHR 470e5c31af7Sopenharmony_ci with [eq]#pname:pBuildInfo = pname:pInfos[i]# and 471e5c31af7Sopenharmony_ci [eq]#pname:pMaxPrimitiveCounts = pname:ppMaxPrimitiveCounts[i]# 472e5c31af7Sopenharmony_ci * [[VUID-vkCmdBuildAccelerationStructuresIndirectKHR-ppMaxPrimitiveCounts-03653]] 473e5c31af7Sopenharmony_ci Each pname:ppMaxPrimitiveCounts[i][j] must: be greater than or equal to 474e5c31af7Sopenharmony_ci the pname:primitiveCount value specified by the 475e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildRangeInfoKHR structure located at 476e5c31af7Sopenharmony_ci [eq]#pname:pIndirectDeviceAddresses[i] {plus} (code:j {times} 477e5c31af7Sopenharmony_ci pname:pIndirectStrides[i])# 478e5c31af7Sopenharmony_ci**** 479e5c31af7Sopenharmony_ci 480e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBuildAccelerationStructuresIndirectKHR.adoc[] 481e5c31af7Sopenharmony_ci-- 482e5c31af7Sopenharmony_ci 483e5c31af7Sopenharmony_ci 484e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureBuildGeometryInfoKHR',desc='Structure specifying the geometry data used to build an acceleration structure',type='structs'] 485e5c31af7Sopenharmony_ci-- 486e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureBuildGeometryInfoKHR 487e5c31af7Sopenharmony_ci 488e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureBuildGeometryInfoKHR structure is defined 489e5c31af7Sopenharmony_cias: 490e5c31af7Sopenharmony_ci 491e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureBuildGeometryInfoKHR.adoc[] 492e5c31af7Sopenharmony_ci 493e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 494e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 495e5c31af7Sopenharmony_ci structure. 496e5c31af7Sopenharmony_ci * pname:type is a elink:VkAccelerationStructureTypeKHR value specifying 497e5c31af7Sopenharmony_ci the type of acceleration structure being built. 498e5c31af7Sopenharmony_ci * pname:flags is a bitmask of 499e5c31af7Sopenharmony_ci elink:VkBuildAccelerationStructureFlagBitsKHR specifying additional 500e5c31af7Sopenharmony_ci parameters of the acceleration structure. 501e5c31af7Sopenharmony_ci * pname:mode is a elink:VkBuildAccelerationStructureModeKHR value 502e5c31af7Sopenharmony_ci specifying the type of operation to perform. 503e5c31af7Sopenharmony_ci * pname:srcAccelerationStructure is a pointer to an existing acceleration 504e5c31af7Sopenharmony_ci structure that is to be used to update the pname:dst acceleration 505e5c31af7Sopenharmony_ci structure when pname:mode is 506e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR. 507e5c31af7Sopenharmony_ci * pname:dstAccelerationStructure is a pointer to the target acceleration 508e5c31af7Sopenharmony_ci structure for the build. 509e5c31af7Sopenharmony_ci * pname:geometryCount specifies the number of geometries that will be 510e5c31af7Sopenharmony_ci built into pname:dstAccelerationStructure. 511e5c31af7Sopenharmony_ci * pname:pGeometries is a pointer to an array of 512e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryKHR structures. 513e5c31af7Sopenharmony_ci * pname:ppGeometries is a pointer to an array of pointers to 514e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryKHR structures. 515e5c31af7Sopenharmony_ci * pname:scratchData is the device or host address to memory that will be 516e5c31af7Sopenharmony_ci used as scratch memory for the build. 517e5c31af7Sopenharmony_ci 518e5c31af7Sopenharmony_ciOnly one of pname:pGeometries or pname:ppGeometries can: be a valid pointer, 519e5c31af7Sopenharmony_cithe other must: be `NULL`. 520e5c31af7Sopenharmony_ciEach element of the non-`NULL` array describes the data used to build each 521e5c31af7Sopenharmony_ciacceleration structure geometry. 522e5c31af7Sopenharmony_ci 523e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline,VK_KHR_ray_query[] 524e5c31af7Sopenharmony_ci[[acceleration-structure-geometry-index]] 525e5c31af7Sopenharmony_ciThe index of each element of the pname:pGeometries or pname:ppGeometries 526e5c31af7Sopenharmony_cimembers of slink:VkAccelerationStructureBuildGeometryInfoKHR is used as the 527e5c31af7Sopenharmony_ci_geometry index_ during ray traversal. 528e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 529e5c31af7Sopenharmony_ciThe geometry index is available in ray shaders via the 530e5c31af7Sopenharmony_ci<<interfaces-builtin-variables-raygeometryindex,code:RayGeometryIndexKHR 531e5c31af7Sopenharmony_cibuilt-in>>, and is <<shader-binding-table-hit-shader-indexing, used to 532e5c31af7Sopenharmony_cidetermine hit and intersection shaders executed during traversal>>. 533e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 534e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_query[] 535e5c31af7Sopenharmony_ciThe geometry index is available to ray queries via the 536e5c31af7Sopenharmony_cicode:OpRayQueryGetIntersectionGeometryIndexKHR instruction. 537e5c31af7Sopenharmony_ciendif::VK_KHR_ray_query[] 538e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline,VK_KHR_ray_query[] 539e5c31af7Sopenharmony_ci 540e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 541e5c31af7Sopenharmony_ci[[acceleration-structure-motion-instances]] 542e5c31af7Sopenharmony_ciSetting ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in pname:flags 543e5c31af7Sopenharmony_ciindicates that this build is a motion top level acceleration structure. 544e5c31af7Sopenharmony_ciA motion top level uses instances of format 545e5c31af7Sopenharmony_cislink:VkAccelerationStructureMotionInstanceNV if 546e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryInstancesDataKHR::pname:arrayOfPointers 547e5c31af7Sopenharmony_ciis ename:VK_FALSE. 548e5c31af7Sopenharmony_ci 549e5c31af7Sopenharmony_ciIf 550e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryInstancesDataKHR::pname:arrayOfPointers 551e5c31af7Sopenharmony_ciis ename:VK_TRUE, the pointer for each element of the array of instance 552e5c31af7Sopenharmony_cipointers consists of 4 bits of 553e5c31af7Sopenharmony_ciename:VkAccelerationStructureMotionInstanceTypeNV in the low 4 bits of the 554e5c31af7Sopenharmony_cipointer identifying the type of structure at the pointer. 555e5c31af7Sopenharmony_ciThe device address accessed is the value in the array with the low 4 bits 556e5c31af7Sopenharmony_ciset to zero. 557e5c31af7Sopenharmony_ciThe structure at the pointer is one of 558e5c31af7Sopenharmony_cislink:VkAccelerationStructureInstanceKHR, 559e5c31af7Sopenharmony_cislink:VkAccelerationStructureMatrixMotionInstanceNV or 560e5c31af7Sopenharmony_cislink:VkAccelerationStructureSRTMotionInstanceNV, depending on the type 561e5c31af7Sopenharmony_civalue encoded in the low 4 bits. 562e5c31af7Sopenharmony_ci 563e5c31af7Sopenharmony_ciA top level acceleration structure with either motion instances or vertex 564e5c31af7Sopenharmony_cimotion in its instances must: set 565e5c31af7Sopenharmony_ciename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in pname:flags. 566e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 567e5c31af7Sopenharmony_ci 568e5c31af7Sopenharmony_ciMembers pname:srcAccelerationStructure and pname:dstAccelerationStructure 569e5c31af7Sopenharmony_cimay: be the same or different for an update operation (when pname:mode is 570e5c31af7Sopenharmony_ciename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR). 571e5c31af7Sopenharmony_ciIf they are the same, the update happens in-place. 572e5c31af7Sopenharmony_ciOtherwise, the target acceleration structure is updated and the source is 573e5c31af7Sopenharmony_cinot modified. 574e5c31af7Sopenharmony_ci 575e5c31af7Sopenharmony_ci.Valid Usage 576e5c31af7Sopenharmony_ci**** 577e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03654]] 578e5c31af7Sopenharmony_ci pname:type must: not be ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR 579e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-pGeometries-03788]] 580e5c31af7Sopenharmony_ci Only one of pname:pGeometries or pname:ppGeometries can: be a valid 581e5c31af7Sopenharmony_ci pointer, the other must: be `NULL` 582e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03789]] 583e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, the 584e5c31af7Sopenharmony_ci pname:geometryType member of elements of either pname:pGeometries or 585e5c31af7Sopenharmony_ci pname:ppGeometries must: be ename:VK_GEOMETRY_TYPE_INSTANCES_KHR 586e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03790]] 587e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, 588e5c31af7Sopenharmony_ci pname:geometryCount must: be `1` 589e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03791]] 590e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR 591e5c31af7Sopenharmony_ci the pname:geometryType member of elements of either pname:pGeometries or 592e5c31af7Sopenharmony_ci pname:ppGeometries must: not be ename:VK_GEOMETRY_TYPE_INSTANCES_KHR 593e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03792]] 594e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR 595e5c31af7Sopenharmony_ci then the pname:geometryType member of each geometry in either 596e5c31af7Sopenharmony_ci pname:pGeometries or pname:ppGeometries must: be the same 597e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03793]] 598e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR 599e5c31af7Sopenharmony_ci then pname:geometryCount must: be less than or equal to 600e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceAccelerationStructurePropertiesKHR::pname:maxGeometryCount 601e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03794]] 602e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR 603e5c31af7Sopenharmony_ci and the pname:geometryType member of either pname:pGeometries or 604e5c31af7Sopenharmony_ci pname:ppGeometries is ename:VK_GEOMETRY_TYPE_AABBS_KHR, the total number 605e5c31af7Sopenharmony_ci of AABBs in all geometries must: be less than or equal to 606e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceAccelerationStructurePropertiesKHR::pname:maxPrimitiveCount 607e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03795]] 608e5c31af7Sopenharmony_ci If pname:type is ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR 609e5c31af7Sopenharmony_ci and the pname:geometryType member of either pname:pGeometries or 610e5c31af7Sopenharmony_ci pname:ppGeometries is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, the total 611e5c31af7Sopenharmony_ci number of triangles in all geometries must: be less than or equal to 612e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceAccelerationStructurePropertiesKHR::pname:maxPrimitiveCount 613e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-flags-03796]] 614e5c31af7Sopenharmony_ci If pname:flags has the 615e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR bit set, 616e5c31af7Sopenharmony_ci then it must: not have the 617e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR bit set 618e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 619e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-dstAccelerationStructure-04927]] 620e5c31af7Sopenharmony_ci If pname:dstAccelerationStructure was created with 621e5c31af7Sopenharmony_ci ename:VK_ACCELERATION_STRUCTURE_CREATE_MOTION_BIT_NV set in 622e5c31af7Sopenharmony_ci slink:VkAccelerationStructureCreateInfoKHR::pname:flags, 623e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV must: be set in 624e5c31af7Sopenharmony_ci pname:flags 625e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-flags-04928]] 626e5c31af7Sopenharmony_ci If ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV is set in 627e5c31af7Sopenharmony_ci pname:flags, pname:dstAccelerationStructure must: have been created with 628e5c31af7Sopenharmony_ci ename:VK_ACCELERATION_STRUCTURE_CREATE_MOTION_BIT_NV set in 629e5c31af7Sopenharmony_ci slink:VkAccelerationStructureCreateInfoKHR::pname:flags 630e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-flags-04929]] 631e5c31af7Sopenharmony_ci If ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV is set in 632e5c31af7Sopenharmony_ci pname:flags, pname:type must: not be 633e5c31af7Sopenharmony_ci ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR 634e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 635e5c31af7Sopenharmony_ciifdef::VK_EXT_opacity_micromap[] 636e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildGeometryInfoKHR-flags-07334]] 637e5c31af7Sopenharmony_ci If pname:flags has the 638e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT 639e5c31af7Sopenharmony_ci bit set then it must: not have the 640e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT 641e5c31af7Sopenharmony_ci bit set 642e5c31af7Sopenharmony_ciendif::VK_EXT_opacity_micromap[] 643e5c31af7Sopenharmony_ci**** 644e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureBuildGeometryInfoKHR.adoc[] 645e5c31af7Sopenharmony_ci-- 646e5c31af7Sopenharmony_ci 647e5c31af7Sopenharmony_ci[open,refpage='VkBuildAccelerationStructureModeKHR',desc='Enum specifying the type of build operation to perform',type='enums'] 648e5c31af7Sopenharmony_ci-- 649e5c31af7Sopenharmony_ci:refpage: VkBuildAccelerationStructureModeKHR 650e5c31af7Sopenharmony_ci 651e5c31af7Sopenharmony_ciThe ename:VkBuildAccelerationStructureModeKHR enumeration is defined as: 652e5c31af7Sopenharmony_ci 653e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkBuildAccelerationStructureModeKHR.adoc[] 654e5c31af7Sopenharmony_ci 655e5c31af7Sopenharmony_ci * ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR specifies that the 656e5c31af7Sopenharmony_ci destination acceleration structure will be built using the specified 657e5c31af7Sopenharmony_ci geometries. 658e5c31af7Sopenharmony_ci * ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR specifies that the 659e5c31af7Sopenharmony_ci destination acceleration structure will be built using data in a source 660e5c31af7Sopenharmony_ci acceleration structure, updated by the specified geometries. 661e5c31af7Sopenharmony_ci-- 662e5c31af7Sopenharmony_ci 663e5c31af7Sopenharmony_ci[open,refpage='VkDeviceOrHostAddressKHR',desc='Union specifying a device or host address',type='structs'] 664e5c31af7Sopenharmony_ci-- 665e5c31af7Sopenharmony_ci:refpage: VkDeviceOrHostAddressKHR 666e5c31af7Sopenharmony_ci 667e5c31af7Sopenharmony_ciThe sname:VkDeviceOrHostAddressKHR union is defined as: 668e5c31af7Sopenharmony_ci 669e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDeviceOrHostAddressKHR.adoc[] 670e5c31af7Sopenharmony_ci 671e5c31af7Sopenharmony_ci * pname:deviceAddress is a buffer device address as returned by the 672e5c31af7Sopenharmony_ci flink:vkGetBufferDeviceAddressKHR command. 673e5c31af7Sopenharmony_ci * pname:hostAddress is a host memory address. 674e5c31af7Sopenharmony_ci 675e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDeviceOrHostAddressKHR.adoc[] 676e5c31af7Sopenharmony_ci-- 677e5c31af7Sopenharmony_ci 678e5c31af7Sopenharmony_ci[open,refpage='VkDeviceOrHostAddressConstKHR',desc='Union specifying a const device or host address',type='structs'] 679e5c31af7Sopenharmony_ci-- 680e5c31af7Sopenharmony_ci:refpage: VkDeviceOrHostAddressConstKHR 681e5c31af7Sopenharmony_ci 682e5c31af7Sopenharmony_ciThe sname:VkDeviceOrHostAddressConstKHR union is defined as: 683e5c31af7Sopenharmony_ci 684e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDeviceOrHostAddressConstKHR.adoc[] 685e5c31af7Sopenharmony_ci 686e5c31af7Sopenharmony_ci * pname:deviceAddress is a buffer device address as returned by the 687e5c31af7Sopenharmony_ci flink:vkGetBufferDeviceAddressKHR command. 688e5c31af7Sopenharmony_ci * pname:hostAddress is a const host memory address. 689e5c31af7Sopenharmony_ci 690e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDeviceOrHostAddressConstKHR.adoc[] 691e5c31af7Sopenharmony_ci-- 692e5c31af7Sopenharmony_ci 693e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureGeometryKHR',desc='Structure specifying geometries to be built into an acceleration structure',type='structs'] 694e5c31af7Sopenharmony_ci-- 695e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureGeometryKHR 696e5c31af7Sopenharmony_ci 697e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureGeometryKHR structure is defined as: 698e5c31af7Sopenharmony_ci 699e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureGeometryKHR.adoc[] 700e5c31af7Sopenharmony_ci 701e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 702e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 703e5c31af7Sopenharmony_ci structure. 704e5c31af7Sopenharmony_ci * pname:geometryType describes which type of geometry this 705e5c31af7Sopenharmony_ci sname:VkAccelerationStructureGeometryKHR refers to. 706e5c31af7Sopenharmony_ci * pname:geometry is a slink:VkAccelerationStructureGeometryDataKHR union 707e5c31af7Sopenharmony_ci describing the geometry data for the relevant geometry type. 708e5c31af7Sopenharmony_ci * pname:flags is a bitmask of elink:VkGeometryFlagBitsKHR values 709e5c31af7Sopenharmony_ci describing additional properties of how the geometry should be built. 710e5c31af7Sopenharmony_ci 711e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureGeometryKHR.adoc[] 712e5c31af7Sopenharmony_ci-- 713e5c31af7Sopenharmony_ci 714e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureGeometryDataKHR',desc='Union specifying acceleration structure geometry data',type='structs'] 715e5c31af7Sopenharmony_ci-- 716e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureGeometryDataKHR 717e5c31af7Sopenharmony_ci 718e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureGeometryDataKHR union is defined as: 719e5c31af7Sopenharmony_ci 720e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureGeometryDataKHR.adoc[] 721e5c31af7Sopenharmony_ci 722e5c31af7Sopenharmony_ci * pname:triangles is a 723e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR structure. 724e5c31af7Sopenharmony_ci * pname:aabbs is a slink:VkAccelerationStructureGeometryAabbsDataKHR 725e5c31af7Sopenharmony_ci structure. 726e5c31af7Sopenharmony_ci * pname:instances is a 727e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryInstancesDataKHR structure. 728e5c31af7Sopenharmony_ci 729e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureGeometryDataKHR.adoc[] 730e5c31af7Sopenharmony_ci-- 731e5c31af7Sopenharmony_ci 732e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureGeometryTrianglesDataKHR',desc='Structure specifying a triangle geometry in a bottom-level acceleration structure',type='structs'] 733e5c31af7Sopenharmony_ci-- 734e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureGeometryTrianglesDataKHR 735e5c31af7Sopenharmony_ci 736e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureGeometryTrianglesDataKHR structure is 737e5c31af7Sopenharmony_cidefined as: 738e5c31af7Sopenharmony_ci 739e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureGeometryTrianglesDataKHR.adoc[] 740e5c31af7Sopenharmony_ci 741e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 742e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 743e5c31af7Sopenharmony_ci structure. 744e5c31af7Sopenharmony_ci * pname:vertexFormat is the elink:VkFormat of each vertex element. 745e5c31af7Sopenharmony_ci * pname:vertexData is a device or host address to memory containing vertex 746e5c31af7Sopenharmony_ci data for this geometry. 747e5c31af7Sopenharmony_ci * pname:maxVertex is the highest index of a vertex that will be addressed 748e5c31af7Sopenharmony_ci by a build command using this structure. 749e5c31af7Sopenharmony_ci * pname:vertexStride is the stride in bytes between each vertex. 750e5c31af7Sopenharmony_ci * pname:indexType is the elink:VkIndexType of each index element. 751e5c31af7Sopenharmony_ci * pname:indexData is a device or host address to memory containing index 752e5c31af7Sopenharmony_ci data for this geometry. 753e5c31af7Sopenharmony_ci * pname:transformData is a device or host address to memory containing an 754e5c31af7Sopenharmony_ci optional reference to a slink:VkTransformMatrixKHR structure describing 755e5c31af7Sopenharmony_ci a transformation from the space in which the vertices in this geometry 756e5c31af7Sopenharmony_ci are described to the space in which the acceleration structure is 757e5c31af7Sopenharmony_ci defined. 758e5c31af7Sopenharmony_ci 759e5c31af7Sopenharmony_ci[NOTE] 760e5c31af7Sopenharmony_ci.Note 761e5c31af7Sopenharmony_ci==== 762e5c31af7Sopenharmony_ciUnlike the stride for vertex buffers in 763e5c31af7Sopenharmony_cislink:VkVertexInputBindingDescription for graphics pipelines which must not 764e5c31af7Sopenharmony_ciexceed pname:maxVertexInputBindingStride, pname:vertexStride for 765e5c31af7Sopenharmony_ciacceleration structure geometry is instead restricted to being a 32-bit 766e5c31af7Sopenharmony_civalue. 767e5c31af7Sopenharmony_ci==== 768e5c31af7Sopenharmony_ci 769e5c31af7Sopenharmony_ci.Valid Usage 770e5c31af7Sopenharmony_ci**** 771e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexStride-03735]] 772e5c31af7Sopenharmony_ci pname:vertexStride must: be a multiple of the size in bytes of the 773e5c31af7Sopenharmony_ci smallest component of pname:vertexFormat 774e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexStride-03819]] 775e5c31af7Sopenharmony_ci pname:vertexStride must: be less than or equal to [eq]#2^32^-1# 776e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexFormat-03797]] 777e5c31af7Sopenharmony_ci The <<resources-buffer-view-format-features,format features>> of 778e5c31af7Sopenharmony_ci pname:vertexFormat must: contain 779e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR 780e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureGeometryTrianglesDataKHR-indexType-03798]] 781e5c31af7Sopenharmony_ci pname:indexType must: be ename:VK_INDEX_TYPE_UINT16, 782e5c31af7Sopenharmony_ci ename:VK_INDEX_TYPE_UINT32, or ename:VK_INDEX_TYPE_NONE_KHR 783e5c31af7Sopenharmony_ci**** 784e5c31af7Sopenharmony_ci 785e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureGeometryTrianglesDataKHR.adoc[] 786e5c31af7Sopenharmony_ci-- 787e5c31af7Sopenharmony_ci 788e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 789e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureGeometryMotionTrianglesDataNV',desc='Structure specifying vertex motion in a bottom-level acceleration structure',type='structs'] 790e5c31af7Sopenharmony_ci-- 791e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureGeometryMotionTrianglesDataNV 792e5c31af7Sopenharmony_ci 793e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureGeometryMotionTrianglesDataNV structure is 794e5c31af7Sopenharmony_cidefined as: 795e5c31af7Sopenharmony_ci 796e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureGeometryMotionTrianglesDataNV.adoc[] 797e5c31af7Sopenharmony_ci 798e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 799e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 800e5c31af7Sopenharmony_ci structure. 801e5c31af7Sopenharmony_ci * pname:vertexData is a pointer to vertex data for this geometry at time 802e5c31af7Sopenharmony_ci 1.0 803e5c31af7Sopenharmony_ci 804e5c31af7Sopenharmony_ciIf sname:VkAccelerationStructureGeometryMotionTrianglesDataNV is included in 805e5c31af7Sopenharmony_cithe pname:pNext chain of a 806e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryTrianglesDataKHR structure, the basic 807e5c31af7Sopenharmony_civertex positions are used for the position of the triangles in the geometry 808e5c31af7Sopenharmony_ciat time 0.0 and the pname:vertexData in 809e5c31af7Sopenharmony_cisname:VkAccelerationStructureGeometryMotionTrianglesDataNV is used for the 810e5c31af7Sopenharmony_civertex positions at time 1.0, with positions linearly interpolated at 811e5c31af7Sopenharmony_ciintermediate times. 812e5c31af7Sopenharmony_ci 813e5c31af7Sopenharmony_ciIndexing for sname:VkAccelerationStructureGeometryMotionTrianglesDataNV 814e5c31af7Sopenharmony_cipname:vertexData is equivalent to the basic vertex position data. 815e5c31af7Sopenharmony_ci 816e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureGeometryMotionTrianglesDataNV.adoc[] 817e5c31af7Sopenharmony_ci-- 818e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 819e5c31af7Sopenharmony_ci 820e5c31af7Sopenharmony_ciifdef::VK_EXT_opacity_micromap[] 821e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureTrianglesOpacityMicromapEXT',desc='Structure specifying an opacity micromap in a bottom-level acceleration structure',type='structs'] 822e5c31af7Sopenharmony_ci-- 823e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureTrianglesOpacityMicromapEXT 824e5c31af7Sopenharmony_ci 825e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureTrianglesOpacityMicromapEXT structure is 826e5c31af7Sopenharmony_cidefined as: 827e5c31af7Sopenharmony_ci 828e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureTrianglesOpacityMicromapEXT.adoc[] 829e5c31af7Sopenharmony_ci 830e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 831e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 832e5c31af7Sopenharmony_ci structure. 833e5c31af7Sopenharmony_ci * pname:indexType is the type of triangle indices used when indexing this 834e5c31af7Sopenharmony_ci micromap 835e5c31af7Sopenharmony_ci * pname:indexBuffer is the address containing the triangle indices 836e5c31af7Sopenharmony_ci * pname:indexStride is the byte stride between triangle indices 837e5c31af7Sopenharmony_ci * pname:baseTriangle is the base value added to the non-negative triangle 838e5c31af7Sopenharmony_ci indices 839e5c31af7Sopenharmony_ci * pname:usageCountsCount specifies the number of usage counts structures 840e5c31af7Sopenharmony_ci that will be used to determine the size of this micromap. 841e5c31af7Sopenharmony_ci * pname:pUsageCounts is a pointer to an array of slink:VkMicromapUsageEXT 842e5c31af7Sopenharmony_ci structures. 843e5c31af7Sopenharmony_ci * pname:ppUsageCounts is a pointer to an array of pointers to 844e5c31af7Sopenharmony_ci slink:VkMicromapUsageEXT structures. 845e5c31af7Sopenharmony_ci * pname:micromap is the handle to the micromap object to include in this 846e5c31af7Sopenharmony_ci geometry 847e5c31af7Sopenharmony_ci 848e5c31af7Sopenharmony_ciIf sname:VkAccelerationStructureTrianglesOpacityMicromapEXT is included in 849e5c31af7Sopenharmony_cithe pname:pNext chain of a 850e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryTrianglesDataKHR structure, that 851e5c31af7Sopenharmony_cigeometry will reference that micromap. 852e5c31af7Sopenharmony_ci 853e5c31af7Sopenharmony_ciFor each triangle in the geometry, the acceleration structure build fetches 854e5c31af7Sopenharmony_cian index from pname:indexBuffer using pname:indexType and pname:indexStride. 855e5c31af7Sopenharmony_ciIf that value is the unsigned cast of one of the values from 856e5c31af7Sopenharmony_cielink:VkOpacityMicromapSpecialIndexEXT then that triangle behaves as 857e5c31af7Sopenharmony_cidescribed for that special value in <<ray-opacity-micromap,Ray Opacity 858e5c31af7Sopenharmony_ciMicromap>>. 859e5c31af7Sopenharmony_ciOtherwise that triangle uses the opacity micromap information from 860e5c31af7Sopenharmony_cipname:micromap at that index plus pname:baseTriangle. 861e5c31af7Sopenharmony_ci 862e5c31af7Sopenharmony_ciOnly one of pname:pUsageCounts or pname:ppUsageCounts can: be a valid 863e5c31af7Sopenharmony_cipointer, the other must: be `NULL`. 864e5c31af7Sopenharmony_ciThe elements of the non-`NULL` array describe the total count used to build 865e5c31af7Sopenharmony_cithis geometry. 866e5c31af7Sopenharmony_ciFor a given pname:format and pname:subdivisionLevel the number of triangles 867e5c31af7Sopenharmony_ciin this geometry matching those values after indirection and special index 868e5c31af7Sopenharmony_cihandling must: be equal to the sum of matching pname:count provided. 869e5c31af7Sopenharmony_ci 870e5c31af7Sopenharmony_ciIf pname:micromap is dlink:VK_NULL_HANDLE, then every value read from 871e5c31af7Sopenharmony_cipname:indexBuffer must: be one of the values in 872e5c31af7Sopenharmony_ciename:VkOpacityMicromapSpecialIndexEXT. 873e5c31af7Sopenharmony_ci 874e5c31af7Sopenharmony_ci.Valid Usage 875e5c31af7Sopenharmony_ci**** 876e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureTrianglesOpacityMicromapEXT-pUsageCounts-07335]] 877e5c31af7Sopenharmony_ci Only one of pname:pUsageCounts or pname:ppUsageCounts can: be a valid 878e5c31af7Sopenharmony_ci pointer, the other must: be `NULL` 879e5c31af7Sopenharmony_ci**** 880e5c31af7Sopenharmony_ci 881e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureTrianglesOpacityMicromapEXT.adoc[] 882e5c31af7Sopenharmony_ci-- 883e5c31af7Sopenharmony_ci 884e5c31af7Sopenharmony_ci[open,refpage='VkOpacityMicromapSpecialIndexEXT',desc='Enum for special indices in the opacity micromap',type='enums'] 885e5c31af7Sopenharmony_ci-- 886e5c31af7Sopenharmony_ci:refpage: VkOpacityMicromapSpecialIndexEXT 887e5c31af7Sopenharmony_ci 888e5c31af7Sopenharmony_ciThe ename:VkOpacityMicromapSpecialIndexEXT enumeration is defined as: 889e5c31af7Sopenharmony_ci 890e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkOpacityMicromapSpecialIndexEXT.adoc[] 891e5c31af7Sopenharmony_ci 892e5c31af7Sopenharmony_ci * ename:VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_TRANSPARENT_EXT specifies 893e5c31af7Sopenharmony_ci that the entire triangle is fully transparent. 894e5c31af7Sopenharmony_ci * ename:VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_OPAQUE_EXT specifies that 895e5c31af7Sopenharmony_ci the entire triangle is fully opaque. 896e5c31af7Sopenharmony_ci * ename:VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_TRANSPARENT_EXT 897e5c31af7Sopenharmony_ci specifies that the entire triangle is unknown-transparent. 898e5c31af7Sopenharmony_ci * ename:VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_OPAQUE_EXT 899e5c31af7Sopenharmony_ci specifies that the entire triangle is unknown-opaque. 900e5c31af7Sopenharmony_ci-- 901e5c31af7Sopenharmony_ci 902e5c31af7Sopenharmony_ciendif::VK_EXT_opacity_micromap[] 903e5c31af7Sopenharmony_ci 904e5c31af7Sopenharmony_ciifdef::VK_NV_displacement_micromap[] 905e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureTrianglesDisplacementMicromapNV',desc='Structure specifying a displacement micromap in a bottom-level acceleration structure',type='structs'] 906e5c31af7Sopenharmony_ci-- 907e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureTrianglesDisplacementMicromapNV 908e5c31af7Sopenharmony_ci 909e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureTrianglesDisplacementMicromapNV structure 910e5c31af7Sopenharmony_ciis defined as: 911e5c31af7Sopenharmony_ci 912e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureTrianglesDisplacementMicromapNV.adoc[] 913e5c31af7Sopenharmony_ci 914e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 915e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 916e5c31af7Sopenharmony_ci structure. 917e5c31af7Sopenharmony_ci * pname:displacementBiasAndScaleFormat is the format of displacement bias 918e5c31af7Sopenharmony_ci and scale used in this displacement micromap reference. 919e5c31af7Sopenharmony_ci * pname:displacementVectorFormat is the format of displacement vector used 920e5c31af7Sopenharmony_ci in this displacement micromap reference. 921e5c31af7Sopenharmony_ci * pname:displacementBiasAndScaleBuffer is the address containing the bias 922e5c31af7Sopenharmony_ci and scale. 923e5c31af7Sopenharmony_ci * pname:displacementBiasAndScaleStride is the byte stride between bias and 924e5c31af7Sopenharmony_ci scale values. 925e5c31af7Sopenharmony_ci * pname:displacementVectorBuffer is the address containing the 926e5c31af7Sopenharmony_ci displacement vector values. 927e5c31af7Sopenharmony_ci * pname:displacementVectorStride is the byte stride between displacement 928e5c31af7Sopenharmony_ci vector values. 929e5c31af7Sopenharmony_ci * pname:displacedMicromapPrimitiveFlags is the address containing the 930e5c31af7Sopenharmony_ci primitive flags. 931e5c31af7Sopenharmony_ci * pname:displacedMicromapPrimitiveFlagsStride is the byte stride between 932e5c31af7Sopenharmony_ci primitive flag values. 933e5c31af7Sopenharmony_ci * pname:indexType is the type of triangle indices used when indexing this 934e5c31af7Sopenharmony_ci micromap. 935e5c31af7Sopenharmony_ci * pname:indexBuffer is the address containing the triangle indices. 936e5c31af7Sopenharmony_ci * pname:indexStride is the byte stride between triangle indices. 937e5c31af7Sopenharmony_ci * pname:baseTriangle is the base value added to the non-negative triangle 938e5c31af7Sopenharmony_ci indices. 939e5c31af7Sopenharmony_ci * pname:usageCountsCount specifies the number of usage counts structures 940e5c31af7Sopenharmony_ci that will be used to determine the size of this micromap. 941e5c31af7Sopenharmony_ci * pname:pUsageCounts is a pointer to an array of slink:VkMicromapUsageEXT 942e5c31af7Sopenharmony_ci structures. 943e5c31af7Sopenharmony_ci * pname:ppUsageCounts is a pointer to an array of pointers to 944e5c31af7Sopenharmony_ci slink:VkMicromapUsageEXT structures. 945e5c31af7Sopenharmony_ci * pname:micromap is the handle to the micromap object to include in this 946e5c31af7Sopenharmony_ci geometry. 947e5c31af7Sopenharmony_ci 948e5c31af7Sopenharmony_ciIf sname:VkAccelerationStructureTrianglesDisplacementMicromapNV is included 949e5c31af7Sopenharmony_ciin the pname:pNext chain of a 950e5c31af7Sopenharmony_cislink:VkAccelerationStructureGeometryTrianglesDataKHR structure, that 951e5c31af7Sopenharmony_cigeometry will reference that micromap. 952e5c31af7Sopenharmony_ci 953e5c31af7Sopenharmony_ciFor each triangle in the geometry, the acceleration structure build fetches 954e5c31af7Sopenharmony_cian index from pname:indexBuffer using pname:indexType and pname:indexStride. 955e5c31af7Sopenharmony_ciThat triangle uses the displacement micromap information from pname:micromap 956e5c31af7Sopenharmony_ciat that index plus pname:baseTriangle. 957e5c31af7Sopenharmony_ci 958e5c31af7Sopenharmony_ciOnly one of pname:pUsageCounts or pname:ppUsageCounts can: be a valid 959e5c31af7Sopenharmony_cipointer, the other must: be `NULL`. 960e5c31af7Sopenharmony_ciThe elements of the non-`NULL` array describe the total count used to build 961e5c31af7Sopenharmony_cithis geometry. 962e5c31af7Sopenharmony_ciFor a given pname:format and pname:subdivisionLevel the number of triangles 963e5c31af7Sopenharmony_ciin this geometry matching those values after indirection must: be equal to 964e5c31af7Sopenharmony_cithe sum of matching pname:count provided. 965e5c31af7Sopenharmony_ci 966e5c31af7Sopenharmony_ci.Valid Usage 967e5c31af7Sopenharmony_ci**** 968e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureTrianglesDisplacementMicromapNV-pUsageCounts-07992]] 969e5c31af7Sopenharmony_ci Only one of pname:pUsageCounts or pname:ppUsageCounts can: be a valid 970e5c31af7Sopenharmony_ci pointer, the other must: be `NULL` 971e5c31af7Sopenharmony_ci**** 972e5c31af7Sopenharmony_ci 973e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureTrianglesDisplacementMicromapNV.adoc[] 974e5c31af7Sopenharmony_ci-- 975e5c31af7Sopenharmony_ciendif::VK_NV_displacement_micromap[] 976e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 977e5c31af7Sopenharmony_ci 978e5c31af7Sopenharmony_ci[open,refpage='VkTransformMatrixKHR',desc='Structure specifying a 3x4 affine transformation matrix',type='structs',alias='VkTransformMatrixNV'] 979e5c31af7Sopenharmony_ci-- 980e5c31af7Sopenharmony_ci:refpage: VkTransformMatrixKHR 981e5c31af7Sopenharmony_ci 982e5c31af7Sopenharmony_ciThe sname:VkTransformMatrixKHR structure is defined as: 983e5c31af7Sopenharmony_ci 984e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkTransformMatrixKHR.adoc[] 985e5c31af7Sopenharmony_ci 986e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 987e5c31af7Sopenharmony_cior the equivalent 988e5c31af7Sopenharmony_ci 989e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkTransformMatrixNV.adoc[] 990e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 991e5c31af7Sopenharmony_ci 992e5c31af7Sopenharmony_ci * pname:matrix is a 3x4 row-major affine transformation matrix. 993e5c31af7Sopenharmony_ci 994e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkTransformMatrixKHR.adoc[] 995e5c31af7Sopenharmony_ci 996e5c31af7Sopenharmony_ci.Valid Usage 997e5c31af7Sopenharmony_ci**** 998e5c31af7Sopenharmony_ci * [[VUID-VkTransformMatrixKHR-matrix-03799]] 999e5c31af7Sopenharmony_ci The first three columns of pname:matrix must: define an invertible 3x3 1000e5c31af7Sopenharmony_ci matrix 1001e5c31af7Sopenharmony_ci**** 1002e5c31af7Sopenharmony_ci-- 1003e5c31af7Sopenharmony_ci 1004e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1005e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureGeometryAabbsDataKHR',desc='Structure specifying axis-aligned bounding box geometry in a bottom-level acceleration structure',type='structs'] 1006e5c31af7Sopenharmony_ci-- 1007e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureGeometryAabbsDataKHR 1008e5c31af7Sopenharmony_ci 1009e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureGeometryAabbsDataKHR structure is defined 1010e5c31af7Sopenharmony_cias: 1011e5c31af7Sopenharmony_ci 1012e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureGeometryAabbsDataKHR.adoc[] 1013e5c31af7Sopenharmony_ci 1014e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 1015e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1016e5c31af7Sopenharmony_ci structure. 1017e5c31af7Sopenharmony_ci * pname:data is a device or host address to memory containing 1018e5c31af7Sopenharmony_ci slink:VkAabbPositionsKHR structures containing position data for each 1019e5c31af7Sopenharmony_ci axis-aligned bounding box in the geometry. 1020e5c31af7Sopenharmony_ci * pname:stride is the stride in bytes between each entry in pname:data. 1021e5c31af7Sopenharmony_ci The stride must: be a multiple of `8`. 1022e5c31af7Sopenharmony_ci 1023e5c31af7Sopenharmony_ci.Valid Usage 1024e5c31af7Sopenharmony_ci**** 1025e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureGeometryAabbsDataKHR-stride-03545]] 1026e5c31af7Sopenharmony_ci pname:stride must: be a multiple of `8` 1027e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureGeometryAabbsDataKHR-stride-03820]] 1028e5c31af7Sopenharmony_ci pname:stride must: be less than or equal to [eq]#2^32^-1# 1029e5c31af7Sopenharmony_ci**** 1030e5c31af7Sopenharmony_ci 1031e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureGeometryAabbsDataKHR.adoc[] 1032e5c31af7Sopenharmony_ci-- 1033e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1034e5c31af7Sopenharmony_ci 1035e5c31af7Sopenharmony_ci[open,refpage='VkAabbPositionsKHR',desc='Structure specifying two opposing corners of an axis-aligned bounding box',type='structs',alias='VkAabbPositionsNV'] 1036e5c31af7Sopenharmony_ci-- 1037e5c31af7Sopenharmony_ci:refpage: VkAabbPositionsKHR 1038e5c31af7Sopenharmony_ci 1039e5c31af7Sopenharmony_ciThe sname:VkAabbPositionsKHR structure is defined as: 1040e5c31af7Sopenharmony_ci 1041e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAabbPositionsKHR.adoc[] 1042e5c31af7Sopenharmony_ci 1043e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 1044e5c31af7Sopenharmony_cior the equivalent 1045e5c31af7Sopenharmony_ci 1046e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAabbPositionsNV.adoc[] 1047e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 1048e5c31af7Sopenharmony_ci 1049e5c31af7Sopenharmony_ci * pname:minX is the x position of one opposing corner of a bounding box. 1050e5c31af7Sopenharmony_ci * pname:minY is the y position of one opposing corner of a bounding box. 1051e5c31af7Sopenharmony_ci * pname:minZ is the z position of one opposing corner of a bounding box. 1052e5c31af7Sopenharmony_ci * pname:maxX is the x position of the other opposing corner of a bounding 1053e5c31af7Sopenharmony_ci box. 1054e5c31af7Sopenharmony_ci * pname:maxY is the y position of the other opposing corner of a bounding 1055e5c31af7Sopenharmony_ci box. 1056e5c31af7Sopenharmony_ci * pname:maxZ is the z position of the other opposing corner of a bounding 1057e5c31af7Sopenharmony_ci box. 1058e5c31af7Sopenharmony_ci 1059e5c31af7Sopenharmony_ci.Valid Usage 1060e5c31af7Sopenharmony_ci**** 1061e5c31af7Sopenharmony_ci * [[VUID-VkAabbPositionsKHR-minX-03546]] 1062e5c31af7Sopenharmony_ci pname:minX must: be less than or equal to pname:maxX 1063e5c31af7Sopenharmony_ci * [[VUID-VkAabbPositionsKHR-minY-03547]] 1064e5c31af7Sopenharmony_ci pname:minY must: be less than or equal to pname:maxY 1065e5c31af7Sopenharmony_ci * [[VUID-VkAabbPositionsKHR-minZ-03548]] 1066e5c31af7Sopenharmony_ci pname:minZ must: be less than or equal to pname:maxZ 1067e5c31af7Sopenharmony_ci**** 1068e5c31af7Sopenharmony_ci 1069e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAabbPositionsKHR.adoc[] 1070e5c31af7Sopenharmony_ci-- 1071e5c31af7Sopenharmony_ci 1072e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1073e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureGeometryInstancesDataKHR',desc='Structure specifying a geometry consisting of instances of other acceleration structures',type='structs'] 1074e5c31af7Sopenharmony_ci-- 1075e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureGeometryInstancesDataKHR 1076e5c31af7Sopenharmony_ci 1077e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureGeometryInstancesDataKHR structure is 1078e5c31af7Sopenharmony_cidefined as: 1079e5c31af7Sopenharmony_ci 1080e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureGeometryInstancesDataKHR.adoc[] 1081e5c31af7Sopenharmony_ci 1082e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 1083e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1084e5c31af7Sopenharmony_ci structure. 1085e5c31af7Sopenharmony_ci * pname:arrayOfPointers specifies whether pname:data is used as an array 1086e5c31af7Sopenharmony_ci of addresses or just an array. 1087e5c31af7Sopenharmony_ci * pname:data is either the address of an array of device or host addresses 1088e5c31af7Sopenharmony_ci referencing individual slink:VkAccelerationStructureInstanceKHR 1089e5c31af7Sopenharmony_ci structures 1090e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 1091e5c31af7Sopenharmony_ci or packed motion instance information as described in 1092e5c31af7Sopenharmony_ci <<acceleration-structure-motion-instances, motion instances>> 1093e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 1094e5c31af7Sopenharmony_ci if pname:arrayOfPointers is ename:VK_TRUE, or the address of an array of 1095e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInstanceKHR 1096e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 1097e5c31af7Sopenharmony_ci or slink:VkAccelerationStructureMotionInstanceNV 1098e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 1099e5c31af7Sopenharmony_ci structures. 1100e5c31af7Sopenharmony_ci Addresses and slink:VkAccelerationStructureInstanceKHR structures are 1101e5c31af7Sopenharmony_ci tightly packed. 1102e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 1103e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMotionInstanceNV structures have a stride 1104e5c31af7Sopenharmony_ci of 160 bytes. 1105e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 1106e5c31af7Sopenharmony_ci 1107e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureGeometryInstancesDataKHR.adoc[] 1108e5c31af7Sopenharmony_ci-- 1109e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1110e5c31af7Sopenharmony_ci 1111e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureInstanceKHR',desc='Structure specifying a single acceleration structure instance for building into an acceleration structure geometry',type='structs',alias='VkAccelerationStructureInstanceNV'] 1112e5c31af7Sopenharmony_ci-- 1113e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureInstanceKHR 1114e5c31af7Sopenharmony_ci 1115e5c31af7Sopenharmony_ci_Acceleration structure instances_ can: be built into top-level acceleration 1116e5c31af7Sopenharmony_cistructures. 1117e5c31af7Sopenharmony_ciEach acceleration structure instance is a separate entry in the top-level 1118e5c31af7Sopenharmony_ciacceleration structure which includes all the geometry of a bottom-level 1119e5c31af7Sopenharmony_ciacceleration structure at a transformed location. 1120e5c31af7Sopenharmony_ciMultiple instances can: point to the same bottom level acceleration 1121e5c31af7Sopenharmony_cistructure. 1122e5c31af7Sopenharmony_ci 1123e5c31af7Sopenharmony_ciAn acceleration structure instance is defined by the structure: 1124e5c31af7Sopenharmony_ci 1125e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureInstanceKHR.adoc[] 1126e5c31af7Sopenharmony_ci 1127e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 1128e5c31af7Sopenharmony_cior the equivalent 1129e5c31af7Sopenharmony_ci 1130e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureInstanceNV.adoc[] 1131e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 1132e5c31af7Sopenharmony_ci 1133e5c31af7Sopenharmony_ci * pname:transform is a slink:VkTransformMatrixKHR structure describing a 1134e5c31af7Sopenharmony_ci transformation to be applied to the acceleration structure. 1135e5c31af7Sopenharmony_ci * pname:instanceCustomIndex is a 24-bit user-specified index value 1136e5c31af7Sopenharmony_ci accessible to ray shaders in the code:InstanceCustomIndexKHR built-in. 1137e5c31af7Sopenharmony_ci * pname:mask is an 8-bit visibility mask for the geometry. 1138e5c31af7Sopenharmony_ci The instance may: only be hit if `Cull Mask & instance.mask != 0` 1139e5c31af7Sopenharmony_ci * pname:instanceShaderBindingTableRecordOffset is a 24-bit offset used in 1140e5c31af7Sopenharmony_ci calculating the hit shader binding table index. 1141e5c31af7Sopenharmony_ci * pname:flags is an 8-bit mask of elink:VkGeometryInstanceFlagBitsKHR 1142e5c31af7Sopenharmony_ci values to apply to this instance. 1143e5c31af7Sopenharmony_ci * pname:accelerationStructureReference is either: 1144e5c31af7Sopenharmony_ci ** a device address containing the value obtained from 1145e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[flink:vkGetAccelerationStructureDeviceAddressKHR] 1146e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure+VK_NV_ray_tracing[or] 1147e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[flink:vkGetAccelerationStructureHandleNV] 1148e5c31af7Sopenharmony_ci (used by device operations which reference acceleration structures) or, 1149e5c31af7Sopenharmony_ci ** a slink:VkAccelerationStructureKHR object (used by host operations 1150e5c31af7Sopenharmony_ci which reference acceleration structures). 1151e5c31af7Sopenharmony_ci 1152e5c31af7Sopenharmony_ciThe C language specification does not define the ordering of bit-fields, but 1153e5c31af7Sopenharmony_ciin practice, this struct produces the correct layout with existing 1154e5c31af7Sopenharmony_cicompilers. 1155e5c31af7Sopenharmony_ciThe intended bit pattern is for the following: 1156e5c31af7Sopenharmony_ci 1157e5c31af7Sopenharmony_ci * pname:instanceCustomIndex and pname:mask occupy the same memory as if a 1158e5c31af7Sopenharmony_ci single code:uint32_t was specified in their place 1159e5c31af7Sopenharmony_ci ** pname:instanceCustomIndex occupies the 24 least significant bits of 1160e5c31af7Sopenharmony_ci that memory 1161e5c31af7Sopenharmony_ci ** pname:mask occupies the 8 most significant bits of that memory 1162e5c31af7Sopenharmony_ci * pname:instanceShaderBindingTableRecordOffset and pname:flags occupy the 1163e5c31af7Sopenharmony_ci same memory as if a single code:uint32_t was specified in their place 1164e5c31af7Sopenharmony_ci ** pname:instanceShaderBindingTableRecordOffset occupies the 24 least 1165e5c31af7Sopenharmony_ci significant bits of that memory 1166e5c31af7Sopenharmony_ci ** pname:flags occupies the 8 most significant bits of that memory 1167e5c31af7Sopenharmony_ci 1168e5c31af7Sopenharmony_ciIf a compiler produces code that diverges from that pattern, applications 1169e5c31af7Sopenharmony_cimust: employ another method to set values according to the correct bit 1170e5c31af7Sopenharmony_cipattern. 1171e5c31af7Sopenharmony_ci 1172e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureInstanceKHR.adoc[] 1173e5c31af7Sopenharmony_ci-- 1174e5c31af7Sopenharmony_ci 1175e5c31af7Sopenharmony_ci[open,refpage='VkGeometryInstanceFlagBitsKHR',desc='Instance flag bits',type='enums',alias='VkGeometryInstanceFlagBitsNV'] 1176e5c31af7Sopenharmony_ci-- 1177e5c31af7Sopenharmony_ci:refpage: VkGeometryInstanceFlagBitsKHR 1178e5c31af7Sopenharmony_ci 1179e5c31af7Sopenharmony_ciPossible values of pname:flags in the instance modifying the behavior of 1180e5c31af7Sopenharmony_cithat instance are: 1181e5c31af7Sopenharmony_ci 1182e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkGeometryInstanceFlagBitsKHR.adoc[] 1183e5c31af7Sopenharmony_ci 1184e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 1185e5c31af7Sopenharmony_cior the equivalent 1186e5c31af7Sopenharmony_ci 1187e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkGeometryInstanceFlagBitsNV.adoc[] 1188e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 1189e5c31af7Sopenharmony_ci 1190e5c31af7Sopenharmony_ci * ename:VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR disables 1191e5c31af7Sopenharmony_ci face culling for this instance. 1192e5c31af7Sopenharmony_ci * ename:VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR indicates that 1193e5c31af7Sopenharmony_ci the <<ray-traversal-culling-face, facing determination>> for geometry in 1194e5c31af7Sopenharmony_ci this instance is inverted. 1195e5c31af7Sopenharmony_ci Because the facing is determined in object space, an instance transform 1196e5c31af7Sopenharmony_ci does not change the winding, but a geometry transform does. 1197e5c31af7Sopenharmony_ci * ename:VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR causes this instance to 1198e5c31af7Sopenharmony_ci act as though ename:VK_GEOMETRY_OPAQUE_BIT_KHR were specified on all 1199e5c31af7Sopenharmony_ci geometries referenced by this instance. 1200e5c31af7Sopenharmony_ci This behavior can: be overridden by the SPIR-V code:NoOpaqueKHR ray 1201e5c31af7Sopenharmony_ci flag. 1202e5c31af7Sopenharmony_ci * ename:VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR causes this instance 1203e5c31af7Sopenharmony_ci to act as though ename:VK_GEOMETRY_OPAQUE_BIT_KHR were not specified on 1204e5c31af7Sopenharmony_ci all geometries referenced by this instance. 1205e5c31af7Sopenharmony_ci This behavior can: be overridden by the SPIR-V code:OpaqueKHR ray flag. 1206e5c31af7Sopenharmony_ci 1207e5c31af7Sopenharmony_ciename:VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR and 1208e5c31af7Sopenharmony_ciename:VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR must: not be used in the 1209e5c31af7Sopenharmony_cisame flag. 1210e5c31af7Sopenharmony_ci-- 1211e5c31af7Sopenharmony_ci 1212e5c31af7Sopenharmony_ci[open,refpage='VkGeometryInstanceFlagsKHR',desc='Bitmask of VkGeometryInstanceFlagBitsKHR',type='flags',alias='VkGeometryInstanceFlagsNV'] 1213e5c31af7Sopenharmony_ci-- 1214e5c31af7Sopenharmony_ci:refpage: VkGeometryInstanceFlagsKHR 1215e5c31af7Sopenharmony_ci 1216e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkGeometryInstanceFlagsKHR.adoc[] 1217e5c31af7Sopenharmony_ci 1218e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 1219e5c31af7Sopenharmony_cior the equivalent 1220e5c31af7Sopenharmony_ci 1221e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkGeometryInstanceFlagsNV.adoc[] 1222e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 1223e5c31af7Sopenharmony_ci 1224e5c31af7Sopenharmony_citname:VkGeometryInstanceFlagsKHR is a bitmask type for setting a mask of 1225e5c31af7Sopenharmony_cizero or more elink:VkGeometryInstanceFlagBitsKHR. 1226e5c31af7Sopenharmony_ci-- 1227e5c31af7Sopenharmony_ci 1228e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 1229e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureMotionInstanceNV',desc='Structure specifying a single acceleration structure motion instance for building into an acceleration structure geometry',type='structs'] 1230e5c31af7Sopenharmony_ci-- 1231e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureMotionInstanceNV 1232e5c31af7Sopenharmony_ci 1233e5c31af7Sopenharmony_ci_Acceleration structure motion instances_ can: be built into top-level 1234e5c31af7Sopenharmony_ciacceleration structures. 1235e5c31af7Sopenharmony_ciEach acceleration structure instance is a separate entry in the top-level 1236e5c31af7Sopenharmony_ciacceleration structure which includes all the geometry of a bottom-level 1237e5c31af7Sopenharmony_ciacceleration structure at a transformed location including a type of motion 1238e5c31af7Sopenharmony_ciand parameters to determine the motion of the instance over time. 1239e5c31af7Sopenharmony_ci 1240e5c31af7Sopenharmony_ciAn acceleration structure motion instance is defined by the structure: 1241e5c31af7Sopenharmony_ci 1242e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureMotionInstanceNV.adoc[] 1243e5c31af7Sopenharmony_ci 1244e5c31af7Sopenharmony_ci * pname:type is a elink:VkAccelerationStructureMotionInstanceTypeNV 1245e5c31af7Sopenharmony_ci enumerant identifying which type of motion instance this is and which 1246e5c31af7Sopenharmony_ci type of the union is valid. 1247e5c31af7Sopenharmony_ci * pname:flags is currently unused, but is required to keep natural 1248e5c31af7Sopenharmony_ci alignment of pname:data. 1249e5c31af7Sopenharmony_ci * pname:data is a slink:VkAccelerationStructureMotionInstanceDataNV 1250e5c31af7Sopenharmony_ci containing motion instance data for this instance. 1251e5c31af7Sopenharmony_ci 1252e5c31af7Sopenharmony_ci[NOTE] 1253e5c31af7Sopenharmony_ci.Note 1254e5c31af7Sopenharmony_ci==== 1255e5c31af7Sopenharmony_ciIf writing this other than with a standard C compiler, note that the final 1256e5c31af7Sopenharmony_cistructure should be 152 bytes in size. 1257e5c31af7Sopenharmony_ci==== 1258e5c31af7Sopenharmony_ci 1259e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureMotionInstanceNV.adoc[] 1260e5c31af7Sopenharmony_ci-- 1261e5c31af7Sopenharmony_ci 1262e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureMotionInstanceDataNV',desc='Union specifying a acceleration structure motion instance data for building into an acceleration structure geometry',type='structs'] 1263e5c31af7Sopenharmony_ci-- 1264e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureMotionInstanceDataNV 1265e5c31af7Sopenharmony_ci 1266e5c31af7Sopenharmony_ciAcceleration structure motion instance is defined by the union: 1267e5c31af7Sopenharmony_ci 1268e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureMotionInstanceDataNV.adoc[] 1269e5c31af7Sopenharmony_ci 1270e5c31af7Sopenharmony_ci * pname:staticInstance is a slink:VkAccelerationStructureInstanceKHR 1271e5c31af7Sopenharmony_ci structure containing data for a static instance. 1272e5c31af7Sopenharmony_ci * pname:matrixMotionInstance is a 1273e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMatrixMotionInstanceNV structure containing 1274e5c31af7Sopenharmony_ci data for a matrix motion instance. 1275e5c31af7Sopenharmony_ci * pname:srtMotionInstance is a 1276e5c31af7Sopenharmony_ci slink:VkAccelerationStructureSRTMotionInstanceNV structure containing 1277e5c31af7Sopenharmony_ci data for an SRT motion instance. 1278e5c31af7Sopenharmony_ci 1279e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureMotionInstanceDataNV.adoc[] 1280e5c31af7Sopenharmony_ci-- 1281e5c31af7Sopenharmony_ci 1282e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureMotionInstanceFlagsNV',desc='Reserved for future use',type='flags'] 1283e5c31af7Sopenharmony_ci-- 1284e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkAccelerationStructureMotionInstanceFlagsNV.adoc[] 1285e5c31af7Sopenharmony_ci 1286e5c31af7Sopenharmony_citname:VkAccelerationStructureMotionInstanceFlagsNV is a bitmask type for 1287e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 1288e5c31af7Sopenharmony_ci-- 1289e5c31af7Sopenharmony_ci 1290e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureMotionInstanceTypeNV',desc='Enum specifying a type of acceleration structure motion instance data for building into an acceleration structure geometry',type='enums'] 1291e5c31af7Sopenharmony_ci-- 1292e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureMotionInstanceTypeNV 1293e5c31af7Sopenharmony_ci 1294e5c31af7Sopenharmony_ciThe ename:VkAccelerationStructureMotionInstanceTypeNV enumeration is defined 1295e5c31af7Sopenharmony_cias: 1296e5c31af7Sopenharmony_ci 1297e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkAccelerationStructureMotionInstanceTypeNV.adoc[] 1298e5c31af7Sopenharmony_ci 1299e5c31af7Sopenharmony_ci * ename:VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_STATIC_NV specifies 1300e5c31af7Sopenharmony_ci that the instance is a static instance with no instance motion. 1301e5c31af7Sopenharmony_ci * ename:VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_MATRIX_MOTION_NV 1302e5c31af7Sopenharmony_ci specifies that the instance is a motion instance with motion specified 1303e5c31af7Sopenharmony_ci by interpolation between two matrices. 1304e5c31af7Sopenharmony_ci * ename:VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_SRT_MOTION_NV 1305e5c31af7Sopenharmony_ci specifies that the instance is a motion instance with motion specified 1306e5c31af7Sopenharmony_ci by interpolation in the SRT decomposition. 1307e5c31af7Sopenharmony_ci-- 1308e5c31af7Sopenharmony_ci 1309e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureMatrixMotionInstanceNV',desc='Structure specifying a single acceleration structure matrix motion instance for building into an acceleration structure geometry',type='structs'] 1310e5c31af7Sopenharmony_ci-- 1311e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureMatrixMotionInstanceNV 1312e5c31af7Sopenharmony_ci 1313e5c31af7Sopenharmony_ciAn acceleration structure matrix motion instance is defined by the 1314e5c31af7Sopenharmony_cistructure: 1315e5c31af7Sopenharmony_ci 1316e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureMatrixMotionInstanceNV.adoc[] 1317e5c31af7Sopenharmony_ci 1318e5c31af7Sopenharmony_ci * pname:transformT0 is a slink:VkTransformMatrixKHR structure describing a 1319e5c31af7Sopenharmony_ci transformation to be applied to the acceleration structure at time 0. 1320e5c31af7Sopenharmony_ci * pname:transformT1 is a slink:VkTransformMatrixKHR structure describing a 1321e5c31af7Sopenharmony_ci transformation to be applied to the acceleration structure at time 1. 1322e5c31af7Sopenharmony_ci * pname:instanceCustomIndex is a 24-bit user-specified index value 1323e5c31af7Sopenharmony_ci accessible to ray shaders in the code:InstanceCustomIndexKHR built-in. 1324e5c31af7Sopenharmony_ci * pname:mask is an 8-bit visibility mask for the geometry. 1325e5c31af7Sopenharmony_ci The instance may: only be hit if `Cull Mask & instance.mask != 0` 1326e5c31af7Sopenharmony_ci * pname:instanceShaderBindingTableRecordOffset is a 24-bit offset used in 1327e5c31af7Sopenharmony_ci calculating the hit shader binding table index. 1328e5c31af7Sopenharmony_ci * pname:flags is an 8-bit mask of elink:VkGeometryInstanceFlagBitsKHR 1329e5c31af7Sopenharmony_ci values to apply to this instance. 1330e5c31af7Sopenharmony_ci * pname:accelerationStructureReference is either: 1331e5c31af7Sopenharmony_ci ** a device address containing the value obtained from 1332e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[flink:vkGetAccelerationStructureDeviceAddressKHR] 1333e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure+VK_NV_ray_tracing[or] 1334e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[flink:vkGetAccelerationStructureHandleNV] 1335e5c31af7Sopenharmony_ci (used by device operations which reference acceleration structures) or, 1336e5c31af7Sopenharmony_ci ** a slink:VkAccelerationStructureKHR object (used by host operations 1337e5c31af7Sopenharmony_ci which reference acceleration structures). 1338e5c31af7Sopenharmony_ci 1339e5c31af7Sopenharmony_ciThe C language specification does not define the ordering of bit-fields, but 1340e5c31af7Sopenharmony_ciin practice, this struct produces the correct layout with existing 1341e5c31af7Sopenharmony_cicompilers. 1342e5c31af7Sopenharmony_ciThe intended bit pattern is for the following: 1343e5c31af7Sopenharmony_ci 1344e5c31af7Sopenharmony_ci * pname:instanceCustomIndex and pname:mask occupy the same memory as if a 1345e5c31af7Sopenharmony_ci single code:uint32_t was specified in their place 1346e5c31af7Sopenharmony_ci ** pname:instanceCustomIndex occupies the 24 least significant bits of 1347e5c31af7Sopenharmony_ci that memory 1348e5c31af7Sopenharmony_ci ** pname:mask occupies the 8 most significant bits of that memory 1349e5c31af7Sopenharmony_ci * pname:instanceShaderBindingTableRecordOffset and pname:flags occupy the 1350e5c31af7Sopenharmony_ci same memory as if a single code:uint32_t was specified in their place 1351e5c31af7Sopenharmony_ci ** pname:instanceShaderBindingTableRecordOffset occupies the 24 least 1352e5c31af7Sopenharmony_ci significant bits of that memory 1353e5c31af7Sopenharmony_ci ** pname:flags occupies the 8 most significant bits of that memory 1354e5c31af7Sopenharmony_ci 1355e5c31af7Sopenharmony_ciIf a compiler produces code that diverges from that pattern, applications 1356e5c31af7Sopenharmony_cimust: employ another method to set values according to the correct bit 1357e5c31af7Sopenharmony_cipattern. 1358e5c31af7Sopenharmony_ci 1359e5c31af7Sopenharmony_ciThe transform for a matrix motion instance at a point in time is derived by 1360e5c31af7Sopenharmony_cicomponent-wise linear interpolation of the two transforms. 1361e5c31af7Sopenharmony_ciThat is, for a code:time in [0,1] the resulting transform is 1362e5c31af7Sopenharmony_ci 1363e5c31af7Sopenharmony_ci {empty}:: [eq]#pname:transformT0 {times} (1 - code:time) {plus} 1364e5c31af7Sopenharmony_ci pname:transformT1 {times} code:time# 1365e5c31af7Sopenharmony_ci 1366e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureMatrixMotionInstanceNV.adoc[] 1367e5c31af7Sopenharmony_ci-- 1368e5c31af7Sopenharmony_ci 1369e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureSRTMotionInstanceNV',desc='Structure specifying a single acceleration structure SRT motion instance for building into an acceleration structure geometry',type='structs'] 1370e5c31af7Sopenharmony_ci-- 1371e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureSRTMotionInstanceNV 1372e5c31af7Sopenharmony_ci 1373e5c31af7Sopenharmony_ciAn acceleration structure SRT motion instance is defined by the structure: 1374e5c31af7Sopenharmony_ci 1375e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureSRTMotionInstanceNV.adoc[] 1376e5c31af7Sopenharmony_ci 1377e5c31af7Sopenharmony_ci * pname:transformT0 is a slink:VkSRTDataNV structure describing a 1378e5c31af7Sopenharmony_ci transformation to be applied to the acceleration structure at time 0. 1379e5c31af7Sopenharmony_ci * pname:transformT1 is a slink:VkSRTDataNV structure describing a 1380e5c31af7Sopenharmony_ci transformation to be applied to the acceleration structure at time 1. 1381e5c31af7Sopenharmony_ci * pname:instanceCustomIndex is a 24-bit user-specified index value 1382e5c31af7Sopenharmony_ci accessible to ray shaders in the code:InstanceCustomIndexKHR built-in. 1383e5c31af7Sopenharmony_ci * pname:mask is an 8-bit visibility mask for the geometry. 1384e5c31af7Sopenharmony_ci The instance may: only be hit if `Cull Mask & instance.mask != 0` 1385e5c31af7Sopenharmony_ci * pname:instanceShaderBindingTableRecordOffset is a 24-bit offset used in 1386e5c31af7Sopenharmony_ci calculating the hit shader binding table index. 1387e5c31af7Sopenharmony_ci * pname:flags is an 8-bit mask of elink:VkGeometryInstanceFlagBitsKHR 1388e5c31af7Sopenharmony_ci values to apply to this instance. 1389e5c31af7Sopenharmony_ci * pname:accelerationStructureReference is either: 1390e5c31af7Sopenharmony_ci ** a device address containing the value obtained from 1391e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[flink:vkGetAccelerationStructureDeviceAddressKHR] 1392e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure+VK_NV_ray_tracing[or] 1393e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[flink:vkGetAccelerationStructureHandleNV] 1394e5c31af7Sopenharmony_ci (used by device operations which reference acceleration structures) or, 1395e5c31af7Sopenharmony_ci ** a slink:VkAccelerationStructureKHR object (used by host operations 1396e5c31af7Sopenharmony_ci which reference acceleration structures). 1397e5c31af7Sopenharmony_ci 1398e5c31af7Sopenharmony_ciThe C language specification does not define the ordering of bit-fields, but 1399e5c31af7Sopenharmony_ciin practice, this struct produces the correct layout with existing 1400e5c31af7Sopenharmony_cicompilers. 1401e5c31af7Sopenharmony_ciThe intended bit pattern is for the following: 1402e5c31af7Sopenharmony_ci 1403e5c31af7Sopenharmony_ci * pname:instanceCustomIndex and pname:mask occupy the same memory as if a 1404e5c31af7Sopenharmony_ci single code:uint32_t was specified in their place 1405e5c31af7Sopenharmony_ci ** pname:instanceCustomIndex occupies the 24 least significant bits of 1406e5c31af7Sopenharmony_ci that memory 1407e5c31af7Sopenharmony_ci ** pname:mask occupies the 8 most significant bits of that memory 1408e5c31af7Sopenharmony_ci * pname:instanceShaderBindingTableRecordOffset and pname:flags occupy the 1409e5c31af7Sopenharmony_ci same memory as if a single code:uint32_t was specified in their place 1410e5c31af7Sopenharmony_ci ** pname:instanceShaderBindingTableRecordOffset occupies the 24 least 1411e5c31af7Sopenharmony_ci significant bits of that memory 1412e5c31af7Sopenharmony_ci ** pname:flags occupies the 8 most significant bits of that memory 1413e5c31af7Sopenharmony_ci 1414e5c31af7Sopenharmony_ciIf a compiler produces code that diverges from that pattern, applications 1415e5c31af7Sopenharmony_cimust: employ another method to set values according to the correct bit 1416e5c31af7Sopenharmony_cipattern. 1417e5c31af7Sopenharmony_ci 1418e5c31af7Sopenharmony_ciThe transform for a SRT motion instance at a point in time is derived from 1419e5c31af7Sopenharmony_cicomponent-wise linear interpolation of the two SRT transforms. 1420e5c31af7Sopenharmony_ciThat is, for a code:time in [0,1] the resulting transform is 1421e5c31af7Sopenharmony_ci 1422e5c31af7Sopenharmony_ci {empty}:: [eq]#pname:transformT0 {times} (1 - code:time) {plus} 1423e5c31af7Sopenharmony_ci pname:transformT1 {times} code:time# 1424e5c31af7Sopenharmony_ci 1425e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureSRTMotionInstanceNV.adoc[] 1426e5c31af7Sopenharmony_ci-- 1427e5c31af7Sopenharmony_ci 1428e5c31af7Sopenharmony_ci[open,refpage='VkSRTDataNV',desc='Structure specifying a transform in SRT decomposition',type='structs'] 1429e5c31af7Sopenharmony_ci-- 1430e5c31af7Sopenharmony_ci:refpage: VkSRTDataNV 1431e5c31af7Sopenharmony_ci 1432e5c31af7Sopenharmony_ciAn acceleration structure SRT transform is defined by the structure: 1433e5c31af7Sopenharmony_ci 1434e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkSRTDataNV.adoc[] 1435e5c31af7Sopenharmony_ci 1436e5c31af7Sopenharmony_ci * pname:sx is the x component of the scale of the transform 1437e5c31af7Sopenharmony_ci * pname:a is one component of the shear for the transform 1438e5c31af7Sopenharmony_ci * pname:b is one component of the shear for the transform 1439e5c31af7Sopenharmony_ci * pname:pvx is the x component of the pivot point of the transform 1440e5c31af7Sopenharmony_ci * pname:sy is the y component of the scale of the transform 1441e5c31af7Sopenharmony_ci * pname:c is one component of the shear for the transform 1442e5c31af7Sopenharmony_ci * pname:pvy is the y component of the pivot point of the transform 1443e5c31af7Sopenharmony_ci * pname:sz is the z component of the scale of the transform 1444e5c31af7Sopenharmony_ci * pname:pvz is the z component of the pivot point of the transform 1445e5c31af7Sopenharmony_ci * pname:qx is the x component of the rotation quaternion 1446e5c31af7Sopenharmony_ci * pname:qy is the y component of the rotation quaternion 1447e5c31af7Sopenharmony_ci * pname:qz is the z component of the rotation quaternion 1448e5c31af7Sopenharmony_ci * pname:qw is the w component of the rotation quaternion 1449e5c31af7Sopenharmony_ci * pname:tx is the x component of the post-rotation translation 1450e5c31af7Sopenharmony_ci * pname:ty is the y component of the post-rotation translation 1451e5c31af7Sopenharmony_ci * pname:tz is the z component of the post-rotation translation 1452e5c31af7Sopenharmony_ci 1453e5c31af7Sopenharmony_ciThis transform decomposition consists of three elements. 1454e5c31af7Sopenharmony_ciThe first is a matrix S, consisting of a scale, shear, and translation, 1455e5c31af7Sopenharmony_ciusually used to define the pivot point of the following rotation. 1456e5c31af7Sopenharmony_ciThis matrix is constructed from the parameters above by: 1457e5c31af7Sopenharmony_ci 1458e5c31af7Sopenharmony_ci[latexmath] 1459e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1460e5c31af7Sopenharmony_ciS = 1461e5c31af7Sopenharmony_ci\left( 1462e5c31af7Sopenharmony_ci \begin{matrix} 1463e5c31af7Sopenharmony_ci sx & a & b & pvx \\ 1464e5c31af7Sopenharmony_ci 0 & sy & c & pvy \\ 1465e5c31af7Sopenharmony_ci 0 & 0 & sz & pvz 1466e5c31af7Sopenharmony_ci \end{matrix} 1467e5c31af7Sopenharmony_ci\right) 1468e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1469e5c31af7Sopenharmony_ci 1470e5c31af7Sopenharmony_ciThe rotation quaternion is defined as: 1471e5c31af7Sopenharmony_ci 1472e5c31af7Sopenharmony_ci {empty}:: [eq]#code:R = [ pname:qx, pname:qy, pname:qz, pname:qw ]# 1473e5c31af7Sopenharmony_ci 1474e5c31af7Sopenharmony_ciThis is a rotation around a conceptual normalized axis [eq]#[ ax, ay, az ]# 1475e5c31af7Sopenharmony_ciof amount code:theta such that: 1476e5c31af7Sopenharmony_ci 1477e5c31af7Sopenharmony_ci {empty}:: [eq]#[ pname:qx, pname:qy, pname:qz ] = sin(code:theta/2) 1478e5c31af7Sopenharmony_ci {times} [ code:ax, code:ay, code:az ]# 1479e5c31af7Sopenharmony_ci 1480e5c31af7Sopenharmony_ciand 1481e5c31af7Sopenharmony_ci 1482e5c31af7Sopenharmony_ci {empty}:: [eq]#pname:qw = cos(code:theta/2)# 1483e5c31af7Sopenharmony_ci 1484e5c31af7Sopenharmony_ciFinally, the transform has a translation T constructed from the parameters 1485e5c31af7Sopenharmony_ciabove by: 1486e5c31af7Sopenharmony_ci 1487e5c31af7Sopenharmony_ci[latexmath] 1488e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1489e5c31af7Sopenharmony_ciT = 1490e5c31af7Sopenharmony_ci\left( 1491e5c31af7Sopenharmony_ci \begin{matrix} 1492e5c31af7Sopenharmony_ci 1 & 0 & 0 & tx \\ 1493e5c31af7Sopenharmony_ci 0 & 1 & 0 & ty \\ 1494e5c31af7Sopenharmony_ci 0 & 0 & 1 & tz 1495e5c31af7Sopenharmony_ci \end{matrix} 1496e5c31af7Sopenharmony_ci\right) 1497e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1498e5c31af7Sopenharmony_ci 1499e5c31af7Sopenharmony_ciThe effective derived transform is then given by 1500e5c31af7Sopenharmony_ci 1501e5c31af7Sopenharmony_ci {empty}:: [eq]#code:T {times} code:R {times} code:S# 1502e5c31af7Sopenharmony_ci 1503e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkSRTDataNV.adoc[] 1504e5c31af7Sopenharmony_ci-- 1505e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 1506e5c31af7Sopenharmony_ci 1507e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1508e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureBuildRangeInfoKHR',desc='Structure specifying build offsets and counts for acceleration structure builds',type='structs'] 1509e5c31af7Sopenharmony_ci-- 1510e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureBuildOffsetInfoKHR 1511e5c31af7Sopenharmony_ci 1512e5c31af7Sopenharmony_cisname:VkAccelerationStructureBuildRangeInfoKHR is defined as: 1513e5c31af7Sopenharmony_ci 1514e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureBuildRangeInfoKHR.adoc[] 1515e5c31af7Sopenharmony_ci 1516e5c31af7Sopenharmony_ci * pname:primitiveCount defines the number of primitives for a 1517e5c31af7Sopenharmony_ci corresponding acceleration structure geometry. 1518e5c31af7Sopenharmony_ci * pname:primitiveOffset defines an offset in bytes into the memory where 1519e5c31af7Sopenharmony_ci primitive data is defined. 1520e5c31af7Sopenharmony_ci * pname:firstVertex is the index of the first vertex to build from for 1521e5c31af7Sopenharmony_ci triangle geometry. 1522e5c31af7Sopenharmony_ci * pname:transformOffset defines an offset in bytes into the memory where a 1523e5c31af7Sopenharmony_ci transform matrix is defined. 1524e5c31af7Sopenharmony_ci 1525e5c31af7Sopenharmony_ciThe primitive count and primitive offset are interpreted differently 1526e5c31af7Sopenharmony_cidepending on the elink:VkGeometryTypeKHR used: 1527e5c31af7Sopenharmony_ci 1528e5c31af7Sopenharmony_ci * For geometries of type ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, 1529e5c31af7Sopenharmony_ci pname:primitiveCount is the number of triangles to be built, where each 1530e5c31af7Sopenharmony_ci triangle is treated as 3 vertices. 1531e5c31af7Sopenharmony_ci ** If the geometry uses indices, [eq]#pname:primitiveCount {times} 3# 1532e5c31af7Sopenharmony_ci indices are consumed from 1533e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:indexData, 1534e5c31af7Sopenharmony_ci starting at an offset of pname:primitiveOffset. 1535e5c31af7Sopenharmony_ci The value of pname:firstVertex is added to the index values before 1536e5c31af7Sopenharmony_ci fetching vertices. 1537e5c31af7Sopenharmony_ci ** If the geometry does not use indices, [eq]#pname:primitiveCount {times} 1538e5c31af7Sopenharmony_ci 3# vertices are consumed from 1539e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:vertexData, 1540e5c31af7Sopenharmony_ci starting at an offset of [eq]#pname:primitiveOffset {plus} 1541e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:vertexStride 1542e5c31af7Sopenharmony_ci {times} pname:firstVertex#. 1543e5c31af7Sopenharmony_ci ** If 1544e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:transformData 1545e5c31af7Sopenharmony_ci is not `NULL`, a single slink:VkTransformMatrixKHR structure is 1546e5c31af7Sopenharmony_ci consumed from 1547e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:transformData, 1548e5c31af7Sopenharmony_ci at an offset of pname:transformOffset. 1549e5c31af7Sopenharmony_ci This matrix describes a transformation from the space in which the 1550e5c31af7Sopenharmony_ci vertices for all triangles in this geometry are described to the space 1551e5c31af7Sopenharmony_ci in which the acceleration structure is defined. 1552e5c31af7Sopenharmony_ci * For geometries of type ename:VK_GEOMETRY_TYPE_AABBS_KHR, 1553e5c31af7Sopenharmony_ci pname:primitiveCount is the number of axis-aligned bounding boxes. 1554e5c31af7Sopenharmony_ci pname:primitiveCount slink:VkAabbPositionsKHR structures are consumed 1555e5c31af7Sopenharmony_ci from slink:VkAccelerationStructureGeometryAabbsDataKHR::pname:data, 1556e5c31af7Sopenharmony_ci starting at an offset of pname:primitiveOffset. 1557e5c31af7Sopenharmony_ci * For geometries of type ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, 1558e5c31af7Sopenharmony_ci pname:primitiveCount is the number of acceleration structures. 1559e5c31af7Sopenharmony_ci pname:primitiveCount slink:VkAccelerationStructureInstanceKHR 1560e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 1561e5c31af7Sopenharmony_ci or slink:VkAccelerationStructureMotionInstanceNV 1562e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 1563e5c31af7Sopenharmony_ci structures are consumed from 1564e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryInstancesDataKHR::pname:data, 1565e5c31af7Sopenharmony_ci starting at an offset of pname:primitiveOffset. 1566e5c31af7Sopenharmony_ci 1567e5c31af7Sopenharmony_ci.Valid Usage 1568e5c31af7Sopenharmony_ci**** 1569e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03656]] 1570e5c31af7Sopenharmony_ci For geometries of type ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the 1571e5c31af7Sopenharmony_ci geometry uses indices, the offset pname:primitiveOffset from 1572e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:indexData 1573e5c31af7Sopenharmony_ci must: be a multiple of the element size of 1574e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:indexType 1575e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03657]] 1576e5c31af7Sopenharmony_ci For geometries of type ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if the 1577e5c31af7Sopenharmony_ci geometry does not use indices, the offset pname:primitiveOffset from 1578e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:vertexData 1579e5c31af7Sopenharmony_ci must: be a multiple of the component size of 1580e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:vertexFormat 1581e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildRangeInfoKHR-transformOffset-03658]] 1582e5c31af7Sopenharmony_ci For geometries of type ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, the offset 1583e5c31af7Sopenharmony_ci pname:transformOffset from 1584e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryTrianglesDataKHR::pname:transformData 1585e5c31af7Sopenharmony_ci must: be a multiple of 16 1586e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03659]] 1587e5c31af7Sopenharmony_ci For geometries of type ename:VK_GEOMETRY_TYPE_AABBS_KHR, the offset 1588e5c31af7Sopenharmony_ci pname:primitiveOffset from 1589e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryAabbsDataKHR::pname:data must: be a 1590e5c31af7Sopenharmony_ci multiple of 8 1591e5c31af7Sopenharmony_ci * [[VUID-VkAccelerationStructureBuildRangeInfoKHR-primitiveOffset-03660]] 1592e5c31af7Sopenharmony_ci For geometries of type ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, the offset 1593e5c31af7Sopenharmony_ci pname:primitiveOffset from 1594e5c31af7Sopenharmony_ci slink:VkAccelerationStructureGeometryInstancesDataKHR::pname:data must: 1595e5c31af7Sopenharmony_ci be a multiple of 16 1596e5c31af7Sopenharmony_ci**** 1597e5c31af7Sopenharmony_ci 1598e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureBuildRangeInfoKHR.adoc[] 1599e5c31af7Sopenharmony_ci-- 1600e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1601e5c31af7Sopenharmony_ci 1602e5c31af7Sopenharmony_ci 1603e5c31af7Sopenharmony_ci[[acceleration-structure-copying]] 1604e5c31af7Sopenharmony_ci=== Copying Acceleration Structures 1605e5c31af7Sopenharmony_ci 1606e5c31af7Sopenharmony_ciAn additional command exists for copying acceleration structures without 1607e5c31af7Sopenharmony_ciupdating their contents. 1608e5c31af7Sopenharmony_ciThe acceleration structure object can: be compacted in order to improve 1609e5c31af7Sopenharmony_ciperformance. 1610e5c31af7Sopenharmony_ciBefore copying, an application must: query the size of the resulting 1611e5c31af7Sopenharmony_ciacceleration structure. 1612e5c31af7Sopenharmony_ci 1613e5c31af7Sopenharmony_ci[open,refpage='vkCmdWriteAccelerationStructuresPropertiesKHR',desc='Write acceleration structure result parameters to query results.',type='protos'] 1614e5c31af7Sopenharmony_ci-- 1615e5c31af7Sopenharmony_ci:refpage: vkCmdWriteAccelerationStructuresPropertiesKHR 1616e5c31af7Sopenharmony_ci 1617e5c31af7Sopenharmony_ciTo query acceleration structure size parameters call: 1618e5c31af7Sopenharmony_ci 1619e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1620e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWriteAccelerationStructuresPropertiesKHR.adoc[] 1621e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1622e5c31af7Sopenharmony_ci 1623e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1624e5c31af7Sopenharmony_ci recorded. 1625e5c31af7Sopenharmony_ci * pname:accelerationStructureCount is the count of acceleration structures 1626e5c31af7Sopenharmony_ci for which to query the property. 1627e5c31af7Sopenharmony_ci * pname:pAccelerationStructures is a pointer to an array of existing 1628e5c31af7Sopenharmony_ci previously built acceleration structures. 1629e5c31af7Sopenharmony_ci * pname:queryType is a elink:VkQueryType value specifying the type of 1630e5c31af7Sopenharmony_ci queries managed by the pool. 1631e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that will manage the results of the 1632e5c31af7Sopenharmony_ci query. 1633e5c31af7Sopenharmony_ci * pname:firstQuery is the first query index within the query pool that 1634e5c31af7Sopenharmony_ci will contain the pname:accelerationStructureCount number of results. 1635e5c31af7Sopenharmony_ci 1636e5c31af7Sopenharmony_ciAccesses to any of the acceleration structures listed in 1637e5c31af7Sopenharmony_cipname:pAccelerationStructures must: be <<synchronization-dependencies, 1638e5c31af7Sopenharmony_cisynchronized>> with the 1639e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1640e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 1641e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 1642e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1643e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1644e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an 1645e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 1646e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR. 1647e5c31af7Sopenharmony_ci 1648e5c31af7Sopenharmony_ci * If pname:queryType is 1649e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR, then the 1650e5c31af7Sopenharmony_ci value written out is the number of bytes required by a compacted 1651e5c31af7Sopenharmony_ci acceleration structure. 1652e5c31af7Sopenharmony_ci * If pname:queryType is 1653e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR, then 1654e5c31af7Sopenharmony_ci the value written out is the number of bytes required by a serialized 1655e5c31af7Sopenharmony_ci acceleration structure. 1656e5c31af7Sopenharmony_ci 1657e5c31af7Sopenharmony_ci.Valid Usage 1658e5c31af7Sopenharmony_ci**** 1659e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-accelerationStructure-08924]] 1660e5c31af7Sopenharmony_ci The <<features-accelerationStructure, 1661e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructure>> 1662e5c31af7Sopenharmony_ci feature must: be enabled 1663e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-queryPool-02493]] 1664e5c31af7Sopenharmony_ci pname:queryPool must: have been created with a pname:queryType matching 1665e5c31af7Sopenharmony_ci pname:queryType 1666e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-queryPool-02494]] 1667e5c31af7Sopenharmony_ci The queries identified by pname:queryPool and pname:firstQuery must: be 1668e5c31af7Sopenharmony_ci _unavailable_ 1669e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-buffer-03736]] 1670e5c31af7Sopenharmony_ci The pname:buffer used to create each acceleration structure in 1671e5c31af7Sopenharmony_ci pname:pAccelerationStructures must: be bound to device memory 1672e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-query-04880]] 1673e5c31af7Sopenharmony_ci The sum of pname:query plus pname:accelerationStructureCount must: be 1674e5c31af7Sopenharmony_ci less than or equal to the number of queries in pname:queryPool 1675e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/write_acceleration_structure_properties_common.adoc[] 1676e5c31af7Sopenharmony_ci**** 1677e5c31af7Sopenharmony_ci 1678e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdWriteAccelerationStructuresPropertiesKHR.adoc[] 1679e5c31af7Sopenharmony_ci-- 1680e5c31af7Sopenharmony_ci 1681e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 1682e5c31af7Sopenharmony_ci[open,refpage='vkCmdWriteAccelerationStructuresPropertiesNV',desc='Write acceleration structure result parameters to query results.',type='protos'] 1683e5c31af7Sopenharmony_ci-- 1684e5c31af7Sopenharmony_ci:refpage: vkCmdWriteAccelerationStructuresPropertiesNV 1685e5c31af7Sopenharmony_ci 1686e5c31af7Sopenharmony_ciTo query acceleration structure size parameters call: 1687e5c31af7Sopenharmony_ci 1688e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdWriteAccelerationStructuresPropertiesNV.adoc[] 1689e5c31af7Sopenharmony_ci 1690e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1691e5c31af7Sopenharmony_ci recorded. 1692e5c31af7Sopenharmony_ci * pname:accelerationStructureCount is the count of acceleration structures 1693e5c31af7Sopenharmony_ci for which to query the property. 1694e5c31af7Sopenharmony_ci * pname:pAccelerationStructures is a pointer to an array of existing 1695e5c31af7Sopenharmony_ci previously built acceleration structures. 1696e5c31af7Sopenharmony_ci * pname:queryType is a elink:VkQueryType value specifying the type of 1697e5c31af7Sopenharmony_ci queries managed by the pool. 1698e5c31af7Sopenharmony_ci * pname:queryPool is the query pool that will manage the results of the 1699e5c31af7Sopenharmony_ci query. 1700e5c31af7Sopenharmony_ci * pname:firstQuery is the first query index within the query pool that 1701e5c31af7Sopenharmony_ci will contain the pname:accelerationStructureCount number of results. 1702e5c31af7Sopenharmony_ci 1703e5c31af7Sopenharmony_ciAccesses to any of the acceleration structures listed in 1704e5c31af7Sopenharmony_cipname:pAccelerationStructures must: be <<synchronization-dependencies, 1705e5c31af7Sopenharmony_cisynchronized>> with the 1706e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1707e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> and an 1708e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 1709e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR. 1710e5c31af7Sopenharmony_ci 1711e5c31af7Sopenharmony_ci.Valid Usage 1712e5c31af7Sopenharmony_ci**** 1713e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-queryPool-03755]] 1714e5c31af7Sopenharmony_ci pname:queryPool must: have been created with a pname:queryType matching 1715e5c31af7Sopenharmony_ci pname:queryType 1716e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-queryPool-03756]] 1717e5c31af7Sopenharmony_ci The queries identified by pname:queryPool and pname:firstQuery must: be 1718e5c31af7Sopenharmony_ci _unavailable_ 1719e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-accelerationStructure-03757]] 1720e5c31af7Sopenharmony_ci pname:accelerationStructure must: be bound completely and contiguously 1721e5c31af7Sopenharmony_ci to a single sname:VkDeviceMemory object via 1722e5c31af7Sopenharmony_ci flink:vkBindAccelerationStructureMemoryNV 1723e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-pAccelerationStructures-04958]] 1724e5c31af7Sopenharmony_ci All acceleration structures in pname:pAccelerationStructures must: have 1725e5c31af7Sopenharmony_ci been built prior to the execution of this command 1726e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-pAccelerationStructures-06215]] 1727e5c31af7Sopenharmony_ci All acceleration structures in pname:pAccelerationStructures must: have 1728e5c31af7Sopenharmony_ci been built with 1729e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR if 1730e5c31af7Sopenharmony_ci pname:queryType is 1731e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV 1732e5c31af7Sopenharmony_ci * [[VUID-vkCmdWriteAccelerationStructuresPropertiesNV-queryType-06216]] 1733e5c31af7Sopenharmony_ci pname:queryType must: be 1734e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV 1735e5c31af7Sopenharmony_ci**** 1736e5c31af7Sopenharmony_ci 1737e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdWriteAccelerationStructuresPropertiesNV.adoc[] 1738e5c31af7Sopenharmony_ci-- 1739e5c31af7Sopenharmony_ci 1740e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyAccelerationStructureNV',desc='Copy an acceleration structure',type='protos'] 1741e5c31af7Sopenharmony_ci-- 1742e5c31af7Sopenharmony_ci:refpage: vkCmdCopyAccelerationStructureNV 1743e5c31af7Sopenharmony_ci 1744e5c31af7Sopenharmony_ciTo copy an acceleration structure call: 1745e5c31af7Sopenharmony_ci 1746e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyAccelerationStructureNV.adoc[] 1747e5c31af7Sopenharmony_ci 1748e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1749e5c31af7Sopenharmony_ci recorded. 1750e5c31af7Sopenharmony_ci * pname:dst is the target acceleration structure for the copy. 1751e5c31af7Sopenharmony_ci * pname:src is the source acceleration structure for the copy. 1752e5c31af7Sopenharmony_ci * pname:mode is a elink:VkCopyAccelerationStructureModeKHR value 1753e5c31af7Sopenharmony_ci specifying additional operations to perform during the copy. 1754e5c31af7Sopenharmony_ci 1755e5c31af7Sopenharmony_ciAccesses to pname:src and pname:dst must: be <<synchronization-dependencies, 1756e5c31af7Sopenharmony_cisynchronized>> with the 1757e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1758e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 1759e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 1760e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1761e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1762e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an 1763e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 1764e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR or 1765e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR as appropriate. 1766e5c31af7Sopenharmony_ci 1767e5c31af7Sopenharmony_ci.Valid Usage 1768e5c31af7Sopenharmony_ci**** 1769e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_acceleration_structure_common.adoc[] 1770e5c31af7Sopenharmony_ci**** 1771e5c31af7Sopenharmony_ci 1772e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyAccelerationStructureNV.adoc[] 1773e5c31af7Sopenharmony_ci-- 1774e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 1775e5c31af7Sopenharmony_ci 1776e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1777e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyAccelerationStructureKHR',desc='Copy an acceleration structure',type='protos'] 1778e5c31af7Sopenharmony_ci-- 1779e5c31af7Sopenharmony_ci:refpage: vkCmdCopyAccelerationStructureKHR 1780e5c31af7Sopenharmony_ci 1781e5c31af7Sopenharmony_ciTo copy an acceleration structure call: 1782e5c31af7Sopenharmony_ci 1783e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyAccelerationStructureKHR.adoc[] 1784e5c31af7Sopenharmony_ci 1785e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1786e5c31af7Sopenharmony_ci recorded. 1787e5c31af7Sopenharmony_ci * pname:pInfo is a pointer to a slink:VkCopyAccelerationStructureInfoKHR 1788e5c31af7Sopenharmony_ci structure defining the copy operation. 1789e5c31af7Sopenharmony_ci 1790e5c31af7Sopenharmony_ciThis command copies the pname:pInfo->src acceleration structure to the 1791e5c31af7Sopenharmony_cipname:pInfo->dst acceleration structure in the manner specified by 1792e5c31af7Sopenharmony_cipname:pInfo->mode. 1793e5c31af7Sopenharmony_ci 1794e5c31af7Sopenharmony_ciAccesses to pname:pInfo->src and pname:pInfo->dst must: be 1795e5c31af7Sopenharmony_ci<<synchronization-dependencies, synchronized>> with the 1796e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1797e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 1798e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 1799e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1800e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1801e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an 1802e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 1803e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR or 1804e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR as appropriate. 1805e5c31af7Sopenharmony_ci 1806e5c31af7Sopenharmony_ci.Valid Usage 1807e5c31af7Sopenharmony_ci**** 1808e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureKHR-accelerationStructure-08925]] 1809e5c31af7Sopenharmony_ci The <<features-accelerationStructure, 1810e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructure>> 1811e5c31af7Sopenharmony_ci feature must: be enabled 1812e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureKHR-buffer-03737]] 1813e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->src must: be bound to 1814e5c31af7Sopenharmony_ci device memory 1815e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureKHR-buffer-03738]] 1816e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->dst must: be bound to 1817e5c31af7Sopenharmony_ci device memory 1818e5c31af7Sopenharmony_ci**** 1819e5c31af7Sopenharmony_ci 1820e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyAccelerationStructureKHR.adoc[] 1821e5c31af7Sopenharmony_ci-- 1822e5c31af7Sopenharmony_ci 1823e5c31af7Sopenharmony_ci[open,refpage='VkCopyAccelerationStructureInfoKHR',desc='Parameters for copying an acceleration structure',type='structs'] 1824e5c31af7Sopenharmony_ci-- 1825e5c31af7Sopenharmony_ci:refpage: VkCopyAccelerationStructureInfoKHR 1826e5c31af7Sopenharmony_ci 1827e5c31af7Sopenharmony_ciThe sname:VkCopyAccelerationStructureInfoKHR structure is defined as: 1828e5c31af7Sopenharmony_ci 1829e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyAccelerationStructureInfoKHR.adoc[] 1830e5c31af7Sopenharmony_ci 1831e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 1832e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1833e5c31af7Sopenharmony_ci structure. 1834e5c31af7Sopenharmony_ci * pname:src is the source acceleration structure for the copy. 1835e5c31af7Sopenharmony_ci * pname:dst is the target acceleration structure for the copy. 1836e5c31af7Sopenharmony_ci * pname:mode is a elink:VkCopyAccelerationStructureModeKHR value 1837e5c31af7Sopenharmony_ci specifying additional operations to perform during the copy. 1838e5c31af7Sopenharmony_ci 1839e5c31af7Sopenharmony_ci.Valid Usage 1840e5c31af7Sopenharmony_ci**** 1841e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_acceleration_structure_common.adoc[] 1842e5c31af7Sopenharmony_ci**** 1843e5c31af7Sopenharmony_ci 1844e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyAccelerationStructureInfoKHR.adoc[] 1845e5c31af7Sopenharmony_ci-- 1846e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1847e5c31af7Sopenharmony_ci 1848e5c31af7Sopenharmony_ci[open,refpage='VkCopyAccelerationStructureModeKHR',desc='Acceleration structure copy mode',type='enums',alias='VkCopyAccelerationStructureModeNV'] 1849e5c31af7Sopenharmony_ci-- 1850e5c31af7Sopenharmony_ci:refpage: VkCopyAccelerationStructureModeKHR 1851e5c31af7Sopenharmony_ci 1852e5c31af7Sopenharmony_ciPossible values of pname:mode specifying additional operations to perform 1853e5c31af7Sopenharmony_ciduring the copy, are: 1854e5c31af7Sopenharmony_ci 1855e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCopyAccelerationStructureModeKHR.adoc[] 1856e5c31af7Sopenharmony_ci 1857e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 1858e5c31af7Sopenharmony_cior the equivalent 1859e5c31af7Sopenharmony_ci 1860e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCopyAccelerationStructureModeNV.adoc[] 1861e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 1862e5c31af7Sopenharmony_ci 1863e5c31af7Sopenharmony_ci * ename:VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR creates a direct 1864e5c31af7Sopenharmony_ci copy of the acceleration structure specified in pname:src into the one 1865e5c31af7Sopenharmony_ci specified by pname:dst. 1866e5c31af7Sopenharmony_ci The pname:dst acceleration structure must: have been created with the 1867e5c31af7Sopenharmony_ci same parameters as pname:src. 1868e5c31af7Sopenharmony_ci If pname:src contains references to other acceleration structures, 1869e5c31af7Sopenharmony_ci pname:dst will reference the same acceleration structures. 1870e5c31af7Sopenharmony_ci * ename:VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR creates a more 1871e5c31af7Sopenharmony_ci compact version of an acceleration structure pname:src into pname:dst. 1872e5c31af7Sopenharmony_ci The acceleration structure pname:dst must: have been created with a size 1873e5c31af7Sopenharmony_ci at least as large as that returned by 1874e5c31af7Sopenharmony_ci flink:vkCmdWriteAccelerationStructuresPropertiesKHR 1875e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1876e5c31af7Sopenharmony_ci or flink:vkWriteAccelerationStructuresPropertiesKHR 1877e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1878e5c31af7Sopenharmony_ci after the build of the acceleration structure specified by pname:src. 1879e5c31af7Sopenharmony_ci If pname:src contains references to other acceleration structures, 1880e5c31af7Sopenharmony_ci pname:dst will reference the same acceleration structures. 1881e5c31af7Sopenharmony_ci * ename:VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR serializes the 1882e5c31af7Sopenharmony_ci acceleration structure to a semi-opaque format which can be reloaded on 1883e5c31af7Sopenharmony_ci a compatible implementation. 1884e5c31af7Sopenharmony_ci * ename:VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR deserializes 1885e5c31af7Sopenharmony_ci the semi-opaque serialization format in the buffer to the acceleration 1886e5c31af7Sopenharmony_ci structure. 1887e5c31af7Sopenharmony_ci-- 1888e5c31af7Sopenharmony_ci 1889e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyAccelerationStructureToMemoryKHR',desc='Copy an acceleration structure to device memory',type='protos'] 1890e5c31af7Sopenharmony_ci-- 1891e5c31af7Sopenharmony_ci:refpage: vkCmdCopyAccelerationStructureToMemoryKHR 1892e5c31af7Sopenharmony_ci 1893e5c31af7Sopenharmony_ciTo copy an acceleration structure to device memory call: 1894e5c31af7Sopenharmony_ci 1895e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyAccelerationStructureToMemoryKHR.adoc[] 1896e5c31af7Sopenharmony_ci 1897e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1898e5c31af7Sopenharmony_ci recorded. 1899e5c31af7Sopenharmony_ci * pname:pInfo is an a pointer to a 1900e5c31af7Sopenharmony_ci slink:VkCopyAccelerationStructureToMemoryInfoKHR structure defining the 1901e5c31af7Sopenharmony_ci copy operation. 1902e5c31af7Sopenharmony_ci 1903e5c31af7Sopenharmony_ciAccesses to pname:pInfo->src must: be <<synchronization-dependencies, 1904e5c31af7Sopenharmony_cisynchronized>> with the 1905e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1906e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 1907e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 1908e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1909e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1910e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an 1911e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 1912e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR. 1913e5c31af7Sopenharmony_ciAccesses to the buffer indicated by pname:pInfo->dst.deviceAddress must: be 1914e5c31af7Sopenharmony_cisynchronized with the 1915e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 1916e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 1917e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 1918e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 1919e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 1920e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an and an access 1921e5c31af7Sopenharmony_citype of ename:VK_ACCESS_TRANSFER_WRITE_BIT. 1922e5c31af7Sopenharmony_ci 1923e5c31af7Sopenharmony_ciThis command produces the same results as 1924e5c31af7Sopenharmony_ciflink:vkCopyAccelerationStructureToMemoryKHR, but writes its result to a 1925e5c31af7Sopenharmony_cidevice address, and is executed on the device rather than the host. 1926e5c31af7Sopenharmony_ciThe output may: not necessarily be bit-for-bit identical, but it can be 1927e5c31af7Sopenharmony_ciequally used by either flink:vkCmdCopyMemoryToAccelerationStructureKHR or 1928e5c31af7Sopenharmony_ciflink:vkCopyMemoryToAccelerationStructureKHR. 1929e5c31af7Sopenharmony_ci 1930e5c31af7Sopenharmony_ci[[serialized-as-header]] 1931e5c31af7Sopenharmony_ciThe defined header structure for the serialized data consists of: 1932e5c31af7Sopenharmony_ci 1933e5c31af7Sopenharmony_ci * ename:VK_UUID_SIZE bytes of data matching 1934e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceIDProperties::pname:driverUUID 1935e5c31af7Sopenharmony_ci * ename:VK_UUID_SIZE bytes of data identifying the compatibility for 1936e5c31af7Sopenharmony_ci comparison using flink:vkGetDeviceAccelerationStructureCompatibilityKHR 1937e5c31af7Sopenharmony_ci * A 64-bit integer of the total size matching the value queried using 1938e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR 1939e5c31af7Sopenharmony_ci * A 64-bit integer of the deserialized size to be passed in to 1940e5c31af7Sopenharmony_ci sname:VkAccelerationStructureCreateInfoKHR::pname:size 1941e5c31af7Sopenharmony_ci * A 64-bit integer of the count of the number of acceleration structure 1942e5c31af7Sopenharmony_ci handles following. 1943e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_maintenance1[] 1944e5c31af7Sopenharmony_ci This value matches the value queried using 1945e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR. 1946e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_maintenance1[] 1947e5c31af7Sopenharmony_ci This will be zero for a bottom-level acceleration structure. 1948e5c31af7Sopenharmony_ci For top-level acceleration structures this number is 1949e5c31af7Sopenharmony_ci implementation-dependent; the number of and ordering of the handles may 1950e5c31af7Sopenharmony_ci not match the instance descriptions which were used to build the 1951e5c31af7Sopenharmony_ci acceleration structure. 1952e5c31af7Sopenharmony_ci 1953e5c31af7Sopenharmony_ciThe corresponding handles matching the values returned by 1954e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[flink:vkGetAccelerationStructureDeviceAddressKHR] 1955e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure+VK_NV_ray_tracing[or] 1956e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[flink:vkGetAccelerationStructureHandleNV] 1957e5c31af7Sopenharmony_ciare tightly packed in the buffer following the count. 1958e5c31af7Sopenharmony_ciThe application is expected to store a mapping between those handles and the 1959e5c31af7Sopenharmony_cioriginal application-generated bottom-level acceleration structures to 1960e5c31af7Sopenharmony_ciprovide when deserializing. 1961e5c31af7Sopenharmony_ciThe serialized data is written to the buffer (or read from the buffer) 1962e5c31af7Sopenharmony_ciaccording to the host endianness. 1963e5c31af7Sopenharmony_ci 1964e5c31af7Sopenharmony_ci.Valid Usage 1965e5c31af7Sopenharmony_ci**** 1966e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureToMemoryKHR-accelerationStructure-08926]] 1967e5c31af7Sopenharmony_ci The <<features-accelerationStructure, 1968e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructure>> 1969e5c31af7Sopenharmony_ci feature must: be enabled 1970e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureToMemoryKHR-pInfo-03739]] 1971e5c31af7Sopenharmony_ci pname:pInfo->dst.deviceAddress must: be a valid device address for a 1972e5c31af7Sopenharmony_ci buffer bound to device memory 1973e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureToMemoryKHR-pInfo-03740]] 1974e5c31af7Sopenharmony_ci pname:pInfo->dst.deviceAddress must: be aligned to `256` bytes 1975e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureToMemoryKHR-pInfo-03741]] 1976e5c31af7Sopenharmony_ci If the buffer pointed to by pname:pInfo->dst.deviceAddress is non-sparse 1977e5c31af7Sopenharmony_ci then it must: be bound completely and contiguously to a single 1978e5c31af7Sopenharmony_ci slink:VkDeviceMemory object 1979e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyAccelerationStructureToMemoryKHR-None-03559]] 1980e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->src must: be bound to 1981e5c31af7Sopenharmony_ci device memory 1982e5c31af7Sopenharmony_ci**** 1983e5c31af7Sopenharmony_ci 1984e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyAccelerationStructureToMemoryKHR.adoc[] 1985e5c31af7Sopenharmony_ci-- 1986e5c31af7Sopenharmony_ci 1987e5c31af7Sopenharmony_ci[open,refpage='VkCopyAccelerationStructureToMemoryInfoKHR',desc='Parameters for serializing an acceleration structure',type='structs'] 1988e5c31af7Sopenharmony_ci-- 1989e5c31af7Sopenharmony_ci:refpage: VkCopyAccelerationStructureToMemoryInfoKHR 1990e5c31af7Sopenharmony_ci 1991e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyAccelerationStructureToMemoryInfoKHR.adoc[] 1992e5c31af7Sopenharmony_ci 1993e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 1994e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1995e5c31af7Sopenharmony_ci structure. 1996e5c31af7Sopenharmony_ci * pname:src is the source acceleration structure for the copy 1997e5c31af7Sopenharmony_ci * pname:dst is the device or host address to memory which is the target 1998e5c31af7Sopenharmony_ci for the copy 1999e5c31af7Sopenharmony_ci * pname:mode is a elink:VkCopyAccelerationStructureModeKHR value 2000e5c31af7Sopenharmony_ci specifying additional operations to perform during the copy. 2001e5c31af7Sopenharmony_ci 2002e5c31af7Sopenharmony_ci.Valid Usage 2003e5c31af7Sopenharmony_ci**** 2004e5c31af7Sopenharmony_ci * [[VUID-VkCopyAccelerationStructureToMemoryInfoKHR-src-04959]] 2005e5c31af7Sopenharmony_ci The source acceleration structure pname:src must: have been constructed 2006e5c31af7Sopenharmony_ci prior to the execution of this command 2007e5c31af7Sopenharmony_ci * [[VUID-VkCopyAccelerationStructureToMemoryInfoKHR-dst-03561]] 2008e5c31af7Sopenharmony_ci The memory pointed to by pname:dst must: be at least as large as the 2009e5c31af7Sopenharmony_ci serialization size of pname:src, as reported by 2010e5c31af7Sopenharmony_ci flink:vkWriteAccelerationStructuresPropertiesKHR or 2011e5c31af7Sopenharmony_ci flink:vkCmdWriteAccelerationStructuresPropertiesKHR with a query type of 2012e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR 2013e5c31af7Sopenharmony_ci * [[VUID-VkCopyAccelerationStructureToMemoryInfoKHR-mode-03412]] 2014e5c31af7Sopenharmony_ci pname:mode must: be 2015e5c31af7Sopenharmony_ci ename:VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR 2016e5c31af7Sopenharmony_ci**** 2017e5c31af7Sopenharmony_ci 2018e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyAccelerationStructureToMemoryInfoKHR.adoc[] 2019e5c31af7Sopenharmony_ci-- 2020e5c31af7Sopenharmony_ci 2021e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyMemoryToAccelerationStructureKHR',desc='Copy device memory to an acceleration structure',type='protos'] 2022e5c31af7Sopenharmony_ci-- 2023e5c31af7Sopenharmony_ci:refpage: vkCmdCopyMemoryToAccelerationStructureKHR 2024e5c31af7Sopenharmony_ci 2025e5c31af7Sopenharmony_ciTo copy device memory to an acceleration structure call: 2026e5c31af7Sopenharmony_ci 2027e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyMemoryToAccelerationStructureKHR.adoc[] 2028e5c31af7Sopenharmony_ci 2029e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2030e5c31af7Sopenharmony_ci recorded. 2031e5c31af7Sopenharmony_ci * pname:pInfo is a pointer to a 2032e5c31af7Sopenharmony_ci slink:VkCopyMemoryToAccelerationStructureInfoKHR structure defining the 2033e5c31af7Sopenharmony_ci copy operation. 2034e5c31af7Sopenharmony_ci 2035e5c31af7Sopenharmony_ciAccesses to pname:pInfo->dst must: be <<synchronization-dependencies, 2036e5c31af7Sopenharmony_cisynchronized>> with the 2037e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 2038e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 2039e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 2040e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 2041e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 2042e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an 2043e5c31af7Sopenharmony_ci<<synchronization-access-types, access type>> of 2044e5c31af7Sopenharmony_ciename:VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR. 2045e5c31af7Sopenharmony_ciAccesses to the buffer indicated by pname:pInfo->src.deviceAddress must: be 2046e5c31af7Sopenharmony_cisynchronized with the 2047e5c31af7Sopenharmony_ciifdef::VK_KHR_synchronization2[] 2048e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR 2049e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>> or the 2050e5c31af7Sopenharmony_ciendif::VK_KHR_synchronization2[] 2051e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR 2052e5c31af7Sopenharmony_ci<<synchronization-pipeline-stages, pipeline stage>>, and an access type of 2053e5c31af7Sopenharmony_ciename:VK_ACCESS_TRANSFER_READ_BIT. 2054e5c31af7Sopenharmony_ci 2055e5c31af7Sopenharmony_ciThis command can accept acceleration structures produced by either 2056e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureToMemoryKHR or 2057e5c31af7Sopenharmony_ciflink:vkCopyAccelerationStructureToMemoryKHR. 2058e5c31af7Sopenharmony_ci 2059e5c31af7Sopenharmony_ciThe structure provided as input to deserialize is as described in 2060e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureToMemoryKHR, with any acceleration 2061e5c31af7Sopenharmony_cistructure handles filled in with the newly-queried handles to bottom level 2062e5c31af7Sopenharmony_ciacceleration structures created before deserialization. 2063e5c31af7Sopenharmony_ciThese do not need to be built at deserialize time, but must: be created. 2064e5c31af7Sopenharmony_ci 2065e5c31af7Sopenharmony_ci.Valid Usage 2066e5c31af7Sopenharmony_ci**** 2067e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyMemoryToAccelerationStructureKHR-accelerationStructure-08927]] 2068e5c31af7Sopenharmony_ci The <<features-accelerationStructure, 2069e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructure>> 2070e5c31af7Sopenharmony_ci feature must: be enabled 2071e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyMemoryToAccelerationStructureKHR-pInfo-03742]] 2072e5c31af7Sopenharmony_ci pname:pInfo->src.deviceAddress must: be a valid device address for a 2073e5c31af7Sopenharmony_ci buffer bound to device memory 2074e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyMemoryToAccelerationStructureKHR-pInfo-03743]] 2075e5c31af7Sopenharmony_ci pname:pInfo->src.deviceAddress must: be aligned to `256` bytes 2076e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyMemoryToAccelerationStructureKHR-pInfo-03744]] 2077e5c31af7Sopenharmony_ci If the buffer pointed to by pname:pInfo->src.deviceAddress is non-sparse 2078e5c31af7Sopenharmony_ci then it must: be bound completely and contiguously to a single 2079e5c31af7Sopenharmony_ci slink:VkDeviceMemory object 2080e5c31af7Sopenharmony_ci * [[VUID-vkCmdCopyMemoryToAccelerationStructureKHR-buffer-03745]] 2081e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->dst must: be bound to 2082e5c31af7Sopenharmony_ci device memory 2083e5c31af7Sopenharmony_ci**** 2084e5c31af7Sopenharmony_ci 2085e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyMemoryToAccelerationStructureKHR.adoc[] 2086e5c31af7Sopenharmony_ci-- 2087e5c31af7Sopenharmony_ci 2088e5c31af7Sopenharmony_ci[open,refpage='VkCopyMemoryToAccelerationStructureInfoKHR',desc='Parameters for deserializing an acceleration structure',type='structs'] 2089e5c31af7Sopenharmony_ci-- 2090e5c31af7Sopenharmony_ci:refpage: VkCopyMemoryToAccelerationStructureInfoKHR 2091e5c31af7Sopenharmony_ci 2092e5c31af7Sopenharmony_ciThe sname:VkCopyMemoryToAccelerationStructureInfoKHR structure is defined 2093e5c31af7Sopenharmony_cias: 2094e5c31af7Sopenharmony_ci 2095e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyMemoryToAccelerationStructureInfoKHR.adoc[] 2096e5c31af7Sopenharmony_ci 2097e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2098e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2099e5c31af7Sopenharmony_ci structure. 2100e5c31af7Sopenharmony_ci * pname:src is the device or host address to memory containing the source 2101e5c31af7Sopenharmony_ci data for the copy. 2102e5c31af7Sopenharmony_ci * pname:dst is the target acceleration structure for the copy. 2103e5c31af7Sopenharmony_ci * pname:mode is a elink:VkCopyAccelerationStructureModeKHR value 2104e5c31af7Sopenharmony_ci specifying additional operations to perform during the copy. 2105e5c31af7Sopenharmony_ci 2106e5c31af7Sopenharmony_ci.Valid Usage 2107e5c31af7Sopenharmony_ci**** 2108e5c31af7Sopenharmony_ci * [[VUID-VkCopyMemoryToAccelerationStructureInfoKHR-src-04960]] 2109e5c31af7Sopenharmony_ci The source memory pointed to by pname:src must: contain data previously 2110e5c31af7Sopenharmony_ci serialized using flink:vkCmdCopyAccelerationStructureToMemoryKHR, 2111e5c31af7Sopenharmony_ci potentially modified to relocate acceleration structure references as 2112e5c31af7Sopenharmony_ci described in that command 2113e5c31af7Sopenharmony_ci * [[VUID-VkCopyMemoryToAccelerationStructureInfoKHR-mode-03413]] 2114e5c31af7Sopenharmony_ci pname:mode must: be 2115e5c31af7Sopenharmony_ci ename:VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR 2116e5c31af7Sopenharmony_ci * [[VUID-VkCopyMemoryToAccelerationStructureInfoKHR-pInfo-03414]] 2117e5c31af7Sopenharmony_ci The data in pname:src must: have a format compatible with the 2118e5c31af7Sopenharmony_ci destination physical device as returned by 2119e5c31af7Sopenharmony_ci flink:vkGetDeviceAccelerationStructureCompatibilityKHR 2120e5c31af7Sopenharmony_ci * [[VUID-VkCopyMemoryToAccelerationStructureInfoKHR-dst-03746]] 2121e5c31af7Sopenharmony_ci pname:dst must: have been created with a pname:size greater than or 2122e5c31af7Sopenharmony_ci equal to that used to serialize the data in pname:src 2123e5c31af7Sopenharmony_ci**** 2124e5c31af7Sopenharmony_ci 2125e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyMemoryToAccelerationStructureInfoKHR.adoc[] 2126e5c31af7Sopenharmony_ci-- 2127e5c31af7Sopenharmony_ci 2128e5c31af7Sopenharmony_ci[open,refpage='vkGetDeviceAccelerationStructureCompatibilityKHR',desc='Check if a serialized acceleration structure is compatible with the current device',type='protos'] 2129e5c31af7Sopenharmony_ci-- 2130e5c31af7Sopenharmony_ci:refpage: vkGetDeviceAccelerationStructureCompatibilityKHR 2131e5c31af7Sopenharmony_ci 2132e5c31af7Sopenharmony_ciTo check if a serialized acceleration structure is compatible with the 2133e5c31af7Sopenharmony_cicurrent device call: 2134e5c31af7Sopenharmony_ci 2135e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetDeviceAccelerationStructureCompatibilityKHR.adoc[] 2136e5c31af7Sopenharmony_ci 2137e5c31af7Sopenharmony_ci * pname:device is the device to check the version against. 2138e5c31af7Sopenharmony_ci * pname:pVersionInfo is a pointer to a 2139e5c31af7Sopenharmony_ci slink:VkAccelerationStructureVersionInfoKHR structure specifying version 2140e5c31af7Sopenharmony_ci information to check against the device. 2141e5c31af7Sopenharmony_ci * pname:pCompatibility is a pointer to a 2142e5c31af7Sopenharmony_ci elink:VkAccelerationStructureCompatibilityKHR value in which 2143e5c31af7Sopenharmony_ci compatibility information is returned. 2144e5c31af7Sopenharmony_ci 2145e5c31af7Sopenharmony_ci.Valid Usage 2146e5c31af7Sopenharmony_ci**** 2147e5c31af7Sopenharmony_ci * [[VUID-vkGetDeviceAccelerationStructureCompatibilityKHR-accelerationStructure-08928]] 2148e5c31af7Sopenharmony_ci The <<features-accelerationStructure, 2149e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructure>> 2150e5c31af7Sopenharmony_ci feature must: be enabled 2151e5c31af7Sopenharmony_ci**** 2152e5c31af7Sopenharmony_ci 2153e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetDeviceAccelerationStructureCompatibilityKHR.adoc[] 2154e5c31af7Sopenharmony_ci-- 2155e5c31af7Sopenharmony_ci 2156e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureVersionInfoKHR',desc='Acceleration structure version information',type='structs'] 2157e5c31af7Sopenharmony_ci-- 2158e5c31af7Sopenharmony_ci:refpage: VkAccelerationStructureVersionKHR 2159e5c31af7Sopenharmony_ci 2160e5c31af7Sopenharmony_ciThe sname:VkAccelerationStructureVersionInfoKHR structure is defined as: 2161e5c31af7Sopenharmony_ci 2162e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkAccelerationStructureVersionInfoKHR.adoc[] 2163e5c31af7Sopenharmony_ci 2164e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2165e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2166e5c31af7Sopenharmony_ci structure. 2167e5c31af7Sopenharmony_ci * pname:pVersionData is a pointer to the version header of an acceleration 2168e5c31af7Sopenharmony_ci structure as defined in flink:vkCmdCopyAccelerationStructureToMemoryKHR 2169e5c31af7Sopenharmony_ci 2170e5c31af7Sopenharmony_ci[NOTE] 2171e5c31af7Sopenharmony_ci.Note 2172e5c31af7Sopenharmony_ci==== 2173e5c31af7Sopenharmony_cipname:pVersionData is a _pointer_ to an array of 2{times}ename:VK_UUID_SIZE 2174e5c31af7Sopenharmony_cicode:uint8_t values instead of two ename:VK_UUID_SIZE arrays as the expected 2175e5c31af7Sopenharmony_ciuse case for this member is to be pointed at the header of a previously 2176e5c31af7Sopenharmony_ciserialized acceleration structure (via 2177e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureToMemoryKHR or 2178e5c31af7Sopenharmony_ciflink:vkCopyAccelerationStructureToMemoryKHR) that is loaded in memory. 2179e5c31af7Sopenharmony_ciUsing arrays would necessitate extra memory copies of the UUIDs. 2180e5c31af7Sopenharmony_ci==== 2181e5c31af7Sopenharmony_ci 2182e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkAccelerationStructureVersionInfoKHR.adoc[] 2183e5c31af7Sopenharmony_ci-- 2184e5c31af7Sopenharmony_ci 2185e5c31af7Sopenharmony_ci[open,refpage='VkAccelerationStructureCompatibilityKHR',desc='Acceleration structure compatibility',type='enums'] 2186e5c31af7Sopenharmony_ci-- 2187e5c31af7Sopenharmony_ciPossible values of pname:pCompatibility returned by 2188e5c31af7Sopenharmony_ciflink:vkGetDeviceAccelerationStructureCompatibilityKHR are: 2189e5c31af7Sopenharmony_ci 2190e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkAccelerationStructureCompatibilityKHR.adoc[] 2191e5c31af7Sopenharmony_ci 2192e5c31af7Sopenharmony_ci * ename:VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR if the 2193e5c31af7Sopenharmony_ci pname:pVersionData version acceleration structure is compatible with 2194e5c31af7Sopenharmony_ci pname:device. 2195e5c31af7Sopenharmony_ci * ename:VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR if the 2196e5c31af7Sopenharmony_ci pname:pVersionData version acceleration structure is not compatible with 2197e5c31af7Sopenharmony_ci pname:device. 2198e5c31af7Sopenharmony_ci-- 2199e5c31af7Sopenharmony_ci 2200e5c31af7Sopenharmony_ci 2201e5c31af7Sopenharmony_ci[[host-acceleration-structure]] 2202e5c31af7Sopenharmony_ci== Host Acceleration Structure Operations 2203e5c31af7Sopenharmony_ci 2204e5c31af7Sopenharmony_ciImplementations are also required to provide host implementations of the 2205e5c31af7Sopenharmony_ciacceleration structure operations if the 2206e5c31af7Sopenharmony_ci<<features-accelerationStructureHostCommands, 2207e5c31af7Sopenharmony_cipname:accelerationStructureHostCommands>> feature is enabled: 2208e5c31af7Sopenharmony_ci 2209e5c31af7Sopenharmony_ci * flink:vkBuildAccelerationStructuresKHR corresponding to 2210e5c31af7Sopenharmony_ci flink:vkCmdBuildAccelerationStructuresKHR 2211e5c31af7Sopenharmony_ci * flink:vkCopyAccelerationStructureKHR corresponding to 2212e5c31af7Sopenharmony_ci flink:vkCmdCopyAccelerationStructureKHR 2213e5c31af7Sopenharmony_ci * flink:vkCopyAccelerationStructureToMemoryKHR corresponding to 2214e5c31af7Sopenharmony_ci flink:vkCmdCopyAccelerationStructureToMemoryKHR 2215e5c31af7Sopenharmony_ci * flink:vkCopyMemoryToAccelerationStructureKHR corresponding to 2216e5c31af7Sopenharmony_ci flink:vkCmdCopyMemoryToAccelerationStructureKHR 2217e5c31af7Sopenharmony_ci * flink:vkWriteAccelerationStructuresPropertiesKHR corresponding to 2218e5c31af7Sopenharmony_ci flink:vkCmdWriteAccelerationStructuresPropertiesKHR 2219e5c31af7Sopenharmony_ci 2220e5c31af7Sopenharmony_ciThese commands are functionally equivalent to their device counterparts, 2221e5c31af7Sopenharmony_ciexcept that they are executed on the host timeline, rather than being 2222e5c31af7Sopenharmony_cienqueued into command buffers. 2223e5c31af7Sopenharmony_ci 2224e5c31af7Sopenharmony_ciAll acceleration structures used by the host commands must: be bound to 2225e5c31af7Sopenharmony_cihost-visible memory, and all input data for acceleration structure builds 2226e5c31af7Sopenharmony_cimust: be referenced using host addresses instead of device addresses. 2227e5c31af7Sopenharmony_ciApplications are not required to map acceleration structure memory when 2228e5c31af7Sopenharmony_ciusing the host commands. 2229e5c31af7Sopenharmony_ci 2230e5c31af7Sopenharmony_ci 2231e5c31af7Sopenharmony_ci[NOTE] 2232e5c31af7Sopenharmony_ci.Note 2233e5c31af7Sopenharmony_ci==== 2234e5c31af7Sopenharmony_ciThe flink:vkBuildAccelerationStructuresKHR and 2235e5c31af7Sopenharmony_ciflink:vkCmdBuildAccelerationStructuresKHR may: use different algorithms, and 2236e5c31af7Sopenharmony_cithus are not required to produce identical structures. 2237e5c31af7Sopenharmony_ciThe structures produced by these two commands may: exhibit different memory 2238e5c31af7Sopenharmony_cifootprints or traversal performance, but should strive to be similar where 2239e5c31af7Sopenharmony_cipossible. 2240e5c31af7Sopenharmony_ci 2241e5c31af7Sopenharmony_ciApart from these details, the host and device operations are 2242e5c31af7Sopenharmony_ciinterchangeable. 2243e5c31af7Sopenharmony_ciFor example, an application can: use flink:vkBuildAccelerationStructuresKHR 2244e5c31af7Sopenharmony_cito build a structure, compact it on the device using 2245e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureKHR, and serialize the result using 2246e5c31af7Sopenharmony_ciflink:vkCopyAccelerationStructureToMemoryKHR. 2247e5c31af7Sopenharmony_ci==== 2248e5c31af7Sopenharmony_ci 2249e5c31af7Sopenharmony_ci[NOTE] 2250e5c31af7Sopenharmony_ci.Note 2251e5c31af7Sopenharmony_ci==== 2252e5c31af7Sopenharmony_ciFor efficient execution, acceleration structures manipulated using these 2253e5c31af7Sopenharmony_cicommands should always be bound to host cached memory, as the implementation 2254e5c31af7Sopenharmony_cimay need to repeatedly read and write this memory during the execution of 2255e5c31af7Sopenharmony_cithe command. 2256e5c31af7Sopenharmony_ci==== 2257e5c31af7Sopenharmony_ci 2258e5c31af7Sopenharmony_ci[open,refpage='vkBuildAccelerationStructuresKHR',desc='Build an acceleration structure on the host',type='protos'] 2259e5c31af7Sopenharmony_ci-- 2260e5c31af7Sopenharmony_ci:refpage: vkBuildAccelerationStructuresKHR 2261e5c31af7Sopenharmony_ci 2262e5c31af7Sopenharmony_ciTo build acceleration structures on the host, call: 2263e5c31af7Sopenharmony_ci 2264e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkBuildAccelerationStructuresKHR.adoc[] 2265e5c31af7Sopenharmony_ci 2266e5c31af7Sopenharmony_ci * pname:device is the sname:VkDevice for which the acceleration structures 2267e5c31af7Sopenharmony_ci are being built. 2268e5c31af7Sopenharmony_ci * pname:deferredOperation is an optional slink:VkDeferredOperationKHR to 2269e5c31af7Sopenharmony_ci <<deferred-host-operations-requesting, request deferral>> for this 2270e5c31af7Sopenharmony_ci command. 2271e5c31af7Sopenharmony_ci * pname:infoCount is the number of acceleration structures to build. 2272e5c31af7Sopenharmony_ci It specifies the number of the pname:pInfos structures and 2273e5c31af7Sopenharmony_ci pname:ppBuildRangeInfos pointers that must: be provided. 2274e5c31af7Sopenharmony_ci * pname:pInfos is a pointer to an array of pname:infoCount 2275e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildGeometryInfoKHR structures defining 2276e5c31af7Sopenharmony_ci the geometry used to build each acceleration structure. 2277e5c31af7Sopenharmony_ci * pname:ppBuildRangeInfos is a pointer to an array of pname:infoCount 2278e5c31af7Sopenharmony_ci pointers to arrays of slink:VkAccelerationStructureBuildRangeInfoKHR 2279e5c31af7Sopenharmony_ci structures. 2280e5c31af7Sopenharmony_ci Each pname:ppBuildRangeInfos[i] is a pointer to an array of 2281e5c31af7Sopenharmony_ci pname:pInfos[i].pname:geometryCount 2282e5c31af7Sopenharmony_ci slink:VkAccelerationStructureBuildRangeInfoKHR structures defining 2283e5c31af7Sopenharmony_ci dynamic offsets to the addresses where geometry data is stored, as 2284e5c31af7Sopenharmony_ci defined by pname:pInfos[i]. 2285e5c31af7Sopenharmony_ci 2286e5c31af7Sopenharmony_ciThis command fulfills the same task as 2287e5c31af7Sopenharmony_ciflink:vkCmdBuildAccelerationStructuresKHR but is executed by the host. 2288e5c31af7Sopenharmony_ci 2289e5c31af7Sopenharmony_ciThe fname:vkBuildAccelerationStructuresKHR command provides the ability to 2290e5c31af7Sopenharmony_ciinitiate multiple acceleration structures builds, however there is no 2291e5c31af7Sopenharmony_ciordering or synchronization implied between any of the individual 2292e5c31af7Sopenharmony_ciacceleration structure builds. 2293e5c31af7Sopenharmony_ci 2294e5c31af7Sopenharmony_ci[NOTE] 2295e5c31af7Sopenharmony_ci.Note 2296e5c31af7Sopenharmony_ci==== 2297e5c31af7Sopenharmony_ciThis means that an application cannot: build a top-level acceleration 2298e5c31af7Sopenharmony_cistructure in the same flink:vkBuildAccelerationStructuresKHR call as the 2299e5c31af7Sopenharmony_ciassociated bottom-level or instance acceleration structures are being built. 2300e5c31af7Sopenharmony_ciThere also cannot: be any memory aliasing between any acceleration structure 2301e5c31af7Sopenharmony_cimemories or scratch memories being used by any of the builds. 2302e5c31af7Sopenharmony_ci==== 2303e5c31af7Sopenharmony_ci 2304e5c31af7Sopenharmony_ci.Valid Usage 2305e5c31af7Sopenharmony_ci**** 2306e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-accelerationStructureHostCommands-03581]] 2307e5c31af7Sopenharmony_ci The <<features-accelerationStructureHostCommands, 2308e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructureHostCommands>> 2309e5c31af7Sopenharmony_ci feature must: be enabled 2310e5c31af7Sopenharmony_ci 2311e5c31af7Sopenharmony_ci:maxinstancecheck: pname:ppBuildRangeInfos[i][j].pname:primitiveCount 2312e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_common.adoc[] 2313e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/build_acceleration_structure_nonindirect_common.adoc[] 2314e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/deferred_operations_common.adoc[] 2315e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03722]] 2316e5c31af7Sopenharmony_ci For each element of pname:pInfos, the pname:buffer used to create its 2317e5c31af7Sopenharmony_ci pname:dstAccelerationStructure member must: be bound to host-visible 2318e5c31af7Sopenharmony_ci device memory 2319e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03723]] 2320e5c31af7Sopenharmony_ci For each element of pname:pInfos, if its pname:mode member is 2321e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR the pname:buffer 2322e5c31af7Sopenharmony_ci used to create its pname:srcAccelerationStructure member must: be bound 2323e5c31af7Sopenharmony_ci to host-visible device memory 2324e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03724]] 2325e5c31af7Sopenharmony_ci For each element of pname:pInfos, the pname:buffer used to create each 2326e5c31af7Sopenharmony_ci acceleration structure referenced by the pname:geometry.instances.data 2327e5c31af7Sopenharmony_ci member of any element of pname:pGeometries or pname:ppGeometries with a 2328e5c31af7Sopenharmony_ci pname:geometryType of ename:VK_GEOMETRY_TYPE_INSTANCES_KHR must: be 2329e5c31af7Sopenharmony_ci bound to host-visible device memory 2330e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03725]] 2331e5c31af7Sopenharmony_ci If pname:pInfos[i].pname:mode is 2332e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR, all addresses 2333e5c31af7Sopenharmony_ci between pname:pInfos[i].pname:scratchData.hostAddress and 2334e5c31af7Sopenharmony_ci pname:pInfos[i].pname:scratchData.hostAddress + N - 1 must: be valid 2335e5c31af7Sopenharmony_ci host memory, where N is given by the pname:buildScratchSize member of 2336e5c31af7Sopenharmony_ci the slink:VkAccelerationStructureBuildSizesInfoKHR structure returned 2337e5c31af7Sopenharmony_ci from a call to flink:vkGetAccelerationStructureBuildSizesKHR with an 2338e5c31af7Sopenharmony_ci identical slink:VkAccelerationStructureBuildGeometryInfoKHR structure 2339e5c31af7Sopenharmony_ci and primitive count 2340e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03726]] 2341e5c31af7Sopenharmony_ci If pname:pInfos[i].pname:mode is 2342e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, all addresses 2343e5c31af7Sopenharmony_ci between pname:pInfos[i].pname:scratchData.hostAddress and 2344e5c31af7Sopenharmony_ci pname:pInfos[i].pname:scratchData.hostAddress + N - 1 must: be valid 2345e5c31af7Sopenharmony_ci host memory, where N is given by the pname:updateScratchSize member of 2346e5c31af7Sopenharmony_ci the slink:VkAccelerationStructureBuildSizesInfoKHR structure returned 2347e5c31af7Sopenharmony_ci from a call to flink:vkGetAccelerationStructureBuildSizesKHR with an 2348e5c31af7Sopenharmony_ci identical slink:VkAccelerationStructureBuildGeometryInfoKHR structure 2349e5c31af7Sopenharmony_ci and primitive count 2350e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03771]] 2351e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2352e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2353e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, 2354e5c31af7Sopenharmony_ci pname:geometry.triangles.vertexData.hostAddress must: be a valid host 2355e5c31af7Sopenharmony_ci address 2356e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03772]] 2357e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2358e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2359e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if 2360e5c31af7Sopenharmony_ci pname:geometry.triangles.indexType is not ename:VK_INDEX_TYPE_NONE_KHR, 2361e5c31af7Sopenharmony_ci pname:geometry.triangles.indexData.hostAddress must: be a valid host 2362e5c31af7Sopenharmony_ci address 2363e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03773]] 2364e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2365e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2366e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if 2367e5c31af7Sopenharmony_ci pname:geometry.triangles.transformData.hostAddress is not `0`, it must: 2368e5c31af7Sopenharmony_ci be a valid host address 2369e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03774]] 2370e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2371e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2372e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_AABBS_KHR, pname:geometry.aabbs.data.hostAddress 2373e5c31af7Sopenharmony_ci must: be a valid host address 2374e5c31af7Sopenharmony_ciifdef::VK_KHR_device_group,VK_VERSION_1_1[] 2375e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03775]] 2376e5c31af7Sopenharmony_ci For each element of pname:pInfos, the pname:buffer used to create its 2377e5c31af7Sopenharmony_ci pname:dstAccelerationStructure member must: be bound to memory that was 2378e5c31af7Sopenharmony_ci not allocated with multiple instances 2379e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03776]] 2380e5c31af7Sopenharmony_ci For each element of pname:pInfos, if its pname:mode member is 2381e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR the pname:buffer 2382e5c31af7Sopenharmony_ci used to create its pname:srcAccelerationStructure member must: be bound 2383e5c31af7Sopenharmony_ci to memory that was not allocated with multiple instances 2384e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03777]] 2385e5c31af7Sopenharmony_ci For each element of pname:pInfos, the pname:buffer used to create each 2386e5c31af7Sopenharmony_ci acceleration structure referenced by the pname:geometry.instances.data 2387e5c31af7Sopenharmony_ci member of any element of pname:pGeometries or pname:ppGeometries with a 2388e5c31af7Sopenharmony_ci pname:geometryType of ename:VK_GEOMETRY_TYPE_INSTANCES_KHR must: be 2389e5c31af7Sopenharmony_ci bound to memory that was not allocated with multiple instances 2390e5c31af7Sopenharmony_ciendif::VK_KHR_device_group,VK_VERSION_1_1[] 2391e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03778]] 2392e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2393e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2394e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, 2395e5c31af7Sopenharmony_ci pname:geometry.instances.data.hostAddress must: be a valid host address 2396e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-03779]] 2397e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2398e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2399e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, each 2400e5c31af7Sopenharmony_ci slink:VkAccelerationStructureInstanceKHR::pname:accelerationStructureReference 2401e5c31af7Sopenharmony_ci value in pname:geometry.instances.data.hostAddress must: be a valid 2402e5c31af7Sopenharmony_ci slink:VkAccelerationStructureKHR object 2403e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 2404e5c31af7Sopenharmony_ci * [[VUID-vkBuildAccelerationStructuresKHR-pInfos-04930]] 2405e5c31af7Sopenharmony_ci For any element of pname:pInfos[i].pname:pGeometries or 2406e5c31af7Sopenharmony_ci pname:pInfos[i].pname:ppGeometries with a pname:geometryType of 2407e5c31af7Sopenharmony_ci ename:VK_GEOMETRY_TYPE_INSTANCES_KHR with 2408e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV set, each 2409e5c31af7Sopenharmony_ci pname:accelerationStructureReference in any structure in 2410e5c31af7Sopenharmony_ci slink:VkAccelerationStructureMotionInstanceNV value in 2411e5c31af7Sopenharmony_ci pname:geometry.instances.data.hostAddress must: be a valid 2412e5c31af7Sopenharmony_ci slink:VkAccelerationStructureKHR object 2413e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 2414e5c31af7Sopenharmony_ci**** 2415e5c31af7Sopenharmony_ci 2416e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkBuildAccelerationStructuresKHR.adoc[] 2417e5c31af7Sopenharmony_ci-- 2418e5c31af7Sopenharmony_ci 2419e5c31af7Sopenharmony_ci[open,refpage='vkCopyAccelerationStructureKHR',desc='Copy an acceleration structure on the host',type='protos'] 2420e5c31af7Sopenharmony_ci-- 2421e5c31af7Sopenharmony_ci:refpage: vkCopyAccelerationStructureKHR 2422e5c31af7Sopenharmony_ci 2423e5c31af7Sopenharmony_ciTo copy or compact an acceleration structure on the host, call: 2424e5c31af7Sopenharmony_ci 2425e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCopyAccelerationStructureKHR.adoc[] 2426e5c31af7Sopenharmony_ci 2427e5c31af7Sopenharmony_ci * pname:device is the device which owns the acceleration structures. 2428e5c31af7Sopenharmony_ci * pname:deferredOperation is an optional slink:VkDeferredOperationKHR to 2429e5c31af7Sopenharmony_ci <<deferred-host-operations-requesting, request deferral>> for this 2430e5c31af7Sopenharmony_ci command. 2431e5c31af7Sopenharmony_ci * pname:pInfo is a pointer to a slink:VkCopyAccelerationStructureInfoKHR 2432e5c31af7Sopenharmony_ci structure defining the copy operation. 2433e5c31af7Sopenharmony_ci 2434e5c31af7Sopenharmony_ciThis command fulfills the same task as 2435e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureKHR but is executed by the host. 2436e5c31af7Sopenharmony_ci 2437e5c31af7Sopenharmony_ci.Valid Usage 2438e5c31af7Sopenharmony_ci**** 2439e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureKHR-accelerationStructureHostCommands-03582]] 2440e5c31af7Sopenharmony_ci The <<features-accelerationStructureHostCommands, 2441e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructureHostCommands>> 2442e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/deferred_operations_common.adoc[] 2443e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureKHR-buffer-03727]] 2444e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->src must: be bound to 2445e5c31af7Sopenharmony_ci host-visible device memory 2446e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureKHR-buffer-03728]] 2447e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->dst must: be bound to 2448e5c31af7Sopenharmony_ci host-visible device memory feature must: be enabled 2449e5c31af7Sopenharmony_ciifdef::VK_KHR_device_group,VK_VERSION_1_1[] 2450e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureKHR-buffer-03780]] 2451e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->src must: be bound to 2452e5c31af7Sopenharmony_ci memory that was not allocated with multiple instances 2453e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureKHR-buffer-03781]] 2454e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->dst must: be bound to 2455e5c31af7Sopenharmony_ci memory that was not allocated with multiple instances 2456e5c31af7Sopenharmony_ciendif::VK_KHR_device_group,VK_VERSION_1_1[] 2457e5c31af7Sopenharmony_ci**** 2458e5c31af7Sopenharmony_ci 2459e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCopyAccelerationStructureKHR.adoc[] 2460e5c31af7Sopenharmony_ci-- 2461e5c31af7Sopenharmony_ci 2462e5c31af7Sopenharmony_ci[open,refpage='vkCopyMemoryToAccelerationStructureKHR',desc='Deserialize an acceleration structure on the host',type='protos'] 2463e5c31af7Sopenharmony_ci-- 2464e5c31af7Sopenharmony_ci:refpage: vkCopyMemoryToAccelerationStructureKHR 2465e5c31af7Sopenharmony_ci 2466e5c31af7Sopenharmony_ciTo copy host accessible memory to an acceleration structure, call: 2467e5c31af7Sopenharmony_ci 2468e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCopyMemoryToAccelerationStructureKHR.adoc[] 2469e5c31af7Sopenharmony_ci 2470e5c31af7Sopenharmony_ci * pname:device is the device which owns pname:pInfo->dst. 2471e5c31af7Sopenharmony_ci * pname:deferredOperation is an optional slink:VkDeferredOperationKHR to 2472e5c31af7Sopenharmony_ci <<deferred-host-operations-requesting, request deferral>> for this 2473e5c31af7Sopenharmony_ci command. 2474e5c31af7Sopenharmony_ci * pname:pInfo is a pointer to a 2475e5c31af7Sopenharmony_ci slink:VkCopyMemoryToAccelerationStructureInfoKHR structure defining the 2476e5c31af7Sopenharmony_ci copy operation. 2477e5c31af7Sopenharmony_ci 2478e5c31af7Sopenharmony_ciThis command fulfills the same task as 2479e5c31af7Sopenharmony_ciflink:vkCmdCopyMemoryToAccelerationStructureKHR but is executed by the host. 2480e5c31af7Sopenharmony_ci 2481e5c31af7Sopenharmony_ciThis command can accept acceleration structures produced by either 2482e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureToMemoryKHR or 2483e5c31af7Sopenharmony_ciflink:vkCopyAccelerationStructureToMemoryKHR. 2484e5c31af7Sopenharmony_ci 2485e5c31af7Sopenharmony_ci.Valid Usage 2486e5c31af7Sopenharmony_ci**** 2487e5c31af7Sopenharmony_ci * [[VUID-vkCopyMemoryToAccelerationStructureKHR-accelerationStructureHostCommands-03583]] 2488e5c31af7Sopenharmony_ci The <<features-accelerationStructureHostCommands, 2489e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructureHostCommands>> 2490e5c31af7Sopenharmony_ci feature must: be enabled 2491e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/deferred_operations_common.adoc[] 2492e5c31af7Sopenharmony_ci * [[VUID-vkCopyMemoryToAccelerationStructureKHR-pInfo-03729]] 2493e5c31af7Sopenharmony_ci pname:pInfo->src.hostAddress must: be a valid host pointer 2494e5c31af7Sopenharmony_ci * [[VUID-vkCopyMemoryToAccelerationStructureKHR-pInfo-03750]] 2495e5c31af7Sopenharmony_ci pname:pInfo->src.hostAddress must: be aligned to 16 bytes 2496e5c31af7Sopenharmony_ci * [[VUID-vkCopyMemoryToAccelerationStructureKHR-buffer-03730]] 2497e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->dst must: be bound to 2498e5c31af7Sopenharmony_ci host-visible device memory 2499e5c31af7Sopenharmony_ciifdef::VK_KHR_device_group,VK_VERSION_1_1[] 2500e5c31af7Sopenharmony_ci * [[VUID-vkCopyMemoryToAccelerationStructureKHR-buffer-03782]] 2501e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->dst must: be bound to 2502e5c31af7Sopenharmony_ci memory that was not allocated with multiple instances 2503e5c31af7Sopenharmony_ciendif::VK_KHR_device_group,VK_VERSION_1_1[] 2504e5c31af7Sopenharmony_ci**** 2505e5c31af7Sopenharmony_ci 2506e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCopyMemoryToAccelerationStructureKHR.adoc[] 2507e5c31af7Sopenharmony_ci-- 2508e5c31af7Sopenharmony_ci 2509e5c31af7Sopenharmony_ci[open,refpage='vkCopyAccelerationStructureToMemoryKHR',desc='Serialize an acceleration structure on the host',type='protos'] 2510e5c31af7Sopenharmony_ci-- 2511e5c31af7Sopenharmony_ci:refpage: vkCopyAccelerationStructureToMemoryKHR 2512e5c31af7Sopenharmony_ci 2513e5c31af7Sopenharmony_ciTo copy an acceleration structure to host accessible memory, call: 2514e5c31af7Sopenharmony_ci 2515e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCopyAccelerationStructureToMemoryKHR.adoc[] 2516e5c31af7Sopenharmony_ci 2517e5c31af7Sopenharmony_ci * pname:device is the device which owns pname:pInfo->src. 2518e5c31af7Sopenharmony_ci * pname:deferredOperation is an optional slink:VkDeferredOperationKHR to 2519e5c31af7Sopenharmony_ci <<deferred-host-operations-requesting, request deferral>> for this 2520e5c31af7Sopenharmony_ci command. 2521e5c31af7Sopenharmony_ci * pname:pInfo is a pointer to a 2522e5c31af7Sopenharmony_ci slink:VkCopyAccelerationStructureToMemoryInfoKHR structure defining the 2523e5c31af7Sopenharmony_ci copy operation. 2524e5c31af7Sopenharmony_ci 2525e5c31af7Sopenharmony_ciThis command fulfills the same task as 2526e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureToMemoryKHR but is executed by the host. 2527e5c31af7Sopenharmony_ci 2528e5c31af7Sopenharmony_ciThis command produces the same results as 2529e5c31af7Sopenharmony_ciflink:vkCmdCopyAccelerationStructureToMemoryKHR, but writes its result 2530e5c31af7Sopenharmony_cidirectly to a host pointer, and is executed on the host rather than the 2531e5c31af7Sopenharmony_cidevice. 2532e5c31af7Sopenharmony_ciThe output may: not necessarily be bit-for-bit identical, but it can be 2533e5c31af7Sopenharmony_ciequally used by either flink:vkCmdCopyMemoryToAccelerationStructureKHR or 2534e5c31af7Sopenharmony_ciflink:vkCopyMemoryToAccelerationStructureKHR. 2535e5c31af7Sopenharmony_ci 2536e5c31af7Sopenharmony_ci.Valid Usage 2537e5c31af7Sopenharmony_ci**** 2538e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureToMemoryKHR-accelerationStructureHostCommands-03584]] 2539e5c31af7Sopenharmony_ci The <<features-accelerationStructureHostCommands, 2540e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructureHostCommands>> 2541e5c31af7Sopenharmony_ci feature must: be enabled 2542e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/deferred_operations_common.adoc[] 2543e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureToMemoryKHR-buffer-03731]] 2544e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->src must: be bound to 2545e5c31af7Sopenharmony_ci host-visible device memory 2546e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureToMemoryKHR-pInfo-03732]] 2547e5c31af7Sopenharmony_ci pname:pInfo->dst.hostAddress must: be a valid host pointer 2548e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureToMemoryKHR-pInfo-03751]] 2549e5c31af7Sopenharmony_ci pname:pInfo->dst.hostAddress must: be aligned to 16 bytes 2550e5c31af7Sopenharmony_ciifdef::VK_KHR_device_group,VK_VERSION_1_1[] 2551e5c31af7Sopenharmony_ci * [[VUID-vkCopyAccelerationStructureToMemoryKHR-buffer-03783]] 2552e5c31af7Sopenharmony_ci The pname:buffer used to create pname:pInfo->src must: be bound to 2553e5c31af7Sopenharmony_ci memory that was not allocated with multiple instances 2554e5c31af7Sopenharmony_ciendif::VK_KHR_device_group,VK_VERSION_1_1[] 2555e5c31af7Sopenharmony_ci**** 2556e5c31af7Sopenharmony_ci 2557e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCopyAccelerationStructureToMemoryKHR.adoc[] 2558e5c31af7Sopenharmony_ci-- 2559e5c31af7Sopenharmony_ci 2560e5c31af7Sopenharmony_ci[open,refpage='vkWriteAccelerationStructuresPropertiesKHR',desc='Query acceleration structure meta-data on the host',type='protos'] 2561e5c31af7Sopenharmony_ci-- 2562e5c31af7Sopenharmony_ci:refpage: vkWriteAccelerationStructuresPropertiesKHR 2563e5c31af7Sopenharmony_ci 2564e5c31af7Sopenharmony_ciTo query acceleration structure size parameters on the host, call: 2565e5c31af7Sopenharmony_ci 2566e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkWriteAccelerationStructuresPropertiesKHR.adoc[] 2567e5c31af7Sopenharmony_ci 2568e5c31af7Sopenharmony_ci * pname:device is the device which owns the acceleration structures in 2569e5c31af7Sopenharmony_ci pname:pAccelerationStructures. 2570e5c31af7Sopenharmony_ci * pname:accelerationStructureCount is the count of acceleration structures 2571e5c31af7Sopenharmony_ci for which to query the property. 2572e5c31af7Sopenharmony_ci * pname:pAccelerationStructures is a pointer to an array of existing 2573e5c31af7Sopenharmony_ci previously built acceleration structures. 2574e5c31af7Sopenharmony_ci * pname:queryType is a elink:VkQueryType value specifying the property to 2575e5c31af7Sopenharmony_ci be queried. 2576e5c31af7Sopenharmony_ci * pname:dataSize is the size in bytes of the buffer pointed to by 2577e5c31af7Sopenharmony_ci pname:pData. 2578e5c31af7Sopenharmony_ci * pname:pData is a pointer to a user-allocated buffer where the results 2579e5c31af7Sopenharmony_ci will be written. 2580e5c31af7Sopenharmony_ci * pname:stride is the stride in bytes between results for individual 2581e5c31af7Sopenharmony_ci queries within pname:pData. 2582e5c31af7Sopenharmony_ci 2583e5c31af7Sopenharmony_ciThis command fulfills the same task as 2584e5c31af7Sopenharmony_ciflink:vkCmdWriteAccelerationStructuresPropertiesKHR but is executed by the 2585e5c31af7Sopenharmony_cihost. 2586e5c31af7Sopenharmony_ci 2587e5c31af7Sopenharmony_ci.Valid Usage 2588e5c31af7Sopenharmony_ci**** 2589e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-accelerationStructureHostCommands-03585]] 2590e5c31af7Sopenharmony_ci The <<features-accelerationStructureHostCommands, 2591e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceAccelerationStructureFeaturesKHR::pname:accelerationStructureHostCommands>> 2592e5c31af7Sopenharmony_ci feature must: be enabled 2593e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/write_acceleration_structure_properties_common.adoc[] 2594e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03448]] 2595e5c31af7Sopenharmony_ci If pname:queryType is 2596e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR, then 2597e5c31af7Sopenharmony_ci pname:stride must: be a multiple of the size of basetype:VkDeviceSize 2598e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03449]] 2599e5c31af7Sopenharmony_ci If pname:queryType is 2600e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR, then 2601e5c31af7Sopenharmony_ci pname:pData must: point to a basetype:VkDeviceSize 2602e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03450]] 2603e5c31af7Sopenharmony_ci If pname:queryType is 2604e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR, then 2605e5c31af7Sopenharmony_ci pname:stride must: be a multiple of the size of basetype:VkDeviceSize 2606e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03451]] 2607e5c31af7Sopenharmony_ci If pname:queryType is 2608e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR, then 2609e5c31af7Sopenharmony_ci pname:pData must: point to a basetype:VkDeviceSize 2610e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_maintenance1[] 2611e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-06731]] 2612e5c31af7Sopenharmony_ci If pname:queryType is 2613e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR, then pname:stride 2614e5c31af7Sopenharmony_ci must: be a multiple of the size of basetype:VkDeviceSize 2615e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-06732]] 2616e5c31af7Sopenharmony_ci If pname:queryType is 2617e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR, then pname:pData 2618e5c31af7Sopenharmony_ci must: point to a basetype:VkDeviceSize 2619e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-06733]] 2620e5c31af7Sopenharmony_ci If pname:queryType is 2621e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR, 2622e5c31af7Sopenharmony_ci then pname:stride must: be a multiple of the size of 2623e5c31af7Sopenharmony_ci basetype:VkDeviceSize 2624e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-06734]] 2625e5c31af7Sopenharmony_ci If pname:queryType is 2626e5c31af7Sopenharmony_ci ename:VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR, 2627e5c31af7Sopenharmony_ci then pname:pData must: point to a basetype:VkDeviceSize 2628e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_maintenance1[] 2629e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-dataSize-03452]] 2630e5c31af7Sopenharmony_ci pname:dataSize must: be greater than or equal to 2631e5c31af7Sopenharmony_ci [eq]#pname:accelerationStructureCount*pname:stride# 2632e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-buffer-03733]] 2633e5c31af7Sopenharmony_ci The pname:buffer used to create each acceleration structure in 2634e5c31af7Sopenharmony_ci pname:pAccelerationStructures must: be bound to host-visible device 2635e5c31af7Sopenharmony_ci memory 2636e5c31af7Sopenharmony_ciifdef::VK_KHR_device_group,VK_VERSION_1_1[] 2637e5c31af7Sopenharmony_ci * [[VUID-vkWriteAccelerationStructuresPropertiesKHR-buffer-03784]] 2638e5c31af7Sopenharmony_ci The pname:buffer used to create each acceleration structure in 2639e5c31af7Sopenharmony_ci pname:pAccelerationStructures must: be bound to memory that was not 2640e5c31af7Sopenharmony_ci allocated with multiple instances 2641e5c31af7Sopenharmony_ciendif::VK_KHR_device_group,VK_VERSION_1_1[] 2642e5c31af7Sopenharmony_ci**** 2643e5c31af7Sopenharmony_ci 2644e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkWriteAccelerationStructuresPropertiesKHR.adoc[] 2645e5c31af7Sopenharmony_ci-- 2646