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

Attachment description.

Wraps a VkAttachmentDescription2. This class is subsequently passed to a RenderPass, see its documentation for a high-level usage information.

Compatibility with VkAttachmentDescription

While the class operates on the VkAttachmentDescription2 structure that's new in Vulkan 1.2 or is provided by the KHR_create_renderpass2 extension, conversion from and to VkAttachmentDescription is provided to some extent — you can create an AttachmentDescription from it, call various methods on the instance and then get a VkAttachmentDescription back again using vkAttachmentDescription().

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

Please note that the conversion to VkAttachmentDescription will ignore all fields that are present only in VkAttachmentDescription2 and its substructures — in particular, the whole pNext pointer chain is omitted. When performing the conversion it's your responsibility to ensure nothing significant was in the fields that were left out.

Public types

enum class Flag: UnsignedInt { MayAlias = VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT }
Attachment description flag.
using Flags = Containers::EnumSet<Flag>
Attachment description flags.

Constructors, destructors, conversion operators

AttachmentDescription(PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit
Constructor.
AttachmentDescription(Magnum::PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit
AttachmentDescription(Magnum::CompressedPixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit
AttachmentDescription(PixelFormat format, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation> depthStencilLoadOperation, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation> depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit
Construct for a combined depth/stencil attachment.
AttachmentDescription(Magnum::PixelFormat format, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation> depthStencilLoadOperation, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation> depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit
AttachmentDescription(Magnum::CompressedPixelFormat format, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation> depthStencilLoadOperation, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation> depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit
AttachmentDescription(NoInitT) explicit noexcept
Construct without initializing the contents.
AttachmentDescription(const VkAttachmentDescription2& description) explicit
Construct from existing data.
AttachmentDescription(const VkAttachmentDescription& description) explicit
Construct from a VkAttachmentDescription
operator const VkAttachmentDescription2*() const
operator const VkAttachmentDescription2&() const

Public functions

auto operator*() -> VkAttachmentDescription2&
Underlying VkAttachmentDescription2 structure.
auto operator*() const -> const VkAttachmentDescription2&
auto operator->() -> VkAttachmentDescription2*
auto operator->() const -> const VkAttachmentDescription2*
auto vkAttachmentDescription() const -> VkAttachmentDescription
Corresponding VkAttachmentDescription structure.

Enum documentation

enum class Magnum::Vk::AttachmentDescription::Flag: UnsignedInt

Attachment description flag.

Wraps VkAttachmentDescriptionFlagBits.

Enumerators
MayAlias

Aliases the same device memory as other attachments

Typedef documentation

typedef Containers::EnumSet<Flag> Magnum::Vk::AttachmentDescription::Flags

Attachment description flags.

Type-safe wrapper for VkAttachmentDescriptionFlags.

Function documentation

Magnum::Vk::AttachmentDescription::AttachmentDescription(PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit

Constructor.

Parameters
format Image format
loadOperation How previous attachment contents are treated at the beginning of a subpass
storeOperation How previous attachment contents are treated at the beginning of a subpass
initialLayout Initial image layout. Can only be ImageLayout::General, ImageLayout::ShaderReadOnly, ImageLayout::TransferSource, ImageLayout::TransferDestination, and ImageLayout::ColorAttachment in case of a color format or ImageLayout::DepthStencilAttachment in case of a depth/stencil format.
finalLayout Final image layout. Can only be ImageLayout::General, ImageLayout::ShaderReadOnly, ImageLayout::TransferSource, ImageLayout::TransferDestination, and ImageLayout::ColorAttachment in case of a color format or ImageLayout::DepthStencilAttachment in case of a depth/stencil format.
samples Sample count
flags Attachment description flags

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

  • flags
  • format
  • samples
  • loadOp to loadOperation
  • storeOp to storeOperation
  • initialLayout
  • finalLayout

See also AttachmentDescription(PixelFormat, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation>, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation>, ImageLayout, ImageLayout, Int, Flags) for a constructing a combined depth/stencil attachment description.

Magnum::Vk::AttachmentDescription::AttachmentDescription(Magnum::PixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit

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

Magnum::Vk::AttachmentDescription::AttachmentDescription(Magnum::CompressedPixelFormat format, AttachmentLoadOperation loadOperation, AttachmentStoreOperation storeOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit

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

Magnum::Vk::AttachmentDescription::AttachmentDescription(PixelFormat format, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation> depthStencilLoadOperation, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation> depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit

Construct for a combined depth/stencil attachment.

Parameters
format Image format
depthStencilLoadOperation How previous depth and stencil attachment contents are treated at the beginning of a subpass
depthStencilStoreOperation How generated depth and stencil attachment contents are treated at the end of a subpass
initialLayout Initial image layout. Can only be ImageLayout::General, ImageLayout::ShaderReadOnly, ImageLayout::TransferSource, ImageLayout::TransferDestination, and ImageLayout::DepthStencilAttachment
finalLayout Final image layout. Can only be ImageLayout::General, ImageLayout::ShaderReadOnly, ImageLayout::TransferSource, ImageLayout::TransferDestination, and ImageLayout::DepthStencilAttachment
samples Sample count
flags Attachment description flags

Compared to AttachmentDescription(PixelFormat, AttachmentLoadOperation, AttachmentStoreOperation, ImageLayout, ImageLayout, Int, Flags) allows you to specify different load/store operation for depth and stencil. The following VkAttachmentDescription2 fields are pre-filled in addition to sType, everything else is zero-filled:

  • flags
  • format
  • samples
  • loadOp and stencilLoadOp to loadOperation
  • storeOp and stencilStoreOp to storeOperation
  • initialLayout
  • finalLayout

Magnum::Vk::AttachmentDescription::AttachmentDescription(Magnum::PixelFormat format, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation> depthStencilLoadOperation, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation> depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit

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

Magnum::Vk::AttachmentDescription::AttachmentDescription(Magnum::CompressedPixelFormat format, Containers::Pair<AttachmentLoadOperation, AttachmentLoadOperation> depthStencilLoadOperation, Containers::Pair<AttachmentStoreOperation, AttachmentStoreOperation> depthStencilStoreOperation, ImageLayout initialLayout, ImageLayout finalLayout, Int samples = 1, Flags flags = {}) explicit

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

Magnum::Vk::AttachmentDescription::AttachmentDescription(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::AttachmentDescription::AttachmentDescription(const VkAttachmentDescription2& description) 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::AttachmentDescription::AttachmentDescription(const VkAttachmentDescription& description) explicit

Construct from a VkAttachmentDescription

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

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

const VkAttachmentDescription2& Magnum::Vk::AttachmentDescription::operator*() const

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

VkAttachmentDescription2* Magnum::Vk::AttachmentDescription::operator->()

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

const VkAttachmentDescription2* Magnum::Vk::AttachmentDescription::operator->() const

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

VkAttachmentDescription Magnum::Vk::AttachmentDescription::vkAttachmentDescription() const

Corresponding VkAttachmentDescription structure.

Provided for compatibility with Vulkan implementations that don't support version 1.2 or the KHR_create_renderpass2 extension. See Compatibility with VkAttachmentDescription for more information.