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

Buffer to image copy command.

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

Compatibility with vkCmdCopyBufferToImage()

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

For direct editing of the Vulkan structure, it's recommended to edit the VkCopyBufferToImageInfo2KHR 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 CopyBufferToImageInfo1D new in Git master
Convenience constructor for a buffer to 1D image copy command.
class CopyBufferToImageInfo1DArray new in Git master
Convenience constructor for a buffer to 1D array image copy command.
class CopyBufferToImageInfo2D new in Git master
Convenience constructor for a buffer to 2D image copy command.
class CopyBufferToImageInfo2DArray new in Git master
Convenience constructor for a buffer to 2D array image copy command.
class CopyBufferToImageInfo3D new in Git master
Convenience constructor for a buffer to 3D image copy command.
class CopyBufferToImageInfoCubeMap new in Git master
Convenience constructor for a buffer to cube map image copy command.
class CopyBufferToImageInfoCubeMapArray new in Git master
Convenience constructor for a buffer to cube map array image copy command.

Constructors, destructors, conversion operators

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

Public functions

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

Function documentation

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

Constructor.

Parameters
source Source Buffer or a raw Vulkan buffer handle. Expected to have been created with BufferUsage::TransferSource.
destination Destination Image or a raw Vulkan image handle. Expected to have been created with ImageUsage::TransferDestination and a PixelFormat usable for transfer destination.
destinationLayout Destination image layout. Can be either ImageLayout::General or ImageLayout::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:

  • srcBuffer to source
  • dstImage to destination
  • dstImageLayout to destinationLayout
  • regionCount and pRegions to regions

Magnum::Vk::CopyBufferToImageInfo::CopyBufferToImageInfo(VkBuffer source, VkImage destination, ImageLayout destinationLayout, 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::CopyBufferToImageInfo::CopyBufferToImageInfo(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::CopyBufferToImageInfo::CopyBufferToImageInfo(const VkCopyBufferToImageInfo2KHR& 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::CopyBufferToImageInfo::operator const VkCopyBufferToImageInfo2KHR*() 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::CopyBufferToImageInfo::vkBufferImageCopies() const

Corresponding VkBufferImageCopy structures.

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

const VkCopyBufferToImageInfo2KHR& Magnum::Vk::CopyBufferToImageInfo::operator*() const

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

VkCopyBufferToImageInfo2KHR* Magnum::Vk::CopyBufferToImageInfo::operator->()

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

const VkCopyBufferToImageInfo2KHR* Magnum::Vk::CopyBufferToImageInfo::operator->() const

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