1// Copyright 2019-2023 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5// Common Valid Usage
6// Common to acceleration structure build commands
7  * [[VUID-{refpage}-mode-04628]]
8    The pname:mode member of each element of pname:pInfos must: be a valid
9    elink:VkBuildAccelerationStructureModeKHR value
10  * [[VUID-{refpage}-srcAccelerationStructure-04629]]
11    If the pname:srcAccelerationStructure member of any element of
12    pname:pInfos is not dlink:VK_NULL_HANDLE, the
13    pname:srcAccelerationStructure member must: be a valid
14    slink:VkAccelerationStructureKHR handle
15  * [[VUID-{refpage}-pInfos-04630]]
16    For each element of pname:pInfos, if its pname:mode member is
17    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, its
18    pname:srcAccelerationStructure member must: not be dlink:VK_NULL_HANDLE
19  * [[VUID-{refpage}-pInfos-03403]]
20    The pname:srcAccelerationStructure member of any element of pname:pInfos
21    must: not be the same acceleration structure as the
22    pname:dstAccelerationStructure member of any other element of
23    pname:pInfos
24  * [[VUID-{refpage}-dstAccelerationStructure-03698]]
25    The pname:dstAccelerationStructure member of any element of pname:pInfos
26    must: not be the same acceleration structure as the
27    pname:dstAccelerationStructure member of any other element of
28    pname:pInfos
29  * [[VUID-{refpage}-dstAccelerationStructure-03800]]
30    The pname:dstAccelerationStructure member of any element of pname:pInfos
31    must: be a valid slink:VkAccelerationStructureKHR handle
32  * [[VUID-{refpage}-pInfos-03699]]
33    For each element of pname:pInfos, if its pname:type member is
34    ename:VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, its
35    pname:dstAccelerationStructure member must: have been created with a
36    value of slink:VkAccelerationStructureCreateInfoKHR::pname:type equal to
37    either ename:VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR or
38    ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR
39  * [[VUID-{refpage}-pInfos-03700]]
40    For each element of pname:pInfos, if its pname:type member is
41    ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR, its
42    pname:dstAccelerationStructure member must: have been created with a
43    value of slink:VkAccelerationStructureCreateInfoKHR::pname:type equal to
44    either ename:VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR or
45    ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR
46  * [[VUID-{refpage}-pInfos-03663]]
47    For each element of pname:pInfos, if its pname:mode member is
48    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR,
49    <<acceleration-structure-inactive-prims,inactive primitives>> in its
50    pname:srcAccelerationStructure member must: not be made active
51  * [[VUID-{refpage}-pInfos-03664]]
52    For each element of pname:pInfos, if its pname:mode member is
53    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, active primitives
54    in its pname:srcAccelerationStructure member must: not be made
55    <<acceleration-structure-inactive-prims,inactive>>
56  * [[VUID-{refpage}-None-03407]]
57    The pname:dstAccelerationStructure member of any element of pname:pInfos
58    must: not be referenced by the pname:geometry.instances.data member of
59    any element of pname:pGeometries or pname:ppGeometries with a
60    pname:geometryType of ename:VK_GEOMETRY_TYPE_INSTANCES_KHR in any other
61    element of pname:pInfos
62  * [[VUID-{refpage}-dstAccelerationStructure-03701]]
63    The range of memory backing the pname:dstAccelerationStructure member of
64    any element of pname:pInfos that is accessed by this command must: not
65    overlap the memory backing the pname:srcAccelerationStructure member of
66    any other element of pname:pInfos with a pname:mode equal to
67    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, which is accessed
68    by this command
69  * [[VUID-{refpage}-dstAccelerationStructure-03702]]
70    The range of memory backing the pname:dstAccelerationStructure member of
71    any element of pname:pInfos that is accessed by this command must: not
72    overlap the memory backing the pname:dstAccelerationStructure member of
73    any other element of pname:pInfos, which is accessed by this command
74  * [[VUID-{refpage}-dstAccelerationStructure-03703]]
75    The range of memory backing the pname:dstAccelerationStructure member of
76    any element of pname:pInfos that is accessed by this command must: not
77    overlap the memory backing the pname:scratchData member of any element
78    of pname:pInfos (including the same element), which is accessed by this
79    command
80  * [[VUID-{refpage}-scratchData-03704]]
81    The range of memory backing the pname:scratchData member of any element
82    of pname:pInfos that is accessed by this command must: not overlap the
83    memory backing the pname:scratchData member of any other element of
84    pname:pInfos, which is accessed by this command
85  * [[VUID-{refpage}-scratchData-03705]]
86    The range of memory backing the pname:scratchData member of any element
87    of pname:pInfos that is accessed by this command must: not overlap the
88    memory backing the pname:srcAccelerationStructure member of any element
89    of pname:pInfos with a pname:mode equal to
90    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR (including the
91    same element), which is accessed by this command
92  * [[VUID-{refpage}-dstAccelerationStructure-03706]]
93    The range of memory backing the pname:dstAccelerationStructure member of
94    any element of pname:pInfos that is accessed by this command must: not
95    overlap the memory backing any acceleration structure referenced by the
96    pname:geometry.instances.data member of any element of pname:pGeometries
97    or pname:ppGeometries with a pname:geometryType of
98    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR in any other element of
99    pname:pInfos, which is accessed by this command
100  * [[VUID-{refpage}-pInfos-03667]]
101    For each element of pname:pInfos, if its pname:mode member is
102    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, its
103    pname:srcAccelerationStructure member must: have previously been
104    constructed with
105    ename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR set in
106    slink:VkAccelerationStructureBuildGeometryInfoKHR::pname:flags in the
107    build
108  * [[VUID-{refpage}-pInfos-03668]]
109    For each element of pname:pInfos, if its pname:mode member is
110    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, its
111    pname:srcAccelerationStructure and pname:dstAccelerationStructure
112    members must: either be the same slink:VkAccelerationStructureKHR, or
113    not have any <<resources-memory-aliasing, memory aliasing>>
114  * [[VUID-{refpage}-pInfos-03758]]
115    For each element of pname:pInfos, if its pname:mode member is
116    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, its
117    pname:geometryCount member must: have the same value which was specified
118    when pname:srcAccelerationStructure was last built
119  * [[VUID-{refpage}-pInfos-03759]]
120    For each element of pname:pInfos, if its pname:mode member is
121    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, its pname:flags
122    member must: have the same value which was specified when
123    pname:srcAccelerationStructure was last built
124  * [[VUID-{refpage}-pInfos-03760]]
125    For each element of pname:pInfos, if its pname:mode member is
126    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, its pname:type
127    member must: have the same value which was specified when
128    pname:srcAccelerationStructure was last built
129  * [[VUID-{refpage}-pInfos-03761]]
130    For each element of pname:pInfos, if its pname:mode member is
131    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
132    sname:VkAccelerationStructureGeometryKHR structure referred to by its
133    pname:pGeometries or pname:ppGeometries members, its pname:geometryType
134    member must: have the same value which was specified when
135    pname:srcAccelerationStructure was last built
136  * [[VUID-{refpage}-pInfos-03762]]
137    For each element of pname:pInfos, if its pname:mode member is
138    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
139    sname:VkAccelerationStructureGeometryKHR structure referred to by its
140    pname:pGeometries or pname:ppGeometries members, its pname:flags member
141    must: have the same value which was specified when
142    pname:srcAccelerationStructure was last built
143  * [[VUID-{refpage}-pInfos-03763]]
144    For each element of pname:pInfos, if its pname:mode member is
145    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
146    sname:VkAccelerationStructureGeometryKHR structure referred to by its
147    pname:pGeometries or pname:ppGeometries members, if pname:geometryType
148    is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, its
149    pname:geometry.triangles.vertexFormat member must: have the same value
150    which was specified when pname:srcAccelerationStructure was last built
151  * [[VUID-{refpage}-pInfos-03764]]
152    For each element of pname:pInfos, if its pname:mode member is
153    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
154    sname:VkAccelerationStructureGeometryKHR structure referred to by its
155    pname:pGeometries or pname:ppGeometries members, if pname:geometryType
156    is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, its
157    pname:geometry.triangles.maxVertex member must: have the same value
158    which was specified when pname:srcAccelerationStructure was last built
159  * [[VUID-{refpage}-pInfos-03765]]
160    For each element of pname:pInfos, if its pname:mode member is
161    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
162    sname:VkAccelerationStructureGeometryKHR structure referred to by its
163    pname:pGeometries or pname:ppGeometries members, if pname:geometryType
164    is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, its
165    pname:geometry.triangles.indexType member must: have the same value
166    which was specified when pname:srcAccelerationStructure was last built
167  * [[VUID-{refpage}-pInfos-03766]]
168    For each element of pname:pInfos, if its pname:mode member is
169    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
170    sname:VkAccelerationStructureGeometryKHR structure referred to by its
171    pname:pGeometries or pname:ppGeometries members, if pname:geometryType
172    is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if its
173    pname:geometry.triangles.transformData address was `NULL` when
174    pname:srcAccelerationStructure was last built, then it must: be `NULL`
175  * [[VUID-{refpage}-pInfos-03767]]
176    For each element of pname:pInfos, if its pname:mode member is
177    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
178    sname:VkAccelerationStructureGeometryKHR structure referred to by its
179    pname:pGeometries or pname:ppGeometries members, if pname:geometryType
180    is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if its
181    pname:geometry.triangles.transformData address was not `NULL` when
182    pname:srcAccelerationStructure was last built, then it must: not be
183    `NULL`
184  * [[VUID-{refpage}-pInfos-03768]]
185    For each element of pname:pInfos, if its pname:mode member is
186    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, then for each
187    sname:VkAccelerationStructureGeometryKHR structure referred to by its
188    pname:pGeometries or pname:ppGeometries members, if pname:geometryType
189    is ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, and
190    pname:geometry.triangles.indexType is not ename:VK_INDEX_TYPE_NONE_KHR,
191    then the value of each index referenced must: be the same as the
192    corresponding index value when pname:srcAccelerationStructure was last
193    built
194  * [[VUID-{refpage}-primitiveCount-03769]]
195    For each sname:VkAccelerationStructureBuildRangeInfoKHR referenced by
196    this command, its pname:primitiveCount member must: have the same value
197    which was specified when pname:srcAccelerationStructure was last built
198  * [[VUID-{refpage}-firstVertex-03770]]
199    For each sname:VkAccelerationStructureBuildRangeInfoKHR referenced by
200    this command, if the corresponding geometry uses indices, its
201    pname:firstVertex member must: have the same value which was specified
202    when pname:srcAccelerationStructure was last built
203  * [[VUID-{refpage}-pInfos-03801]]
204    For each element of pname:pInfos[i].pname:pGeometries or
205    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
206    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, the corresponding
207    {maxinstancecheck} must: be less than or equal to
208    slink:VkPhysicalDeviceAccelerationStructurePropertiesKHR::pname:maxInstanceCount
209// Common Valid Usage
210