1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[copies]]
6e5c31af7Sopenharmony_ci= Copy Commands
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ciAn application can: copy buffer and image data using several methods
9e5c31af7Sopenharmony_cidepending on the type of data transfer.
10e5c31af7Sopenharmony_ciData can: be copied between buffer objects with
11e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
12e5c31af7Sopenharmony_cifname:vkCmdCopyBuffer2KHR and
13e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
14e5c31af7Sopenharmony_cifname:vkCmdCopyBuffer and a portion of an image can: be copied to another
15e5c31af7Sopenharmony_ciimage with
16e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
17e5c31af7Sopenharmony_cifname:vkCmdCopyImage2KHR and
18e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
19e5c31af7Sopenharmony_cifname:vkCmdCopyImage.
20e5c31af7Sopenharmony_ciImage data can: also be copied to and from buffer memory using
21e5c31af7Sopenharmony_ciifndef::VK_KHR_copy_commands2[]
22e5c31af7Sopenharmony_cifname:vkCmdCopyImageToBuffer and fname:vkCmdCopyBufferToImage.
23e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
24e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
25e5c31af7Sopenharmony_cifname:vkCmdCopyImageToBuffer2KHR, fname:vkCmdCopyImageToBuffer,
26e5c31af7Sopenharmony_cifname:vkCmdCopyBufferToImage2KHR, and fname:vkCmdCopyBufferToImage.
27e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
28e5c31af7Sopenharmony_ciImage data can: be blitted (with or without scaling and filtering) with
29e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
30e5c31af7Sopenharmony_cifname:vkCmdBlitImage2KHR and
31e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
32e5c31af7Sopenharmony_cifname:vkCmdBlitImage.
33e5c31af7Sopenharmony_ciMultisampled images can: be resolved to a non-multisampled image with
34e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
35e5c31af7Sopenharmony_cifname:vkCmdResolveImage2KHR and
36e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
37e5c31af7Sopenharmony_cifname:vkCmdResolveImage.
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_ci
40e5c31af7Sopenharmony_ci== Common Operation
41e5c31af7Sopenharmony_ci
42e5c31af7Sopenharmony_ciThe following valid usage rules apply to all copy commands:
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ci  * Copy commands must: be recorded outside of a render pass instance.
45e5c31af7Sopenharmony_ci  * The set of all bytes bound to all the source regions must: not overlap
46e5c31af7Sopenharmony_ci    the set of all bytes bound to the destination regions.
47e5c31af7Sopenharmony_ci  * The set of all bytes bound to each destination region must: not overlap
48e5c31af7Sopenharmony_ci    the set of all bytes bound to another destination region.
49e5c31af7Sopenharmony_ci  * Copy regions must: be non-empty.
50e5c31af7Sopenharmony_ci  * Regions must: not extend outside the bounds of the buffer or image
51e5c31af7Sopenharmony_ci    level, except that regions of compressed images can: extend as far as
52e5c31af7Sopenharmony_ci    the dimension of the image level rounded up to a complete compressed
53e5c31af7Sopenharmony_ci    texel block.
54e5c31af7Sopenharmony_ci  * Source image subresources must: be in either the
55e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_GENERAL or
56e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL layout.
57e5c31af7Sopenharmony_ci    Destination image subresources must: be in the
58e5c31af7Sopenharmony_ciifdef::VK_KHR_shared_presentable_image[]
59e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR,
60e5c31af7Sopenharmony_ciendif::VK_KHR_shared_presentable_image[]
61e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_GENERAL or
62e5c31af7Sopenharmony_ci    ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL layout.
63e5c31af7Sopenharmony_ci    As a consequence, if an image subresource is used as both source and
64e5c31af7Sopenharmony_ci    destination of a copy, it must: be in the ename:VK_IMAGE_LAYOUT_GENERAL
65e5c31af7Sopenharmony_ci    layout.
66e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
67e5c31af7Sopenharmony_ci  * Source images must: have ename:VK_FORMAT_FEATURE_TRANSFER_SRC_BIT in
68e5c31af7Sopenharmony_ci    their <<resources-image-format-features,format features>>.
69e5c31af7Sopenharmony_ci  * Destination images must: have ename:VK_FORMAT_FEATURE_TRANSFER_DST_BIT
70e5c31af7Sopenharmony_ci    in their <<resources-image-format-features,format features>>.
71e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
72e5c31af7Sopenharmony_ci  * Source buffers must: have been created with the
73e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFER_SRC_BIT usage bit enabled and destination
74e5c31af7Sopenharmony_ci    buffers must: have been created with the
75e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT usage bit enabled.
76e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2+VK_EXT_separate_stencil_usage[]
77e5c31af7Sopenharmony_ci  * Source images must: have been created with
78e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT set in
79e5c31af7Sopenharmony_ci    slink:VkImageCreateInfo::pname:usage
80e5c31af7Sopenharmony_ci  * Destination images must: have been created with
81e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT set in
82e5c31af7Sopenharmony_ci    slink:VkImageCreateInfo::pname:usage
83e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2+VK_EXT_separate_stencil_usage[]
84e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
85e5c31af7Sopenharmony_ci  * If the stencil aspect of source image is accessed, and the source image
86e5c31af7Sopenharmony_ci    was not created with <<VkImageStencilUsageCreateInfo,separate stencil
87e5c31af7Sopenharmony_ci    usage>>, the source image must: have been created with
88e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT set in
89e5c31af7Sopenharmony_ci    slink:VkImageCreateInfo::pname:usage
90e5c31af7Sopenharmony_ci  * If the stencil aspect of destination image is accessed, and the
91e5c31af7Sopenharmony_ci    destination image was not created with
92e5c31af7Sopenharmony_ci    <<VkImageStencilUsageCreateInfo,separate stencil usage>>, the
93e5c31af7Sopenharmony_ci    destination image must: have been created with
94e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT set in
95e5c31af7Sopenharmony_ci    slink:VkImageCreateInfo::pname:usage
96e5c31af7Sopenharmony_ci  * If the stencil aspect of source image is accessed, and the source image
97e5c31af7Sopenharmony_ci    was created with <<VkImageStencilUsageCreateInfo,separate stencil
98e5c31af7Sopenharmony_ci    usage>>, the source image must: have been created with
99e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT set in
100e5c31af7Sopenharmony_ci    slink:VkImageStencilUsageCreateInfo::pname:stencilUsage
101e5c31af7Sopenharmony_ci  * If the stencil aspect of destination image is accessed, and the
102e5c31af7Sopenharmony_ci    destination image was created with
103e5c31af7Sopenharmony_ci    <<VkImageStencilUsageCreateInfo,separate stencil usage>>, the
104e5c31af7Sopenharmony_ci    destination image must: have been created with
105e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT set in
106e5c31af7Sopenharmony_ci    slink:VkImageStencilUsageCreateInfo::pname:stencilUsage
107e5c31af7Sopenharmony_ci  * If non-stencil aspects of a source image are accessed, the source image
108e5c31af7Sopenharmony_ci    must: have been created with ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT set
109e5c31af7Sopenharmony_ci    in slink:VkImageCreateInfo::pname:usage
110e5c31af7Sopenharmony_ci  * If non-stencil aspects of a destination image are accessed, the
111e5c31af7Sopenharmony_ci    destination image must: have been created with
112e5c31af7Sopenharmony_ci    ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT set in
113e5c31af7Sopenharmony_ci    slink:VkImageCreateInfo::pname:usage
114e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_separate_stencil_usage[]
115e5c31af7Sopenharmony_ci
116e5c31af7Sopenharmony_ciAll copy commands are treated as "`transfer`" operations for the purposes of
117e5c31af7Sopenharmony_cisynchronization barriers.
118e5c31af7Sopenharmony_ci
119e5c31af7Sopenharmony_ciAll copy commands that have a source format with an X component in its
120e5c31af7Sopenharmony_ciformat description read undefined: values from those bits.
121e5c31af7Sopenharmony_ci
122e5c31af7Sopenharmony_ciAll copy commands that have a destination format with an X component in its
123e5c31af7Sopenharmony_ciformat description write undefined: values to those bits.
124e5c31af7Sopenharmony_ci
125e5c31af7Sopenharmony_ci
126e5c31af7Sopenharmony_ci[[copies-buffers]]
127e5c31af7Sopenharmony_ci== Copying Data Between Buffers
128e5c31af7Sopenharmony_ci
129e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyBuffer',desc='Copy data between buffer regions',type='protos']
130e5c31af7Sopenharmony_ci--
131e5c31af7Sopenharmony_ci:refpage: vkCmdCopyBuffer
132e5c31af7Sopenharmony_ci
133e5c31af7Sopenharmony_ciTo copy data between buffer objects, call:
134e5c31af7Sopenharmony_ci
135e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyBuffer.txt[]
136e5c31af7Sopenharmony_ci
137e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
138e5c31af7Sopenharmony_ci    recorded.
139e5c31af7Sopenharmony_ci  * pname:srcBuffer is the source buffer.
140e5c31af7Sopenharmony_ci  * pname:dstBuffer is the destination buffer.
141e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
142e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkBufferCopy structures
143e5c31af7Sopenharmony_ci    specifying the regions to copy.
144e5c31af7Sopenharmony_ci
145e5c31af7Sopenharmony_ciEach region in pname:pRegions is copied from the source buffer to the same
146e5c31af7Sopenharmony_ciregion of the destination buffer.
147e5c31af7Sopenharmony_cipname:srcBuffer and pname:dstBuffer can: be the same buffer or alias the
148e5c31af7Sopenharmony_cisame memory, but the resulting values are undefined: if the copy regions
149e5c31af7Sopenharmony_cioverlap in memory.
150e5c31af7Sopenharmony_ci
151e5c31af7Sopenharmony_ci.Valid Usage
152e5c31af7Sopenharmony_ci****
153e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_command_buffer_common.txt[]
154e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_common.txt[]
155e5c31af7Sopenharmony_ci****
156e5c31af7Sopenharmony_ci
157e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyBuffer.txt[]
158e5c31af7Sopenharmony_ci--
159e5c31af7Sopenharmony_ci
160e5c31af7Sopenharmony_ci[open,refpage='VkBufferCopy',desc='Structure specifying a buffer copy operation',type='structs']
161e5c31af7Sopenharmony_ci--
162e5c31af7Sopenharmony_ci:refpage: VkBufferCopy
163e5c31af7Sopenharmony_ci
164e5c31af7Sopenharmony_ciThe sname:VkBufferCopy structure is defined as:
165e5c31af7Sopenharmony_ci
166e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBufferCopy.txt[]
167e5c31af7Sopenharmony_ci
168e5c31af7Sopenharmony_ci  * pname:srcOffset is the starting offset in bytes from the start of
169e5c31af7Sopenharmony_ci    pname:srcBuffer.
170e5c31af7Sopenharmony_ci  * pname:dstOffset is the starting offset in bytes from the start of
171e5c31af7Sopenharmony_ci    pname:dstBuffer.
172e5c31af7Sopenharmony_ci  * pname:size is the number of bytes to copy.
173e5c31af7Sopenharmony_ci
174e5c31af7Sopenharmony_ci.Valid Usage
175e5c31af7Sopenharmony_ci****
176e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/buffer_copy_common.txt[]
177e5c31af7Sopenharmony_ci****
178e5c31af7Sopenharmony_ci
179e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBufferCopy.txt[]
180e5c31af7Sopenharmony_ci--
181e5c31af7Sopenharmony_ci
182e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
183e5c31af7Sopenharmony_ci
184e5c31af7Sopenharmony_ciA more extensible version of the copy buffer command is defined below.
185e5c31af7Sopenharmony_ci
186e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyBuffer2KHR',desc='Copy data between buffer regions',type='protos']
187e5c31af7Sopenharmony_ci--
188e5c31af7Sopenharmony_ci:refpage: vkCmdCopyBuffer2KHR
189e5c31af7Sopenharmony_ci
190e5c31af7Sopenharmony_ciTo copy data between buffer objects, call:
191e5c31af7Sopenharmony_ci
192e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyBuffer2KHR.txt[]
193e5c31af7Sopenharmony_ci
194e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
195e5c31af7Sopenharmony_ci    recorded.
196e5c31af7Sopenharmony_ci  * pname:pCopyBufferInfo is a pointer to a slink:VkCopyBufferInfo2KHR
197e5c31af7Sopenharmony_ci    structure describing the copy parameters.
198e5c31af7Sopenharmony_ci
199e5c31af7Sopenharmony_ciThis command is functionally identical to flink:vkCmdCopyBuffer, but
200e5c31af7Sopenharmony_ciincludes extensible sub-structures that include pname:sType and pname:pNext
201e5c31af7Sopenharmony_ciparameters, allowing them to be more easily extended.
202e5c31af7Sopenharmony_ci
203e5c31af7Sopenharmony_ci.Valid Usage
204e5c31af7Sopenharmony_ci****
205e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_command_buffer_common.txt[]
206e5c31af7Sopenharmony_ci****
207e5c31af7Sopenharmony_ci
208e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyBuffer2KHR.txt[]
209e5c31af7Sopenharmony_ci--
210e5c31af7Sopenharmony_ci
211e5c31af7Sopenharmony_ci[open,refpage='VkCopyBufferInfo2KHR',desc='Structure specifying parameters of a buffer copy command',type='structs']
212e5c31af7Sopenharmony_ci--
213e5c31af7Sopenharmony_ci:refpage: VkCopyBufferInfo2KHR
214e5c31af7Sopenharmony_ci
215e5c31af7Sopenharmony_ciThe sname:VkCopyBufferInfo2KHR structure is defined as:
216e5c31af7Sopenharmony_ci
217e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyBufferInfo2KHR.txt[]
218e5c31af7Sopenharmony_ci
219e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
220e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
221e5c31af7Sopenharmony_ci    structure.
222e5c31af7Sopenharmony_ci  * pname:srcBuffer is the source buffer.
223e5c31af7Sopenharmony_ci  * pname:dstBuffer is the destination buffer.
224e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
225e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkBufferCopy2KHR
226e5c31af7Sopenharmony_ci    structures specifying the regions to copy.
227e5c31af7Sopenharmony_ci
228e5c31af7Sopenharmony_ciMembers defined by this structure with the same name as parameters in
229e5c31af7Sopenharmony_ciflink:vkCmdCopyBuffer have the identical effect to those parameters; the
230e5c31af7Sopenharmony_cichild structure slink:VkBufferCopy2KHR is a variant of slink:VkBufferCopy
231e5c31af7Sopenharmony_ciwhich includes pname:sType and pname:pNext parameters, allowing it to be
232e5c31af7Sopenharmony_ciextended.
233e5c31af7Sopenharmony_ci
234e5c31af7Sopenharmony_ci.Valid Usage
235e5c31af7Sopenharmony_ci****
236e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_common.txt[]
237e5c31af7Sopenharmony_ci****
238e5c31af7Sopenharmony_ci
239e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyBufferInfo2KHR.txt[]
240e5c31af7Sopenharmony_ci--
241e5c31af7Sopenharmony_ci
242e5c31af7Sopenharmony_ci[open,refpage='VkBufferCopy2KHR',desc='Structure specifying a buffer copy operation',type='structs']
243e5c31af7Sopenharmony_ci--
244e5c31af7Sopenharmony_ci:refpage: VkBufferCopy2KHR
245e5c31af7Sopenharmony_ci
246e5c31af7Sopenharmony_ciThe sname:VkBufferCopy2KHR structure is defined as:
247e5c31af7Sopenharmony_ci
248e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBufferCopy2KHR.txt[]
249e5c31af7Sopenharmony_ci
250e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
251e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
252e5c31af7Sopenharmony_ci    structure.
253e5c31af7Sopenharmony_ci  * pname:srcOffset is the starting offset in bytes from the start of
254e5c31af7Sopenharmony_ci    pname:srcBuffer.
255e5c31af7Sopenharmony_ci  * pname:dstOffset is the starting offset in bytes from the start of
256e5c31af7Sopenharmony_ci    pname:dstBuffer.
257e5c31af7Sopenharmony_ci  * pname:size is the number of bytes to copy.
258e5c31af7Sopenharmony_ci
259e5c31af7Sopenharmony_ci.Valid Usage
260e5c31af7Sopenharmony_ci****
261e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/buffer_copy_common.txt[]
262e5c31af7Sopenharmony_ci****
263e5c31af7Sopenharmony_ci
264e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBufferCopy2KHR.txt[]
265e5c31af7Sopenharmony_ci--
266e5c31af7Sopenharmony_ci
267e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
268e5c31af7Sopenharmony_ci
269e5c31af7Sopenharmony_ci
270e5c31af7Sopenharmony_ci[[copies-images]]
271e5c31af7Sopenharmony_ci== Copying Data Between Images
272e5c31af7Sopenharmony_ci
273e5c31af7Sopenharmony_cifname:vkCmdCopyImage performs image copies in a similar manner to a host
274e5c31af7Sopenharmony_cimemcpy.
275e5c31af7Sopenharmony_ciIt does not perform general-purpose conversions such as scaling, resizing,
276e5c31af7Sopenharmony_ciblending, color-space conversion, or format conversions.
277e5c31af7Sopenharmony_ciRather, it simply copies raw image data.
278e5c31af7Sopenharmony_cifname:vkCmdCopyImage can: copy between images with different formats,
279e5c31af7Sopenharmony_ciprovided the formats are compatible as defined below.
280e5c31af7Sopenharmony_ci
281e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyImage',desc='Copy data between images',type='protos']
282e5c31af7Sopenharmony_ci--
283e5c31af7Sopenharmony_ci:refpage: vkCmdCopyImage
284e5c31af7Sopenharmony_ci
285e5c31af7Sopenharmony_ciTo copy data between image objects, call:
286e5c31af7Sopenharmony_ci
287e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyImage.txt[]
288e5c31af7Sopenharmony_ci
289e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
290e5c31af7Sopenharmony_ci    recorded.
291e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
292e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the current layout of the source image
293e5c31af7Sopenharmony_ci    subresource.
294e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
295e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the current layout of the destination image
296e5c31af7Sopenharmony_ci    subresource.
297e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
298e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkImageCopy structures
299e5c31af7Sopenharmony_ci    specifying the regions to copy.
300e5c31af7Sopenharmony_ci
301e5c31af7Sopenharmony_ciEach region in pname:pRegions is copied from the source image to the same
302e5c31af7Sopenharmony_ciregion of the destination image.
303e5c31af7Sopenharmony_cipname:srcImage and pname:dstImage can: be the same image or alias the same
304e5c31af7Sopenharmony_cimemory.
305e5c31af7Sopenharmony_ci
306e5c31af7Sopenharmony_ci[[copies-images-format-compatibility]]
307e5c31af7Sopenharmony_ciThe formats of pname:srcImage and pname:dstImage must: be compatible.
308e5c31af7Sopenharmony_ciFormats are compatible if they share the same class, as shown in the
309e5c31af7Sopenharmony_ci<<formats-compatibility,Compatible Formats>> table.
310e5c31af7Sopenharmony_ciDepth/stencil formats must: match exactly.
311e5c31af7Sopenharmony_ci
312e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
313e5c31af7Sopenharmony_ciIf either pname:srcImage or pname:dstImage has a
314e5c31af7Sopenharmony_ci<<formats-requiring-sampler-ycbcr-conversion, _multi-planar_ format>>,
315e5c31af7Sopenharmony_ciregions of each plane to be copied must: be specified separately using the
316e5c31af7Sopenharmony_cipname:srcSubresource and pname:dstSubresource members of the
317e5c31af7Sopenharmony_cislink:VkImageCopy structure.
318e5c31af7Sopenharmony_ciIn this case, the pname:aspectMask of the pname:srcSubresource or
319e5c31af7Sopenharmony_cipname:dstSubresource that refers to the multi-planar image must: be
320e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_0_BIT, ename:VK_IMAGE_ASPECT_PLANE_1_BIT, or
321e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_2_BIT.
322e5c31af7Sopenharmony_ciFor the purposes of fname:vkCmdCopyImage, each plane of a multi-planar image
323e5c31af7Sopenharmony_ciis treated as having the format listed in <<formats-compatible-planes>> for
324e5c31af7Sopenharmony_cithe plane identified by the pname:aspectMask of the corresponding
325e5c31af7Sopenharmony_cisubresource.
326e5c31af7Sopenharmony_ciThis applies both to elink:VkFormat and to coordinates used in the copy,
327e5c31af7Sopenharmony_ciwhich correspond to texels in the _plane_ rather than how these texels map
328e5c31af7Sopenharmony_cito coordinates in the image as a whole.
329e5c31af7Sopenharmony_ci
330e5c31af7Sopenharmony_ci[NOTE]
331e5c31af7Sopenharmony_ci.Note
332e5c31af7Sopenharmony_ci====
333e5c31af7Sopenharmony_ciFor example, the ename:VK_IMAGE_ASPECT_PLANE_1_BIT plane of a
334e5c31af7Sopenharmony_ciename:VK_FORMAT_G8_B8R8_2PLANE_420_UNORM image is compatible with an image
335e5c31af7Sopenharmony_ciof format ename:VK_FORMAT_R8G8_UNORM and (less usefully) with the
336e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_0_BIT plane of an image of format
337e5c31af7Sopenharmony_ciename:VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16, as each texel is
338e5c31af7Sopenharmony_ci2 bytes in size.
339e5c31af7Sopenharmony_ci====
340e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
341e5c31af7Sopenharmony_ci
342e5c31af7Sopenharmony_ci[[copies-images-format-size-compatibility]]
343e5c31af7Sopenharmony_cifname:vkCmdCopyImage allows copying between _size-compatible_ compressed and
344e5c31af7Sopenharmony_ciuncompressed internal formats.
345e5c31af7Sopenharmony_ciFormats are size-compatible if the texel block size of the uncompressed
346e5c31af7Sopenharmony_ciformat is equal to the texel block size of the compressed format.
347e5c31af7Sopenharmony_ciSuch a copy does not perform on-the-fly compression or decompression.
348e5c31af7Sopenharmony_ciWhen copying from an uncompressed format to a compressed format, each texel
349e5c31af7Sopenharmony_ciof uncompressed data of the source image is copied as a raw value to the
350e5c31af7Sopenharmony_cicorresponding compressed texel block of the destination image.
351e5c31af7Sopenharmony_ciWhen copying from a compressed format to an uncompressed format, each
352e5c31af7Sopenharmony_cicompressed texel block of the source image is copied as a raw value to the
353e5c31af7Sopenharmony_cicorresponding texel of uncompressed data in the destination image.
354e5c31af7Sopenharmony_ciThus, for example, it is legal to copy between a 128-bit uncompressed format
355e5c31af7Sopenharmony_ciand a compressed format which has a 128-bit sized compressed texel block
356e5c31af7Sopenharmony_cirepresenting 4{times}4 texels (using 8 bits per texel), or between a 64-bit
357e5c31af7Sopenharmony_ciuncompressed format and a compressed format which has a 64-bit sized
358e5c31af7Sopenharmony_cicompressed texel block representing 4{times}4 texels (using 4 bits per
359e5c31af7Sopenharmony_citexel).
360e5c31af7Sopenharmony_ci
361e5c31af7Sopenharmony_ciWhen copying between compressed and uncompressed formats the pname:extent
362e5c31af7Sopenharmony_cimembers represent the texel dimensions of the source image and not the
363e5c31af7Sopenharmony_cidestination.
364e5c31af7Sopenharmony_ciWhen copying from a compressed image to an uncompressed image the image
365e5c31af7Sopenharmony_citexel dimensions written to the uncompressed image will be source extent
366e5c31af7Sopenharmony_cidivided by the compressed texel block dimensions.
367e5c31af7Sopenharmony_ciWhen copying from an uncompressed image to a compressed image the image
368e5c31af7Sopenharmony_citexel dimensions written to the compressed image will be the source extent
369e5c31af7Sopenharmony_cimultiplied by the compressed texel block dimensions.
370e5c31af7Sopenharmony_ciIn both cases the number of bytes read and the number of bytes written will
371e5c31af7Sopenharmony_cibe identical.
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ciCopying to or from block-compressed images is typically done in multiples of
374e5c31af7Sopenharmony_cithe compressed texel block size.
375e5c31af7Sopenharmony_ciFor this reason the pname:extent must: be a multiple of the compressed texel
376e5c31af7Sopenharmony_ciblock dimension.
377e5c31af7Sopenharmony_ciThere is one exception to this rule which is required: to handle compressed
378e5c31af7Sopenharmony_ciimages created with dimensions that are not a multiple of the compressed
379e5c31af7Sopenharmony_citexel block dimensions: if the pname:srcImage is compressed, then:
380e5c31af7Sopenharmony_ci
381e5c31af7Sopenharmony_ci  * If pname:extent.width is not a multiple of the compressed texel block
382e5c31af7Sopenharmony_ci    width, then [eq]#(pname:extent.width {plus} pname:srcOffset.x)# must:
383e5c31af7Sopenharmony_ci    equal the image subresource width.
384e5c31af7Sopenharmony_ci  * If pname:extent.height is not a multiple of the compressed texel block
385e5c31af7Sopenharmony_ci    height, then [eq]#(pname:extent.height {plus} pname:srcOffset.y)# must:
386e5c31af7Sopenharmony_ci    equal the image subresource height.
387e5c31af7Sopenharmony_ci  * If pname:extent.depth is not a multiple of the compressed texel block
388e5c31af7Sopenharmony_ci    depth, then [eq]#(pname:extent.depth {plus} pname:srcOffset.z)# must:
389e5c31af7Sopenharmony_ci    equal the image subresource depth.
390e5c31af7Sopenharmony_ci
391e5c31af7Sopenharmony_ciSimilarly, if the pname:dstImage is compressed, then:
392e5c31af7Sopenharmony_ci
393e5c31af7Sopenharmony_ci  * If pname:extent.width is not a multiple of the compressed texel block
394e5c31af7Sopenharmony_ci    width, then [eq]#(pname:extent.width {plus} pname:dstOffset.x)# must:
395e5c31af7Sopenharmony_ci    equal the image subresource width.
396e5c31af7Sopenharmony_ci  * If pname:extent.height is not a multiple of the compressed texel block
397e5c31af7Sopenharmony_ci    height, then [eq]#(pname:extent.height {plus} pname:dstOffset.y)# must:
398e5c31af7Sopenharmony_ci    equal the image subresource height.
399e5c31af7Sopenharmony_ci  * If pname:extent.depth is not a multiple of the compressed texel block
400e5c31af7Sopenharmony_ci    depth, then [eq]#(pname:extent.depth {plus} pname:dstOffset.z)# must:
401e5c31af7Sopenharmony_ci    equal the image subresource depth.
402e5c31af7Sopenharmony_ci
403e5c31af7Sopenharmony_ciThis allows the last compressed texel block of the image in each
404e5c31af7Sopenharmony_cinon-multiple dimension to be included as a source or destination of the
405e5c31af7Sopenharmony_cicopy.
406e5c31af7Sopenharmony_ci
407e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
408e5c31af7Sopenharmony_ci"`etext:_422`" image formats that are not
409e5c31af7Sopenharmony_ci<<formats-requiring-sampler-ycbcr-conversion,_multi-planar_>> are treated as
410e5c31af7Sopenharmony_cihaving a 2{times}1 compressed texel block for the purposes of these rules.
411e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_cifname:vkCmdCopyImage can: be used to copy image data between multisample
414e5c31af7Sopenharmony_ciimages, but both images must: have the same number of samples.
415e5c31af7Sopenharmony_ci
416e5c31af7Sopenharmony_ci.Valid Usage
417e5c31af7Sopenharmony_ci****
418e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_command_buffer_common.txt[]
419e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_common.txt[]
420e5c31af7Sopenharmony_ci****
421e5c31af7Sopenharmony_ci
422e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyImage.txt[]
423e5c31af7Sopenharmony_ci--
424e5c31af7Sopenharmony_ci
425e5c31af7Sopenharmony_ci[open,refpage='VkImageCopy',desc='Structure specifying an image copy operation',type='structs']
426e5c31af7Sopenharmony_ci--
427e5c31af7Sopenharmony_ci:refpage: VkImageCopy
428e5c31af7Sopenharmony_ci
429e5c31af7Sopenharmony_ciThe sname:VkImageCopy structure is defined as:
430e5c31af7Sopenharmony_ci
431e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageCopy.txt[]
432e5c31af7Sopenharmony_ci
433e5c31af7Sopenharmony_ci  * pname:srcSubresource and pname:dstSubresource are
434e5c31af7Sopenharmony_ci    slink:VkImageSubresourceLayers structures specifying the image
435e5c31af7Sopenharmony_ci    subresources of the images used for the source and destination image
436e5c31af7Sopenharmony_ci    data, respectively.
437e5c31af7Sopenharmony_ci  * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y,
438e5c31af7Sopenharmony_ci    and pname:z offsets in texels of the sub-regions of the source and
439e5c31af7Sopenharmony_ci    destination image data.
440e5c31af7Sopenharmony_ci  * pname:extent is the size in texels of the image to copy in pname:width,
441e5c31af7Sopenharmony_ci    pname:height and pname:depth.
442e5c31af7Sopenharmony_ci
443e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
444e5c31af7Sopenharmony_ciFor ename:VK_IMAGE_TYPE_3D images, copies are performed slice by slice
445e5c31af7Sopenharmony_cistarting with the pname:z member of the pname:srcOffset or pname:dstOffset,
446e5c31af7Sopenharmony_ciand copying pname:depth slices.
447e5c31af7Sopenharmony_ciFor images with multiple layers, copies are performed layer by layer
448e5c31af7Sopenharmony_cistarting with the pname:baseArrayLayer member of the pname:srcSubresource or
449e5c31af7Sopenharmony_cipname:dstSubresource and copying pname:layerCount layers.
450e5c31af7Sopenharmony_ciImage data can: be copied between images with different image types.
451e5c31af7Sopenharmony_ciIf one image is ename:VK_IMAGE_TYPE_3D and the other image is
452e5c31af7Sopenharmony_ciename:VK_IMAGE_TYPE_2D with multiple layers, then each slice is copied to or
453e5c31af7Sopenharmony_cifrom a different layer.
454e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
455e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_maintenance1[]
456e5c31af7Sopenharmony_ciCopies are done layer by layer starting with pname:baseArrayLayer member of
457e5c31af7Sopenharmony_cipname:srcSubresource for the source and pname:dstSubresource for the
458e5c31af7Sopenharmony_cidestination.
459e5c31af7Sopenharmony_cipname:layerCount layers are copied to the destination image.
460e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
461e5c31af7Sopenharmony_ci
462e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
463e5c31af7Sopenharmony_ciCopies involving a <<formats-requiring-sampler-ycbcr-conversion,
464e5c31af7Sopenharmony_cimulti-planar image format>> specify the region to be copied in terms of the
465e5c31af7Sopenharmony_ci_plane_ to be copied, not the coordinates of the multi-planar image.
466e5c31af7Sopenharmony_ciThis means that copies accessing the R/B planes of "`etext:_422`" format
467e5c31af7Sopenharmony_ciimages must: fit the copied region within half the pname:width of the parent
468e5c31af7Sopenharmony_ciimage, and that copies accessing the R/B planes of "`etext:_420`" format
469e5c31af7Sopenharmony_ciimages must: fit the copied region within half the pname:width and
470e5c31af7Sopenharmony_cipname:height of the parent image.
471e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
472e5c31af7Sopenharmony_ci
473e5c31af7Sopenharmony_ci.Valid Usage
474e5c31af7Sopenharmony_ci****
475e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_copy_common.txt[]
476e5c31af7Sopenharmony_ci****
477e5c31af7Sopenharmony_ci
478e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageCopy.txt[]
479e5c31af7Sopenharmony_ci--
480e5c31af7Sopenharmony_ci
481e5c31af7Sopenharmony_ci[open,refpage='VkImageSubresourceLayers',desc='Structure specifying an image subresource layers',type='structs']
482e5c31af7Sopenharmony_ci--
483e5c31af7Sopenharmony_ci
484e5c31af7Sopenharmony_ciThe sname:VkImageSubresourceLayers structure is defined as:
485e5c31af7Sopenharmony_ci
486e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageSubresourceLayers.txt[]
487e5c31af7Sopenharmony_ci
488e5c31af7Sopenharmony_ci  * pname:aspectMask is a combination of elink:VkImageAspectFlagBits,
489e5c31af7Sopenharmony_ci    selecting the color, depth and/or stencil aspects to be copied.
490e5c31af7Sopenharmony_ci  * pname:mipLevel is the mipmap level to copy
491e5c31af7Sopenharmony_ci  * pname:baseArrayLayer and pname:layerCount are the starting layer and
492e5c31af7Sopenharmony_ci    number of layers to copy.
493e5c31af7Sopenharmony_ci
494e5c31af7Sopenharmony_ci.Valid Usage
495e5c31af7Sopenharmony_ci****
496e5c31af7Sopenharmony_ci  * [[VUID-VkImageSubresourceLayers-aspectMask-00167]]
497e5c31af7Sopenharmony_ci    If pname:aspectMask contains ename:VK_IMAGE_ASPECT_COLOR_BIT, it must:
498e5c31af7Sopenharmony_ci    not contain either of ename:VK_IMAGE_ASPECT_DEPTH_BIT or
499e5c31af7Sopenharmony_ci    ename:VK_IMAGE_ASPECT_STENCIL_BIT
500e5c31af7Sopenharmony_ci  * [[VUID-VkImageSubresourceLayers-aspectMask-00168]]
501e5c31af7Sopenharmony_ci    pname:aspectMask must: not contain ename:VK_IMAGE_ASPECT_METADATA_BIT
502e5c31af7Sopenharmony_ciifdef::VK_EXT_image_drm_format_modifier[]
503e5c31af7Sopenharmony_ci  * [[VUID-VkImageSubresourceLayers-aspectMask-02247]]
504e5c31af7Sopenharmony_ci    pname:aspectMask must: not include
505e5c31af7Sopenharmony_ci    `VK_IMAGE_ASPECT_MEMORY_PLANE__{ibit}__BIT_EXT` for any index _i_
506e5c31af7Sopenharmony_ciendif::VK_EXT_image_drm_format_modifier[]
507e5c31af7Sopenharmony_ci  * [[VUID-VkImageSubresourceLayers-layerCount-01700]]
508e5c31af7Sopenharmony_ci    pname:layerCount must: be greater than 0
509e5c31af7Sopenharmony_ci****
510e5c31af7Sopenharmony_ci
511e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageSubresourceLayers.txt[]
512e5c31af7Sopenharmony_ci--
513e5c31af7Sopenharmony_ci
514e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
515e5c31af7Sopenharmony_ci
516e5c31af7Sopenharmony_ciA more extensible version of the copy image command is defined below.
517e5c31af7Sopenharmony_ci
518e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyImage2KHR',desc='Copy data between images',type='protos']
519e5c31af7Sopenharmony_ci--
520e5c31af7Sopenharmony_ci:refpage: vkCmdCopyImage2KHR
521e5c31af7Sopenharmony_ci
522e5c31af7Sopenharmony_ciTo copy data between image objects, call:
523e5c31af7Sopenharmony_ci
524e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyImage2KHR.txt[]
525e5c31af7Sopenharmony_ci
526e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
527e5c31af7Sopenharmony_ci    recorded.
528e5c31af7Sopenharmony_ci  * pname:pCopyImageInfo is a pointer to a slink:VkCopyImageInfo2KHR
529e5c31af7Sopenharmony_ci    structure describing the copy parameters.
530e5c31af7Sopenharmony_ci
531e5c31af7Sopenharmony_ciThis command is functionally identical to flink:vkCmdCopyImage, but includes
532e5c31af7Sopenharmony_ciextensible sub-structures that include pname:sType and pname:pNext
533e5c31af7Sopenharmony_ciparameters, allowing them to be more easily extended.
534e5c31af7Sopenharmony_ci
535e5c31af7Sopenharmony_ci.Valid Usage
536e5c31af7Sopenharmony_ci****
537e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_command_buffer_common.txt[]
538e5c31af7Sopenharmony_ci****
539e5c31af7Sopenharmony_ci
540e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyImage2KHR.txt[]
541e5c31af7Sopenharmony_ci--
542e5c31af7Sopenharmony_ci
543e5c31af7Sopenharmony_ci
544e5c31af7Sopenharmony_ci[open,refpage='VkCopyImageInfo2KHR',desc='Structure specifying parameters of an image copy command',type='structs']
545e5c31af7Sopenharmony_ci--
546e5c31af7Sopenharmony_ci:refpage: VkCopyImageInfo2KHR
547e5c31af7Sopenharmony_ci
548e5c31af7Sopenharmony_ciThe sname:VkCopyImageInfo2KHR structure is defined as:
549e5c31af7Sopenharmony_ci
550e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyImageInfo2KHR.txt[]
551e5c31af7Sopenharmony_ci
552e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
553e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
554e5c31af7Sopenharmony_ci    structure.
555e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
556e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the current layout of the source image
557e5c31af7Sopenharmony_ci    subresource.
558e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
559e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the current layout of the destination image
560e5c31af7Sopenharmony_ci    subresource.
561e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
562e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkImageCopy2KHR
563e5c31af7Sopenharmony_ci    structures specifying the regions to copy.
564e5c31af7Sopenharmony_ci
565e5c31af7Sopenharmony_ci
566e5c31af7Sopenharmony_ci.Valid Usage
567e5c31af7Sopenharmony_ci****
568e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_common.txt[]
569e5c31af7Sopenharmony_ci****
570e5c31af7Sopenharmony_ci
571e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyImageInfo2KHR.txt[]
572e5c31af7Sopenharmony_ci--
573e5c31af7Sopenharmony_ci
574e5c31af7Sopenharmony_ci[open,refpage='VkImageCopy2KHR',desc='Structure specifying an image copy operation',type='structs']
575e5c31af7Sopenharmony_ci--
576e5c31af7Sopenharmony_ci:refpage: VkImageCopy2KHR
577e5c31af7Sopenharmony_ci
578e5c31af7Sopenharmony_ciThe sname:VkImageCopy2KHR structure is defined as:
579e5c31af7Sopenharmony_ci
580e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageCopy2KHR.txt[]
581e5c31af7Sopenharmony_ci
582e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
583e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
584e5c31af7Sopenharmony_ci    structure.
585e5c31af7Sopenharmony_ci  * pname:srcSubresource and pname:dstSubresource are
586e5c31af7Sopenharmony_ci    slink:VkImageSubresourceLayers structures specifying the image
587e5c31af7Sopenharmony_ci    subresources of the images used for the source and destination image
588e5c31af7Sopenharmony_ci    data, respectively.
589e5c31af7Sopenharmony_ci  * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y,
590e5c31af7Sopenharmony_ci    and pname:z offsets in texels of the sub-regions of the source and
591e5c31af7Sopenharmony_ci    destination image data.
592e5c31af7Sopenharmony_ci  * pname:extent is the size in texels of the image to copy in pname:width,
593e5c31af7Sopenharmony_ci    pname:height and pname:depth.
594e5c31af7Sopenharmony_ci
595e5c31af7Sopenharmony_ci.Valid Usage
596e5c31af7Sopenharmony_ci****
597e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_copy_common.txt[]
598e5c31af7Sopenharmony_ci****
599e5c31af7Sopenharmony_ci
600e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageCopy2KHR.txt[]
601e5c31af7Sopenharmony_ci--
602e5c31af7Sopenharmony_ci
603e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
604e5c31af7Sopenharmony_ci
605e5c31af7Sopenharmony_ci
606e5c31af7Sopenharmony_ci[[copies-buffers-images]]
607e5c31af7Sopenharmony_ci== Copying Data Between Buffers and Images
608e5c31af7Sopenharmony_ci
609e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyBufferToImage',desc='Copy data from a buffer into an image',type='protos']
610e5c31af7Sopenharmony_ci--
611e5c31af7Sopenharmony_ci:refpage: vkCmdCopyBufferToImage
612e5c31af7Sopenharmony_ci:imageparam: pname:dstImage
613e5c31af7Sopenharmony_ci
614e5c31af7Sopenharmony_ciTo copy data from a buffer object to an image object, call:
615e5c31af7Sopenharmony_ci
616e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyBufferToImage.txt[]
617e5c31af7Sopenharmony_ci
618e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
619e5c31af7Sopenharmony_ci    recorded.
620e5c31af7Sopenharmony_ci  * pname:srcBuffer is the source buffer.
621e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
622e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the layout of the destination image subresources
623e5c31af7Sopenharmony_ci    for the copy.
624e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
625e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy
626e5c31af7Sopenharmony_ci    structures specifying the regions to copy.
627e5c31af7Sopenharmony_ci
628e5c31af7Sopenharmony_ciEach region in pname:pRegions is copied from the specified region of the
629e5c31af7Sopenharmony_cisource buffer to the specified region of the destination image.
630e5c31af7Sopenharmony_ci
631e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
632e5c31af7Sopenharmony_ciIf pname:dstImage has a
633e5c31af7Sopenharmony_ci<<formats-requiring-sampler-ycbcr-conversion,multi-planar format>>, regions
634e5c31af7Sopenharmony_ciof each plane to be a target of a copy must: be specified separately using
635e5c31af7Sopenharmony_cithe pname:pRegions member of the slink:VkBufferImageCopy structure.
636e5c31af7Sopenharmony_ciIn this case, the pname:aspectMask of pname:imageSubresource must: be
637e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_0_BIT, ename:VK_IMAGE_ASPECT_PLANE_1_BIT, or
638e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_2_BIT.
639e5c31af7Sopenharmony_ciFor the purposes of fname:vkCmdCopyBufferToImage, each plane of a
640e5c31af7Sopenharmony_cimulti-planar image is treated as having the format listed in
641e5c31af7Sopenharmony_ci<<formats-compatible-planes>> for the plane identified by the
642e5c31af7Sopenharmony_cipname:aspectMask of the corresponding subresource.
643e5c31af7Sopenharmony_ciThis applies both to elink:VkFormat and to coordinates used in the copy,
644e5c31af7Sopenharmony_ciwhich correspond to texels in the _plane_ rather than how these texels map
645e5c31af7Sopenharmony_cito coordinates in the image as a whole.
646e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
647e5c31af7Sopenharmony_ci
648e5c31af7Sopenharmony_ci.Valid Usage
649e5c31af7Sopenharmony_ci****
650e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_to_image_command_buffer_common.txt[]
651e5c31af7Sopenharmony_ci  * [[VUID-vkCmdCopyBufferToImage-pRegions-06217]]
652e5c31af7Sopenharmony_ci    The image region specified by each element of pname:pRegions must: be
653e5c31af7Sopenharmony_ci    contained within the specified pname:imageSubresource of pname:dstImage
654e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_to_image_common.txt[]
655e5c31af7Sopenharmony_ci  * [[VUID-vkCmdCopyBufferToImage-pRegions-06218]]
656e5c31af7Sopenharmony_ci    For each element of pname:pRegions, pname:imageOffset.x and
657e5c31af7Sopenharmony_ci    [eq]#(pname:imageExtent.width {plus} pname:imageOffset.x)# must: both be
658e5c31af7Sopenharmony_ci    greater than or equal to `0` and less than or equal to the width of the
659e5c31af7Sopenharmony_ci    specified pname:imageSubresource of pname:dstImage
660e5c31af7Sopenharmony_ci  * [[VUID-vkCmdCopyBufferToImage-pRegions-06219]]
661e5c31af7Sopenharmony_ci    For each element of pname:pRegions, pname:imageOffset.y and
662e5c31af7Sopenharmony_ci    [eq]#(pname:imageExtent.height {plus} pname:imageOffset.y)# must: both
663e5c31af7Sopenharmony_ci    be greater than or equal to `0` and less than or equal to the height of
664e5c31af7Sopenharmony_ci    the specified pname:imageSubresource of pname:dstImage
665e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.txt[]
666e5c31af7Sopenharmony_ci****
667e5c31af7Sopenharmony_ci
668e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyBufferToImage.txt[]
669e5c31af7Sopenharmony_ci--
670e5c31af7Sopenharmony_ci
671e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyImageToBuffer',desc='Copy image data into a buffer',type='protos']
672e5c31af7Sopenharmony_ci--
673e5c31af7Sopenharmony_ci:refpage: vkCmdCopyImageToBuffer
674e5c31af7Sopenharmony_ci:imageparam: pname:srcImage
675e5c31af7Sopenharmony_ci
676e5c31af7Sopenharmony_ciTo copy data from an image object to a buffer object, call:
677e5c31af7Sopenharmony_ci
678e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyImageToBuffer.txt[]
679e5c31af7Sopenharmony_ci
680e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
681e5c31af7Sopenharmony_ci    recorded.
682e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
683e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the layout of the source image subresources for
684e5c31af7Sopenharmony_ci    the copy.
685e5c31af7Sopenharmony_ci  * pname:dstBuffer is the destination buffer.
686e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
687e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy
688e5c31af7Sopenharmony_ci    structures specifying the regions to copy.
689e5c31af7Sopenharmony_ci
690e5c31af7Sopenharmony_ciEach region in pname:pRegions is copied from the specified region of the
691e5c31af7Sopenharmony_cisource image to the specified region of the destination buffer.
692e5c31af7Sopenharmony_ci
693e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
694e5c31af7Sopenharmony_ciIf pname:srcImage has a <<formats-requiring-sampler-ycbcr-conversion,
695e5c31af7Sopenharmony_cimulti-planar format>>, regions of each plane to be a source of a copy must:
696e5c31af7Sopenharmony_cibe specified separately using the pname:pRegions member of the
697e5c31af7Sopenharmony_cislink:VkBufferImageCopy structure.
698e5c31af7Sopenharmony_ciIn this case, the pname:aspectMask of pname:imageSubresource must: be
699e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_0_BIT, ename:VK_IMAGE_ASPECT_PLANE_1_BIT, or
700e5c31af7Sopenharmony_ciename:VK_IMAGE_ASPECT_PLANE_2_BIT.
701e5c31af7Sopenharmony_ciFor the purposes of fname:vkCmdCopyBufferToImage, each plane of a
702e5c31af7Sopenharmony_cimulti-planar image is treated as having the format listed in
703e5c31af7Sopenharmony_ci<<formats-compatible-planes>> for the plane identified by the
704e5c31af7Sopenharmony_cipname:aspectMask of the corresponding subresource.
705e5c31af7Sopenharmony_ciThis applies both to elink:VkFormat and to coordinates used in the copy,
706e5c31af7Sopenharmony_ciwhich correspond to texels in the _plane_ rather than how these texels map
707e5c31af7Sopenharmony_cito coordinates in the image as a whole.
708e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
709e5c31af7Sopenharmony_ci
710e5c31af7Sopenharmony_ci.Valid Usage
711e5c31af7Sopenharmony_ci****
712e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_to_buffer_command_buffer_common.txt[]
713e5c31af7Sopenharmony_ci  * [[VUID-vkCmdCopyImageToBuffer-pRegions-06220]]
714e5c31af7Sopenharmony_ci    The image region specified by each element of pname:pRegions must: be
715e5c31af7Sopenharmony_ci    contained within the specified pname:imageSubresource of pname:srcImage
716e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_to_buffer_common.txt[]
717e5c31af7Sopenharmony_ci  * [[VUID-vkCmdCopyImageToBuffer-pRegions-06221]]
718e5c31af7Sopenharmony_ci    For each element of pname:pRegions, pname:imageOffset.x and
719e5c31af7Sopenharmony_ci    [eq]#(pname:imageExtent.width {plus} pname:imageOffset.x)# must: both be
720e5c31af7Sopenharmony_ci    greater than or equal to `0` and less than or equal to the width of the
721e5c31af7Sopenharmony_ci    specified pname:imageSubresource of pname:srcImage
722e5c31af7Sopenharmony_ci  * [[VUID-vkCmdCopyImageToBuffer-pRegions-06222]]
723e5c31af7Sopenharmony_ci    For each element of pname:pRegions, pname:imageOffset.y and
724e5c31af7Sopenharmony_ci    [eq]#(imageExtent.height {plus} pname:imageOffset.y)# must: both be
725e5c31af7Sopenharmony_ci    greater than or equal to `0` and less than or equal to the height of the
726e5c31af7Sopenharmony_ci    specified pname:imageSubresource of pname:srcImage
727e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.txt[]
728e5c31af7Sopenharmony_ci****
729e5c31af7Sopenharmony_ci
730e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyImageToBuffer.txt[]
731e5c31af7Sopenharmony_ci--
732e5c31af7Sopenharmony_ci
733e5c31af7Sopenharmony_ci[open,refpage='VkBufferImageCopy',desc='Structure specifying a buffer image copy operation',type='structs']
734e5c31af7Sopenharmony_ci--
735e5c31af7Sopenharmony_ci:refpage: VkBufferImageCopy
736e5c31af7Sopenharmony_ci
737e5c31af7Sopenharmony_ciFor both flink:vkCmdCopyBufferToImage and flink:vkCmdCopyImageToBuffer, each
738e5c31af7Sopenharmony_cielement of pname:pRegions is a structure defined as:
739e5c31af7Sopenharmony_ci
740e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBufferImageCopy.txt[]
741e5c31af7Sopenharmony_ci
742e5c31af7Sopenharmony_ci  * pname:bufferOffset is the offset in bytes from the start of the buffer
743e5c31af7Sopenharmony_ci    object where the image data is copied from or to.
744e5c31af7Sopenharmony_ci  * pname:bufferRowLength and pname:bufferImageHeight specify in texels a
745e5c31af7Sopenharmony_ci    subregion of a larger two- or three-dimensional image in buffer memory,
746e5c31af7Sopenharmony_ci    and control the addressing calculations.
747e5c31af7Sopenharmony_ci    If either of these values is zero, that aspect of the buffer memory is
748e5c31af7Sopenharmony_ci    considered to be tightly packed according to the pname:imageExtent.
749e5c31af7Sopenharmony_ci  * pname:imageSubresource is a slink:VkImageSubresourceLayers used to
750e5c31af7Sopenharmony_ci    specify the specific image subresources of the image used for the source
751e5c31af7Sopenharmony_ci    or destination image data.
752e5c31af7Sopenharmony_ci  * pname:imageOffset selects the initial pname:x, pname:y, pname:z offsets
753e5c31af7Sopenharmony_ci    in texels of the sub-region of the source or destination image data.
754e5c31af7Sopenharmony_ci  * pname:imageExtent is the size in texels of the image to copy in
755e5c31af7Sopenharmony_ci    pname:width, pname:height and pname:depth.
756e5c31af7Sopenharmony_ci
757e5c31af7Sopenharmony_ciWhen copying to or from a depth or stencil aspect, the data in buffer memory
758e5c31af7Sopenharmony_ciuses a layout that is a (mostly) tightly packed representation of the depth
759e5c31af7Sopenharmony_cior stencil data.
760e5c31af7Sopenharmony_ciSpecifically:
761e5c31af7Sopenharmony_ci
762e5c31af7Sopenharmony_ci  * data copied to or from the stencil aspect of any depth/stencil format is
763e5c31af7Sopenharmony_ci    tightly packed with one ename:VK_FORMAT_S8_UINT value per texel.
764e5c31af7Sopenharmony_ci  * data copied to or from the depth aspect of a ename:VK_FORMAT_D16_UNORM
765e5c31af7Sopenharmony_ci    or ename:VK_FORMAT_D16_UNORM_S8_UINT format is tightly packed with one
766e5c31af7Sopenharmony_ci    ename:VK_FORMAT_D16_UNORM value per texel.
767e5c31af7Sopenharmony_ci  * data copied to or from the depth aspect of a ename:VK_FORMAT_D32_SFLOAT
768e5c31af7Sopenharmony_ci    or ename:VK_FORMAT_D32_SFLOAT_S8_UINT format is tightly packed with one
769e5c31af7Sopenharmony_ci    ename:VK_FORMAT_D32_SFLOAT value per texel.
770e5c31af7Sopenharmony_ci  * data copied to or from the depth aspect of a
771e5c31af7Sopenharmony_ci    ename:VK_FORMAT_X8_D24_UNORM_PACK32 or ename:VK_FORMAT_D24_UNORM_S8_UINT
772e5c31af7Sopenharmony_ci    format is packed with one 32-bit word per texel with the D24 value in
773e5c31af7Sopenharmony_ci    the LSBs of the word, and undefined: values in the eight MSBs.
774e5c31af7Sopenharmony_ci
775e5c31af7Sopenharmony_ci[NOTE]
776e5c31af7Sopenharmony_ci.Note
777e5c31af7Sopenharmony_ci====
778e5c31af7Sopenharmony_ciTo copy both the depth and stencil aspects of a depth/stencil format, two
779e5c31af7Sopenharmony_cientries in pname:pRegions can: be used, where one specifies the depth aspect
780e5c31af7Sopenharmony_ciin pname:imageSubresource, and the other specifies the stencil aspect.
781e5c31af7Sopenharmony_ci====
782e5c31af7Sopenharmony_ci
783e5c31af7Sopenharmony_ciBecause depth or stencil aspect buffer to image copies may: require format
784e5c31af7Sopenharmony_ciconversions on some implementations, they are not supported on queues that
785e5c31af7Sopenharmony_cido not support graphics.
786e5c31af7Sopenharmony_ci
787e5c31af7Sopenharmony_ciWhen copying to a depth aspect,
788e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[]
789e5c31af7Sopenharmony_ciand the `apiext:VK_EXT_depth_range_unrestricted` extension is not enabled,
790e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
791e5c31af7Sopenharmony_cithe data in buffer memory must: be in the range [eq]#[0,1]#, or the
792e5c31af7Sopenharmony_ciresulting values are undefined:.
793e5c31af7Sopenharmony_ci
794e5c31af7Sopenharmony_ciCopies are done layer by layer starting with image layer
795e5c31af7Sopenharmony_cipname:baseArrayLayer member of pname:imageSubresource.
796e5c31af7Sopenharmony_cipname:layerCount layers are copied from the source image or to the
797e5c31af7Sopenharmony_cidestination image.
798e5c31af7Sopenharmony_ci
799e5c31af7Sopenharmony_ci[[blocked-image]]
800e5c31af7Sopenharmony_ciFor purpose of valid usage statements here and in related copy commands, a
801e5c31af7Sopenharmony_ci_blocked image_ is defined as:
802e5c31af7Sopenharmony_ci
803e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
804e5c31af7Sopenharmony_ci  * an image with a _single-plane_, "`etext:_422`" format, which is treated
805e5c31af7Sopenharmony_ci    as a format with a 2 {times} 1 compressed texel block, or
806e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
807e5c31af7Sopenharmony_ci  * a compressed image.
808e5c31af7Sopenharmony_ci
809e5c31af7Sopenharmony_ci.Valid Usage
810e5c31af7Sopenharmony_ci****
811e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/buffer_image_copy_common.txt[]
812e5c31af7Sopenharmony_ci****
813e5c31af7Sopenharmony_ci
814e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBufferImageCopy.txt[]
815e5c31af7Sopenharmony_ci--
816e5c31af7Sopenharmony_ci
817e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
818e5c31af7Sopenharmony_ci
819e5c31af7Sopenharmony_ciMore extensible versions of the commands to copy between buffers and images
820e5c31af7Sopenharmony_ciare defined below.
821e5c31af7Sopenharmony_ci
822e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyBufferToImage2KHR',desc='Copy data from a buffer into an image',type='protos']
823e5c31af7Sopenharmony_ci--
824e5c31af7Sopenharmony_ci:refpage: vkCmdCopyBufferToImage2KHR
825e5c31af7Sopenharmony_ci
826e5c31af7Sopenharmony_ciTo copy data from a buffer object to an image object, call:
827e5c31af7Sopenharmony_ci
828e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyBufferToImage2KHR.txt[]
829e5c31af7Sopenharmony_ci
830e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
831e5c31af7Sopenharmony_ci    recorded.
832e5c31af7Sopenharmony_ci  * pname:pCopyBufferToImageInfo is a pointer to a
833e5c31af7Sopenharmony_ci    slink:VkCopyBufferToImageInfo2KHR structure describing the copy
834e5c31af7Sopenharmony_ci    parameters.
835e5c31af7Sopenharmony_ci
836e5c31af7Sopenharmony_ciThis command is functionally identical to flink:vkCmdCopyBufferToImage, but
837e5c31af7Sopenharmony_ciincludes extensible sub-structures that include pname:sType and pname:pNext
838e5c31af7Sopenharmony_ciparameters, allowing them to be more easily extended.
839e5c31af7Sopenharmony_ci
840e5c31af7Sopenharmony_ci.Valid Usage
841e5c31af7Sopenharmony_ci****
842e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_to_image_command_buffer_common.txt[]
843e5c31af7Sopenharmony_ci****
844e5c31af7Sopenharmony_ci
845e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyBufferToImage2KHR.txt[]
846e5c31af7Sopenharmony_ci--
847e5c31af7Sopenharmony_ci
848e5c31af7Sopenharmony_ci[open,refpage='VkCopyBufferToImageInfo2KHR',desc='Structure specifying parameters of a buffer to image copy command',type='structs']
849e5c31af7Sopenharmony_ci--
850e5c31af7Sopenharmony_ci:refpage: VkCopyBufferToImageInfo2KHR
851e5c31af7Sopenharmony_ci:imageparam: pname:dstImage
852e5c31af7Sopenharmony_ci
853e5c31af7Sopenharmony_ciThe sname:VkCopyBufferToImageInfo2KHR structure is defined as:
854e5c31af7Sopenharmony_ci
855e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyBufferToImageInfo2KHR.txt[]
856e5c31af7Sopenharmony_ci
857e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
858e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
859e5c31af7Sopenharmony_ci    structure.
860e5c31af7Sopenharmony_ci  * pname:srcBuffer is the source buffer.
861e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
862e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the layout of the destination image subresources
863e5c31af7Sopenharmony_ci    for the copy.
864e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
865e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy2KHR
866e5c31af7Sopenharmony_ci    structures specifying the regions to copy.
867e5c31af7Sopenharmony_ci
868e5c31af7Sopenharmony_ci.Valid Usage
869e5c31af7Sopenharmony_ci****
870e5c31af7Sopenharmony_ciifndef::VK_QCOM_rotated_copy_commands[]
871e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-00172]]
872e5c31af7Sopenharmony_ci    The image region specified by each element of pname:pRegions must: be
873e5c31af7Sopenharmony_ci    contained within the specified pname:imageSubresource of pname:dstImage
874e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
875e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
876e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-04565]]
877e5c31af7Sopenharmony_ci    If the image region specified by each element of pname:pRegions does not
878e5c31af7Sopenharmony_ci    contain slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain,
879e5c31af7Sopenharmony_ci    it must: be a region that is contained within the specified
880e5c31af7Sopenharmony_ci    pname:imageSubresource of pname:dstImage
881e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-04554]]
882e5c31af7Sopenharmony_ci    If the image region specified by each element of pname:pRegions contains
883e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, the
884e5c31af7Sopenharmony_ci    rotated destination region as described in
885e5c31af7Sopenharmony_ci    <<copies-buffers-images-rotation-addressing>> must: be contained within
886e5c31af7Sopenharmony_ci    pname:dstImage
887e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-04555]]
888e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
889e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
890e5c31af7Sopenharmony_ci    pname:dstImage must: not be a <<blocked-image,blocked image>>
891e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-06203]]
892e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
893e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
894e5c31af7Sopenharmony_ci    pname:dstImage must: be of type ename:VK_IMAGE_TYPE_2D
895e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-06204]]
896e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
897e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
898e5c31af7Sopenharmony_ci    pname:dstImage must: not have a
899e5c31af7Sopenharmony_ci    <<formats-requiring-sampler-ycbcr-conversion, multi-planar format>>
900e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
901e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_buffer_to_image_common.txt[]
902e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-06223]]
903e5c31af7Sopenharmony_ci    For each element of pname:pRegions not containing
904e5c31af7Sopenharmony_ci    sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain,
905e5c31af7Sopenharmony_ci    pname:imageOffset.x and [eq]#(pname:imageExtent.width {plus}
906e5c31af7Sopenharmony_ci    pname:imageOffset.x)# must: both be greater than or equal to `0` and
907e5c31af7Sopenharmony_ci    less than or equal to the width of the specified pname:imageSubresource
908e5c31af7Sopenharmony_ci    of pname:dstImage
909e5c31af7Sopenharmony_ci  * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-06224]]
910e5c31af7Sopenharmony_ci    For each element of pname:pRegions not containing
911e5c31af7Sopenharmony_ci    sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain,
912e5c31af7Sopenharmony_ci    pname:imageOffset.y and [eq]#(pname:imageExtent.height {plus}
913e5c31af7Sopenharmony_ci    pname:imageOffset.y)# must: both be greater than or equal to `0` and
914e5c31af7Sopenharmony_ci    less than or equal to the height of the specified pname:imageSubresource
915e5c31af7Sopenharmony_ci    of pname:dstImage
916e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.txt[]
917e5c31af7Sopenharmony_ci****
918e5c31af7Sopenharmony_ci
919e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyBufferToImageInfo2KHR.txt[]
920e5c31af7Sopenharmony_ci--
921e5c31af7Sopenharmony_ci
922e5c31af7Sopenharmony_ci[open,refpage='vkCmdCopyImageToBuffer2KHR',desc='Copy image data into a buffer',type='protos']
923e5c31af7Sopenharmony_ci--
924e5c31af7Sopenharmony_ci:refpage: vkCmdCopyImageToBuffer2KHR
925e5c31af7Sopenharmony_ci:imageparam: pname:srcImage
926e5c31af7Sopenharmony_ci
927e5c31af7Sopenharmony_ciTo copy data from an image object to a buffer object, call:
928e5c31af7Sopenharmony_ci
929e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdCopyImageToBuffer2KHR.txt[]
930e5c31af7Sopenharmony_ci
931e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
932e5c31af7Sopenharmony_ci    recorded.
933e5c31af7Sopenharmony_ci  * pname:pCopyImageToBufferInfo is a pointer to a
934e5c31af7Sopenharmony_ci    slink:VkCopyImageToBufferInfo2KHR structure describing the copy
935e5c31af7Sopenharmony_ci    parameters.
936e5c31af7Sopenharmony_ci
937e5c31af7Sopenharmony_ciThis command is functionally identical to flink:vkCmdCopyImageToBuffer, but
938e5c31af7Sopenharmony_ciincludes extensible sub-structures that include pname:sType and pname:pNext
939e5c31af7Sopenharmony_ciparameters, allowing them to be more easily extended.
940e5c31af7Sopenharmony_ci
941e5c31af7Sopenharmony_ci
942e5c31af7Sopenharmony_ci.Valid Usage
943e5c31af7Sopenharmony_ci****
944e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_to_buffer_command_buffer_common.txt[]
945e5c31af7Sopenharmony_ci****
946e5c31af7Sopenharmony_ci
947e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdCopyImageToBuffer2KHR.txt[]
948e5c31af7Sopenharmony_ci--
949e5c31af7Sopenharmony_ci
950e5c31af7Sopenharmony_ci[open,refpage='VkCopyImageToBufferInfo2KHR',desc='Structure specifying parameters of an image to buffer copy command',type='structs']
951e5c31af7Sopenharmony_ci--
952e5c31af7Sopenharmony_ci:refpage: VkCopyImageToBufferInfo2KHR
953e5c31af7Sopenharmony_ci
954e5c31af7Sopenharmony_ciThe sname:VkCopyImageToBufferInfo2KHR structure is defined as:
955e5c31af7Sopenharmony_ci
956e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyImageToBufferInfo2KHR.txt[]
957e5c31af7Sopenharmony_ci
958e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
959e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
960e5c31af7Sopenharmony_ci    structure.
961e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
962e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the layout of the source image subresources for
963e5c31af7Sopenharmony_ci    the copy.
964e5c31af7Sopenharmony_ci  * pname:dstBuffer is the destination buffer.
965e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to copy.
966e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy2KHR
967e5c31af7Sopenharmony_ci    structures specifying the regions to copy.
968e5c31af7Sopenharmony_ci
969e5c31af7Sopenharmony_ci.Valid Usage
970e5c31af7Sopenharmony_ci****
971e5c31af7Sopenharmony_ciifndef::VK_QCOM_rotated_copy_commands[]
972e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-00182]]
973e5c31af7Sopenharmony_ci    The image region specified by each element of pname:pRegions must: be
974e5c31af7Sopenharmony_ci    contained within the specified pname:imageSubresource of pname:srcImage
975e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
976e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
977e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-04566]]
978e5c31af7Sopenharmony_ci    If the image region specified by each element of pname:pRegions does not
979e5c31af7Sopenharmony_ci    contain slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain,
980e5c31af7Sopenharmony_ci    it must: be contained within the specified pname:imageSubresource of
981e5c31af7Sopenharmony_ci    pname:srcImage
982e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-04557]]
983e5c31af7Sopenharmony_ci    If the image region specified by each element of pname:pRegions contains
984e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, the
985e5c31af7Sopenharmony_ci    rotated source region as described in
986e5c31af7Sopenharmony_ci    <<copies-buffers-images-rotation-addressing>> must: be contained within
987e5c31af7Sopenharmony_ci    pname:srcImage
988e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-04558]]
989e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
990e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
991e5c31af7Sopenharmony_ci    pname:srcImage must: not be a <<blocked-image,blocked image>>
992e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-06205]]
993e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
994e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
995e5c31af7Sopenharmony_ci    pname:srcImage must: be of type ename:VK_IMAGE_TYPE_2D
996e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-06206]]
997e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
998e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
999e5c31af7Sopenharmony_ci    pname:srcImage must: not have a
1000e5c31af7Sopenharmony_ci    <<formats-requiring-sampler-ycbcr-conversion, multi-planar format>>
1001e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
1002e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_image_to_buffer_common.txt[]
1003e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-imageOffset-00197]]
1004e5c31af7Sopenharmony_ci    For each element of pname:pRegions not containing
1005e5c31af7Sopenharmony_ci    sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain,
1006e5c31af7Sopenharmony_ci    pname:imageOffset.x and [eq]#(pname:imageExtent.width {plus}
1007e5c31af7Sopenharmony_ci    pname:imageOffset.x)# must: both be greater than or equal to `0` and
1008e5c31af7Sopenharmony_ci    less than or equal to the width of the specified pname:imageSubresource
1009e5c31af7Sopenharmony_ci    of pname:srcImage
1010e5c31af7Sopenharmony_ci  * [[VUID-VkCopyImageToBufferInfo2KHR-imageOffset-00198]]
1011e5c31af7Sopenharmony_ci    For each element of pname:pRegions not containing
1012e5c31af7Sopenharmony_ci    sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain,
1013e5c31af7Sopenharmony_ci    pname:imageOffset.y and [eq]#(pname:imageExtent.height {plus}
1014e5c31af7Sopenharmony_ci    pname:imageOffset.y)# must: both be greater than or equal to `0` and
1015e5c31af7Sopenharmony_ci    less than or equal to the height of the specified pname:imageSubresource
1016e5c31af7Sopenharmony_ci    of pname:srcImage
1017e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.txt[]
1018e5c31af7Sopenharmony_ci****
1019e5c31af7Sopenharmony_ci
1020e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyImageToBufferInfo2KHR.txt[]
1021e5c31af7Sopenharmony_ci--
1022e5c31af7Sopenharmony_ci
1023e5c31af7Sopenharmony_ci[open,refpage='VkBufferImageCopy2KHR',desc='Structure specifying a buffer image copy operation',type='structs']
1024e5c31af7Sopenharmony_ci--
1025e5c31af7Sopenharmony_ci:refpage: VkBufferImageCopy2KHR
1026e5c31af7Sopenharmony_ci
1027e5c31af7Sopenharmony_ciFor both flink:vkCmdCopyBufferToImage2KHR and
1028e5c31af7Sopenharmony_ciflink:vkCmdCopyImageToBuffer2KHR, each element of pname:pRegions is a
1029e5c31af7Sopenharmony_cistructure defined as:
1030e5c31af7Sopenharmony_ci
1031e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBufferImageCopy2KHR.txt[]
1032e5c31af7Sopenharmony_ci
1033e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1034e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1035e5c31af7Sopenharmony_ci    structure.
1036e5c31af7Sopenharmony_ci  * pname:bufferOffset is the offset in bytes from the start of the buffer
1037e5c31af7Sopenharmony_ci    object where the image data is copied from or to.
1038e5c31af7Sopenharmony_ci  * pname:bufferRowLength and pname:bufferImageHeight specify in texels a
1039e5c31af7Sopenharmony_ci    subregion of a larger two- or three-dimensional image in buffer memory,
1040e5c31af7Sopenharmony_ci    and control the addressing calculations.
1041e5c31af7Sopenharmony_ci    If either of these values is zero, that aspect of the buffer memory is
1042e5c31af7Sopenharmony_ci    considered to be tightly packed according to the pname:imageExtent.
1043e5c31af7Sopenharmony_ci  * pname:imageSubresource is a slink:VkImageSubresourceLayers used to
1044e5c31af7Sopenharmony_ci    specify the specific image subresources of the image used for the source
1045e5c31af7Sopenharmony_ci    or destination image data.
1046e5c31af7Sopenharmony_ci  * pname:imageOffset selects the initial pname:x, pname:y, pname:z offsets
1047e5c31af7Sopenharmony_ci    in texels of the sub-region of the source or destination image data.
1048e5c31af7Sopenharmony_ci  * pname:imageExtent is the size in texels of the image to copy in
1049e5c31af7Sopenharmony_ci    pname:width, pname:height and pname:depth.
1050e5c31af7Sopenharmony_ci
1051e5c31af7Sopenharmony_ciThis structure is functionally identical to slink:VkBufferImageCopy, but
1052e5c31af7Sopenharmony_ciadds pname:sType and pname:pNext parameters, allowing it to be more easily
1053e5c31af7Sopenharmony_ciextended.
1054e5c31af7Sopenharmony_ci
1055e5c31af7Sopenharmony_ci.Valid Usage
1056e5c31af7Sopenharmony_ci****
1057e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/buffer_image_copy_common.txt[]
1058e5c31af7Sopenharmony_ci****
1059e5c31af7Sopenharmony_ci
1060e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBufferImageCopy2KHR.txt[]
1061e5c31af7Sopenharmony_ci--
1062e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
1063e5c31af7Sopenharmony_ci
1064e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
1065e5c31af7Sopenharmony_ciFor both flink:vkCmdCopyBufferToImage2KHR and
1066e5c31af7Sopenharmony_ciflink:vkCmdCopyImageToBuffer2KHR, each region copied can include a rotation.
1067e5c31af7Sopenharmony_ciTo specify a region with rotation, add the
1068e5c31af7Sopenharmony_cislink:VkCopyCommandTransformInfoQCOM to the pname:pNext chain of
1069e5c31af7Sopenharmony_cislink:VkBufferImageCopy2KHR.
1070e5c31af7Sopenharmony_ciWhen a rotation is specified, <<copies-buffers-images-rotation-addressing,
1071e5c31af7Sopenharmony_ciBuffer and Image Addressing with Rotation>> specifies how coordinates of
1072e5c31af7Sopenharmony_citexels in the source region are rotated by pname:transform to produce texel
1073e5c31af7Sopenharmony_cicoordinates in the destination region.
1074e5c31af7Sopenharmony_ciWhen rotation is specified, the source and destination images must: each be
1075e5c31af7Sopenharmony_ci2D images.
1076e5c31af7Sopenharmony_ciThey must: not be <<blocked-image,blocked images>> or have a
1077e5c31af7Sopenharmony_ci<<formats-requiring-sampler-ycbcr-conversion, multi-planar format>>.
1078e5c31af7Sopenharmony_ci
1079e5c31af7Sopenharmony_ci[open,refpage='VkCopyCommandTransformInfoQCOM',desc='Structure describing transform parameters of rotated copy command',type='structs']
1080e5c31af7Sopenharmony_ci--
1081e5c31af7Sopenharmony_ciThe sname:VkRenderPassTransformBeginInfoQCOM structure is defined as:
1082e5c31af7Sopenharmony_ci
1083e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkCopyCommandTransformInfoQCOM.txt[]
1084e5c31af7Sopenharmony_ci
1085e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1086e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1087e5c31af7Sopenharmony_ci    structure.
1088e5c31af7Sopenharmony_ci  * pname:transform is a elink:VkSurfaceTransformFlagBitsKHR value
1089e5c31af7Sopenharmony_ci    describing the transform to be applied.
1090e5c31af7Sopenharmony_ci
1091e5c31af7Sopenharmony_ci.Valid Usage
1092e5c31af7Sopenharmony_ci****
1093e5c31af7Sopenharmony_ci  * [[VUID-VkCopyCommandTransformInfoQCOM-transform-04560]]
1094e5c31af7Sopenharmony_ci    pname:transform must: be ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
1095e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR,
1096e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, or
1097e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR
1098e5c31af7Sopenharmony_ci****
1099e5c31af7Sopenharmony_ci
1100e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkCopyCommandTransformInfoQCOM.txt[]
1101e5c31af7Sopenharmony_ci--
1102e5c31af7Sopenharmony_ci
1103e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
1104e5c31af7Sopenharmony_ci
1105e5c31af7Sopenharmony_ci
1106e5c31af7Sopenharmony_ci[[copies-buffers-images-addressing]]
1107e5c31af7Sopenharmony_ci=== Buffer and Image Addressing
1108e5c31af7Sopenharmony_ci
1109e5c31af7Sopenharmony_ciPseudocode for image/buffer addressing of uncompressed formats is:
1110e5c31af7Sopenharmony_ci
1111e5c31af7Sopenharmony_ci[source,c]
1112e5c31af7Sopenharmony_ci---------------------------------------------------
1113e5c31af7Sopenharmony_cirowLength = region->bufferRowLength;
1114e5c31af7Sopenharmony_ciif (rowLength == 0)
1115e5c31af7Sopenharmony_ci    rowLength = region->imageExtent.width;
1116e5c31af7Sopenharmony_ci
1117e5c31af7Sopenharmony_ciimageHeight = region->bufferImageHeight;
1118e5c31af7Sopenharmony_ciif (imageHeight == 0)
1119e5c31af7Sopenharmony_ci    imageHeight = region->imageExtent.height;
1120e5c31af7Sopenharmony_ci
1121e5c31af7Sopenharmony_citexelBlockSize = <texel block size of the format of the src/dstImage>;
1122e5c31af7Sopenharmony_ci
1123e5c31af7Sopenharmony_ciaddress of (x,y,z) = region->bufferOffset + (((z * imageHeight) + y) * rowLength + x) * texelBlockSize;
1124e5c31af7Sopenharmony_ci
1125e5c31af7Sopenharmony_ciwhere x,y,z range from (0,0,0) to region->imageExtent.{width,height,depth}.
1126e5c31af7Sopenharmony_ci---------------------------------------------------
1127e5c31af7Sopenharmony_ci
1128e5c31af7Sopenharmony_ciNote that pname:imageOffset does not affect addressing calculations for
1129e5c31af7Sopenharmony_cibuffer memory.
1130e5c31af7Sopenharmony_ciInstead, pname:bufferOffset can: be used to select the starting address in
1131e5c31af7Sopenharmony_cibuffer memory.
1132e5c31af7Sopenharmony_ci
1133e5c31af7Sopenharmony_ciFor block-compressed formats, all parameters are still specified in texels
1134e5c31af7Sopenharmony_cirather than compressed texel blocks, but the addressing math operates on
1135e5c31af7Sopenharmony_ciwhole compressed texel blocks.
1136e5c31af7Sopenharmony_ciPseudocode for compressed copy addressing is:
1137e5c31af7Sopenharmony_ci
1138e5c31af7Sopenharmony_ci[source,c]
1139e5c31af7Sopenharmony_ci---------------------------------------------------
1140e5c31af7Sopenharmony_cirowLength = region->bufferRowLength;
1141e5c31af7Sopenharmony_ciif (rowLength == 0)
1142e5c31af7Sopenharmony_ci    rowLength = region->imageExtent.width;
1143e5c31af7Sopenharmony_ci
1144e5c31af7Sopenharmony_ciimageHeight = region->bufferImageHeight;
1145e5c31af7Sopenharmony_ciif (imageHeight == 0)
1146e5c31af7Sopenharmony_ci    imageHeight = region->imageExtent.height;
1147e5c31af7Sopenharmony_ci
1148e5c31af7Sopenharmony_cicompressedTexelBlockSizeInBytes = <compressed texel block size taken from the src/dstImage>;
1149e5c31af7Sopenharmony_cirowLength = (rowLength + compressedTexelBlockWidth - 1) / compressedTexelBlockWidth;
1150e5c31af7Sopenharmony_ciimageHeight = (imageHeight + compressedTexelBlockHeight - 1) / compressedTexelBlockHeight;
1151e5c31af7Sopenharmony_ci
1152e5c31af7Sopenharmony_ciaddress of (x,y,z) = region->bufferOffset + (((z * imageHeight) + y) * rowLength + x) * compressedTexelBlockSizeInBytes;
1153e5c31af7Sopenharmony_ci
1154e5c31af7Sopenharmony_ciwhere x,y,z range from (0,0,0) to region->imageExtent.{width/compressedTexelBlockWidth,height/compressedTexelBlockHeight,depth/compressedTexelBlockDepth}.
1155e5c31af7Sopenharmony_ci---------------------------------------------------
1156e5c31af7Sopenharmony_ci
1157e5c31af7Sopenharmony_ciCopying to or from block-compressed images is typically done in multiples of
1158e5c31af7Sopenharmony_cithe compressed texel block size.
1159e5c31af7Sopenharmony_ciFor this reason the pname:imageExtent must: be a multiple of the compressed
1160e5c31af7Sopenharmony_citexel block dimension.
1161e5c31af7Sopenharmony_ciThere is one exception to this rule which is required: to handle compressed
1162e5c31af7Sopenharmony_ciimages created with dimensions that are not a multiple of the compressed
1163e5c31af7Sopenharmony_citexel block dimensions:
1164e5c31af7Sopenharmony_ci
1165e5c31af7Sopenharmony_ci  * If pname:imageExtent.width is not a multiple of the compressed texel
1166e5c31af7Sopenharmony_ci    block width, then [eq]#(pname:imageExtent.width {plus}
1167e5c31af7Sopenharmony_ci    pname:imageOffset.x)# must: equal the image subresource width.
1168e5c31af7Sopenharmony_ci  * If pname:imageExtent.height is not a multiple of the compressed texel
1169e5c31af7Sopenharmony_ci    block height, then [eq]#(pname:imageExtent.height {plus}
1170e5c31af7Sopenharmony_ci    pname:imageOffset.y)# must: equal the image subresource height.
1171e5c31af7Sopenharmony_ci  * If pname:imageExtent.depth is not a multiple of the compressed texel
1172e5c31af7Sopenharmony_ci    block depth, then [eq]#(pname:imageExtent.depth {plus}
1173e5c31af7Sopenharmony_ci    pname:imageOffset.z)# must: equal the image subresource depth.
1174e5c31af7Sopenharmony_ci
1175e5c31af7Sopenharmony_ciThis allows the last compressed texel block of the image in each
1176e5c31af7Sopenharmony_cinon-multiple dimension to be included as a source or destination of the
1177e5c31af7Sopenharmony_cicopy.
1178e5c31af7Sopenharmony_ci
1179e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
1180e5c31af7Sopenharmony_ciinclude::{chapters}/VK_QCOM_rotated_copies/rotated_addressing_copies.txt[]
1181e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
1182e5c31af7Sopenharmony_ci
1183e5c31af7Sopenharmony_ci
1184e5c31af7Sopenharmony_ci[[copies-imagescaling]]
1185e5c31af7Sopenharmony_ci== Image Copies with Scaling
1186e5c31af7Sopenharmony_ci
1187e5c31af7Sopenharmony_ci[open,refpage='vkCmdBlitImage',desc='Copy regions of an image, potentially performing format conversion,',type='protos']
1188e5c31af7Sopenharmony_ci--
1189e5c31af7Sopenharmony_ci:refpage: vkCmdBlitImage
1190e5c31af7Sopenharmony_ci
1191e5c31af7Sopenharmony_ciTo copy regions of a source image into a destination image, potentially
1192e5c31af7Sopenharmony_ciperforming format conversion, arbitrary scaling, and filtering, call:
1193e5c31af7Sopenharmony_ci
1194e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBlitImage.txt[]
1195e5c31af7Sopenharmony_ci
1196e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1197e5c31af7Sopenharmony_ci    recorded.
1198e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
1199e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the layout of the source image subresources for
1200e5c31af7Sopenharmony_ci    the blit.
1201e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
1202e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the layout of the destination image subresources
1203e5c31af7Sopenharmony_ci    for the blit.
1204e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to blit.
1205e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkImageBlit structures
1206e5c31af7Sopenharmony_ci    specifying the regions to blit.
1207e5c31af7Sopenharmony_ci  * pname:filter is a elink:VkFilter specifying the filter to apply if the
1208e5c31af7Sopenharmony_ci    blits require scaling.
1209e5c31af7Sopenharmony_ci
1210e5c31af7Sopenharmony_cifname:vkCmdBlitImage must: not be used for multisampled source or
1211e5c31af7Sopenharmony_cidestination images.
1212e5c31af7Sopenharmony_ciUse flink:vkCmdResolveImage for this purpose.
1213e5c31af7Sopenharmony_ci
1214e5c31af7Sopenharmony_ciAs the sizes of the source and destination extents can: differ in any
1215e5c31af7Sopenharmony_cidimension, texels in the source extent are scaled and filtered to the
1216e5c31af7Sopenharmony_cidestination extent.
1217e5c31af7Sopenharmony_ciScaling occurs via the following operations:
1218e5c31af7Sopenharmony_ci
1219e5c31af7Sopenharmony_ci  * For each destination texel, the integer coordinate of that texel is
1220e5c31af7Sopenharmony_ci    converted to an unnormalized texture coordinate, using the effective
1221e5c31af7Sopenharmony_ci    inverse of the equations described in
1222e5c31af7Sopenharmony_ci    <<textures-unnormalized-to-integer, unnormalized to integer
1223e5c31af7Sopenharmony_ci    conversion>>:
1224e5c31af7Sopenharmony_ci  {empty}:: [eq]#u~base~ = i {plus} {onehalf}#
1225e5c31af7Sopenharmony_ci  {empty}:: [eq]#v~base~ = j {plus} {onehalf}#
1226e5c31af7Sopenharmony_ci  {empty}:: [eq]#w~base~ = k {plus} {onehalf}#
1227e5c31af7Sopenharmony_ci  * These base coordinates are then offset by the first destination offset:
1228e5c31af7Sopenharmony_ci  {empty}:: [eq]#u~offset~ = u~base~ - x~dst0~#
1229e5c31af7Sopenharmony_ci  {empty}:: [eq]#v~offset~ = v~base~ - y~dst0~#
1230e5c31af7Sopenharmony_ci  {empty}:: [eq]#w~offset~ = w~base~ - z~dst0~#
1231e5c31af7Sopenharmony_ci  {empty}:: [eq]#a~offset~ = a - pname:baseArrayCount~dst~#
1232e5c31af7Sopenharmony_ci  * The scale is determined from the source and destination regions, and
1233e5c31af7Sopenharmony_ci    applied to the offset coordinates:
1234e5c31af7Sopenharmony_ci  {empty}:: [eq]#scale~u~ = (x~src1~ - x~src0~) / (x~dst1~ - x~dst0~)#
1235e5c31af7Sopenharmony_ci  {empty}:: [eq]#scale~v~ = (y~src1~ - y~src0~) / (y~dst1~ - y~dst0~)#
1236e5c31af7Sopenharmony_ci  {empty}:: [eq]#scale~w~ = (z~src1~ - z~src0~) / (z~dst1~ - z~dst0~)#
1237e5c31af7Sopenharmony_ci  {empty}:: [eq]#u~scaled~ = u~offset~ {times} scale~u~#
1238e5c31af7Sopenharmony_ci  {empty}:: [eq]#v~scaled~ = v~offset~ {times} scale~v~#
1239e5c31af7Sopenharmony_ci  {empty}:: [eq]#w~scaled~ = w~offset~ {times} scale~w~#
1240e5c31af7Sopenharmony_ci  * Finally the source offset is added to the scaled coordinates, to
1241e5c31af7Sopenharmony_ci    determine the final unnormalized coordinates used to sample from
1242e5c31af7Sopenharmony_ci    pname:srcImage:
1243e5c31af7Sopenharmony_ci  {empty}:: [eq]#u = u~scaled~ {plus} x~src0~#
1244e5c31af7Sopenharmony_ci  {empty}:: [eq]#v = v~scaled~ {plus} y~src0~#
1245e5c31af7Sopenharmony_ci  {empty}:: [eq]#w = w~scaled~ {plus} z~src0~#
1246e5c31af7Sopenharmony_ci  {empty}:: [eq]#q = pname:mipLevel#
1247e5c31af7Sopenharmony_ci  {empty}:: [eq]#a = a~offset~ {plus} pname:baseArrayCount~src~#
1248e5c31af7Sopenharmony_ci
1249e5c31af7Sopenharmony_ciThese coordinates are used to sample from the source image, as described in
1250e5c31af7Sopenharmony_ci<<textures, Image Operations chapter>>, with the filter mode equal to that
1251e5c31af7Sopenharmony_ciof pname:filter, a mipmap mode of ename:VK_SAMPLER_MIPMAP_MODE_NEAREST and
1252e5c31af7Sopenharmony_cian address mode of ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE.
1253e5c31af7Sopenharmony_ciImplementations must: clamp at the edge of the source image, and may:
1254e5c31af7Sopenharmony_ciadditionally clamp to the edge of the source region.
1255e5c31af7Sopenharmony_ci
1256e5c31af7Sopenharmony_ci[NOTE]
1257e5c31af7Sopenharmony_ci.Note
1258e5c31af7Sopenharmony_ci====
1259e5c31af7Sopenharmony_ciDue to allowable rounding errors in the generation of the source texture
1260e5c31af7Sopenharmony_cicoordinates, it is not always possible to guarantee exactly which source
1261e5c31af7Sopenharmony_citexels will be sampled for a given blit.
1262e5c31af7Sopenharmony_ciAs rounding errors are implementation-dependent, the exact results of a
1263e5c31af7Sopenharmony_ciblitting operation are also implementation-dependent.
1264e5c31af7Sopenharmony_ci====
1265e5c31af7Sopenharmony_ci
1266e5c31af7Sopenharmony_ciBlits are done layer by layer starting with the pname:baseArrayLayer member
1267e5c31af7Sopenharmony_ciof pname:srcSubresource for the source and pname:dstSubresource for the
1268e5c31af7Sopenharmony_cidestination.
1269e5c31af7Sopenharmony_cipname:layerCount layers are blitted to the destination image.
1270e5c31af7Sopenharmony_ci
1271e5c31af7Sopenharmony_ciWhen blitting 3D textures, slices in the destination region bounded by
1272e5c31af7Sopenharmony_cipname:dstOffsets[0].z and pname:dstOffsets[1].z are sampled from slices in
1273e5c31af7Sopenharmony_cithe source region bounded by pname:srcOffsets[0].z and
1274e5c31af7Sopenharmony_cipname:srcOffsets[1].z.
1275e5c31af7Sopenharmony_ciIf the pname:filter parameter is ename:VK_FILTER_LINEAR then the value
1276e5c31af7Sopenharmony_cisampled from the source image is taken by doing linear filtering using the
1277e5c31af7Sopenharmony_ciinterpolated *z* coordinate represented by *w* in the previous equations.
1278e5c31af7Sopenharmony_ciIf the pname:filter parameter is ename:VK_FILTER_NEAREST then the value
1279e5c31af7Sopenharmony_cisampled from the source image is taken from the single nearest slice, with
1280e5c31af7Sopenharmony_cian implementation-dependent arithmetic rounding mode.
1281e5c31af7Sopenharmony_ci
1282e5c31af7Sopenharmony_ciThe following filtering and conversion rules apply:
1283e5c31af7Sopenharmony_ci
1284e5c31af7Sopenharmony_ci  * Integer formats can: only be converted to other integer formats with the
1285e5c31af7Sopenharmony_ci    same signedness.
1286e5c31af7Sopenharmony_ci  * No format conversion is supported between depth/stencil images.
1287e5c31af7Sopenharmony_ci    The formats must: match.
1288e5c31af7Sopenharmony_ci  * Format conversions on unorm, snorm, unscaled and packed float formats of
1289e5c31af7Sopenharmony_ci    the copied aspect of the image are performed by first converting the
1290e5c31af7Sopenharmony_ci    pixels to float values.
1291e5c31af7Sopenharmony_ci  * For sRGB source formats, nonlinear RGB values are converted to linear
1292e5c31af7Sopenharmony_ci    representation prior to filtering.
1293e5c31af7Sopenharmony_ci  * After filtering, the float values are first clamped and then cast to the
1294e5c31af7Sopenharmony_ci    destination image format.
1295e5c31af7Sopenharmony_ci    In case of sRGB destination format, linear RGB values are converted to
1296e5c31af7Sopenharmony_ci    nonlinear representation before writing the pixel to the image.
1297e5c31af7Sopenharmony_ci
1298e5c31af7Sopenharmony_ciSigned and unsigned integers are converted by first clamping to the
1299e5c31af7Sopenharmony_cirepresentable range of the destination format, then casting the value.
1300e5c31af7Sopenharmony_ci
1301e5c31af7Sopenharmony_ci.Valid Usage
1302e5c31af7Sopenharmony_ci****
1303e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/blit_image_command_buffer_common.txt[]
1304e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/blit_image_common.txt[]
1305e5c31af7Sopenharmony_ci****
1306e5c31af7Sopenharmony_ci
1307e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBlitImage.txt[]
1308e5c31af7Sopenharmony_ci--
1309e5c31af7Sopenharmony_ci
1310e5c31af7Sopenharmony_ci[open,refpage='VkImageBlit',desc='Structure specifying an image blit operation',type='structs']
1311e5c31af7Sopenharmony_ci--
1312e5c31af7Sopenharmony_ci:refpage: VkImageBlit
1313e5c31af7Sopenharmony_ci
1314e5c31af7Sopenharmony_ciThe sname:VkImageBlit structure is defined as:
1315e5c31af7Sopenharmony_ci
1316e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageBlit.txt[]
1317e5c31af7Sopenharmony_ci
1318e5c31af7Sopenharmony_ci  * pname:srcSubresource is the subresource to blit from.
1319e5c31af7Sopenharmony_ci  * pname:srcOffsets is a pointer to an array of two slink:VkOffset3D
1320e5c31af7Sopenharmony_ci    structures specifying the bounds of the source region within
1321e5c31af7Sopenharmony_ci    pname:srcSubresource.
1322e5c31af7Sopenharmony_ci  * pname:dstSubresource is the subresource to blit into.
1323e5c31af7Sopenharmony_ci  * pname:dstOffsets is a pointer to an array of two slink:VkOffset3D
1324e5c31af7Sopenharmony_ci    structures specifying the bounds of the destination region within
1325e5c31af7Sopenharmony_ci    pname:dstSubresource.
1326e5c31af7Sopenharmony_ci
1327e5c31af7Sopenharmony_ciFor each element of the pname:pRegions array, a blit operation is performed
1328e5c31af7Sopenharmony_cifor the specified source and destination regions.
1329e5c31af7Sopenharmony_ci
1330e5c31af7Sopenharmony_ci.Valid Usage
1331e5c31af7Sopenharmony_ci****
1332e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_blit_common.txt[]
1333e5c31af7Sopenharmony_ci****
1334e5c31af7Sopenharmony_ci
1335e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageBlit.txt[]
1336e5c31af7Sopenharmony_ci--
1337e5c31af7Sopenharmony_ci
1338e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
1339e5c31af7Sopenharmony_ci
1340e5c31af7Sopenharmony_ciA more extensible version of the blit image command is defined below.
1341e5c31af7Sopenharmony_ci
1342e5c31af7Sopenharmony_ci[open,refpage='vkCmdBlitImage2KHR',desc='Copy regions of an image, potentially performing format conversion,',type='protos']
1343e5c31af7Sopenharmony_ci--
1344e5c31af7Sopenharmony_ci:refpage: vkCmdBlitImage2KHR
1345e5c31af7Sopenharmony_ci
1346e5c31af7Sopenharmony_ciTo copy regions of a source image into a destination image, potentially
1347e5c31af7Sopenharmony_ciperforming format conversion, arbitrary scaling, and filtering, call:
1348e5c31af7Sopenharmony_ci
1349e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBlitImage2KHR.txt[]
1350e5c31af7Sopenharmony_ci
1351e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1352e5c31af7Sopenharmony_ci    recorded.
1353e5c31af7Sopenharmony_ci  * pname:pBlitImageInfo is a pointer to a slink:VkBlitImageInfo2KHR
1354e5c31af7Sopenharmony_ci    structure describing the blit parameters.
1355e5c31af7Sopenharmony_ci
1356e5c31af7Sopenharmony_ciThis command is functionally identical to flink:vkCmdBlitImage, but includes
1357e5c31af7Sopenharmony_ciextensible sub-structures that include pname:sType and pname:pNext
1358e5c31af7Sopenharmony_ciparameters, allowing them to be more easily extended.
1359e5c31af7Sopenharmony_ci
1360e5c31af7Sopenharmony_ci.Valid Usage
1361e5c31af7Sopenharmony_ci****
1362e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/blit_image_command_buffer_common.txt[]
1363e5c31af7Sopenharmony_ci****
1364e5c31af7Sopenharmony_ci
1365e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBlitImage2KHR.txt[]
1366e5c31af7Sopenharmony_ci--
1367e5c31af7Sopenharmony_ci
1368e5c31af7Sopenharmony_ci[open,refpage='VkBlitImageInfo2KHR',desc='Structure specifying parameters of blit image command',type='structs']
1369e5c31af7Sopenharmony_ci--
1370e5c31af7Sopenharmony_ci:refpage: VkBlitImageInfo2KHR
1371e5c31af7Sopenharmony_ci
1372e5c31af7Sopenharmony_ciThe sname:VkBlitImageInfo2KHR structure is defined as:
1373e5c31af7Sopenharmony_ci
1374e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkBlitImageInfo2KHR.txt[]
1375e5c31af7Sopenharmony_ci
1376e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1377e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1378e5c31af7Sopenharmony_ci    structure.
1379e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
1380e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the layout of the source image subresources for
1381e5c31af7Sopenharmony_ci    the blit.
1382e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
1383e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the layout of the destination image subresources
1384e5c31af7Sopenharmony_ci    for the blit.
1385e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to blit.
1386e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkImageBlit2KHR
1387e5c31af7Sopenharmony_ci    structures specifying the regions to blit.
1388e5c31af7Sopenharmony_ci  * pname:filter is a elink:VkFilter specifying the filter to apply if the
1389e5c31af7Sopenharmony_ci    blits require scaling.
1390e5c31af7Sopenharmony_ci
1391e5c31af7Sopenharmony_ci.Valid Usage
1392e5c31af7Sopenharmony_ci****
1393e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/blit_image_common.txt[]
1394e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
1395e5c31af7Sopenharmony_ci  * [[VUID-VkBlitImageInfo2KHR-pRegions-04561]]
1396e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
1397e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
1398e5c31af7Sopenharmony_ci    pname:srcImage and pname:dstImage must: not be block-compressed images
1399e5c31af7Sopenharmony_ci  * [[VUID-VkBlitImageInfo2KHR-pRegions-06207]]
1400e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
1401e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
1402e5c31af7Sopenharmony_ci    pname:srcImage must: be of type ename:VK_IMAGE_TYPE_2D
1403e5c31af7Sopenharmony_ci  * [[VUID-VkBlitImageInfo2KHR-pRegions-06208]]
1404e5c31af7Sopenharmony_ci    If any element of pname:pRegions contains
1405e5c31af7Sopenharmony_ci    slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then
1406e5c31af7Sopenharmony_ci    pname:srcImage must: not have a
1407e5c31af7Sopenharmony_ci    <<formats-requiring-sampler-ycbcr-conversion, multi-planar format>>
1408e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
1409e5c31af7Sopenharmony_ci****
1410e5c31af7Sopenharmony_ci
1411e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkBlitImageInfo2KHR.txt[]
1412e5c31af7Sopenharmony_ci--
1413e5c31af7Sopenharmony_ci
1414e5c31af7Sopenharmony_ci[open,refpage='VkImageBlit2KHR',desc='Structure specifying an image blit operation',type='structs']
1415e5c31af7Sopenharmony_ci--
1416e5c31af7Sopenharmony_ci:refpage: VkImageBlit2KHR
1417e5c31af7Sopenharmony_ci
1418e5c31af7Sopenharmony_ciThe sname:VkImageBlit2KHR structure is defined as:
1419e5c31af7Sopenharmony_ci
1420e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageBlit2KHR.txt[]
1421e5c31af7Sopenharmony_ci
1422e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1423e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1424e5c31af7Sopenharmony_ci    structure.
1425e5c31af7Sopenharmony_ci  * pname:srcSubresource is the subresource to blit from.
1426e5c31af7Sopenharmony_ci  * pname:srcOffsets is a pointer to an array of two slink:VkOffset3D
1427e5c31af7Sopenharmony_ci    structures specifying the bounds of the source region within
1428e5c31af7Sopenharmony_ci    pname:srcSubresource.
1429e5c31af7Sopenharmony_ci  * pname:dstSubresource is the subresource to blit into.
1430e5c31af7Sopenharmony_ci  * pname:dstOffsets is a pointer to an array of two slink:VkOffset3D
1431e5c31af7Sopenharmony_ci    structures specifying the bounds of the destination region within
1432e5c31af7Sopenharmony_ci    pname:dstSubresource.
1433e5c31af7Sopenharmony_ci
1434e5c31af7Sopenharmony_ciFor each element of the pname:pRegions array, a blit operation is performed
1435e5c31af7Sopenharmony_cifor the specified source and destination regions.
1436e5c31af7Sopenharmony_ci
1437e5c31af7Sopenharmony_ci.Valid Usage
1438e5c31af7Sopenharmony_ci****
1439e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_blit_common.txt[]
1440e5c31af7Sopenharmony_ci****
1441e5c31af7Sopenharmony_ci
1442e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageBlit2KHR.txt[]
1443e5c31af7Sopenharmony_ci--
1444e5c31af7Sopenharmony_ci
1445e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
1446e5c31af7Sopenharmony_ciFor flink:vkCmdBlitImage2KHR, each region copied can include a rotation.
1447e5c31af7Sopenharmony_ciTo specify a rotated region, add slink:VkCopyCommandTransformInfoQCOM to the
1448e5c31af7Sopenharmony_cipname:pNext chain of slink:VkImageBlit2KHR.
1449e5c31af7Sopenharmony_ciFor each region with a rotation specified,
1450e5c31af7Sopenharmony_ci<<copies-images-scaling-rotation,Image Blits with Scaling and Rotation>>
1451e5c31af7Sopenharmony_cispecifies how coordinates are rotated prior to sampling from the source
1452e5c31af7Sopenharmony_ciimage.
1453e5c31af7Sopenharmony_ciWhen rotation is specified, the source and destination images must: each be
1454e5c31af7Sopenharmony_ci2D images.
1455e5c31af7Sopenharmony_ciThey must: not be <<blocked-image,blocked images>> or have a
1456e5c31af7Sopenharmony_ci<<formats-requiring-sampler-ycbcr-conversion, multi-planar format>>.
1457e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
1458e5c31af7Sopenharmony_ci
1459e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
1460e5c31af7Sopenharmony_ci
1461e5c31af7Sopenharmony_ciifdef::VK_QCOM_rotated_copy_commands[]
1462e5c31af7Sopenharmony_ciinclude::{chapters}/VK_QCOM_rotated_copies/rotated_addressing_blits.txt[]
1463e5c31af7Sopenharmony_ciendif::VK_QCOM_rotated_copy_commands[]
1464e5c31af7Sopenharmony_ci
1465e5c31af7Sopenharmony_ci
1466e5c31af7Sopenharmony_ci[[copies-resolve]]
1467e5c31af7Sopenharmony_ci== Resolving Multisample Images
1468e5c31af7Sopenharmony_ci
1469e5c31af7Sopenharmony_ci[open,refpage='vkCmdResolveImage',desc='Resolve regions of an image',type='protos']
1470e5c31af7Sopenharmony_ci--
1471e5c31af7Sopenharmony_ci:refpage: vkCmdResolveImage
1472e5c31af7Sopenharmony_ci
1473e5c31af7Sopenharmony_ciTo resolve a multisample color image to a non-multisample color image, call:
1474e5c31af7Sopenharmony_ci
1475e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdResolveImage.txt[]
1476e5c31af7Sopenharmony_ci
1477e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1478e5c31af7Sopenharmony_ci    recorded.
1479e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
1480e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the layout of the source image subresources for
1481e5c31af7Sopenharmony_ci    the resolve.
1482e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
1483e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the layout of the destination image subresources
1484e5c31af7Sopenharmony_ci    for the resolve.
1485e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to resolve.
1486e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkImageResolve
1487e5c31af7Sopenharmony_ci    structures specifying the regions to resolve.
1488e5c31af7Sopenharmony_ci
1489e5c31af7Sopenharmony_ciDuring the resolve the samples corresponding to each pixel location in the
1490e5c31af7Sopenharmony_cisource are converted to a single sample before being written to the
1491e5c31af7Sopenharmony_cidestination.
1492e5c31af7Sopenharmony_ciIf the source formats are floating-point or normalized types, the sample
1493e5c31af7Sopenharmony_civalues for each pixel are resolved in an implementation-dependent manner.
1494e5c31af7Sopenharmony_ciIf the source formats are integer types, a single sample's value is selected
1495e5c31af7Sopenharmony_cifor each pixel.
1496e5c31af7Sopenharmony_ci
1497e5c31af7Sopenharmony_cipname:srcOffset and pname:dstOffset select the initial pname:x, pname:y, and
1498e5c31af7Sopenharmony_cipname:z offsets in texels of the sub-regions of the source and destination
1499e5c31af7Sopenharmony_ciimage data.
1500e5c31af7Sopenharmony_cipname:extent is the size in texels of the source image to resolve in
1501e5c31af7Sopenharmony_cipname:width, pname:height and pname:depth.
1502e5c31af7Sopenharmony_ciEach element of pname:pRegions must: be a region that is contained within
1503e5c31af7Sopenharmony_ciits corresponding image.
1504e5c31af7Sopenharmony_ci
1505e5c31af7Sopenharmony_ciResolves are done layer by layer starting with pname:baseArrayLayer member
1506e5c31af7Sopenharmony_ciof pname:srcSubresource for the source and pname:dstSubresource for the
1507e5c31af7Sopenharmony_cidestination.
1508e5c31af7Sopenharmony_cipname:layerCount layers are resolved to the destination image.
1509e5c31af7Sopenharmony_ci
1510e5c31af7Sopenharmony_ci.Valid Usage
1511e5c31af7Sopenharmony_ci****
1512e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/resolve_image_command_buffer_common.txt[]
1513e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/resolve_image_common.txt[]
1514e5c31af7Sopenharmony_ci****
1515e5c31af7Sopenharmony_ci
1516e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdResolveImage.txt[]
1517e5c31af7Sopenharmony_ci--
1518e5c31af7Sopenharmony_ci
1519e5c31af7Sopenharmony_ci[open,refpage='VkImageResolve',desc='Structure specifying an image resolve operation',type='structs']
1520e5c31af7Sopenharmony_ci--
1521e5c31af7Sopenharmony_ci:refpage: VkImageResolve
1522e5c31af7Sopenharmony_ci
1523e5c31af7Sopenharmony_ciThe sname:VkImageResolve structure is defined as:
1524e5c31af7Sopenharmony_ci
1525e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageResolve.txt[]
1526e5c31af7Sopenharmony_ci
1527e5c31af7Sopenharmony_ci  * pname:srcSubresource and pname:dstSubresource are
1528e5c31af7Sopenharmony_ci    slink:VkImageSubresourceLayers structures specifying the image
1529e5c31af7Sopenharmony_ci    subresources of the images used for the source and destination image
1530e5c31af7Sopenharmony_ci    data, respectively.
1531e5c31af7Sopenharmony_ci    Resolve of depth/stencil images is not supported.
1532e5c31af7Sopenharmony_ci  * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y,
1533e5c31af7Sopenharmony_ci    and pname:z offsets in texels of the sub-regions of the source and
1534e5c31af7Sopenharmony_ci    destination image data.
1535e5c31af7Sopenharmony_ci  * pname:extent is the size in texels of the source image to resolve in
1536e5c31af7Sopenharmony_ci    pname:width, pname:height and pname:depth.
1537e5c31af7Sopenharmony_ci
1538e5c31af7Sopenharmony_ci.Valid Usage
1539e5c31af7Sopenharmony_ci****
1540e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_resolve_common.txt[]
1541e5c31af7Sopenharmony_ci****
1542e5c31af7Sopenharmony_ci
1543e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageResolve.txt[]
1544e5c31af7Sopenharmony_ci--
1545e5c31af7Sopenharmony_ci
1546e5c31af7Sopenharmony_ciifdef::VK_AMD_buffer_marker[]
1547e5c31af7Sopenharmony_ciinclude::{chapters}/VK_AMD_buffer_marker/copies.txt[]
1548e5c31af7Sopenharmony_ciendif::VK_AMD_buffer_marker[]
1549e5c31af7Sopenharmony_ci
1550e5c31af7Sopenharmony_ciifdef::VK_KHR_copy_commands2[]
1551e5c31af7Sopenharmony_ci
1552e5c31af7Sopenharmony_ciA more extensible version of the resolve image command is defined below.
1553e5c31af7Sopenharmony_ci
1554e5c31af7Sopenharmony_ci[open,refpage='vkCmdResolveImage2KHR',desc='Resolve regions of an image',type='protos']
1555e5c31af7Sopenharmony_ci--
1556e5c31af7Sopenharmony_ci:refpage: vkCmdResolveImage2KHR
1557e5c31af7Sopenharmony_ci
1558e5c31af7Sopenharmony_ciTo resolve a multisample image to a non-multisample image, call:
1559e5c31af7Sopenharmony_ci
1560e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdResolveImage2KHR.txt[]
1561e5c31af7Sopenharmony_ci
1562e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1563e5c31af7Sopenharmony_ci    recorded.
1564e5c31af7Sopenharmony_ci  * pname:pResolveImageInfo is a pointer to a slink:VkResolveImageInfo2KHR
1565e5c31af7Sopenharmony_ci    structure describing the resolve parameters.
1566e5c31af7Sopenharmony_ci
1567e5c31af7Sopenharmony_ciThis command is functionally identical to flink:vkCmdResolveImage, but
1568e5c31af7Sopenharmony_ciincludes extensible sub-structures that include pname:sType and pname:pNext
1569e5c31af7Sopenharmony_ciparameters, allowing them to be more easily extended.
1570e5c31af7Sopenharmony_ci
1571e5c31af7Sopenharmony_ci
1572e5c31af7Sopenharmony_ci.Valid Usage
1573e5c31af7Sopenharmony_ci****
1574e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/resolve_image_command_buffer_common.txt[]
1575e5c31af7Sopenharmony_ci****
1576e5c31af7Sopenharmony_ci
1577e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdResolveImage2KHR.txt[]
1578e5c31af7Sopenharmony_ci--
1579e5c31af7Sopenharmony_ci
1580e5c31af7Sopenharmony_ci[open,refpage='VkResolveImageInfo2KHR',desc='Structure specifying parameters of resolve image command',type='structs']
1581e5c31af7Sopenharmony_ci--
1582e5c31af7Sopenharmony_ci:refpage: VkResolveImageInfo2KHR
1583e5c31af7Sopenharmony_ci
1584e5c31af7Sopenharmony_ciThe sname:VkResolveImageInfo2KHR structure is defined as:
1585e5c31af7Sopenharmony_ci
1586e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkResolveImageInfo2KHR.txt[]
1587e5c31af7Sopenharmony_ci
1588e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1589e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1590e5c31af7Sopenharmony_ci    structure.
1591e5c31af7Sopenharmony_ci  * pname:srcImage is the source image.
1592e5c31af7Sopenharmony_ci  * pname:srcImageLayout is the layout of the source image subresources for
1593e5c31af7Sopenharmony_ci    the resolve.
1594e5c31af7Sopenharmony_ci  * pname:dstImage is the destination image.
1595e5c31af7Sopenharmony_ci  * pname:dstImageLayout is the layout of the destination image subresources
1596e5c31af7Sopenharmony_ci    for the resolve.
1597e5c31af7Sopenharmony_ci  * pname:regionCount is the number of regions to resolve.
1598e5c31af7Sopenharmony_ci  * pname:pRegions is a pointer to an array of slink:VkImageResolve2KHR
1599e5c31af7Sopenharmony_ci    structures specifying the regions to resolve.
1600e5c31af7Sopenharmony_ci
1601e5c31af7Sopenharmony_ci.Valid Usage
1602e5c31af7Sopenharmony_ci****
1603e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/resolve_image_common.txt[]
1604e5c31af7Sopenharmony_ci****
1605e5c31af7Sopenharmony_ci
1606e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkResolveImageInfo2KHR.txt[]
1607e5c31af7Sopenharmony_ci--
1608e5c31af7Sopenharmony_ci
1609e5c31af7Sopenharmony_ci[open,refpage='VkImageResolve2KHR',desc='Structure specifying an image resolve operation',type='structs']
1610e5c31af7Sopenharmony_ci--
1611e5c31af7Sopenharmony_ci:refpage: VkImageResolve2KHR
1612e5c31af7Sopenharmony_ci
1613e5c31af7Sopenharmony_ciThe sname:VkImageResolve2KHR structure is defined as:
1614e5c31af7Sopenharmony_ci
1615e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkImageResolve2KHR.txt[]
1616e5c31af7Sopenharmony_ci
1617e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1618e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1619e5c31af7Sopenharmony_ci    structure.
1620e5c31af7Sopenharmony_ci  * pname:srcSubresource and pname:dstSubresource are
1621e5c31af7Sopenharmony_ci    slink:VkImageSubresourceLayers structures specifying the image
1622e5c31af7Sopenharmony_ci    subresources of the images used for the source and destination image
1623e5c31af7Sopenharmony_ci    data, respectively.
1624e5c31af7Sopenharmony_ci    Resolve of depth/stencil images is not supported.
1625e5c31af7Sopenharmony_ci  * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y,
1626e5c31af7Sopenharmony_ci    and pname:z offsets in texels of the sub-regions of the source and
1627e5c31af7Sopenharmony_ci    destination image data.
1628e5c31af7Sopenharmony_ci  * pname:extent is the size in texels of the source image to resolve in
1629e5c31af7Sopenharmony_ci    pname:width, pname:height and pname:depth.
1630e5c31af7Sopenharmony_ci
1631e5c31af7Sopenharmony_ci.Valid Usage
1632e5c31af7Sopenharmony_ci****
1633e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/image_resolve_common.txt[]
1634e5c31af7Sopenharmony_ci****
1635e5c31af7Sopenharmony_ci
1636e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkImageResolve2KHR.txt[]
1637e5c31af7Sopenharmony_ci--
1638e5c31af7Sopenharmony_ci
1639e5c31af7Sopenharmony_ciendif::VK_KHR_copy_commands2[]
1640