// Copyright 2020-2021 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

// Common Valid Usage
// Common to commands copying from images to buffers, or buffers to images
// This relies on an additional attribute {imageparam} set by the command
// which includes this file, specifying the name of the source or
// destination image.

ifndef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-bufferOffset-00193]]
    If {imageparam} does not have a depth/stencil format, then for each
    element of pname:pRegions, pname:bufferOffset must: be a multiple of the
    format's texel block size
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-bufferOffset-01558]]
    If {imageparam} does not have either a depth/stencil or a
    <<formats-requiring-sampler-ycbcr-conversion,multi-planar format>>, then
    for each element of pname:pRegions, pname:bufferOffset must: be a
    multiple of the format's texel block size
  * [[VUID-{refpage}-bufferOffset-01559]]
    If {imageparam} has a
    <<formats-requiring-sampler-ycbcr-conversion,multi-planar format>>, then
    for each element of pname:pRegions, pname:bufferOffset must: be a
    multiple of the element size of the compatible format for the format and
    the pname:aspectMask of the pname:imageSubresource as defined in
    <<formats-compatible-planes>>
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-srcImage-00199]]
    If {imageparam} is of type ename:VK_IMAGE_TYPE_1D, then for each element
    of pname:pRegions, pname:imageOffset.y must: be `0` and
    pname:imageExtent.height must: be `1`
  * [[VUID-{refpage}-imageOffset-00200]]
    For each element of pname:pRegions, pname:imageOffset.z and
    [eq]#(pname:imageExtent.depth {plus} pname:imageOffset.z)# must: both be
    greater than or equal to `0` and less than or equal to the depth of the
    specified pname:imageSubresource of {imageparam}
  * [[VUID-{refpage}-srcImage-00201]]
    If {imageparam} is of type ename:VK_IMAGE_TYPE_1D or
    ename:VK_IMAGE_TYPE_2D, then for each element of pname:pRegions,
    pname:imageOffset.z must: be `0` and pname:imageExtent.depth must: be
    `1`
  * [[VUID-{refpage}-bufferRowLength-00203]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:bufferRowLength must: be a multiple of the
    compressed texel block width
  * [[VUID-{refpage}-bufferImageHeight-00204]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:bufferImageHeight must: be a multiple of the
    compressed texel block height
  * [[VUID-{refpage}-imageOffset-00205]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, all members of pname:imageOffset must: be a multiple
    of the corresponding dimensions of the compressed texel block
  * [[VUID-{refpage}-bufferOffset-00206]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:bufferOffset must: be a multiple of the
    compressed texel block size in bytes
  * [[VUID-{refpage}-imageExtent-00207]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:imageExtent.width must: be a multiple of the
    compressed texel block width or [eq]#(pname:imageExtent.width {plus}
    pname:imageOffset.x)# must: equal the width of the specified
    pname:imageSubresource of {imageparam}
  * [[VUID-{refpage}-imageExtent-00208]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:imageExtent.height must: be a multiple of the
    compressed texel block height or [eq]#(pname:imageExtent.height {plus}
    pname:imageOffset.y)# must: equal the height of the specified
    pname:imageSubresource of {imageparam}
  * [[VUID-{refpage}-imageExtent-00209]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:imageExtent.depth must: be a multiple of the
    compressed texel block depth or [eq]#(pname:imageExtent.depth {plus}
    pname:imageOffset.z)# must: equal the depth of the specified
    pname:imageSubresource of {imageparam}
  * [[VUID-{refpage}-aspectMask-00211]]
    For each element of pname:pRegions, pname:imageSubresource.aspectMask
    must: specify aspects present in {imageparam}
ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-aspectMask-01560]]
    If {imageparam} has a
    <<formats-requiring-sampler-ycbcr-conversion,multi-planar format>>, then
    for each element of pname:pRegions, pname:imageSubresource.aspectMask
    must: be ename:VK_IMAGE_ASPECT_PLANE_0_BIT,
    ename:VK_IMAGE_ASPECT_PLANE_1_BIT, or ename:VK_IMAGE_ASPECT_PLANE_2_BIT
    (with ename:VK_IMAGE_ASPECT_PLANE_2_BIT valid only for image formats
    with three planes)
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-baseArrayLayer-00213]]
    If {imageparam} is of type ename:VK_IMAGE_TYPE_3D, for each element of
    pname:pRegions, pname:imageSubresource.baseArrayLayer must: be `0` and
    pname:imageSubresource.layerCount must: be `1`
  * [[VUID-{refpage}-pRegions-04725]]
    If {imageparam} is not a <<blocked-image, blocked image>>, for each
    element of pname:pRegions, pname:bufferRowLength multiplied by the texel
    block size of {imageparam} must: be less than or equal to [eq]#2^31^-1#
  * [[VUID-{refpage}-pRegions-04726]]
    If {imageparam} is a <<blocked-image, blocked image>>, for each element
    of pname:pRegions, pname:bufferRowLength divided by the compressed texel
    block width and then multiplied by the texel block size of {imageparam}
    must: be less than or equal to [eq]#2^31^-1#
  * [[VUID-{refpage}-commandBuffer-04052]]
    If the queue family used to create the slink:VkCommandPool which
    pname:commandBuffer was allocated from does not support
    ename:VK_QUEUE_GRAPHICS_BIT or ename:VK_QUEUE_COMPUTE_BIT, the
    pname:bufferOffset member of any element of pname:pRegions must: be a
    multiple of `4`
  * [[VUID-{refpage}-srcImage-04053]]
    If {imageparam} has a depth/stencil format, the pname:bufferOffset
    member of any element of pname:pRegions must: be a multiple of `4`
// Common Valid Usage
