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 VkImageMemoryBarrier* structs
7  * [[VUID-{refpage}-oldLayout-01208]]
8    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
9    <<synchronization-queue-transfers, queue family ownership transfer>> or
10    pname:oldLayout and pname:newLayout define an
11    <<synchronization-image-layout-transitions, image layout transition>>,
12    and pname:oldLayout or pname:newLayout is
13    ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL then pname:image must:
14    have been created with ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
15  * [[VUID-{refpage}-oldLayout-01209]]
16    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
17    <<synchronization-queue-transfers, queue family ownership transfer>> or
18    pname:oldLayout and pname:newLayout define an
19    <<synchronization-image-layout-transitions, image layout transition>>,
20    and pname:oldLayout or pname:newLayout is
21    ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL then pname:image
22    must: have been created with
23    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
24  * [[VUID-{refpage}-oldLayout-01210]]
25    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
26    <<synchronization-queue-transfers, queue family ownership transfer>> or
27    pname:oldLayout and pname:newLayout define an
28    <<synchronization-image-layout-transitions, image layout transition>>,
29    and pname:oldLayout or pname:newLayout is
30    ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL then pname:image
31    must: have been created with
32    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
33  * [[VUID-{refpage}-oldLayout-01211]]
34    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
35    <<synchronization-queue-transfers, queue family ownership transfer>> or
36    pname:oldLayout and pname:newLayout define an
37    <<synchronization-image-layout-transitions, image layout transition>>,
38    and pname:oldLayout or pname:newLayout is
39    ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL then pname:image must:
40    have been created with ename:VK_IMAGE_USAGE_SAMPLED_BIT or
41    ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
42  * [[VUID-{refpage}-oldLayout-01212]]
43    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
44    <<synchronization-queue-transfers, queue family ownership transfer>> or
45    pname:oldLayout and pname:newLayout define an
46    <<synchronization-image-layout-transitions, image layout transition>>,
47    and pname:oldLayout or pname:newLayout is
48    ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL then pname:image must: have
49    been created with ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT
50  * [[VUID-{refpage}-oldLayout-01213]]
51    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
52    <<synchronization-queue-transfers, queue family ownership transfer>> or
53    pname:oldLayout and pname:newLayout define an
54    <<synchronization-image-layout-transitions, image layout transition>>,
55    and pname:oldLayout or pname:newLayout is
56    ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL then pname:image must: have
57    been created with ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT
58  * [[VUID-{refpage}-oldLayout-01197]]
59    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
60    <<synchronization-queue-transfers, queue family ownership transfer>> or
61    pname:oldLayout and pname:newLayout define an
62    <<synchronization-image-layout-transitions, image layout transition>>,
63    pname:oldLayout must: be ename:VK_IMAGE_LAYOUT_UNDEFINED or the current
64    layout of the image subresources affected by the barrier
65  * [[VUID-{refpage}-newLayout-01198]]
66    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
67    <<synchronization-queue-transfers, queue family ownership transfer>> or
68    pname:oldLayout and pname:newLayout define an
69    <<synchronization-image-layout-transitions, image layout transition>>,
70    pname:newLayout must: not be ename:VK_IMAGE_LAYOUT_UNDEFINED or
71    ename:VK_IMAGE_LAYOUT_PREINITIALIZED
72ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[]
73  * [[VUID-{refpage}-oldLayout-01658]]
74    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
75    <<synchronization-queue-transfers, queue family ownership transfer>> or
76    pname:oldLayout and pname:newLayout define an
77    <<synchronization-image-layout-transitions, image layout transition>>,
78    and pname:oldLayout or pname:newLayout is
79    ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL then
80    pname:image must: have been created with
81    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
82  * [[VUID-{refpage}-oldLayout-01659]]
83    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
84    <<synchronization-queue-transfers, queue family ownership transfer>> or
85    pname:oldLayout and pname:newLayout define an
86    <<synchronization-image-layout-transitions, image layout transition>>,
87    and pname:oldLayout or pname:newLayout is
88    ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL then
89    pname:image must: have been created with
90    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
91endif::VK_VERSION_1_1,VK_KHR_maintenance2[]
92ifdef::VK_VERSION_1_2,VK_EXT_separate_depth_stencil_layouts[]
93  * [[VUID-{refpage}-srcQueueFamilyIndex-04065]]
94    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
95    <<synchronization-queue-transfers, queue family ownership transfer>> or
96    pname:oldLayout and pname:newLayout define an
97    <<synchronization-image-layout-transitions, image layout transition>>,
98    and pname:oldLayout or pname:newLayout is
99    ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL then pname:image must:
100    have been created with at least one of
101    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
102    ename:VK_IMAGE_USAGE_SAMPLED_BIT, or
103    ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
104  * [[VUID-{refpage}-srcQueueFamilyIndex-04066]]
105    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
106    <<synchronization-queue-transfers, queue family ownership transfer>> or
107    pname:oldLayout and pname:newLayout define an
108    <<synchronization-image-layout-transitions, image layout transition>>,
109    and pname:oldLayout or pname:newLayout is
110    ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL then pname:image must:
111    have been created with ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
112    set
113  * [[VUID-{refpage}-srcQueueFamilyIndex-04067]]
114    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
115    <<synchronization-queue-transfers, queue family ownership transfer>> or
116    pname:oldLayout and pname:newLayout define an
117    <<synchronization-image-layout-transitions, image layout transition>>,
118    and pname:oldLayout or pname:newLayout is
119    ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL then pname:image must:
120    have been created with at least one of
121    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
122    ename:VK_IMAGE_USAGE_SAMPLED_BIT, or
123    ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
124  * [[VUID-{refpage}-srcQueueFamilyIndex-04068]]
125    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
126    <<synchronization-queue-transfers, queue family ownership transfer>> or
127    pname:oldLayout and pname:newLayout define an
128    <<synchronization-image-layout-transitions, image layout transition>>,
129    and pname:oldLayout or pname:newLayout is
130    ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL then pname:image must:
131    have been created with ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
132    set
133endif::VK_VERSION_1_2,VK_EXT_separate_depth_stencil_layouts[]
134ifdef::VK_VERSION_1_3,VK_KHR_synchronization2[]
135  * [[VUID-{refpage}-synchronization2-07793]]
136    If the <<features-synchronization2, pname:synchronization2>> feature is
137    not enabled, pname:oldLayout must: not be
138    ename:VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR or
139    ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR
140  * [[VUID-{refpage}-synchronization2-07794]]
141    If the <<features-synchronization2, pname:synchronization2>> feature is
142    not enabled, pname:newLayout must: not be
143    ename:VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR or
144    ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR
145  * [[VUID-{refpage}-srcQueueFamilyIndex-03938]]
146    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
147    <<synchronization-queue-transfers, queue family ownership transfer>> or
148    pname:oldLayout and pname:newLayout define an
149    <<synchronization-image-layout-transitions, image layout transition>>,
150    and pname:oldLayout or pname:newLayout is
151    ename:VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL, pname:image must: have been
152    created with ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or
153    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
154  * [[VUID-{refpage}-srcQueueFamilyIndex-03939]]
155    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
156    <<synchronization-queue-transfers, queue family ownership transfer>> or
157    pname:oldLayout and pname:newLayout define an
158    <<synchronization-image-layout-transitions, image layout transition>>,
159    and pname:oldLayout or pname:newLayout is
160    ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL, pname:image must: have been
161    created with at least one of
162    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
163    ename:VK_IMAGE_USAGE_SAMPLED_BIT, or
164    ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
165endif::VK_VERSION_1_3,VK_KHR_synchronization2[]
166ifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
167  * [[VUID-{refpage}-oldLayout-02088]]
168    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
169    <<synchronization-queue-transfers, queue family ownership transfer>> or
170    pname:oldLayout and pname:newLayout define an
171    <<synchronization-image-layout-transitions, image layout transition>>,
172    and pname:oldLayout or pname:newLayout is
173    ename:VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR then
174    pname:image must: have been created with
175    ename:VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR set
176endif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
177  * [[VUID-{refpage}-image-09117]]
178    If pname:image was created with a sharing mode of
179    ename:VK_SHARING_MODE_EXCLUSIVE, and pname:srcQueueFamilyIndex and
180    pname:dstQueueFamilyIndex are not equal, pname:srcQueueFamilyIndex must:
181    be
182ifdef::VK_VERSION_1_1,VK_KHR_external_memory[]
183    ename:VK_QUEUE_FAMILY_EXTERNAL,
184ifdef::VK_EXT_queue_family_foreign[]
185    ename:VK_QUEUE_FAMILY_FOREIGN_EXT,
186endif::VK_EXT_queue_family_foreign[]
187    or
188endif::VK_VERSION_1_1,VK_KHR_external_memory[]
189    a valid queue family
190  * [[VUID-{refpage}-image-09118]]
191    If pname:image was created with a sharing mode of
192    ename:VK_SHARING_MODE_EXCLUSIVE, and pname:srcQueueFamilyIndex and
193    pname:dstQueueFamilyIndex are not equal, pname:dstQueueFamilyIndex must:
194    be
195ifdef::VK_VERSION_1_1,VK_KHR_external_memory[]
196    ename:VK_QUEUE_FAMILY_EXTERNAL,
197ifdef::VK_EXT_queue_family_foreign[]
198    ename:VK_QUEUE_FAMILY_FOREIGN_EXT,
199endif::VK_EXT_queue_family_foreign[]
200    or
201endif::VK_VERSION_1_1,VK_KHR_external_memory[]
202    a valid queue family
203ifdef::VK_VERSION_1_1,VK_KHR_external_memory[]
204  * [[VUID-{refpage}-srcQueueFamilyIndex-04070]]
205    If pname:srcQueueFamilyIndex is not equal to pname:dstQueueFamilyIndex,
206    at least one of pname:srcQueueFamilyIndex or pname:dstQueueFamilyIndex
207    must: not be ename:VK_QUEUE_FAMILY_EXTERNAL
208ifdef::VK_EXT_queue_family_foreign[]
209    or ename:VK_QUEUE_FAMILY_FOREIGN_EXT
210endif::VK_EXT_queue_family_foreign[]
211  * [[VUID-{refpage}-None-09119]]
212    {empty}
213ifdef::VK_VERSION_1_1,VK_KHR_external_memory[If]
214ifdef::VK_KHR_external_memory[]
215    the apiext:VK_KHR_external_memory extension is not enabled,
216endif::VK_KHR_external_memory[]
217ifdef::VK_VERSION_1_1+VK_KHR_external_memory[and]
218ifdef::VK_VERSION_1_1[]
219    the value of slink:VkApplicationInfo::pname:apiVersion used to create
220    the slink:VkInstance is not greater than or equal to Version 1.1,
221endif::VK_VERSION_1_1[]
222    pname:srcQueueFamilyIndex must: not be ename:VK_QUEUE_FAMILY_EXTERNAL
223  * [[VUID-{refpage}-None-09120]]
224    {empty}
225ifdef::VK_VERSION_1_1,VK_KHR_external_memory[If]
226ifdef::VK_KHR_external_memory[]
227    the apiext:VK_KHR_external_memory extension is not enabled,
228endif::VK_KHR_external_memory[]
229ifdef::VK_VERSION_1_1+VK_KHR_external_memory[and]
230ifdef::VK_VERSION_1_1[]
231    the value of slink:VkApplicationInfo::pname:apiVersion used to create
232    the slink:VkInstance is not greater than or equal to Version 1.1,
233endif::VK_VERSION_1_1[]
234    pname:dstQueueFamilyIndex must: not be ename:VK_QUEUE_FAMILY_EXTERNAL
235ifdef::VK_EXT_queue_family_foreign[]
236  * [[VUID-{refpage}-srcQueueFamilyIndex-09121]]
237    If the apiext:VK_EXT_queue_family_foreign extension is not enabled
238    pname:srcQueueFamilyIndex must: not be ename:VK_QUEUE_FAMILY_FOREIGN_EXT
239  * [[VUID-{refpage}-dstQueueFamilyIndex-09122]]
240    If the apiext:VK_EXT_queue_family_foreign extension is not enabled
241    pname:dstQueueFamilyIndex must: not be ename:VK_QUEUE_FAMILY_FOREIGN_EXT
242endif::VK_EXT_queue_family_foreign[]
243endif::VK_VERSION_1_1,VK_KHR_external_memory[]
244ifdef::VK_KHR_video_decode_queue[]
245  * [[VUID-{refpage}-srcQueueFamilyIndex-07120]]
246    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
247    <<synchronization-queue-transfers, queue family ownership transfer>> or
248    pname:oldLayout and pname:newLayout define an
249    <<synchronization-image-layout-transitions, image layout transition>>,
250    and pname:oldLayout or pname:newLayout is
251    ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR then pname:image must: have
252    been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR
253  * [[VUID-{refpage}-srcQueueFamilyIndex-07121]]
254    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
255    <<synchronization-queue-transfers, queue family ownership transfer>> or
256    pname:oldLayout and pname:newLayout define an
257    <<synchronization-image-layout-transitions, image layout transition>>,
258    and pname:oldLayout or pname:newLayout is
259    ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR then pname:image must: have
260    been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
261  * [[VUID-{refpage}-srcQueueFamilyIndex-07122]]
262    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
263    <<synchronization-queue-transfers, queue family ownership transfer>> or
264    pname:oldLayout and pname:newLayout define an
265    <<synchronization-image-layout-transitions, image layout transition>>,
266    and pname:oldLayout or pname:newLayout is
267    ename:VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR then pname:image must: have
268    been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
269endif::VK_KHR_video_decode_queue[]
270ifdef::VK_KHR_video_encode_queue[]
271  * [[VUID-{refpage}-srcQueueFamilyIndex-07123]]
272    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
273    <<synchronization-queue-transfers, queue family ownership transfer>> or
274    pname:oldLayout and pname:newLayout define an
275    <<synchronization-image-layout-transitions, image layout transition>>,
276    and pname:oldLayout or pname:newLayout is
277    ename:VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR then pname:image must: have
278    been created with ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
279  * [[VUID-{refpage}-srcQueueFamilyIndex-07124]]
280    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
281    <<synchronization-queue-transfers, queue family ownership transfer>> or
282    pname:oldLayout and pname:newLayout define an
283    <<synchronization-image-layout-transitions, image layout transition>>,
284    and pname:oldLayout or pname:newLayout is
285    ename:VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR then pname:image must: have
286    been created with ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR
287  * [[VUID-{refpage}-srcQueueFamilyIndex-07125]]
288    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
289    <<synchronization-queue-transfers, queue family ownership transfer>> or
290    pname:oldLayout and pname:newLayout define an
291    <<synchronization-image-layout-transitions, image layout transition>>,
292    and pname:oldLayout or pname:newLayout is
293    ename:VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR then pname:image must: have
294    been created with ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR
295endif::VK_KHR_video_encode_queue[]
296ifdef::VK_EXT_attachment_feedback_loop_layout[]
297  * [[VUID-{refpage}-srcQueueFamilyIndex-07006]]
298    If pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex define a
299    <<synchronization-queue-transfers, queue family ownership transfer>> or
300    pname:oldLayout and pname:newLayout define an
301    <<synchronization-image-layout-transitions, image layout transition>>,
302    and pname:oldLayout or pname:newLayout is
303    ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT then
304    pname:image must: have been created with either the
305    ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or
306    ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT usage bits, and the
307    ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT or
308    ename:VK_IMAGE_USAGE_SAMPLED_BIT usage bits, and the
309    ename:VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT usage bit
310  * [[VUID-{refpage}-attachmentFeedbackLoopLayout-07313]]
311    If the <<features-attachmentFeedbackLoopLayout,
312    pname:attachmentFeedbackLoopLayout>> feature is not enabled,
313    pname:newLayout must: not be
314    ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT
315endif::VK_EXT_attachment_feedback_loop_layout[]
316// Common Valid Usage
317