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

Image to buffer copy command.

Wraps a VkCopyImageToBufferInfo2KHR. This class is subsequently used in CommandBuffer::copyImageToBuffer(). See Copying image data for more information.

Compatibility with vkCmdCopyImageToBuffer()

While the class operates on the VkCopyImageToBufferInfo2KHR structure that's provided by the KHR_copy_commands2 extension, conversion from and to the set of parameters accepted by vkCmdCopyImageToBuffer() is provided to some extent — you can create BufferImageCopy instances out of VkBufferImageCopy structures, pass them together with the rest to CopyImageToBufferInfo and then get a VkBufferImageCopy list back again using vkBufferImageCopies().

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

Derived classes

class CopyImageToBufferInfo1D new in Git master
Convenience constructor for a 1D image to buffer copy command.
class CopyImageToBufferInfo1DArray new in Git master
Convenience constructor for a 1D array image to buffer copy command.
class CopyImageToBufferInfo2D new in Git master
Convenience constructor for a 2D image to buffer copy command.
class CopyImageToBufferInfo2DArray new in Git master
Convenience constructor for a 2D array image to buffer copy command.
class CopyImageToBufferInfo3D new in Git master
Convenience constructor for a 3D image to buffer copy command.
class CopyImageToBufferInfoCubeMap new in Git master
Convenience constructor for a cube map image to buffer copy command.
class CopyImageToBufferInfoCubeMapArray new in Git master
Convenience constructor for a cube map array image to buffer copy command.

Constructors, destructors, conversion operators

CopyImageToBufferInfo(VkImage source, ImageLayout sourceLayout, VkBuffer destination, Containers::ArrayView<const BufferImageCopy> regions)
Constructor.
CopyImageToBufferInfo(VkImage source, ImageLayout sourceLayout, VkBuffer destination, std::initializer_list<BufferImageCopy> regions)
CopyImageToBufferInfo(NoInitT) explicit noexcept
Construct without initializing the contents.
CopyImageToBufferInfo(const VkCopyImageToBufferInfo2KHR& info) explicit
Construct from existing data.
operator const VkCopyImageToBufferInfo2KHR*() const

Public functions

auto vkBufferImageCopies() const -> Containers::Array<VkBufferImageCopy>
Corresponding VkBufferImageCopy structures.
auto operator*() -> VkCopyImageToBufferInfo2KHR&
Underlying VkCopyImageToBufferInfo2KHR structure.
auto operator*() const -> const VkCopyImageToBufferInfo2KHR&
auto operator->() -> VkCopyImageToBufferInfo2KHR*
auto operator->() const -> const VkCopyImageToBufferInfo2KHR*

Function documentation

Magnum::Vk::CopyImageToBufferInfo::CopyImageToBufferInfo(VkImage source, ImageLayout sourceLayout, VkBuffer destination, Containers::ArrayView<const BufferImageCopy> regions)

Constructor.

Parameters
source Source Image or a raw Vulkan image handle. Expected to have been created with ImageUsage::TransferSource and a PixelFormat usable for transfer source.
sourceLayout Source image layout. Can be either ImageLayout::General or ImageLayout::TransferSource.
destination Destination Buffer or a raw Vulkan buffer handle. Expected to have been created with BufferUsage::TransferDestination.
regions Regions to copy. There has to be at least one.

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

  • srcImage to source
  • srcImageLayout to sourceLayout
  • dstBuffer to destination
  • regionCount and pRegions to regions

Magnum::Vk::CopyImageToBufferInfo::CopyImageToBufferInfo(VkImage source, ImageLayout sourceLayout, VkBuffer destination, std::initializer_list<BufferImageCopy> regions)

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

Magnum::Vk::CopyImageToBufferInfo::CopyImageToBufferInfo(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::CopyImageToBufferInfo::CopyImageToBufferInfo(const VkCopyImageToBufferInfo2KHR& info) 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::CopyImageToBufferInfo::operator const VkCopyImageToBufferInfo2KHR*() const

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

Containers::Array<VkBufferImageCopy> Magnum::Vk::CopyImageToBufferInfo::vkBufferImageCopies() const

Corresponding VkBufferImageCopy structures.

Provided for compatibility with Vulkan implementations that don't support the KHR_copy_commands2 extension. See Compatibility with vkCmdCopyImageToBuffer() for more information.

const VkCopyImageToBufferInfo2KHR& Magnum::Vk::CopyImageToBufferInfo::operator*() const

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

VkCopyImageToBufferInfo2KHR* Magnum::Vk::CopyImageToBufferInfo::operator->()

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

const VkCopyImageToBufferInfo2KHR* Magnum::Vk::CopyImageToBufferInfo::operator->() const

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