1// Copyright 2020-2023 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5// Common Valid Usage
6// Common to VkCmdCopyImage* commands
7  * [[VUID-{refpage}-pRegions-00124]]
8    The union of all source regions, and the union of all destination
9    regions, specified by the elements of pname:pRegions, must: not overlap
10    in memory
11ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
12  * [[VUID-{refpage}-srcImage-01995]]
13    The <<resources-image-format-features,format features>> of
14    pname:srcImage must: contain ename:VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
15endif::VK_VERSION_1_1,VK_KHR_maintenance1[]
16  * [[VUID-{refpage}-srcImageLayout-00128]]
17    pname:srcImageLayout must: specify the layout of the image subresources
18    of pname:srcImage specified in pname:pRegions at the time this command
19    is executed on a sname:VkDevice
20  * [[VUID-{refpage}-srcImageLayout-01917]]
21    pname:srcImageLayout must: be
22ifdef::VK_KHR_shared_presentable_image[]
23    ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR,
24endif::VK_KHR_shared_presentable_image[]
25    ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, or
26    ename:VK_IMAGE_LAYOUT_GENERAL
27ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
28  * [[VUID-{refpage}-dstImage-01996]]
29    The <<resources-image-format-features,format features>> of
30    pname:dstImage must: contain ename:VK_FORMAT_FEATURE_TRANSFER_DST_BIT
31endif::VK_VERSION_1_1,VK_KHR_maintenance1[]
32  * [[VUID-{refpage}-dstImageLayout-00133]]
33    pname:dstImageLayout must: specify the layout of the image subresources
34    of pname:dstImage specified in pname:pRegions at the time this command
35    is executed on a sname:VkDevice
36  * [[VUID-{refpage}-dstImageLayout-01395]]
37    pname:dstImageLayout must: be
38ifdef::VK_KHR_shared_presentable_image[]
39    ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR,
40endif::VK_KHR_shared_presentable_image[]
41    ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, or
42    ename:VK_IMAGE_LAYOUT_GENERAL
43  * [[VUID-{refpage}-srcImage-01548]]
44ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
45    If the elink:VkFormat of each of pname:srcImage and pname:dstImage is
46    not a <<formats-requiring-sampler-ycbcr-conversion,_multi-planar
47    format_>>, the
48endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
49ifndef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[The]
50    elink:VkFormat of each of pname:srcImage and pname:dstImage must: be
51    <<formats-size-compatibility,size-compatible>>
52ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
53  * [[VUID-{refpage}-None-01549]]
54    In a copy to or from a plane of a
55    <<formats-requiring-sampler-ycbcr-conversion,multi-planar image>>, the
56    elink:VkFormat of the image and plane must: be compatible according to
57    <<formats-compatible-planes,the description of compatible planes>> for
58    the plane being copied
59endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
60  * [[VUID-{refpage}-srcImage-09247]]
61    If the elink:VkFormat of each of pname:srcImage and pname:dstImage is a
62    <<compressed_image_formats,compressed image format>>, the formats must:
63    have the same texel block extent
64  * [[VUID-{refpage}-srcImage-00136]]
65    The sample count of pname:srcImage and pname:dstImage must: match
66  * [[VUID-{refpage}-srcOffset-01783]]
67    The pname:srcOffset and pname:extent members of each element of
68    pname:pRegions must: respect the image transfer granularity requirements
69    of pname:commandBuffer's command pool's queue family, as described in
70    slink:VkQueueFamilyProperties
71  * [[VUID-{refpage}-dstOffset-01784]]
72    The pname:dstOffset and pname:extent members of each element of
73    pname:pRegions must: respect the image transfer granularity requirements
74    of pname:commandBuffer's command pool's queue family, as described in
75    slink:VkQueueFamilyProperties
76// The remaining common VU used to be in image_copy_common.adoc and have been
77// rewritten to apply to the calling command rather than the structure
78// parameter(s) of that command.
79ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
80  * [[VUID-{refpage}-srcImage-01551]]
81    If neither pname:srcImage nor pname:dstImage has a
82    <<formats-requiring-sampler-ycbcr-conversion, multi-planar image
83    format>> then for each element of pname:pRegions,
84    pname:srcSubresource.aspectMask and pname:dstSubresource.aspectMask
85    must: match
86  * [[VUID-{refpage}-srcImage-08713]]
87    If pname:srcImage has a <<formats-requiring-sampler-ycbcr-conversion,
88    multi-planar image format>>, then for each element of pname:pRegions,
89    pname:srcSubresource.aspectMask must: be a single valid
90    <<formats-planes-image-aspect,multi-planar aspect mask>> bit
91  * [[VUID-{refpage}-dstImage-08714]]
92    If pname:dstImage has a <<formats-requiring-sampler-ycbcr-conversion,
93    multi-planar image format>>, then for each element of pname:pRegions,
94    pname:dstSubresource.aspectMask must: be a single valid
95    <<formats-planes-image-aspect,multi-planar aspect mask>> bit
96  * [[VUID-{refpage}-srcImage-01556]]
97    If pname:srcImage has a
98    <<formats-requiring-sampler-ycbcr-conversion,multi-planar image format>>
99    and the pname:dstImage does not have a multi-planar image format, then
100    for each element of pname:pRegions, pname:dstSubresource.aspectMask
101    must: be ename:VK_IMAGE_ASPECT_COLOR_BIT
102  * [[VUID-{refpage}-dstImage-01557]]
103    If pname:dstImage has a
104    <<formats-requiring-sampler-ycbcr-conversion,multi-planar image format>>
105    and the pname:srcImage does not have a multi-planar image format, then
106    for each element of pname:pRegions, pname:srcSubresource.aspectMask
107    must: be ename:VK_IMAGE_ASPECT_COLOR_BIT
108endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
109ifndef::VKSC_VERSION_1_0[]
110  * [[VUID-{refpage}-apiVersion-07932]]
111    If
112ifdef::VK_KHR_maintenance1[]
113    the apiext:VK_KHR_maintenance1 extension is not enabled,
114endif::VK_KHR_maintenance1[]
115ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[or]
116ifdef::VK_VERSION_1_1[]
117    slink:VkPhysicalDeviceProperties::pname:apiVersion is less than Vulkan
118    1.1,
119endif::VK_VERSION_1_1[]
120ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[and]
121    either pname:srcImage or pname:dstImage is of type
122    ename:VK_IMAGE_TYPE_3D, then for each element of pname:pRegions,
123    pname:srcSubresource.baseArrayLayer and
124    pname:dstSubresource.baseArrayLayer must: both be `0`, and
125    pname:srcSubresource.layerCount and pname:dstSubresource.layerCount
126    must: both be `1`
127endif::VKSC_VERSION_1_0[]
128  * [[VUID-{refpage}-srcImage-04443]]
129    If pname:srcImage is of type ename:VK_IMAGE_TYPE_3D, then for each
130    element of pname:pRegions, pname:srcSubresource.baseArrayLayer must: be
131    `0` and pname:srcSubresource.layerCount must: be `1`
132  * [[VUID-{refpage}-dstImage-04444]]
133    If pname:dstImage is of type ename:VK_IMAGE_TYPE_3D, then for each
134    element of pname:pRegions, pname:dstSubresource.baseArrayLayer must: be
135    `0` and pname:dstSubresource.layerCount must: be `1`
136  * [[VUID-{refpage}-aspectMask-00142]]
137    For each element of pname:pRegions, pname:srcSubresource.aspectMask
138    must: specify aspects present in pname:srcImage
139  * [[VUID-{refpage}-aspectMask-00143]]
140    For each element of pname:pRegions, pname:dstSubresource.aspectMask
141    must: specify aspects present in pname:dstImage
142  * [[VUID-{refpage}-srcOffset-00144]]
143    For each element of pname:pRegions, pname:srcOffset.x and
144    [eq]#(pname:extent.width {plus} pname:srcOffset.x)# must: both be
145    greater than or equal to `0` and less than or equal to the width of the
146    specified pname:srcSubresource of pname:srcImage
147  * [[VUID-{refpage}-srcOffset-00145]]
148    For each element of pname:pRegions, pname:srcOffset.y and
149    [eq]#(pname:extent.height {plus} pname:srcOffset.y)# must: both be
150    greater than or equal to `0` and less than or equal to the height of the
151    specified pname:srcSubresource of pname:srcImage
152  * [[VUID-{refpage}-srcImage-00146]]
153    If pname:srcImage is of type ename:VK_IMAGE_TYPE_1D, then for each
154    element of pname:pRegions, pname:srcOffset.y must: be `0` and
155    pname:extent.height must: be `1`
156  * [[VUID-{refpage}-srcOffset-00147]]
157    If pname:srcImage is of type ename:VK_IMAGE_TYPE_3D, then for each
158    element of pname:pRegions, pname:srcOffset.z and
159    [eq]#(pname:extent.depth {plus} pname:srcOffset.z)# must: both be
160    greater than or equal to `0` and less than or equal to the depth of the
161    specified pname:srcSubresource of pname:srcImage
162  * [[VUID-{refpage}-srcImage-01785]]
163    If pname:srcImage is of type ename:VK_IMAGE_TYPE_1D, then for each
164    element of pname:pRegions, pname:srcOffset.z must: be `0` and
165    pname:extent.depth must: be `1`
166  * [[VUID-{refpage}-dstImage-01786]]
167    If pname:dstImage is of type ename:VK_IMAGE_TYPE_1D, then for each
168    element of pname:pRegions, pname:dstOffset.z must: be `0` and
169    pname:extent.depth must: be `1`
170  * [[VUID-{refpage}-srcImage-01787]]
171    If pname:srcImage is of type ename:VK_IMAGE_TYPE_2D, then for each
172    element of pname:pRegions, pname:srcOffset.z must: be `0`
173  * [[VUID-{refpage}-dstImage-01788]]
174    If pname:dstImage is of type ename:VK_IMAGE_TYPE_2D, then for each
175    element of pname:pRegions, pname:dstOffset.z must: be `0`
176ifndef::VKSC_VERSION_1_0[]
177  * [[VUID-{refpage}-apiVersion-07933]]
178    If
179ifdef::VK_KHR_maintenance1[]
180    the apiext:VK_KHR_maintenance1 extension is not enabled,
181endif::VK_KHR_maintenance1[]
182ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[and]
183ifdef::VK_VERSION_1_1[]
184    slink:VkPhysicalDeviceProperties::pname:apiVersion is less than Vulkan
185    1.1,
186endif::VK_VERSION_1_1[]
187    pname:srcImage and pname:dstImage must: have the same elink:VkImageType
188  * [[VUID-{refpage}-apiVersion-08969]]
189    If
190ifdef::VK_KHR_maintenance1[]
191    the apiext:VK_KHR_maintenance1 extension is not enabled,
192endif::VK_KHR_maintenance1[]
193ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[and]
194ifdef::VK_VERSION_1_1[]
195    slink:VkPhysicalDeviceProperties::pname:apiVersion is less than Vulkan
196    1.1,
197endif::VK_VERSION_1_1[]
198    pname:srcImage or pname:dstImage is of type ename:VK_IMAGE_TYPE_2D, then
199    for each element of pname:pRegions, pname:extent.depth must: be `1`
200endif::VKSC_VERSION_1_0[]
201ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
202  * [[VUID-{refpage}-srcImage-07743]]
203    If pname:srcImage and pname:dstImage have a different elink:VkImageType,
204ifdef::VK_KHR_maintenance5[]
205    and <<features-maintenance5, pname:maintenance5>> is not enabled,
206endif::VK_KHR_maintenance5[]
207    one must: be ename:VK_IMAGE_TYPE_3D and the other must: be
208    ename:VK_IMAGE_TYPE_2D
209  * [[VUID-{refpage}-srcImage-08793]]
210    If pname:srcImage and pname:dstImage have the same elink:VkImageType,
211    for each element of pname:pRegions,
212ifdef::VK_KHR_maintenance5[]
213    if neither of the pname:layerCount members of pname:srcSubresource or
214    pname:dstSubresource are ename:VK_REMAINING_ARRAY_LAYERS,
215endif::VK_KHR_maintenance5[]
216    the pname:layerCount members of pname:srcSubresource or
217    pname:dstSubresource must: match
218ifdef::VK_KHR_maintenance5[]
219  * [[VUID-{refpage}-maintenance5-08792]]
220    If the <<features-maintenance5, pname:maintenance5>> feature is not
221    enabled, the pname:layerCount member of pname:srcSubresource or
222    pname:dstSubresource must: not be ename:VK_REMAINING_ARRAY_LAYERS
223  * [[VUID-{refpage}-srcImage-08794]]
224    If pname:srcImage and pname:dstImage have the same elink:VkImageType,
225    and one of the pname:layerCount members of pname:srcSubresource or
226    pname:dstSubresource is ename:VK_REMAINING_ARRAY_LAYERS, the other
227    member must: be either ename:VK_REMAINING_ARRAY_LAYERS or equal to the
228    pname:arrayLayers member of the slink:VkImageCreateInfo used to create
229    the image minus pname:baseArrayLayer
230endif::VK_KHR_maintenance5[]
231  * [[VUID-{refpage}-srcImage-01790]]
232    If pname:srcImage and pname:dstImage are both of type
233    ename:VK_IMAGE_TYPE_2D, then for each element of pname:pRegions,
234    pname:extent.depth must: be `1`
235  * [[VUID-{refpage}-srcImage-01791]]
236    If pname:srcImage is of type ename:VK_IMAGE_TYPE_2D, and pname:dstImage
237    is of type ename:VK_IMAGE_TYPE_3D, then for each element of
238    pname:pRegions, pname:extent.depth must: equal
239    pname:srcSubresource.layerCount
240  * [[VUID-{refpage}-dstImage-01792]]
241    If pname:dstImage is of type ename:VK_IMAGE_TYPE_2D, and pname:srcImage
242    is of type ename:VK_IMAGE_TYPE_3D, then for each element of
243    pname:pRegions, pname:extent.depth must: equal
244    pname:dstSubresource.layerCount
245endif::VK_VERSION_1_1,VK_KHR_maintenance1[]
246  * [[VUID-{refpage}-dstOffset-00150]]
247    For each element of pname:pRegions, pname:dstOffset.x and
248    [eq]#(pname:extent.width {plus} pname:dstOffset.x)# must: both be
249    greater than or equal to `0` and less than or equal to the width of the
250    specified pname:dstSubresource of pname:dstImage
251  * [[VUID-{refpage}-dstOffset-00151]]
252    For each element of pname:pRegions, pname:dstOffset.y and
253    [eq]#(pname:extent.height {plus} pname:dstOffset.y)# must: both be
254    greater than or equal to `0` and less than or equal to the height of the
255    specified pname:dstSubresource of pname:dstImage
256  * [[VUID-{refpage}-dstImage-00152]]
257    If pname:dstImage is of type ename:VK_IMAGE_TYPE_1D, then for each
258    element of pname:pRegions, pname:dstOffset.y must: be `0` and
259    pname:extent.height must: be `1`
260  * [[VUID-{refpage}-dstOffset-00153]]
261    If pname:dstImage is of type ename:VK_IMAGE_TYPE_3D, then for each
262    element of pname:pRegions, pname:dstOffset.z and
263    [eq]#(pname:extent.depth {plus} pname:dstOffset.z)# must: both be
264    greater than or equal to `0` and less than or equal to the depth of the
265    specified pname:dstSubresource of pname:dstImage
266  * [[VUID-{refpage}-pRegions-07278]]
267    For each element of pname:pRegions, pname:srcOffset.x must: be a
268    multiple of the <<formats-compatibility-classes,texel block extent
269    width>> of the elink:VkFormat of pname:srcImage
270  * [[VUID-{refpage}-pRegions-07279]]
271    For each element of pname:pRegions, pname:srcOffset.y must: be a
272    multiple of the <<formats-compatibility-classes,texel block extent
273    height>> of the elink:VkFormat of pname:srcImage
274  * [[VUID-{refpage}-pRegions-07280]]
275    For each element of pname:pRegions, pname:srcOffset.z must: be a
276    multiple of the <<formats-compatibility-classes,texel block extent
277    depth>> of the elink:VkFormat of pname:srcImage
278  * [[VUID-{refpage}-pRegions-07281]]
279    For each element of pname:pRegions, pname:dstOffset.x must: be a
280    multiple of the <<formats-compatibility-classes,texel block extent
281    width>> of the elink:VkFormat of pname:dstImage
282  * [[VUID-{refpage}-pRegions-07282]]
283    For each element of pname:pRegions, pname:dstOffset.y must: be a
284    multiple of the <<formats-compatibility-classes,texel block extent
285    height>> of the elink:VkFormat of pname:dstImage
286  * [[VUID-{refpage}-pRegions-07283]]
287    For each element of pname:pRegions, pname:dstOffset.z must: be a
288    multiple of the <<formats-compatibility-classes,texel block extent
289    depth>> of the elink:VkFormat of pname:dstImage
290  * [[VUID-{refpage}-srcImage-01728]]
291    For each element of pname:pRegions, if the sum of pname:srcOffset.x and
292    pname:extent.width does not equal the width of the subresource specified
293    by pname:srcSubresource, pname:extent.width must: be a multiple of the
294    <<formats-compatibility-classes,texel block extent width>> of the
295    elink:VkFormat of pname:srcImage
296  * [[VUID-{refpage}-srcImage-01729]]
297    For each element of pname:pRegions, if the sum of pname:srcOffset.y and
298    pname:extent.height does not equal the height of the subresource
299    specified by pname:srcSubresource, pname:extent.height must: be a
300    multiple of the <<formats-compatibility-classes,texel block extent
301    height>> of the elink:VkFormat of pname:srcImage
302  * [[VUID-{refpage}-srcImage-01730]]
303    For each element of pname:pRegions, if the sum of pname:srcOffset.z and
304    pname:extent.depth does not equal the depth of the subresource specified
305    by pname:srcSubresource, pname:extent.depth must: be a multiple of the
306    <<formats-compatibility-classes,texel block extent depth>> of the
307    elink:VkFormat of pname:srcImage
308  * [[VUID-{refpage}-dstImage-01732]]
309    For each element of pname:pRegions, if the sum of pname:dstOffset.x and
310    pname:extent.width does not equal the width of the subresource specified
311    by pname:dstSubresource, pname:extent.width must: be a multiple of the
312    <<formats-compatibility-classes,texel block extent width>> of the
313    elink:VkFormat of pname:dstImage
314  * [[VUID-{refpage}-dstImage-01733]]
315    For each element of pname:pRegions, if the sum of pname:dstOffset.y and
316    pname:extent.height does not equal the height of the subresource
317    specified by pname:dstSubresource, pname:extent.height must: be a
318    multiple of the <<formats-compatibility-classes,texel block extent
319    height>> of the elink:VkFormat of pname:dstImage
320  * [[VUID-{refpage}-dstImage-01734]]
321    For each element of pname:pRegions, if the sum of pname:dstOffset.z and
322    pname:extent.depth does not equal the depth of the subresource specified
323    by pname:dstSubresource, pname:extent.depth must: be a multiple of the
324    <<formats-compatibility-classes,texel block extent depth>> of the
325    elink:VkFormat of pname:dstImage
326  * [[VUID-{refpage}-aspect-06662]]
327ifdef::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
328    If the pname:aspect member of any element of pname:pRegions includes any
329    flag other than ename:VK_IMAGE_ASPECT_STENCIL_BIT or pname:srcImage was
330    not created with <<VkImageStencilUsageCreateInfo,separate stencil
331    usage>>,
332endif::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
333    ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT must: have been included in the
334    slink:VkImageCreateInfo::pname:usage used to create pname:srcImage
335  * [[VUID-{refpage}-aspect-06663]]
336ifdef::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
337    If the pname:aspect member of any element of pname:pRegions includes any
338    flag other than ename:VK_IMAGE_ASPECT_STENCIL_BIT or pname:dstImage was
339    not created with <<VkImageStencilUsageCreateInfo,separate stencil
340    usage>>,
341endif::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
342    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT must: have been included in the
343    slink:VkImageCreateInfo::pname:usage used to create pname:dstImage
344ifdef::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
345  * [[VUID-{refpage}-aspect-06664]]
346    If the pname:aspect member of any element of pname:pRegions includes
347    ename:VK_IMAGE_ASPECT_STENCIL_BIT, and pname:srcImage was created with
348    <<VkImageStencilUsageCreateInfo,separate stencil usage>>,
349    ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT must: have been included in the
350    slink:VkImageStencilUsageCreateInfo::pname:stencilUsage used to create
351    pname:srcImage
352  * [[VUID-{refpage}-aspect-06665]]
353    If the pname:aspect member of any element of pname:pRegions includes
354    ename:VK_IMAGE_ASPECT_STENCIL_BIT, and pname:dstImage was created with
355    <<VkImageStencilUsageCreateInfo,separate stencil usage>>,
356    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT must: have been included in the
357    slink:VkImageStencilUsageCreateInfo::pname:stencilUsage used to create
358    pname:dstImage
359endif::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
360// Common Valid Usage
361