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 executed on the device
7  * [[VUID-{refpage}-pInfos-03707]]
8    For each element of pname:pInfos, the pname:buffer used to create its
9    pname:dstAccelerationStructure member must: be bound to device memory
10  * [[VUID-{refpage}-pInfos-03708]]
11    For each element of pname:pInfos, if its pname:mode member is
12    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR the pname:buffer
13    used to create its pname:srcAccelerationStructure member must: be bound
14    to device memory
15  * [[VUID-{refpage}-pInfos-03709]]
16    For each element of pname:pInfos, the pname:buffer used to create each
17    acceleration structure referenced by the pname:geometry.instances.data
18    member of any element of pname:pGeometries or pname:ppGeometries with a
19    pname:geometryType of ename:VK_GEOMETRY_TYPE_INSTANCES_KHR must: be
20    bound to device memory
21  * [[VUID-{refpage}-pInfos-03671]]
22    If pname:pInfos[i].pname:mode is
23    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR, all addresses
24    between pname:pInfos[i].pname:scratchData.deviceAddress and
25    pname:pInfos[i].pname:scratchData.deviceAddress {plus} N - 1 must: be in
26    the buffer device address range of the same buffer, where N is given by
27    the pname:buildScratchSize member of the
28    slink:VkAccelerationStructureBuildSizesInfoKHR structure returned from a
29    call to flink:vkGetAccelerationStructureBuildSizesKHR with an identical
30    slink:VkAccelerationStructureBuildGeometryInfoKHR structure and
31    primitive count
32  * [[VUID-{refpage}-pInfos-03672]]
33    If pname:pInfos[i].pname:mode is
34    ename:VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR, all addresses
35    between pname:pInfos[i].pname:scratchData.deviceAddress and
36    pname:pInfos[i].pname:scratchData.deviceAddress {plus} N - 1 must: be in
37    the buffer device address range of the same buffer, where N is given by
38    the pname:updateScratchSize member of the
39    slink:VkAccelerationStructureBuildSizesInfoKHR structure returned from a
40    call to flink:vkGetAccelerationStructureBuildSizesKHR with an identical
41    slink:VkAccelerationStructureBuildGeometryInfoKHR structure and
42    primitive count
43  * [[VUID-{refpage}-geometry-03673]]
44    The buffers from which the buffer device addresses for all of the
45    pname:geometry.triangles.vertexData, pname:geometry.triangles.indexData,
46    pname:geometry.triangles.transformData, pname:geometry.aabbs.data, and
47    pname:geometry.instances.data members of all
48    pname:pInfos[i].pname:pGeometries and pname:pInfos[i].pname:ppGeometries
49    are queried must: have been created with the
50    ename:VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR
51    usage flag
52  * [[VUID-{refpage}-pInfos-03674]]
53    The buffer from which the buffer device address
54    pname:pInfos[i].pname:scratchData.deviceAddress is queried must: have
55    been created with ename:VK_BUFFER_USAGE_STORAGE_BUFFER_BIT usage flag
56  * [[VUID-{refpage}-pInfos-03802]]
57    For each element of pname:pInfos, its pname:scratchData.deviceAddress
58    member must: be a valid device address obtained from
59    flink:vkGetBufferDeviceAddress
60  * [[VUID-{refpage}-pInfos-03803]]
61    For each element of pname:pInfos, if pname:scratchData.deviceAddress is
62    the address of a non-sparse buffer then it must: be bound completely and
63    contiguously to a single slink:VkDeviceMemory object
64  * [[VUID-{refpage}-pInfos-03710]]
65    For each element of pname:pInfos, its pname:scratchData.deviceAddress
66    member must: be a multiple of
67    slink:VkPhysicalDeviceAccelerationStructurePropertiesKHR::pname:minAccelerationStructureScratchOffsetAlignment
68  * [[VUID-{refpage}-pInfos-03804]]
69    For any element of pname:pInfos[i].pname:pGeometries or
70    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
71    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR,
72    pname:geometry.triangles.vertexData.deviceAddress must: be a valid
73    device address obtained from flink:vkGetBufferDeviceAddress
74  * [[VUID-{refpage}-pInfos-03805]]
75    For any element of pname:pInfos[i].pname:pGeometries or
76    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
77    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if
78    pname:geometry.triangles.vertexData.deviceAddress is the address of a
79    non-sparse buffer then it must: be bound completely and contiguously to
80    a single slink:VkDeviceMemory object
81  * [[VUID-{refpage}-pInfos-03711]]
82    For any element of pname:pInfos[i].pname:pGeometries or
83    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
84    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR,
85    pname:geometry.triangles.vertexData.deviceAddress must: be aligned to
86    the size in bytes of the smallest component of the format in
87    pname:vertexFormat
88  * [[VUID-{refpage}-pInfos-03806]]
89    For any element of pname:pInfos[i].pname:pGeometries or
90    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
91    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if
92    pname:geometry.triangles.indexType is not ename:VK_INDEX_TYPE_NONE_KHR,
93    pname:geometry.triangles.indexData.deviceAddress must: be a valid device
94    address obtained from flink:vkGetBufferDeviceAddress
95  * [[VUID-{refpage}-pInfos-03807]]
96    For any element of pname:pInfos[i].pname:pGeometries or
97    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
98    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if
99    pname:geometry.triangles.indexType is not ename:VK_INDEX_TYPE_NONE_KHR,
100    if pname:geometry.triangles.indexData.deviceAddress is the address of a
101    non-sparse buffer then it must: be bound completely and contiguously to
102    a single slink:VkDeviceMemory object
103  * [[VUID-{refpage}-pInfos-03712]]
104    For any element of pname:pInfos[i].pname:pGeometries or
105    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
106    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, and with
107    pname:geometry.triangles.indexType not equal to
108    ename:VK_INDEX_TYPE_NONE_KHR,
109    pname:geometry.triangles.indexData.deviceAddress must: be aligned to the
110    size in bytes of the type in pname:indexType
111  * [[VUID-{refpage}-pInfos-03808]]
112    For any element of pname:pInfos[i].pname:pGeometries or
113    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
114    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if
115    pname:geometry.triangles.transformData.deviceAddress is not `0`, it
116    must: be a valid device address obtained from
117    flink:vkGetBufferDeviceAddress
118  * [[VUID-{refpage}-pInfos-03809]]
119    For any element of pname:pInfos[i].pname:pGeometries or
120    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
121    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if
122    pname:geometry.triangles.transformData.deviceAddress is the address of a
123    non-sparse buffer then it must: be bound completely and contiguously to
124    a single slink:VkDeviceMemory object
125  * [[VUID-{refpage}-pInfos-03810]]
126    For any element of pname:pInfos[i].pname:pGeometries or
127    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
128    ename:VK_GEOMETRY_TYPE_TRIANGLES_KHR, if
129    pname:geometry.triangles.transformData.deviceAddress is not `0`, it
130    must: be aligned to `16` bytes
131  * [[VUID-{refpage}-pInfos-03811]]
132    For any element of pname:pInfos[i].pname:pGeometries or
133    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
134    ename:VK_GEOMETRY_TYPE_AABBS_KHR,
135    pname:geometry.aabbs.data.deviceAddress must: be a valid device address
136    obtained from flink:vkGetBufferDeviceAddress
137  * [[VUID-{refpage}-pInfos-03812]]
138    For any element of pname:pInfos[i].pname:pGeometries or
139    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
140    ename:VK_GEOMETRY_TYPE_AABBS_KHR, if
141    pname:geometry.aabbs.data.deviceAddress is the address of a non-sparse
142    buffer then it must: be bound completely and contiguously to a single
143    slink:VkDeviceMemory object
144  * [[VUID-{refpage}-pInfos-03714]]
145    For any element of pname:pInfos[i].pname:pGeometries or
146    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
147    ename:VK_GEOMETRY_TYPE_AABBS_KHR,
148    pname:geometry.aabbs.data.deviceAddress must: be aligned to `8` bytes
149  * [[VUID-{refpage}-pInfos-03715]]
150    For any element of pname:pInfos[i].pname:pGeometries or
151    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
152    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, if pname:geometry.arrayOfPointers
153    is ename:VK_FALSE, pname:geometry.instances.data.deviceAddress must: be
154    aligned to `16` bytes
155  * [[VUID-{refpage}-pInfos-03716]]
156    For any element of pname:pInfos[i].pname:pGeometries or
157    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
158    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, if pname:geometry.arrayOfPointers
159    is ename:VK_TRUE, pname:geometry.instances.data.deviceAddress must: be
160    aligned to `8` bytes
161  * [[VUID-{refpage}-pInfos-03717]]
162    For any element of pname:pInfos[i].pname:pGeometries or
163    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
164    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, if pname:geometry.arrayOfPointers
165    is ename:VK_TRUE, each element of
166    pname:geometry.instances.data.deviceAddress in device memory must: be
167    aligned to `16` bytes
168  * [[VUID-{refpage}-pInfos-03813]]
169    For any element of pname:pInfos[i].pname:pGeometries or
170    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
171    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR,
172    pname:geometry.instances.data.deviceAddress must: be a valid device
173    address obtained from flink:vkGetBufferDeviceAddress
174  * [[VUID-{refpage}-pInfos-03814]]
175    For any element of pname:pInfos[i].pname:pGeometries or
176    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
177    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, if
178    pname:geometry.instances.data.deviceAddress is the address of a
179    non-sparse buffer then it must: be bound completely and contiguously to
180    a single slink:VkDeviceMemory object
181  * [[VUID-{refpage}-pInfos-06707]]
182    For any element of pname:pInfos[i].pname:pGeometries or
183    pname:pInfos[i].pname:ppGeometries with a pname:geometryType of
184    ename:VK_GEOMETRY_TYPE_INSTANCES_KHR, each
185    slink:VkAccelerationStructureInstanceKHR::pname:accelerationStructureReference
186    value in pname:geometry.instances.data.deviceAddress must: be a valid
187    device address containing a value obtained from
188    flink:vkGetAccelerationStructureDeviceAddressKHR or `0`
189// Common Valid Usage
190