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

Buffer copy region.

Wraps a VkBufferCopy2KHR. This class is subsequently passed to a CopyBufferInfo and then used in CommandBuffer::copyBuffer(). See Copying buffer data for usage information and examples.

Compatibility with VkBufferCopy

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

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

Constructors, destructors, conversion operators

BufferCopy(UnsignedLong sourceOffset, UnsignedLong destinationOffset, UnsignedLong size)
Constructor.
BufferCopy(NoInitT) explicit noexcept
Construct without initializing the contents.
BufferCopy(const VkBufferCopy2KHR& copy) explicit
Construct from existing data.
BufferCopy(const VkBufferCopy& copy) explicit
Construct from a VkBufferCopy
operator const VkBufferCopy2KHR*() const
operator const VkBufferCopy2KHR&() const

Public functions

auto vkBufferCopy() const -> VkBufferCopy
Corresponding VkBufferCopy structure.
auto operator*() -> VkBufferCopy2KHR&
Underlying VkBufferCopy2KHR structure.
auto operator*() const -> const VkBufferCopy2KHR&
auto operator->() -> VkBufferCopy2KHR*
auto operator->() const -> const VkBufferCopy2KHR*

Function documentation

Magnum::Vk::BufferCopy::BufferCopy(UnsignedLong sourceOffset, UnsignedLong destinationOffset, UnsignedLong size)

Constructor.

Parameters
sourceOffset Source buffer offset in bytes
destinationOffset Destination buffer offset in bytes
size Size to copy in bytes

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

  • srcOffset to sourceOffset
  • dstOffset to destinationOffset
  • size

Magnum::Vk::BufferCopy::BufferCopy(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::BufferCopy::BufferCopy(const VkBufferCopy2KHR& 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::BufferCopy::BufferCopy(const VkBufferCopy& copy) explicit

Construct from a VkBufferCopy

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

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

VkBufferCopy Magnum::Vk::BufferCopy::vkBufferCopy() const

Corresponding VkBufferCopy structure.

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

const VkBufferCopy2KHR& Magnum::Vk::BufferCopy::operator*() const

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

VkBufferCopy2KHR* Magnum::Vk::BufferCopy::operator->()

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

const VkBufferCopy2KHR* Magnum::Vk::BufferCopy::operator->() const

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