1// Copyright 2015-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[copies]] 6= Copy Commands 7 8An application can: copy buffer and image data using several methods 9described in this chapter, depending on the type of data transfer. 10 11All copy commands are treated as "`transfer`" operations for the purposes of 12synchronization barriers. 13 14All copy commands that have a source format with an X component in its 15format description read undefined: values from those bits. 16 17All copy commands that have a destination format with an X component in its 18format description write undefined: values to those bits. 19 20 21[[copies-buffers]] 22== Copying Data Between Buffers 23 24[open,refpage='vkCmdCopyBuffer',desc='Copy data between buffer regions',type='protos'] 25-- 26:refpage: vkCmdCopyBuffer 27 28To copy data between buffer objects, call: 29 30include::{generated}/api/protos/vkCmdCopyBuffer.adoc[] 31 32 * pname:commandBuffer is the command buffer into which the command will be 33 recorded. 34 * pname:srcBuffer is the source buffer. 35 * pname:dstBuffer is the destination buffer. 36 * pname:regionCount is the number of regions to copy. 37 * pname:pRegions is a pointer to an array of slink:VkBufferCopy structures 38 specifying the regions to copy. 39 40Each source region specified by pname:pRegions is copied from the source 41buffer to the destination region of the destination buffer. 42If any of the specified regions in pname:srcBuffer overlaps in memory with 43any of the specified regions in pname:dstBuffer, values read from those 44overlapping regions are undefined:. 45 46.Valid Usage 47**** 48include::{chapters}/commonvalidity/copy_buffer_command_buffer_common.adoc[] 49include::{chapters}/commonvalidity/copy_buffer_common.adoc[] 50**** 51 52include::{generated}/validity/protos/vkCmdCopyBuffer.adoc[] 53-- 54 55[open,refpage='VkBufferCopy',desc='Structure specifying a buffer copy operation',type='structs'] 56-- 57:refpage: VkBufferCopy 58 59The sname:VkBufferCopy structure is defined as: 60 61include::{generated}/api/structs/VkBufferCopy.adoc[] 62 63 * pname:srcOffset is the starting offset in bytes from the start of 64 pname:srcBuffer. 65 * pname:dstOffset is the starting offset in bytes from the start of 66 pname:dstBuffer. 67 * pname:size is the number of bytes to copy. 68 69.Valid Usage 70**** 71include::{chapters}/commonvalidity/buffer_copy_common.adoc[] 72**** 73 74include::{generated}/validity/structs/VkBufferCopy.adoc[] 75-- 76 77ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[] 78A more extensible version of the copy buffer command is defined below. 79 80[open,refpage='vkCmdCopyBuffer2',desc='Copy data between buffer regions',type='protos',alias='vkCmdCopyBuffer2KHR'] 81-- 82:refpage: vkCmdCopyBuffer2 83 84To copy data between buffer objects, call: 85 86ifdef::VK_VERSION_1_3[] 87include::{generated}/api/protos/vkCmdCopyBuffer2.adoc[] 88endif::VK_VERSION_1_3[] 89 90ifdef::VK_VERSION_1_3+VK_KHR_copy_commands2[or the equivalent command] 91 92ifdef::VK_KHR_copy_commands2[] 93include::{generated}/api/protos/vkCmdCopyBuffer2KHR.adoc[] 94endif::VK_KHR_copy_commands2[] 95 96 * pname:commandBuffer is the command buffer into which the command will be 97 recorded. 98 * pname:pCopyBufferInfo is a pointer to a slink:VkCopyBufferInfo2 99 structure describing the copy parameters. 100 101Each source region specified by pname:pCopyBufferInfo->pname:pRegions is 102copied from the source buffer to the destination region of the destination 103buffer. 104If any of the specified regions in pname:pCopyBufferInfo->pname:srcBuffer 105overlaps in memory with any of the specified regions in 106pname:pCopyBufferInfo->pname:dstBuffer, values read from those overlapping 107regions are undefined:. 108 109.Valid Usage 110**** 111include::{chapters}/commonvalidity/copy_buffer_command_buffer_common.adoc[] 112**** 113 114include::{generated}/validity/protos/vkCmdCopyBuffer2.adoc[] 115-- 116 117[open,refpage='VkCopyBufferInfo2',desc='Structure specifying parameters of a buffer copy command',type='structs',alias='VkCopyBufferInfo2KHR'] 118-- 119:refpage: VkCopyBufferInfo2 120 121The sname:VkCopyBufferInfo2 structure is defined as: 122 123include::{generated}/api/structs/VkCopyBufferInfo2.adoc[] 124 125ifdef::VK_KHR_copy_commands2[] 126or the equivalent 127 128include::{generated}/api/structs/VkCopyBufferInfo2KHR.adoc[] 129endif::VK_KHR_copy_commands2[] 130 131 * pname:sType is the type of this structure. 132 * pname:pNext is `NULL` or a pointer to a structure extending this 133 structure. 134 * pname:srcBuffer is the source buffer. 135 * pname:dstBuffer is the destination buffer. 136 * pname:regionCount is the number of regions to copy. 137 * pname:pRegions is a pointer to an array of slink:VkBufferCopy2 138 structures specifying the regions to copy. 139 140.Valid Usage 141**** 142include::{chapters}/commonvalidity/copy_buffer_common.adoc[] 143**** 144 145include::{generated}/validity/structs/VkCopyBufferInfo2.adoc[] 146-- 147 148[open,refpage='VkBufferCopy2',desc='Structure specifying a buffer copy operation',type='structs',alias='VkBufferCopy2KHR'] 149-- 150:refpage: VkBufferCopy2 151 152The sname:VkBufferCopy2 structure is defined as: 153 154include::{generated}/api/structs/VkBufferCopy2.adoc[] 155 156ifdef::VK_KHR_copy_commands2[] 157or the equivalent 158 159include::{generated}/api/structs/VkBufferCopy2KHR.adoc[] 160endif::VK_KHR_copy_commands2[] 161 162 * pname:sType is the type of this structure. 163 * pname:pNext is `NULL` or a pointer to a structure extending this 164 structure. 165 * pname:srcOffset is the starting offset in bytes from the start of 166 pname:srcBuffer. 167 * pname:dstOffset is the starting offset in bytes from the start of 168 pname:dstBuffer. 169 * pname:size is the number of bytes to copy. 170 171.Valid Usage 172**** 173include::{chapters}/commonvalidity/buffer_copy_common.adoc[] 174**** 175 176include::{generated}/validity/structs/VkBufferCopy2.adoc[] 177-- 178endif::VK_VERSION_1_3,VK_KHR_copy_commands2[] 179 180 181[[copies-images]] 182== Copying Data Between Images 183 184[open,refpage='vkCmdCopyImage',desc='Copy data between images',type='protos'] 185-- 186:refpage: vkCmdCopyImage 187 188To copy data between image objects, call: 189 190include::{generated}/api/protos/vkCmdCopyImage.adoc[] 191 192 * pname:commandBuffer is the command buffer into which the command will be 193 recorded. 194 * pname:srcImage is the source image. 195 * pname:srcImageLayout is the current layout of the source image 196 subresource. 197 * pname:dstImage is the destination image. 198 * pname:dstImageLayout is the current layout of the destination image 199 subresource. 200 * pname:regionCount is the number of regions to copy. 201 * pname:pRegions is a pointer to an array of slink:VkImageCopy structures 202 specifying the regions to copy. 203 204Each source region specified by pname:pRegions is copied from the source 205image to the destination region of the destination image. 206If any of the specified regions in pname:srcImage overlaps in memory with 207any of the specified regions in pname:dstImage, values read from those 208overlapping regions are undefined:. 209 210ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 211<<formats-requiring-sampler-ycbcr-conversion, Multi-planar images>> can: 212only be copied on a per-plane basis, and the subresources used in each 213region when copying to or from such images must: specify only one plane, 214though different regions can: specify different planes. 215When copying planes of multi-planar images, the format considered is the 216<<formats-compatible-planes, compatible format for that plane>>, rather than 217the format of the multi-planar image. 218endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 219 220If the format of the destination image has a different 221<<formats-compatibility-classes,block extent>> than the source image (e.g. 222one is a compressed format), the offset and extent for each of the regions 223specified is <<formats-size-compatibility, scaled according to the block 224extents of each format>> to match in size. 225Copy regions for each image must: be aligned to a multiple of the texel 226block extent in each dimension, except at the edges of the image, where 227region extents must: match the edge of the image. 228 229ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[] 230Image data can: be copied between images with different image types. 231If one image is ename:VK_IMAGE_TYPE_3D and the other image is 232ename:VK_IMAGE_TYPE_2D with multiple layers, then each slice is copied to or 233from a different layer; pname:depth slices in the 3D image correspond to 234pname:layerCount layers in the 2D image, with an effective pname:depth of 235`1` used for the 2D image. 236endif::VK_VERSION_1_1,VK_KHR_maintenance1[] 237 238.Valid Usage 239**** 240include::{chapters}/commonvalidity/copy_image_command_buffer_common.adoc[] 241include::{chapters}/commonvalidity/copy_image_common.adoc[] 242**** 243 244include::{generated}/validity/protos/vkCmdCopyImage.adoc[] 245-- 246 247[open,refpage='VkImageCopy',desc='Structure specifying an image copy operation',type='structs'] 248-- 249:refpage: VkImageCopy 250 251The sname:VkImageCopy structure is defined as: 252 253include::{generated}/api/structs/VkImageCopy.adoc[] 254 255 * pname:srcSubresource and pname:dstSubresource are 256 slink:VkImageSubresourceLayers structures specifying the image 257 subresources of the images used for the source and destination image 258 data, respectively. 259 * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y, 260 and pname:z offsets in texels of the sub-regions of the source and 261 destination image data. 262 * pname:extent is the size in texels of the image to copy in pname:width, 263 pname:height and pname:depth. 264 265.Valid Usage 266**** 267include::{chapters}/commonvalidity/image_copy_common.adoc[] 268**** 269 270include::{generated}/validity/structs/VkImageCopy.adoc[] 271-- 272 273[open,refpage='VkImageSubresourceLayers',desc='Structure specifying an image subresource layers',type='structs'] 274-- 275The sname:VkImageSubresourceLayers structure is defined as: 276 277include::{generated}/api/structs/VkImageSubresourceLayers.adoc[] 278 279 * pname:aspectMask is a combination of elink:VkImageAspectFlagBits, 280 selecting the color, depth and/or stencil aspects to be copied. 281 * pname:mipLevel is the mipmap level to copy 282 * pname:baseArrayLayer and pname:layerCount are the starting layer and 283 number of layers to copy. 284 285.Valid Usage 286**** 287 * [[VUID-VkImageSubresourceLayers-aspectMask-00167]] 288 If pname:aspectMask contains ename:VK_IMAGE_ASPECT_COLOR_BIT, it must: 289 not contain either of ename:VK_IMAGE_ASPECT_DEPTH_BIT or 290 ename:VK_IMAGE_ASPECT_STENCIL_BIT 291 * [[VUID-VkImageSubresourceLayers-aspectMask-00168]] 292 pname:aspectMask must: not contain ename:VK_IMAGE_ASPECT_METADATA_BIT 293ifdef::VK_EXT_image_drm_format_modifier[] 294 * [[VUID-VkImageSubresourceLayers-aspectMask-02247]] 295 pname:aspectMask must: not include 296 `VK_IMAGE_ASPECT_MEMORY_PLANE__{ibit}__BIT_EXT` for any index _i_ 297endif::VK_EXT_image_drm_format_modifier[] 298 * [[VUID-VkImageSubresourceLayers-layerCount-01700]] 299 pname:layerCount must: be greater than 0 300**** 301 302include::{generated}/validity/structs/VkImageSubresourceLayers.adoc[] 303-- 304 305ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[] 306A more extensible version of the copy image command is defined below. 307 308[open,refpage='vkCmdCopyImage2',desc='Copy data between images',type='protos',alias='vkCmdCopyImage2KHR'] 309-- 310:refpage: vkCmdCopyImage2 311 312To copy data between image objects, call: 313 314ifdef::VK_VERSION_1_3[] 315include::{generated}/api/protos/vkCmdCopyImage2.adoc[] 316endif::VK_VERSION_1_3[] 317 318ifdef::VK_VERSION_1_3+VK_KHR_copy_commands2[or the equivalent command] 319 320ifdef::VK_KHR_copy_commands2[] 321include::{generated}/api/protos/vkCmdCopyImage2KHR.adoc[] 322endif::VK_KHR_copy_commands2[] 323 324 * pname:commandBuffer is the command buffer into which the command will be 325 recorded. 326 * pname:pCopyImageInfo is a pointer to a slink:VkCopyImageInfo2 structure 327 describing the copy parameters. 328 329This command is functionally identical to flink:vkCmdCopyImage, but includes 330extensible sub-structures that include pname:sType and pname:pNext 331parameters, allowing them to be more easily extended. 332 333.Valid Usage 334**** 335include::{chapters}/commonvalidity/copy_image_command_buffer_common.adoc[] 336**** 337 338include::{generated}/validity/protos/vkCmdCopyImage2.adoc[] 339-- 340 341 342[open,refpage='VkCopyImageInfo2',desc='Structure specifying parameters of an image copy command',type='structs',alias='VkCopyImageInfo2KHR'] 343-- 344:refpage: VkCopyImageInfo2 345 346The sname:VkCopyImageInfo2 structure is defined as: 347 348include::{generated}/api/structs/VkCopyImageInfo2.adoc[] 349 350ifdef::VK_KHR_copy_commands2[] 351or the equivalent 352 353include::{generated}/api/structs/VkCopyImageInfo2KHR.adoc[] 354endif::VK_KHR_copy_commands2[] 355 356 * pname:sType is the type of this structure. 357 * pname:pNext is `NULL` or a pointer to a structure extending this 358 structure. 359 * pname:srcImage is the source image. 360 * pname:srcImageLayout is the current layout of the source image 361 subresource. 362 * pname:dstImage is the destination image. 363 * pname:dstImageLayout is the current layout of the destination image 364 subresource. 365 * pname:regionCount is the number of regions to copy. 366 * pname:pRegions is a pointer to an array of slink:VkImageCopy2 structures 367 specifying the regions to copy. 368 369 370.Valid Usage 371**** 372include::{chapters}/commonvalidity/copy_image_common.adoc[] 373**** 374 375include::{generated}/validity/structs/VkCopyImageInfo2.adoc[] 376-- 377 378[open,refpage='VkImageCopy2',desc='Structure specifying an image copy operation',type='structs',alias='VkImageCopy2KHR'] 379-- 380:refpage: VkImageCopy2 381 382The sname:VkImageCopy2 structure is defined as: 383 384include::{generated}/api/structs/VkImageCopy2.adoc[] 385 386ifdef::VK_KHR_copy_commands2[] 387or the equivalent 388 389include::{generated}/api/structs/VkImageCopy2KHR.adoc[] 390endif::VK_KHR_copy_commands2[] 391 392 * pname:sType is the type of this structure. 393 * pname:pNext is `NULL` or a pointer to a structure extending this 394 structure. 395 * pname:srcSubresource and pname:dstSubresource are 396 slink:VkImageSubresourceLayers structures specifying the image 397 subresources of the images used for the source and destination image 398 data, respectively. 399 * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y, 400 and pname:z offsets in texels of the sub-regions of the source and 401 destination image data. 402 * pname:extent is the size in texels of the image to copy in pname:width, 403 pname:height and pname:depth. 404 405.Valid Usage 406**** 407include::{chapters}/commonvalidity/image_copy_common.adoc[] 408**** 409 410include::{generated}/validity/structs/VkImageCopy2.adoc[] 411-- 412endif::VK_VERSION_1_3,VK_KHR_copy_commands2[] 413 414 415[[copies-buffers-images]] 416== Copying Data Between Buffers and Images 417 418Data can: be copied between buffers and images, enabling applications to 419load and store data between images and user defined offsets in buffer 420memory. 421 422[[copies-buffers-images-addressing]] 423When copying between a buffer and an image, whole texel blocks are always 424copied; each texel block in the specified extent in the image to be copied 425will be written to a region in the buffer, specified according to the 426position of the texel block, and the <<formats-compatibility-classes,texel 427block extent>> and size of the format being copied. 428 429For a set of coordinates [eq]#(x,y,z,layer)#, where: 430 431 {empty}:: [eq]#x# is in the range [eq]#[pname:imageOffset.x / blockWidth, 432 {lceil}(pname:imageOffset.x {plus} pname:imageExtent.width) / 433 blockWidth{rceil})#, 434 {empty}:: [eq]#y# is in the range [eq]#[pname:imageOffset.y / blockHeight, 435 {lceil}(pname:imageOffset.y {plus} pname:imageExtent.height) / 436 blockHeight{rceil})#, 437 {empty}:: [eq]#z# is in the range [eq]#[pname:imageOffset.z / blockDepth, 438 {lceil}(pname:imageOffset.z {plus} pname:imageExtent.depth) / 439 blockDepth{rceil})#, 440 {empty}:: [eq]#layer# is in the range 441 [pname:imageSubresource.baseArrayLayer, 442 pname:imageSubresource.baseArrayLayer {plus} 443 pname:imageSubresource.layerCount), 444 445and where [eq]#blockWidth#, [eq]#blockHeight#, and [eq]#blockDepth# are the 446dimensions of the <<formats-compatibility-classes,texel block extent>> of 447the image's format. 448 449For each [eq]#(x,y,z,layer)# coordinate, texels in the image layer selected 450by [eq]#layer# are accessed in the following ranges: 451 452 {empty}:: [eq]#[x {times} blockWidth, max( (x {times} blockWidth) {plus} 453 blockWidth, imageWidth) )# 454 {empty}:: [eq]#[y {times} blockHeight, max( (y {times} blockHeight) {plus} 455 blockHeight, imageHeight) )# 456 {empty}:: [eq]#[z {times} blockDepth, max( (z {times} blockDepth) {plus} 457 blockDepth, imageDepth) )# 458 459where [eq]#imageWidth#, [eq]#imageHeight#, and [eq]#imageDepth# are the 460dimensions of the image subresource. 461 462For each [eq]#(x,y,z,layer)# coordinate, bytes in the buffer are accessed at 463offsets in the range [eq]#[texelOffset, texelOffset {plus} blockSize)#, 464where: 465 466 {empty}:: [eq]#texelOffset = pname:bufferOffset {plus} (x {times} 467 blockSize) {plus} (y {times} rowExtent) {plus} (z {times} 468 sliceExtent) + (layer {times} layerExtent)# 469 {empty}:: [eq]#blockSize# is the size of the block in bytes for the format 470 {empty}:: [eq]#rowExtent = max(pname:bufferRowLength, 471 {lceil}pname:imageExtent.width / blockWidth{rceil} {times} 472 blockSize)# 473 {empty}:: [eq]#sliceExtent = max(pname:bufferImageHeight, 474 pname:imageExtent.height {times} rowExtent)# 475 {empty}:: [eq]#layerExtent = pname:imageExtent.depth {times} sliceExtent# 476 477ifdef::VK_QCOM_rotated_copy_commands[] 478[[copies-buffers-images-rotation-addressing]] 479If a rotation is specified by slink:VkCopyCommandTransformInfoQCOM, the 2D 480region of the image being addressed is rotated around the offset, modifying 481the range of [eq]#x# and [eq]#y# coordinates for the image address according 482to the specified elink:VkSurfaceTransformFlagBitsKHR: 483 484 * If ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR is specified, no rotation 485 is performed: 486 {empty}:: [eq]#x'# is in the same range as [eq]#x# 487 {empty}:: [eq]#y'# is in the same range as [eq]#y# 488 {empty}:: [eq]#blockWidth' = blockWidth# 489 {empty}:: [eq]#blockHeight' = blockHeight# 490 {empty}:: [eq]#imageWidth' = imageWidth# 491 {empty}:: [eq]#imageHeight' = imageHeight# 492 * If ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR is specified 493 {empty}:: [eq]#x'# is in the range [eq]#[{lceil}(pname:imageOffset.x 494 {minus} pname:imageExtent.height) / blockHeight{rceil}, 495 pname:imageOffset.x {minus} image/ blockHeight)# 496 {empty}:: [eq]#y'# is in the range [eq]#[pname:imageOffset.y / 497 blockWidth, {lceil}(pname:imageOffset.y {plus} 498 pname:imageExtent.width) / blockWidth{rceil})# 499 {empty}:: [eq]#blockWidth' = blockHeight# 500 {empty}:: [eq]#blockHeight' = blockWidth# 501 {empty}:: [eq]#imageWidth' = imageHeight# 502 {empty}:: [eq]#imageHeight' = imageWidth# 503 * If ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR is specified: 504 {empty}:: [eq]#x'# is in the range [eq]#[{lceil}(pname:imageOffset.x 505 {minus} pname:imageExtent.width) / blockWidth{rceil}, 506 pname:imageOffset.x / blockWidth)#, 507 {empty}:: [eq]#y'# is in the range [eq]#[{lceil}(pname:imageOffset.x 508 {plus} pname:imageExtent.height) / blockHeight{rceil}, 509 pname:imageOffset.x / blockHeight)#, 510 {empty}:: [eq]#blockWidth' = blockWidth# 511 {empty}:: [eq]#blockHeight' = blockHeight# 512 {empty}:: [eq]#imageWidth' = imageWidth# 513 {empty}:: [eq]#imageHeight' = imageHeight# 514 * If ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR is specified: 515 {empty}:: [eq]#x# is in the range [eq]#[pname:imageOffset.x / 516 blockHeight, {lceil}(pname:imageOffset.x {plus} 517 pname:imageExtent.height) / blockHeight{rceil})# 518 {empty}:: [eq]#y# is in the range [eq]#[{lceil}(pname:imageOffset.y 519 {minus} pname:imageExtent.width) / blockWidth{rceil}, 520 pname:imageOffset.y / blockWidth)#. 521 {empty}:: [eq]#blockWidth' = blockHeight# 522 {empty}:: [eq]#blockHeight' = blockWidth# 523 {empty}:: [eq]#imageWidth' = imageHeight# 524 {empty}:: [eq]#imageHeight' = imageWidth# 525 526When rotation is performed, for each [eq]#(x,y,z,layer)# coordinate, texels 527in the image layer selected by [eq]#layer# are instead accessed in the 528following ranges: 529 530 {empty}:: [eq]#[x' {times} blockWidth', max( (x' {times} blockWidth') 531 {plus} blockWidth', imageWidth') )# 532 {empty}:: [eq]#[y' {times} blockHeight', max( (y' {times} blockHeight') 533 {plus} blockHeight', imageHeight') )# 534 {empty}:: [eq]#[z' {times} blockDepth', max( (z' {times} blockDepth') 535 {plus} blockDepth', imageDepth') )# 536 537Buffer addressing calculations are unaffected by this rotation. 538endif::VK_QCOM_rotated_copy_commands[] 539 540[[copies-buffers-images-depth-stencil]] 541When copying between a buffer and the depth or stencil aspect of an image, 542data in the buffer is assumed to be laid out as separate planes rather than 543interleaved. 544Addressing calculations are thus performed for a different format than the 545base image, according to the aspect, as described in the following table: 546 547.Depth/Stencil Aspect Copy Table 548[width="95%",cols="1,1,1",options="header"] 549|==== 550^| Base Format ^| Depth Aspect Format ^| Stencil Aspect Format 551^| ename:VK_FORMAT_D16_UNORM 552^| ename:VK_FORMAT_D16_UNORM 553^| - 554^| ename:VK_FORMAT_X8_D24_UNORM_PACK32 555^| ename:VK_FORMAT_X8_D24_UNORM_PACK32 556^| - 557^| ename:VK_FORMAT_D32_SFLOAT 558^| ename:VK_FORMAT_D32_SFLOAT 559^| - 560^| ename:VK_FORMAT_S8_UINT 561^| - 562^| ename:VK_FORMAT_S8_UINT 563^| ename:VK_FORMAT_D16_UNORM_S8_UINT 564^| ename:VK_FORMAT_D16_UNORM 565^| ename:VK_FORMAT_S8_UINT 566^| ename:VK_FORMAT_D24_UNORM_S8_UINT 567^| ename:VK_FORMAT_X8_D24_UNORM_PACK32 568^| ename:VK_FORMAT_S8_UINT 569^| ename:VK_FORMAT_D32_SFLOAT_S8_UINT 570^| ename:VK_FORMAT_D32_SFLOAT 571^| ename:VK_FORMAT_S8_UINT 572|==== 573 574ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 575[[copies-buffers-images-multi-planar]] 576When copying between a buffer and any plane of a 577<<formats-requiring-sampler-ycbcr-conversion, multi-planar image>>, 578addressing calculations are performed using the <<formats-compatible-planes, 579compatible format for that plane>>, rather than the format of the 580multi-planar image. 581endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 582 583Each texel block is copied from one resource to the other according to the 584above addressing equations. 585 586 587[open,refpage='vkCmdCopyBufferToImage',desc='Copy data from a buffer into an image',type='protos'] 588-- 589:refpage: vkCmdCopyBufferToImage 590 591To copy data from a buffer object to an image object, call: 592 593include::{generated}/api/protos/vkCmdCopyBufferToImage.adoc[] 594 595 * pname:commandBuffer is the command buffer into which the command will be 596 recorded. 597 * pname:srcBuffer is the source buffer. 598 * pname:dstImage is the destination image. 599 * pname:dstImageLayout is the layout of the destination image subresources 600 for the copy. 601 * pname:regionCount is the number of regions to copy. 602 * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy 603 structures specifying the regions to copy. 604 605Each source region specified by pname:pRegions is copied from the source 606buffer to the destination region of the destination image according to the 607<<copies-buffers-images-addressing,addressing calculations>> for each 608resource. 609If any of the specified regions in pname:srcBuffer overlaps in memory with 610any of the specified regions in pname:dstImage, values read from those 611overlapping regions are undefined:. 612If any region accesses a depth aspect in pname:dstImage 613ifdef::VK_EXT_depth_range_unrestricted[] 614and the `apiext:VK_EXT_depth_range_unrestricted` extension is not enabled, 615endif::VK_EXT_depth_range_unrestricted[] 616values copied from pname:srcBuffer outside of the range [eq]#[0,1]# will be 617be written as undefined: values to the destination image. 618 619Copy regions for the image must: be aligned to a multiple of the texel block 620extent in each dimension, except at the edges of the image, where region 621extents must: match the edge of the image. 622 623:imageparam: pname:dstImage 624:regionsparam: pname:pRegions 625 626.Valid Usage 627**** 628include::{chapters}/commonvalidity/copy_buffer_to_image_command_buffer_common.adoc[] 629include::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.adoc[] 630include::{chapters}/commonvalidity/copy_buffer_to_image_common.adoc[] 631 * [[VUID-vkCmdCopyBufferToImage-pRegions-06217]] 632 The image region specified by each element of pname:pRegions must: be 633 contained within the specified pname:imageSubresource of pname:dstImage 634 * [[VUID-vkCmdCopyBufferToImage-pRegions-06218]] 635 For each element of pname:pRegions, pname:imageOffset.x and 636 [eq]#(pname:imageExtent.width {plus} pname:imageOffset.x)# must: both be 637 greater than or equal to `0` and less than or equal to the width of the 638 specified pname:imageSubresource of pname:dstImage 639 * [[VUID-vkCmdCopyBufferToImage-pRegions-06219]] 640 For each element of pname:pRegions, pname:imageOffset.y and 641 [eq]#(pname:imageExtent.height {plus} pname:imageOffset.y)# must: both 642 be greater than or equal to `0` and less than or equal to the height of 643 the specified pname:imageSubresource of pname:dstImage 644**** 645 646include::{generated}/validity/protos/vkCmdCopyBufferToImage.adoc[] 647-- 648 649[open,refpage='vkCmdCopyImageToBuffer',desc='Copy image data into a buffer',type='protos'] 650-- 651:refpage: vkCmdCopyImageToBuffer 652 653To copy data from an image object to a buffer object, call: 654 655include::{generated}/api/protos/vkCmdCopyImageToBuffer.adoc[] 656 657 * pname:commandBuffer is the command buffer into which the command will be 658 recorded. 659 * pname:srcImage is the source image. 660 * pname:srcImageLayout is the layout of the source image subresources for 661 the copy. 662 * pname:dstBuffer is the destination buffer. 663 * pname:regionCount is the number of regions to copy. 664 * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy 665 structures specifying the regions to copy. 666 667Each source region specified by pname:pRegions is copied from the source 668image to the destination region of the destination buffer according to the 669<<copies-buffers-images-addressing,addressing calculations>> for each 670resource. 671If any of the specified regions in pname:srcImage overlaps in memory with 672any of the specified regions in pname:dstBuffer, values read from those 673overlapping regions are undefined:. 674 675Copy regions for the image must: be aligned to a multiple of the texel block 676extent in each dimension, except at the edges of the image, where region 677extents must: match the edge of the image. 678 679:imageparam: pname:srcImage 680:regionsparam: pname:pRegions 681 682.Valid Usage 683**** 684include::{chapters}/commonvalidity/copy_image_to_buffer_command_buffer_common.adoc[] 685include::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.adoc[] 686include::{chapters}/commonvalidity/copy_image_to_buffer_common.adoc[] 687 * [[VUID-vkCmdCopyImageToBuffer-pRegions-06220]] 688 The image region specified by each element of pname:pRegions must: be 689 contained within the specified pname:imageSubresource of pname:srcImage 690 * [[VUID-vkCmdCopyImageToBuffer-pRegions-06221]] 691 For each element of pname:pRegions, pname:imageOffset.x and 692 [eq]#(pname:imageExtent.width {plus} pname:imageOffset.x)# must: both be 693 greater than or equal to `0` and less than or equal to the width of the 694 specified pname:imageSubresource of pname:srcImage 695 * [[VUID-vkCmdCopyImageToBuffer-pRegions-06222]] 696 For each element of pname:pRegions, pname:imageOffset.y and 697 [eq]#(imageExtent.height {plus} pname:imageOffset.y)# must: both be 698 greater than or equal to `0` and less than or equal to the height of the 699 specified pname:imageSubresource of pname:srcImage 700**** 701 702include::{generated}/validity/protos/vkCmdCopyImageToBuffer.adoc[] 703-- 704 705[open,refpage='VkBufferImageCopy',desc='Structure specifying a buffer image copy operation',type='structs'] 706-- 707:refpage: VkBufferImageCopy 708 709For both flink:vkCmdCopyBufferToImage and flink:vkCmdCopyImageToBuffer, each 710element of pname:pRegions is a structure defined as: 711 712include::{generated}/api/structs/VkBufferImageCopy.adoc[] 713 714 * pname:bufferOffset is the offset in bytes from the start of the buffer 715 object where the image data is copied from or to. 716 * pname:bufferRowLength and pname:bufferImageHeight specify in texels a 717 subregion of a larger two- or three-dimensional image in buffer memory, 718 and control the addressing calculations. 719 If either of these values is zero, that aspect of the buffer memory is 720 considered to be tightly packed according to the pname:imageExtent. 721 * pname:imageSubresource is a slink:VkImageSubresourceLayers used to 722 specify the specific image subresources of the image used for the source 723 or destination image data. 724 * pname:imageOffset selects the initial pname:x, pname:y, pname:z offsets 725 in texels of the sub-region of the source or destination image data. 726 * pname:imageExtent is the size in texels of the image to copy in 727 pname:width, pname:height and pname:depth. 728 729.Valid Usage 730**** 731include::{chapters}/commonvalidity/buffer_image_copy_common.adoc[] 732**** 733 734include::{generated}/validity/structs/VkBufferImageCopy.adoc[] 735-- 736 737ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[] 738More extensible versions of the commands to copy between buffers and images 739are defined below. 740 741[open,refpage='vkCmdCopyBufferToImage2',desc='Copy data from a buffer into an image',type='protos',alias='vkCmdCopyBufferToImage2KHR'] 742-- 743:refpage: vkCmdCopyBufferToImage2 744 745To copy data from a buffer object to an image object, call: 746 747ifdef::VK_VERSION_1_3[] 748include::{generated}/api/protos/vkCmdCopyBufferToImage2.adoc[] 749endif::VK_VERSION_1_3[] 750 751ifdef::VK_VERSION_1_3+VK_KHR_copy_commands2[or the equivalent command] 752 753ifdef::VK_KHR_copy_commands2[] 754include::{generated}/api/protos/vkCmdCopyBufferToImage2KHR.adoc[] 755endif::VK_KHR_copy_commands2[] 756 757 * pname:commandBuffer is the command buffer into which the command will be 758 recorded. 759 * pname:pCopyBufferToImageInfo is a pointer to a 760 slink:VkCopyBufferToImageInfo2 structure describing the copy parameters. 761 762This command is functionally identical to flink:vkCmdCopyBufferToImage, but 763includes extensible sub-structures that include pname:sType and pname:pNext 764parameters, allowing them to be more easily extended. 765 766:regionsparam: pname:pCopyBufferToImageInfo->pRegions 767 768.Valid Usage 769**** 770include::{chapters}/commonvalidity/copy_buffer_to_image_command_buffer_common.adoc[] 771**** 772 773include::{generated}/validity/protos/vkCmdCopyBufferToImage2.adoc[] 774-- 775 776[open,refpage='VkCopyBufferToImageInfo2',desc='Structure specifying parameters of a buffer to image copy command',type='structs',alias='VkCopyBufferToImageInfo2KHR'] 777-- 778:refpage: VkCopyBufferToImageInfo2 779 780The sname:VkCopyBufferToImageInfo2 structure is defined as: 781 782include::{generated}/api/structs/VkCopyBufferToImageInfo2.adoc[] 783 784ifdef::VK_KHR_copy_commands2[] 785or the equivalent 786 787include::{generated}/api/structs/VkCopyBufferToImageInfo2KHR.adoc[] 788endif::VK_KHR_copy_commands2[] 789 790 * pname:sType is the type of this structure. 791 * pname:pNext is `NULL` or a pointer to a structure extending this 792 structure. 793 * pname:srcBuffer is the source buffer. 794 * pname:dstImage is the destination image. 795 * pname:dstImageLayout is the layout of the destination image subresources 796 for the copy. 797 * pname:regionCount is the number of regions to copy. 798 * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy2 799 structures specifying the regions to copy. 800 801.Valid Usage 802**** 803ifndef::VK_QCOM_rotated_copy_commands[] 804 * [[VUID-VkCopyBufferToImageInfo2-pRegions-00172]] 805 The image region specified by each element of pname:pRegions must: be 806 contained within the specified pname:imageSubresource of pname:dstImage 807endif::VK_QCOM_rotated_copy_commands[] 808ifdef::VK_QCOM_rotated_copy_commands[] 809 * [[VUID-VkCopyBufferToImageInfo2-pRegions-04565]] 810 If the image region specified by each element of pname:pRegions does not 811 contain slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, 812 it must: be a region that is contained within the specified 813 pname:imageSubresource of pname:dstImage 814 * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-04554]] 815 If the image region specified by each element of pname:pRegions contains 816 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, the 817 rotated destination region as described in 818 <<copies-buffers-images-rotation-addressing>> must: be contained within 819 pname:dstImage 820 * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-04555]] 821 If any element of pname:pRegions contains 822 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 823 pname:dstImage must: have a 1x1x1 <<formats-compatibility-classes,texel 824 block extent>> 825 * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-06203]] 826 If any element of pname:pRegions contains 827 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 828 pname:dstImage must: be of type ename:VK_IMAGE_TYPE_2D 829 * [[VUID-VkCopyBufferToImageInfo2KHR-pRegions-06204]] 830 If any element of pname:pRegions contains 831 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 832 pname:dstImage must: not have a 833 <<formats-requiring-sampler-ycbcr-conversion, multi-planar format>> 834endif::VK_QCOM_rotated_copy_commands[] 835include::{chapters}/commonvalidity/copy_buffer_to_image_common.adoc[] 836 * [[VUID-VkCopyBufferToImageInfo2-pRegions-06223]] 837 For each element of pname:pRegions not containing 838 sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, 839 pname:imageOffset.x and [eq]#(pname:imageExtent.width {plus} 840 pname:imageOffset.x)# must: both be greater than or equal to `0` and 841 less than or equal to the width of the specified pname:imageSubresource 842 of pname:dstImage 843 * [[VUID-VkCopyBufferToImageInfo2-pRegions-06224]] 844 For each element of pname:pRegions not containing 845 sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, 846 pname:imageOffset.y and [eq]#(pname:imageExtent.height {plus} 847 pname:imageOffset.y)# must: both be greater than or equal to `0` and 848 less than or equal to the height of the specified pname:imageSubresource 849 of pname:dstImage 850 851:imageparam: pname:dstImage 852include::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.adoc[] 853**** 854 855include::{generated}/validity/structs/VkCopyBufferToImageInfo2.adoc[] 856-- 857 858[open,refpage='vkCmdCopyImageToBuffer2',desc='Copy image data into a buffer',type='protos',alias='vkCmdCopyImageToBuffer2KHR'] 859-- 860:refpage: vkCmdCopyImageToBuffer2 861 862To copy data from an image object to a buffer object, call: 863 864ifdef::VK_VERSION_1_3[] 865include::{generated}/api/protos/vkCmdCopyImageToBuffer2.adoc[] 866endif::VK_VERSION_1_3[] 867 868ifdef::VK_VERSION_1_3+VK_KHR_copy_commands2[or the equivalent command] 869 870ifdef::VK_KHR_copy_commands2[] 871include::{generated}/api/protos/vkCmdCopyImageToBuffer2KHR.adoc[] 872endif::VK_KHR_copy_commands2[] 873 874 * pname:commandBuffer is the command buffer into which the command will be 875 recorded. 876 * pname:pCopyImageToBufferInfo is a pointer to a 877 slink:VkCopyImageToBufferInfo2 structure describing the copy parameters. 878 879This command is functionally identical to flink:vkCmdCopyImageToBuffer, but 880includes extensible sub-structures that include pname:sType and pname:pNext 881parameters, allowing them to be more easily extended. 882 883:regionsparam: pname:pCopyImageToBufferInfo->pRegions 884 885.Valid Usage 886**** 887include::{chapters}/commonvalidity/copy_image_to_buffer_command_buffer_common.adoc[] 888**** 889 890include::{generated}/validity/protos/vkCmdCopyImageToBuffer2.adoc[] 891-- 892 893[open,refpage='VkCopyImageToBufferInfo2',desc='Structure specifying parameters of an image to buffer copy command',type='structs',alias='VkCopyImageToBufferInfo2KHR'] 894-- 895:refpage: VkCopyImageToBufferInfo2 896 897The sname:VkCopyImageToBufferInfo2 structure is defined as: 898 899include::{generated}/api/structs/VkCopyImageToBufferInfo2.adoc[] 900 901ifdef::VK_KHR_copy_commands2[] 902or the equivalent 903 904include::{generated}/api/structs/VkCopyImageToBufferInfo2KHR.adoc[] 905endif::VK_KHR_copy_commands2[] 906 907 * pname:sType is the type of this structure. 908 * pname:pNext is `NULL` or a pointer to a structure extending this 909 structure. 910 * pname:srcImage is the source image. 911 * pname:srcImageLayout is the layout of the source image subresources for 912 the copy. 913 * pname:dstBuffer is the destination buffer. 914 * pname:regionCount is the number of regions to copy. 915 * pname:pRegions is a pointer to an array of slink:VkBufferImageCopy2 916 structures specifying the regions to copy. 917 918.Valid Usage 919**** 920ifndef::VK_QCOM_rotated_copy_commands[] 921 * [[VUID-VkCopyImageToBufferInfo2-pRegions-00182]] 922 The image region specified by each element of pname:pRegions must: be 923 contained within the specified pname:imageSubresource of pname:srcImage 924endif::VK_QCOM_rotated_copy_commands[] 925ifdef::VK_QCOM_rotated_copy_commands[] 926 * [[VUID-VkCopyImageToBufferInfo2-pRegions-04566]] 927 If the image region specified by each element of pname:pRegions does not 928 contain slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, 929 it must: be contained within the specified pname:imageSubresource of 930 pname:srcImage 931 * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-04557]] 932 If the image region specified by each element of pname:pRegions contains 933 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, the 934 rotated source region as described in 935 <<copies-buffers-images-rotation-addressing>> must: be contained within 936 pname:srcImage 937 * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-04558]] 938 If any element of pname:pRegions contains 939 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 940 pname:srcImage must: have a 1x1x1 <<formats-compatibility-classes,texel 941 block extent>> 942 * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-06205]] 943 If any element of pname:pRegions contains 944 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 945 pname:srcImage must: be of type ename:VK_IMAGE_TYPE_2D 946 * [[VUID-VkCopyImageToBufferInfo2KHR-pRegions-06206]] 947 If any element of pname:pRegions contains 948 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 949 pname:srcImage must: not have a 950 <<formats-requiring-sampler-ycbcr-conversion, multi-planar format>> 951endif::VK_QCOM_rotated_copy_commands[] 952include::{chapters}/commonvalidity/copy_image_to_buffer_common.adoc[] 953 * [[VUID-VkCopyImageToBufferInfo2-imageOffset-00197]] 954 For each element of pname:pRegions not containing 955 sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, 956 pname:imageOffset.x and [eq]#(pname:imageExtent.width {plus} 957 pname:imageOffset.x)# must: both be greater than or equal to `0` and 958 less than or equal to the width of the specified pname:imageSubresource 959 of pname:srcImage 960 * [[VUID-VkCopyImageToBufferInfo2-imageOffset-00198]] 961 For each element of pname:pRegions not containing 962 sname:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, 963 pname:imageOffset.y and [eq]#(pname:imageExtent.height {plus} 964 pname:imageOffset.y)# must: both be greater than or equal to `0` and 965 less than or equal to the height of the specified pname:imageSubresource 966 of pname:srcImage 967 968:imageparam: pname:srcImage 969include::{chapters}/commonvalidity/copy_bufferimage_to_imagebuffer_common.adoc[] 970**** 971 972include::{generated}/validity/structs/VkCopyImageToBufferInfo2.adoc[] 973-- 974 975[open,refpage='VkBufferImageCopy2',desc='Structure specifying a buffer image copy operation',type='structs',alias='VkBufferImageCopy2KHR'] 976-- 977:refpage: VkBufferImageCopy2 978 979For both flink:vkCmdCopyBufferToImage2 and flink:vkCmdCopyImageToBuffer2, 980each element of pname:pRegions is a structure defined as: 981 982include::{generated}/api/structs/VkBufferImageCopy2.adoc[] 983 984ifdef::VK_KHR_copy_commands2[] 985or the equivalent 986 987include::{generated}/api/structs/VkBufferImageCopy2KHR.adoc[] 988endif::VK_KHR_copy_commands2[] 989 990 * pname:sType is the type of this structure. 991 * pname:pNext is `NULL` or a pointer to a structure extending this 992 structure. 993 * pname:bufferOffset is the offset in bytes from the start of the buffer 994 object where the image data is copied from or to. 995 * pname:bufferRowLength and pname:bufferImageHeight specify in texels a 996 subregion of a larger two- or three-dimensional image in buffer memory, 997 and control the addressing calculations. 998 If either of these values is zero, that aspect of the buffer memory is 999 considered to be tightly packed according to the pname:imageExtent. 1000 * pname:imageSubresource is a slink:VkImageSubresourceLayers used to 1001 specify the specific image subresources of the image used for the source 1002 or destination image data. 1003 * pname:imageOffset selects the initial pname:x, pname:y, pname:z offsets 1004 in texels of the sub-region of the source or destination image data. 1005 * pname:imageExtent is the size in texels of the image to copy in 1006 pname:width, pname:height and pname:depth. 1007 1008This structure is functionally identical to slink:VkBufferImageCopy, but 1009adds pname:sType and pname:pNext parameters, allowing it to be more easily 1010extended. 1011 1012.Valid Usage 1013**** 1014include::{chapters}/commonvalidity/buffer_image_copy_common.adoc[] 1015**** 1016 1017include::{generated}/validity/structs/VkBufferImageCopy2.adoc[] 1018-- 1019endif::VK_VERSION_1_3,VK_KHR_copy_commands2[] 1020 1021ifdef::VK_QCOM_rotated_copy_commands[] 1022[open,refpage='VkCopyCommandTransformInfoQCOM',desc='Structure describing transform parameters of rotated copy command',type='structs'] 1023-- 1024The sname:VkCopyCommandTransformInfoQCOM structure is defined as: 1025 1026include::{generated}/api/structs/VkCopyCommandTransformInfoQCOM.adoc[] 1027 1028 * pname:sType is the type of this structure. 1029 * pname:pNext is `NULL` or a pointer to a structure extending this 1030 structure. 1031 * pname:transform is a elink:VkSurfaceTransformFlagBitsKHR value 1032 describing the transform to be applied. 1033 1034Including this structure in the pname:pNext chain of 1035slink:VkBufferImageCopy2 defines a rotation to be performed when copying 1036between an image and a buffer. 1037Including this structure in the pname:pNext chain of slink:VkBlitImageInfo2 1038defines a rotation to be performed when blitting between two images. 1039If this structure is not specified in either case, the implementation 1040behaves as if it was specified with a pname:transform equal to 1041ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR. 1042 1043Specifying a transform for a copy between an image and a buffer 1044<<copies-buffers-images-rotation-addressing, rotates the region accessed in 1045the image around the offset>>. 1046Specifying a transform for a blit performs a similar transform as described 1047in <<copies-images-scaling-rotation, Image Blits with Scaling and 1048Rotation>>. 1049 1050Rotations other than ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR can: only 1051be specified for single-plane 2D images with a 1x1x1 1052<<formats-compatibility-classes,texel block extent>>. 1053 1054.Valid Usage 1055**** 1056 * [[VUID-VkCopyCommandTransformInfoQCOM-transform-04560]] 1057 pname:transform must: be ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, 1058 ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, 1059 ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, or 1060 ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR 1061**** 1062 1063include::{generated}/validity/structs/VkCopyCommandTransformInfoQCOM.adoc[] 1064-- 1065endif::VK_QCOM_rotated_copy_commands[] 1066 1067 1068ifdef::VK_NV_copy_memory_indirect[] 1069[[indirect-copies]] 1070== Indirect Copies 1071 1072An application can use indirect copies when the copy parameters are not 1073known during the command buffer creation time. 1074 1075[open,refpage='vkCmdCopyMemoryIndirectNV',desc='Copy data between memory regions',type='protos'] 1076-- 1077To copy data between two memory regions by specifying copy parameters 1078indirectly in a buffer, call: 1079 1080include::{generated}/api/protos/vkCmdCopyMemoryIndirectNV.adoc[] 1081 1082 * pname:commandBuffer is the command buffer into which the command will be 1083 recorded. 1084 * pname:copyBufferAddress is the buffer address specifying the copy 1085 parameters. 1086 This buffer is laid out in memory as an array of 1087 slink:VkCopyMemoryIndirectCommandNV structures. 1088 * pname:copyCount is the number of copies to execute, and can be zero. 1089 * pname:stride is the stride in bytes between successive sets of copy 1090 parameters. 1091 1092Each region read from pname:copyBufferAddress is copied from the source 1093region to the specified destination region. 1094The results are undefined: if any of the source and destination regions 1095overlap in memory. 1096 1097.Valid Usage 1098**** 1099 * [[VUID-vkCmdCopyMemoryIndirectNV-None-07653]] 1100 The <<features-indirectCopy, pname:indirectCopy>> feature must: be 1101 enabled 1102 * [[VUID-vkCmdCopyMemoryIndirectNV-copyBufferAddress-07654]] 1103 pname:copyBufferAddress must: be 4 byte aligned 1104 * [[VUID-vkCmdCopyMemoryIndirectNV-stride-07655]] 1105 pname:stride must: be a multiple of `4` and must: be greater than or 1106 equal to sizeof(sname:VkCopyMemoryIndirectCommandNV) 1107 * [[VUID-vkCmdCopyMemoryIndirectNV-commandBuffer-07656]] 1108 The slink:VkCommandPool that pname:commandBuffer was allocated from 1109 must: support at least one of the 1110 slink:VkPhysicalDeviceCopyMemoryIndirectPropertiesNV::pname:supportedQueues 1111**** 1112 1113include::{generated}/validity/protos/vkCmdCopyMemoryIndirectNV.adoc[] 1114-- 1115 1116[open,refpage='VkCopyMemoryIndirectCommandNV',desc='Structure specifying indirect memory region copy operation',type='structs'] 1117-- 1118The structure describing source and destination memory regions, 1119sname:VkCopyMemoryIndirectCommandNV is defined as: 1120 1121include::{generated}/api/structs/VkCopyMemoryIndirectCommandNV.adoc[] 1122 1123 * pname:srcAddress is the starting address of the source host or device 1124 memory to copy from. 1125 * pname:dstAddress is the starting address of the destination host or 1126 device memory to copy to. 1127 * pname:size is the size of the copy in bytes. 1128 1129.Valid Usage 1130**** 1131 * [[VUID-VkCopyMemoryIndirectCommandNV-srcAddress-07657]] 1132 The pname:srcAddress must: be 4 byte aligned 1133 * [[VUID-VkCopyMemoryIndirectCommandNV-dstAddress-07658]] 1134 The pname:dstAddress must: be 4 byte aligned 1135 * [[VUID-VkCopyMemoryIndirectCommandNV-size-07659]] 1136 The pname:size must: be 4 byte aligned 1137**** 1138 1139include::{generated}/validity/structs/VkCopyMemoryIndirectCommandNV.adoc[] 1140-- 1141 1142[open,refpage='vkCmdCopyMemoryToImageIndirectNV',desc='Copy data from a memory region into an image',type='protos'] 1143-- 1144To copy data from a memory region to an image object by specifying copy 1145parameters in a buffer, call: 1146 1147include::{generated}/api/protos/vkCmdCopyMemoryToImageIndirectNV.adoc[] 1148 1149 * pname:commandBuffer is the command buffer into which the command will be 1150 recorded. 1151 * pname:copyBufferAddress is the buffer address specifying the copy 1152 parameters. 1153 This buffer is laid out in memory as an array of 1154 slink:VkCopyMemoryToImageIndirectCommandNV structures. 1155 * pname:copyCount is the number of copies to execute, and can be zero. 1156 * pname:stride is the byte stride between successive sets of copy 1157 parameters. 1158 * pname:dstImage is the destination image. 1159 * pname:dstImageLayout is the layout of the destination image subresources 1160 for the copy. 1161 * pname:pImageSubresources is a pointer to an array of size 1162 pname:copyCount of slink:VkImageSubresourceLayers used to specify the 1163 specific image subresource of the destination image data for that copy. 1164 1165Each region in pname:copyBufferAddress is copied from the source memory 1166region to an image region in the destination image. 1167If the destination image is of type ename:VK_IMAGE_TYPE_3D, the starting 1168slice and number of slices to copy are specified in 1169pname:pImageSubresources::pname:baseArrayLayer and 1170pname:pImageSubresources::pname:layerCount respectively. 1171The copy must: be performed on a queue that supports indirect copy 1172operations, see slink:VkPhysicalDeviceCopyMemoryIndirectPropertiesNV. 1173 1174.Valid Usage 1175**** 1176 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-None-07660]] 1177 The <<features-indirectCopy, pname:indirectCopy>> feature must: be 1178 enabled 1179 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImage-07661]] 1180 pname:dstImage must: not be a protected image 1181 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-aspectMask-07662]] 1182 The pname:aspectMask member for every subresource in 1183 pname:pImageSubresources must: only have a single bit set 1184 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImage-07663]] 1185 The image region specified by each element in sname:copyBufferAddress 1186 must: be a region that is contained within pname:dstImage 1187 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImage-07664]] 1188 pname:dstImage must: have been created with 1189 ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag 1190 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImage-07665]] 1191 If pname:dstImage is non-sparse then it must: be bound completely and 1192 contiguously to a single sname:VkDeviceMemory object 1193 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImage-07666]] 1194 pname:dstImage must: have a sample count equal to 1195 ename:VK_SAMPLE_COUNT_1_BIT 1196 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImageLayout-07667]] 1197 pname:dstImageLayout must: specify the layout of the image subresources 1198 of pname:dstImage at the time this command is executed on a 1199 sname:VkDevice 1200ifndef::VK_KHR_shared_presentable_image[] 1201 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImageLayout-07668]] 1202 pname:dstImageLayout must: be ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL 1203 or ename:VK_IMAGE_LAYOUT_GENERAL 1204endif::VK_KHR_shared_presentable_image[] 1205ifdef::VK_KHR_shared_presentable_image[] 1206 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImageLayout-07669]] 1207 pname:dstImageLayout must: be 1208 ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1209 ename:VK_IMAGE_LAYOUT_GENERAL, or 1210 ename:VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR 1211endif::VK_KHR_shared_presentable_image[] 1212 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-mipLevel-07670]] 1213 The specified pname:mipLevel of each region must: be less than the 1214 pname:mipLevels specified in slink:VkImageCreateInfo when pname:dstImage 1215 was created 1216 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-baseArrayLayer-07671]] 1217 The specified pname:baseArrayLayer {plus} pname:layerCount of each 1218 region must: be less than or equal to the pname:arrayLayers specified in 1219 slink:VkImageCreateInfo when pname:dstImage was created 1220 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-imageOffset-07672]] 1221 The pname:imageOffset and pname:imageExtent members of each region must: 1222 respect the image transfer granularity requirements of 1223 pname:commandBuffer's command pool's queue family, as described in 1224 slink:VkQueueFamilyProperties 1225ifdef::VK_EXT_fragment_density_map[] 1226 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-dstImage-07673]] 1227 pname:dstImage must: not have been created with pname:flags containing 1228 ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT 1229endif::VK_EXT_fragment_density_map[] 1230 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-commandBuffer-07674]] 1231 If the queue family used to create the slink:VkCommandPool which 1232 pname:commandBuffer was allocated from does not support 1233 ename:VK_QUEUE_GRAPHICS_BIT, for each region, the pname:aspectMask 1234 member of pname:pImageSubresources must: not be 1235 ename:VK_IMAGE_ASPECT_DEPTH_BIT or ename:VK_IMAGE_ASPECT_STENCIL_BIT 1236 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-imageOffset-07675]] 1237 For each region in sname:copyBufferAddress, pname:imageOffset.y and 1238 [eq]#(pname:imageExtent.height {plus} pname:imageOffset.y)# must: both 1239 be greater than or equal to `0` and less than or equal to the height of 1240 the specified subresource 1241 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-offset-07676]] 1242 pname:offset must: be 4 byte aligned 1243 * [[VUID-vkCmdCopyMemoryToImageIndirectNV-stride-07677]] 1244 pname:stride must: be a multiple of `4` and must: be greater than or 1245 equal to sizeof(sname:VkCopyMemoryToImageIndirectCommandNV) 1246**** 1247 1248include::{generated}/validity/protos/vkCmdCopyMemoryToImageIndirectNV.adoc[] 1249-- 1250 1251[open,refpage='VkCopyMemoryToImageIndirectCommandNV',desc='Structure specifying indirect buffer image copy operation',type='structs'] 1252-- 1253The sname:VkCopyMemoryToImageIndirectCommandNV is defined as: 1254 1255include::{generated}/api/structs/VkCopyMemoryToImageIndirectCommandNV.adoc[] 1256 1257 * pname:srcAddress is the starting address of the source host or device 1258 memory to copy from. 1259 * pname:bufferRowLength and pname:bufferImageHeight specify in texels a 1260 subregion of a larger two- or three-dimensional image in buffer memory, 1261 and control the addressing calculations. 1262 If either of these values is zero, that aspect of the buffer memory is 1263 considered to be tightly packed according to the pname:imageExtent. 1264 * pname:imageSubresource is a slink:VkImageSubresourceLayers used to 1265 specify the specific image subresources of the image used for the 1266 destination image data, which must: match the values specified in 1267 pname:pImageSubresources parameter of 1268 flink:vkCmdCopyMemoryToImageIndirectNV during command recording. 1269 * pname:imageOffset selects the initial pname:x, pname:y, pname:z offsets 1270 in texels of the sub-region of the destination image data. 1271 * pname:imageExtent is the size in texels of the destination image in 1272 pname:width, pname:height and pname:depth. 1273 1274.Valid Usage 1275**** 1276 * [[VUID-VkCopyMemoryToImageIndirectCommandNV-srcAddress-07678]] 1277 The pname:srcAddress must: be 4 byte aligned 1278 * [[VUID-VkCopyMemoryToImageIndirectCommandNV-bufferRowLength-07679]] 1279 pname:bufferRowLength must: be `0`, or greater than or equal to the 1280 pname:width member of pname:imageExtent 1281 * [[VUID-VkCopyMemoryToImageIndirectCommandNV-bufferImageHeight-07680]] 1282 pname:bufferImageHeight must: be `0`, or greater than or equal to the 1283 pname:height member of pname:imageExtent 1284 * [[VUID-VkCopyMemoryToImageIndirectCommandNV-imageOffset-07681]] 1285 pname:imageOffset must: specify a valid offset in the destination image 1286 * [[VUID-VkCopyMemoryToImageIndirectCommandNV-imageExtent-07682]] 1287 pname:imageExtent must: specify a valid region in the destination image 1288 and can be `0` 1289**** 1290 1291include::{generated}/validity/structs/VkCopyMemoryToImageIndirectCommandNV.adoc[] 1292-- 1293endif::VK_NV_copy_memory_indirect[] 1294 1295 1296[[copies-imagescaling]] 1297== Image Copies with Scaling 1298 1299[open,refpage='vkCmdBlitImage',desc='Copy regions of an image, potentially performing format conversion,',type='protos'] 1300-- 1301:refpage: vkCmdBlitImage 1302 1303To copy regions of a source image into a destination image, potentially 1304performing format conversion, arbitrary scaling, and filtering, call: 1305 1306include::{generated}/api/protos/vkCmdBlitImage.adoc[] 1307 1308 * pname:commandBuffer is the command buffer into which the command will be 1309 recorded. 1310 * pname:srcImage is the source image. 1311 * pname:srcImageLayout is the layout of the source image subresources for 1312 the blit. 1313 * pname:dstImage is the destination image. 1314 * pname:dstImageLayout is the layout of the destination image subresources 1315 for the blit. 1316 * pname:regionCount is the number of regions to blit. 1317 * pname:pRegions is a pointer to an array of slink:VkImageBlit structures 1318 specifying the regions to blit. 1319 * pname:filter is a elink:VkFilter specifying the filter to apply if the 1320 blits require scaling. 1321 1322fname:vkCmdBlitImage must: not be used for multisampled source or 1323destination images. 1324Use flink:vkCmdResolveImage for this purpose. 1325 1326As the sizes of the source and destination extents can: differ in any 1327dimension, texels in the source extent are scaled and filtered to the 1328destination extent. 1329Scaling occurs via the following operations: 1330 1331 * For each destination texel, the integer coordinate of that texel is 1332 converted to an unnormalized texture coordinate, using the effective 1333 inverse of the equations described in 1334 <<textures-unnormalized-to-integer, unnormalized to integer 1335 conversion>>: 1336 {empty}:: [eq]#u~base~ = i {plus} {onehalf}# 1337 {empty}:: [eq]#v~base~ = j {plus} {onehalf}# 1338 {empty}:: [eq]#w~base~ = k {plus} {onehalf}# 1339 * These base coordinates are then offset by the first destination offset: 1340 {empty}:: [eq]#u~offset~ = u~base~ - x~dst0~# 1341 {empty}:: [eq]#v~offset~ = v~base~ - y~dst0~# 1342 {empty}:: [eq]#w~offset~ = w~base~ - z~dst0~# 1343 {empty}:: [eq]#a~offset~ = a - pname:baseArrayCount~dst~# 1344 * The scale is determined from the source and destination regions, and 1345 applied to the offset coordinates: 1346 {empty}:: [eq]#scale~u~ = (x~src1~ - x~src0~) / (x~dst1~ - x~dst0~)# 1347 {empty}:: [eq]#scale~v~ = (y~src1~ - y~src0~) / (y~dst1~ - y~dst0~)# 1348 {empty}:: [eq]#scale~w~ = (z~src1~ - z~src0~) / (z~dst1~ - z~dst0~)# 1349 {empty}:: [eq]#u~scaled~ = u~offset~ {times} scale~u~# 1350 {empty}:: [eq]#v~scaled~ = v~offset~ {times} scale~v~# 1351 {empty}:: [eq]#w~scaled~ = w~offset~ {times} scale~w~# 1352 * Finally the source offset is added to the scaled coordinates, to 1353 determine the final unnormalized coordinates used to sample from 1354 pname:srcImage: 1355 {empty}:: [eq]#u = u~scaled~ {plus} x~src0~# 1356 {empty}:: [eq]#v = v~scaled~ {plus} y~src0~# 1357 {empty}:: [eq]#w = w~scaled~ {plus} z~src0~# 1358 {empty}:: [eq]#q = pname:mipLevel# 1359 {empty}:: [eq]#a = a~offset~ {plus} pname:baseArrayCount~src~# 1360 1361These coordinates are used to sample from the source image, as described in 1362<<textures, Image Operations chapter>>, with the filter mode equal to that 1363of pname:filter, a mipmap mode of ename:VK_SAMPLER_MIPMAP_MODE_NEAREST and 1364an address mode of ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE. 1365Implementations must: clamp at the edge of the source image, and may: 1366additionally clamp to the edge of the source region. 1367 1368[NOTE] 1369.Note 1370==== 1371Due to allowable rounding errors in the generation of the source texture 1372coordinates, it is not always possible to guarantee exactly which source 1373texels will be sampled for a given blit. 1374As rounding errors are implementation-dependent, the exact results of a 1375blitting operation are also implementation-dependent. 1376==== 1377 1378Blits are done layer by layer starting with the pname:baseArrayLayer member 1379of pname:srcSubresource for the source and pname:dstSubresource for the 1380destination. 1381pname:layerCount layers are blitted to the destination image. 1382 1383When blitting 3D textures, slices in the destination region bounded by 1384pname:dstOffsets[0].z and pname:dstOffsets[1].z are sampled from slices in 1385the source region bounded by pname:srcOffsets[0].z and 1386pname:srcOffsets[1].z. 1387If the pname:filter parameter is ename:VK_FILTER_LINEAR then the value 1388sampled from the source image is taken by doing linear filtering using the 1389interpolated *z* coordinate represented by *w* in the previous equations. 1390If the pname:filter parameter is ename:VK_FILTER_NEAREST then the value 1391sampled from the source image is taken from the single nearest slice, with 1392an implementation-dependent arithmetic rounding mode. 1393 1394The following filtering and conversion rules apply: 1395 1396 * Integer formats can: only be converted to other integer formats with the 1397 same signedness. 1398 * No format conversion is supported between depth/stencil images. 1399 The formats must: match. 1400 * Format conversions on unorm, snorm, scaled and packed float formats of 1401 the copied aspect of the image are performed by first converting the 1402 pixels to float values. 1403 * For sRGB source formats, nonlinear RGB values are converted to linear 1404 representation prior to filtering. 1405 * After filtering, the float values are first clamped and then cast to the 1406 destination image format. 1407 In case of sRGB destination format, linear RGB values are converted to 1408 nonlinear representation before writing the pixel to the image. 1409 1410Signed and unsigned integers are converted by first clamping to the 1411representable range of the destination format, then casting the value. 1412 1413.Valid Usage 1414**** 1415include::{chapters}/commonvalidity/blit_image_command_buffer_common.adoc[] 1416include::{chapters}/commonvalidity/blit_image_common.adoc[] 1417**** 1418 1419include::{generated}/validity/protos/vkCmdBlitImage.adoc[] 1420-- 1421 1422[open,refpage='VkImageBlit',desc='Structure specifying an image blit operation',type='structs'] 1423-- 1424:refpage: VkImageBlit 1425 1426The sname:VkImageBlit structure is defined as: 1427 1428include::{generated}/api/structs/VkImageBlit.adoc[] 1429 1430 * pname:srcSubresource is the subresource to blit from. 1431 * pname:srcOffsets is a pointer to an array of two slink:VkOffset3D 1432 structures specifying the bounds of the source region within 1433 pname:srcSubresource. 1434 * pname:dstSubresource is the subresource to blit into. 1435 * pname:dstOffsets is a pointer to an array of two slink:VkOffset3D 1436 structures specifying the bounds of the destination region within 1437 pname:dstSubresource. 1438 1439For each element of the pname:pRegions array, a blit operation is performed 1440for the specified source and destination regions. 1441 1442.Valid Usage 1443**** 1444include::{chapters}/commonvalidity/image_blit_common.adoc[] 1445**** 1446 1447include::{generated}/validity/structs/VkImageBlit.adoc[] 1448-- 1449 1450ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[] 1451A more extensible version of the blit image command is defined below. 1452 1453[open,refpage='vkCmdBlitImage2',desc='Copy regions of an image, potentially performing format conversion,',type='protos',alias='vkCmdBlitImage2KHR'] 1454-- 1455:refpage: vkCmdBlitImage2 1456 1457To copy regions of a source image into a destination image, potentially 1458performing format conversion, arbitrary scaling, and filtering, call: 1459 1460ifdef::VK_VERSION_1_3[] 1461include::{generated}/api/protos/vkCmdBlitImage2.adoc[] 1462endif::VK_VERSION_1_3[] 1463 1464ifdef::VK_VERSION_1_3+VK_KHR_copy_commands2[or the equivalent command] 1465 1466ifdef::VK_KHR_copy_commands2[] 1467include::{generated}/api/protos/vkCmdBlitImage2KHR.adoc[] 1468endif::VK_KHR_copy_commands2[] 1469 1470 * pname:commandBuffer is the command buffer into which the command will be 1471 recorded. 1472 * pname:pBlitImageInfo is a pointer to a slink:VkBlitImageInfo2 structure 1473 describing the blit parameters. 1474 1475This command is functionally identical to flink:vkCmdBlitImage, but includes 1476extensible sub-structures that include pname:sType and pname:pNext 1477parameters, allowing them to be more easily extended. 1478 1479.Valid Usage 1480**** 1481include::{chapters}/commonvalidity/blit_image_command_buffer_common.adoc[] 1482**** 1483 1484include::{generated}/validity/protos/vkCmdBlitImage2.adoc[] 1485-- 1486 1487[open,refpage='VkBlitImageInfo2',desc='Structure specifying parameters of blit image command',type='structs',alias='VkBlitImageInfo2KHR'] 1488-- 1489:refpage: VkBlitImageInfo2 1490 1491The sname:VkBlitImageInfo2 structure is defined as: 1492 1493include::{generated}/api/structs/VkBlitImageInfo2.adoc[] 1494 1495ifdef::VK_KHR_copy_commands2[] 1496or the equivalent 1497 1498include::{generated}/api/structs/VkBlitImageInfo2KHR.adoc[] 1499endif::VK_KHR_copy_commands2[] 1500 1501 * pname:sType is the type of this structure. 1502 * pname:pNext is `NULL` or a pointer to a structure extending this 1503 structure. 1504 * pname:srcImage is the source image. 1505 * pname:srcImageLayout is the layout of the source image subresources for 1506 the blit. 1507 * pname:dstImage is the destination image. 1508 * pname:dstImageLayout is the layout of the destination image subresources 1509 for the blit. 1510 * pname:regionCount is the number of regions to blit. 1511 * pname:pRegions is a pointer to an array of slink:VkImageBlit2 structures 1512 specifying the regions to blit. 1513 * pname:filter is a elink:VkFilter specifying the filter to apply if the 1514 blits require scaling. 1515 1516.Valid Usage 1517**** 1518include::{chapters}/commonvalidity/blit_image_common.adoc[] 1519ifdef::VK_QCOM_rotated_copy_commands[] 1520 * [[VUID-VkBlitImageInfo2-pRegions-04561]] 1521 If any element of pname:pRegions contains 1522 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 1523 pname:srcImage and pname:dstImage must: not be block-compressed images 1524 * [[VUID-VkBlitImageInfo2KHR-pRegions-06207]] 1525 If any element of pname:pRegions contains 1526 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 1527 pname:srcImage must: be of type ename:VK_IMAGE_TYPE_2D 1528 * [[VUID-VkBlitImageInfo2KHR-pRegions-06208]] 1529 If any element of pname:pRegions contains 1530 slink:VkCopyCommandTransformInfoQCOM in its pname:pNext chain, then 1531 pname:srcImage must: not have a 1532 <<formats-requiring-sampler-ycbcr-conversion, multi-planar format>> 1533endif::VK_QCOM_rotated_copy_commands[] 1534**** 1535 1536include::{generated}/validity/structs/VkBlitImageInfo2.adoc[] 1537-- 1538 1539[open,refpage='VkImageBlit2',desc='Structure specifying an image blit operation',type='structs',alias='VkImageBlit2KHR'] 1540-- 1541:refpage: VkImageBlit2 1542 1543The sname:VkImageBlit2 structure is defined as: 1544 1545include::{generated}/api/structs/VkImageBlit2.adoc[] 1546 1547ifdef::VK_KHR_copy_commands2[] 1548or the equivalent 1549 1550include::{generated}/api/structs/VkImageBlit2KHR.adoc[] 1551endif::VK_KHR_copy_commands2[] 1552 1553 * pname:sType is the type of this structure. 1554 * pname:pNext is `NULL` or a pointer to a structure extending this 1555 structure. 1556 * pname:srcSubresource is the subresource to blit from. 1557 * pname:srcOffsets is a pointer to an array of two slink:VkOffset3D 1558 structures specifying the bounds of the source region within 1559 pname:srcSubresource. 1560 * pname:dstSubresource is the subresource to blit into. 1561 * pname:dstOffsets is a pointer to an array of two slink:VkOffset3D 1562 structures specifying the bounds of the destination region within 1563 pname:dstSubresource. 1564 1565For each element of the pname:pRegions array, a blit operation is performed 1566for the specified source and destination regions. 1567 1568.Valid Usage 1569**** 1570include::{chapters}/commonvalidity/image_blit_common.adoc[] 1571**** 1572 1573include::{generated}/validity/structs/VkImageBlit2.adoc[] 1574-- 1575 1576ifdef::VK_QCOM_rotated_copy_commands[] 1577For flink:vkCmdBlitImage2, each region copied can include a rotation. 1578To specify a rotated region, add slink:VkCopyCommandTransformInfoQCOM to the 1579pname:pNext chain of slink:VkImageBlit2. 1580For each region with a rotation specified, 1581<<copies-images-scaling-rotation,Image Blits with Scaling and Rotation>> 1582specifies how coordinates are rotated prior to sampling from the source 1583image. 1584When rotation is specified, the source and destination images must: each be 15852D images, have a 1x1x1 <<formats-compatibility-classes,texel block 1586extent>>, and only one plane. 1587endif::VK_QCOM_rotated_copy_commands[] 1588endif::VK_VERSION_1_3,VK_KHR_copy_commands2[] 1589 1590ifdef::VK_QCOM_rotated_copy_commands[] 1591include::{chapters}/VK_QCOM_rotated_copies/rotated_addressing_blits.adoc[] 1592endif::VK_QCOM_rotated_copy_commands[] 1593 1594 1595[[copies-resolve]] 1596== Resolving Multisample Images 1597 1598[open,refpage='vkCmdResolveImage',desc='Resolve regions of an image',type='protos'] 1599-- 1600:refpage: vkCmdResolveImage 1601 1602To resolve a multisample color image to a non-multisample color image, call: 1603 1604include::{generated}/api/protos/vkCmdResolveImage.adoc[] 1605 1606 * pname:commandBuffer is the command buffer into which the command will be 1607 recorded. 1608 * pname:srcImage is the source image. 1609 * pname:srcImageLayout is the layout of the source image subresources for 1610 the resolve. 1611 * pname:dstImage is the destination image. 1612 * pname:dstImageLayout is the layout of the destination image subresources 1613 for the resolve. 1614 * pname:regionCount is the number of regions to resolve. 1615 * pname:pRegions is a pointer to an array of slink:VkImageResolve 1616 structures specifying the regions to resolve. 1617 1618During the resolve the samples corresponding to each pixel location in the 1619source are converted to a single sample before being written to the 1620destination. 1621If the source formats are floating-point or normalized types, the sample 1622values for each pixel are resolved in an implementation-dependent manner. 1623If the source formats are integer types, a single sample's value is selected 1624for each pixel. 1625 1626pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y, and 1627pname:z offsets in texels of the sub-regions of the source and destination 1628image data. 1629pname:extent is the size in texels of the source image to resolve in 1630pname:width, pname:height and pname:depth. 1631Each element of pname:pRegions must: be a region that is contained within 1632its corresponding image. 1633 1634Resolves are done layer by layer starting with pname:baseArrayLayer member 1635of pname:srcSubresource for the source and pname:dstSubresource for the 1636destination. 1637pname:layerCount layers are resolved to the destination image. 1638 1639.Valid Usage 1640**** 1641include::{chapters}/commonvalidity/resolve_image_command_buffer_common.adoc[] 1642include::{chapters}/commonvalidity/resolve_image_common.adoc[] 1643**** 1644 1645include::{generated}/validity/protos/vkCmdResolveImage.adoc[] 1646-- 1647 1648[open,refpage='VkImageResolve',desc='Structure specifying an image resolve operation',type='structs'] 1649-- 1650:refpage: VkImageResolve 1651 1652The sname:VkImageResolve structure is defined as: 1653 1654include::{generated}/api/structs/VkImageResolve.adoc[] 1655 1656 * pname:srcSubresource and pname:dstSubresource are 1657 slink:VkImageSubresourceLayers structures specifying the image 1658 subresources of the images used for the source and destination image 1659 data, respectively. 1660 Resolve of depth/stencil images is not supported. 1661 * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y, 1662 and pname:z offsets in texels of the sub-regions of the source and 1663 destination image data. 1664 * pname:extent is the size in texels of the source image to resolve in 1665 pname:width, pname:height and pname:depth. 1666 1667.Valid Usage 1668**** 1669include::{chapters}/commonvalidity/image_resolve_common.adoc[] 1670**** 1671 1672include::{generated}/validity/structs/VkImageResolve.adoc[] 1673-- 1674 1675ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[] 1676 1677A more extensible version of the resolve image command is defined below. 1678 1679[open,refpage='vkCmdResolveImage2',desc='Resolve regions of an image',type='protos',alias='vkCmdResolveImage2KHR'] 1680-- 1681:refpage: vkCmdResolveImage2 1682 1683To resolve a multisample image to a non-multisample image, call: 1684 1685ifdef::VK_VERSION_1_3[] 1686include::{generated}/api/protos/vkCmdResolveImage2.adoc[] 1687endif::VK_VERSION_1_3[] 1688 1689ifdef::VK_VERSION_1_3+VK_KHR_copy_commands2[or the equivalent command] 1690 1691ifdef::VK_KHR_copy_commands2[] 1692include::{generated}/api/protos/vkCmdResolveImage2KHR.adoc[] 1693endif::VK_KHR_copy_commands2[] 1694 1695 * pname:commandBuffer is the command buffer into which the command will be 1696 recorded. 1697 * pname:pResolveImageInfo is a pointer to a slink:VkResolveImageInfo2 1698 structure describing the resolve parameters. 1699 1700This command is functionally identical to flink:vkCmdResolveImage, but 1701includes extensible sub-structures that include pname:sType and pname:pNext 1702parameters, allowing them to be more easily extended. 1703 1704 1705.Valid Usage 1706**** 1707include::{chapters}/commonvalidity/resolve_image_command_buffer_common.adoc[] 1708**** 1709 1710include::{generated}/validity/protos/vkCmdResolveImage2.adoc[] 1711-- 1712 1713[open,refpage='VkResolveImageInfo2',desc='Structure specifying parameters of resolve image command',type='structs',alias='VkResolveImageInfo2KHR'] 1714-- 1715:refpage: VkResolveImageInfo2 1716 1717The sname:VkResolveImageInfo2 structure is defined as: 1718 1719include::{generated}/api/structs/VkResolveImageInfo2.adoc[] 1720 1721ifdef::VK_KHR_copy_commands2[] 1722or the equivalent 1723 1724include::{generated}/api/structs/VkResolveImageInfo2KHR.adoc[] 1725endif::VK_KHR_copy_commands2[] 1726 1727 * pname:sType is the type of this structure. 1728 * pname:pNext is `NULL` or a pointer to a structure extending this 1729 structure. 1730 * pname:srcImage is the source image. 1731 * pname:srcImageLayout is the layout of the source image subresources for 1732 the resolve. 1733 * pname:dstImage is the destination image. 1734 * pname:dstImageLayout is the layout of the destination image subresources 1735 for the resolve. 1736 * pname:regionCount is the number of regions to resolve. 1737 * pname:pRegions is a pointer to an array of slink:VkImageResolve2 1738 structures specifying the regions to resolve. 1739 1740.Valid Usage 1741**** 1742include::{chapters}/commonvalidity/resolve_image_common.adoc[] 1743**** 1744 1745include::{generated}/validity/structs/VkResolveImageInfo2.adoc[] 1746-- 1747 1748[open,refpage='VkImageResolve2',desc='Structure specifying an image resolve operation',type='structs',alias='VkImageResolve2KHR'] 1749-- 1750:refpage: VkImageResolve2 1751 1752The sname:VkImageResolve2 structure is defined as: 1753 1754include::{generated}/api/structs/VkImageResolve2.adoc[] 1755 1756ifdef::VK_KHR_copy_commands2[] 1757or the equivalent 1758 1759include::{generated}/api/structs/VkImageResolve2KHR.adoc[] 1760endif::VK_KHR_copy_commands2[] 1761 1762 * pname:sType is the type of this structure. 1763 * pname:pNext is `NULL` or a pointer to a structure extending this 1764 structure. 1765 * pname:srcSubresource and pname:dstSubresource are 1766 slink:VkImageSubresourceLayers structures specifying the image 1767 subresources of the images used for the source and destination image 1768 data, respectively. 1769 Resolve of depth/stencil images is not supported. 1770 * pname:srcOffset and pname:dstOffset select the initial pname:x, pname:y, 1771 and pname:z offsets in texels of the sub-regions of the source and 1772 destination image data. 1773 * pname:extent is the size in texels of the source image to resolve in 1774 pname:width, pname:height and pname:depth. 1775 1776.Valid Usage 1777**** 1778include::{chapters}/commonvalidity/image_resolve_common.adoc[] 1779**** 1780 1781include::{generated}/validity/structs/VkImageResolve2.adoc[] 1782-- 1783endif::VK_VERSION_1_3,VK_KHR_copy_commands2[] 1784 1785ifdef::VK_AMD_buffer_marker[] 1786include::{chapters}/VK_AMD_buffer_marker/copies.adoc[] 1787endif::VK_AMD_buffer_marker[] 1788