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

Buffer / image copy region.

Wraps a VkBufferImageCopy2KHR. This class is subsequently passed to a CopyBufferToImageInfo / CopyImageToBufferInfo and then used in CommandBuffer::copyBufferToImage() / CommandBuffer::copyImageToBuffer(). See Copying image data for usage information and examples.

Compatibility with VkBufferImageCopy

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

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

Derived classes

class BufferImageCopy1D new in Git master
Convenience constructor for buffer / 1D image copy region.
class BufferImageCopy1DArray new in Git master
Convenience constructor for buffer / 1D array image copy region.
class BufferImageCopy2D new in Git master
Convenience constructor for buffer / 2D image copy region.
class BufferImageCopy2DArray new in Git master
Convenience constructor for buffer / 2D array image copy region.
class BufferImageCopy3D new in Git master
Convenience constructor for buffer / 3D image copy region.
class BufferImageCopyCubeMap new in Git master
Convenience constructor for buffer / cube map image copy region.
class BufferImageCopyCubeMapArray new in Git master
Convenience constructor for buffer / cube map image copy region.

Constructors, destructors, conversion operators

BufferImageCopy(UnsignedLong bufferOffset, UnsignedInt bufferRowLength, UnsignedInt bufferImageHeight, ImageAspect imageAspect, Int imageLevel, Int imageLayerOffset, Int imageLayerCount, const Range3Di& imageRange)
Constructor.
BufferImageCopy(NoInitT) explicit noexcept
Construct without initializing the contents.
BufferImageCopy(const VkBufferImageCopy2KHR& copy) explicit
Construct from existing data.
BufferImageCopy(const VkBufferImageCopy& copy) explicit
Construct from a VkBufferImageCopy
operator const VkBufferImageCopy2KHR*() const
operator const VkBufferImageCopy2KHR&() const

Public functions

auto vkBufferImageCopy() const -> VkBufferImageCopy
Corresponding VkBufferImageCopy structure.
auto operator*() -> VkBufferImageCopy2KHR&
Underlying VkBufferImageCopy2KHR structure.
auto operator*() const -> const VkBufferImageCopy2KHR&
auto operator->() -> VkBufferImageCopy2KHR*
auto operator->() const -> const VkBufferImageCopy2KHR*

Function documentation

Magnum::Vk::BufferImageCopy::BufferImageCopy(UnsignedLong bufferOffset, UnsignedInt bufferRowLength, UnsignedInt bufferImageHeight, ImageAspect imageAspect, Int imageLevel, Int imageLayerOffset, Int imageLayerCount, const Range3Di& imageRange)

Constructor.

Parameters
bufferOffset Buffer offset in bytes
bufferRowLength Row length when linearized in the buffer, in pixels. Use 0 for tightly packed rows, which is equivalent to width of imageRange.
bufferImageHeight Image height when linearized in the buffer, in pixels. Using 0 for tightly packed images, which is equivalent to height of imageRange.
imageAspect Image aspect to copy. Only one aspect can be copied at a time, so this is not ImageAspects.
imageLevel Image mip level
imageLayerOffset Image layer offset
imageLayerCount Image layer count
imageRange Image range

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

  • bufferOffset
  • bufferRowLength
  • bufferImageHeight
  • imageSubresource.aspectMask to imageAspect
  • imageSubresource.mipLevel to imageLevel
  • imageSubresource.baseArrayLayer to imageLayerOffset
  • imageSubresource.layerCount to imageLayerCount
  • imageOffset to imageRange min()
  • imageExtent to imageRange size()

There are various restrictions on imageLayerCount and imageRange depending on whether the image has additional dimensions or layers and you're encouraged to make use of BufferImageCopy1D, BufferImageCopy3D, BufferImageCopy3D, BufferImageCopy1DArray, BufferImageCopy2DArray, BufferImageCopyCubeMap and BufferImageCopyCubeMapArray convenience classes instead of this constructor.

Magnum::Vk::BufferImageCopy::BufferImageCopy(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::BufferImageCopy::BufferImageCopy(const VkBufferImageCopy2KHR& 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::BufferImageCopy::BufferImageCopy(const VkBufferImageCopy& copy) explicit

Construct from a VkBufferImageCopy

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

Magnum::Vk::BufferImageCopy::operator const VkBufferImageCopy2KHR*() 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::BufferImageCopy::operator const VkBufferImageCopy2KHR&() 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.

VkBufferImageCopy Magnum::Vk::BufferImageCopy::vkBufferImageCopy() const

Corresponding VkBufferImageCopy structure.

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

const VkBufferImageCopy2KHR& Magnum::Vk::BufferImageCopy::operator*() const

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

VkBufferImageCopy2KHR* Magnum::Vk::BufferImageCopy::operator->()

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

const VkBufferImageCopy2KHR* Magnum::Vk::BufferImageCopy::operator->() const

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