Magnum::Vk::ImageCopy class new in Git master

Image copy region.

Wraps a VkImageCopy2KHR. This calss is subsequently passed to a CopyImageInfo and then used in CommandBuffer::copyImage(). See Copying image data for usage information and examples.

Compatibility with VkImageCopy

While the class operates on the VkImageCopy2KHR structure that's provided by the KHR_copy_commands2 extension, conversion from and to VkImageCopy is provided to some extent — you can create a ImageCopy from it, call various methods on the instance and then get a VkImageCopy back again using vkImageCopy().

For direct editing of the Vulkan structure, it's recommended to edit the VkImageCopy2KHR fields and then perform the conversion instead of editing the resulting VkImageCopy, as additional safety checks may be done during the conversion to ensure no information is lost.

Constructors, destructors, conversion operators

ImageCopy(ImageAspects aspects, Int sourceLevel, Int sourceLayerOffset, Int sourceLayerCount, const Vector3i& sourceOffset, Int destinationLevel, Int destinationLayerOffset, Int destinationLayerCount, const Vector3i& destinationOffset, const Vector3i& size)
Constructor.
ImageCopy(NoInitT) explicit noexcept
Construct without initializing the contents.
ImageCopy(const VkImageCopy2KHR& copy) explicit
Construct from existing data.
ImageCopy(const VkImageCopy& copy) explicit
Construct from a VkImageCopy
operator const VkImageCopy2KHR*() const
operator const VkImageCopy2KHR&() const

Public functions

auto vkImageCopy() const -> VkImageCopy
Corresponding VkImageCopy structure.
auto operator*() -> VkImageCopy2KHR&
Underlying VkImageCopy2KHR structure.
auto operator*() const -> const VkImageCopy2KHR&
auto operator->() -> VkImageCopy2KHR*
auto operator->() const -> const VkImageCopy2KHR*

Function documentation

Magnum::Vk::ImageCopy::ImageCopy(ImageAspects aspects, Int sourceLevel, Int sourceLayerOffset, Int sourceLayerCount, const Vector3i& sourceOffset, Int destinationLevel, Int destinationLayerOffset, Int destinationLayerCount, const Vector3i& destinationOffset, const Vector3i& size)

Constructor.

Parameters
aspects Aspects to copy between the images
sourceLevel Source image mip level
sourceLayerOffset Source image layer offset
sourceLayerCount Source image layer count
sourceOffset Source image offset
destinationLevel Destination image level
destinationLayerOffset Destination image layer offset
destinationLayerCount Destination image layer count. Should be the same as sourceLayerCount except when copying data between 2D (array) and 3D images, in which case layers of one image correspond to depth of the other.
destinationOffset Destination image offset
size Size of the copied region

The following VkImageCopy2KHR fields are pre-filled in addition to sType, everything else is zero-filled:

  • srcSubresource.aspectMask to aspects
  • srcSubresource.mipLevel to sourceLevel
  • srcSubresource.baseArrayLayer to sourceLayerOffset
  • srcSubresource.layerCount to sourceLayerCount
  • srcOffset to sourceOffset
  • dstSubresource.aspectMask to aspects
  • dstSubresource.mipLevel to destinationLevel
  • dstSubresource.baseArrayLayer to destinationLayerOffset
  • dstSubresource.layerCount to destinationLayerCount
  • dstOffset to destinationOffset
  • extent to size

There are various restrictions on sourceLayerCount, destinationLayerCount and size depending on whether the source and destination images have additional dimensions or layers. However, because there is many possible combinations, this class doesn't provide convenience classes for particular image types like BufferImageCopy does.

Magnum::Vk::ImageCopy::ImageCopy(NoInitT) explicit noexcept

Construct without initializing the contents.

Note that not even the sType field is set — the structure has to be fully initialized afterwards in order to be usable.

Magnum::Vk::ImageCopy::ImageCopy(const VkImageCopy2KHR& copy) explicit

Construct from existing data.

Copies the existing values verbatim, pointers are kept unchanged without taking over the ownership. Modifying the newly created instance will not modify the original data nor the pointed-to data.

Magnum::Vk::ImageCopy::ImageCopy(const VkImageCopy& copy) explicit

Construct from a VkImageCopy

Compared to the above, fills the common subset of VkImageCopy2KHR, sets sType and zero-fills pNext.

Magnum::Vk::ImageCopy::operator const VkImageCopy2KHR*() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Vk::ImageCopy::operator const VkImageCopy2KHR&() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

The class is implicitly convertible to a reference in addition to a pointer because the type is commonly used in arrays as well, which would be annoying to do with a pointer conversion.

VkImageCopy Magnum::Vk::ImageCopy::vkImageCopy() const

Corresponding VkImageCopy structure.

Provided for compatibility with Vulkan implementations that don't support the KHR_copy_commands2 extensions. See Compatibility with VkImageCopy for more information.

const VkImageCopy2KHR& Magnum::Vk::ImageCopy::operator*() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

VkImageCopy2KHR* Magnum::Vk::ImageCopy::operator->()

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

const VkImageCopy2KHR* Magnum::Vk::ImageCopy::operator->() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.