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

Image view.

View onto an Image. Wraps a VkImageView.

Image view creation

Similarly to Image, a view is created by passing one of the ImageViewCreateInfo subclasses with desired layer/level range to the Image constructor. Commonly you'd use the same ImageViewCreateInfo subclass as ImageCreateInfo, but other combinations are possible as well — see docs of each subclass for more information.

#include <Magnum/Vk/ImageViewCreateInfo.h>

Vk::Image image{device, Vk::ImageCreateInfo2DArray{ /* created before */
}, };

Vk::ImageView view{device, Vk::ImageViewCreateInfo2DArray{image}};

While it would be technically possible to infer a view type from the originating Image and thus avoid having to specify the type twice, the mapping isn't crystal clear in all cases and could cause hard-to-detect issues if you suddenly get an unexpected view type. Thus the view type is required to be always explicitly specified.

Public static functions

static auto wrap(Device& device, VkImageView handle, HandleFlags flags = {}) -> ImageView
Wrap existing Vulkan handle.

Constructors, destructors, conversion operators

ImageView(Device& device, const ImageViewCreateInfo& info) explicit
ImageView(NoCreateT) explicit
Construct without creating the image.
ImageView(const ImageView&) deleted
Copying is not allowed.
ImageView(ImageView&& other) noexcept
Move constructor.
operator VkImageView()

Public functions

auto operator=(const ImageView&) -> ImageView& deleted
Copying is not allowed.
auto operator=(ImageView&& other) -> ImageView& noexcept
Move assignment.
auto handle() -> VkImageView
Underlying VkImageView handle.
auto handleFlags() const -> HandleFlags
Handle flags.
auto release() -> VkImageView
Release the underlying Vulkan image view.

Function documentation

static ImageView Magnum::Vk::ImageView::wrap(Device& device, VkImageView handle, HandleFlags flags = {})

Wrap existing Vulkan handle.

device Vulkan device the image view is created on
handle The VkImageView handle
flags Handle flags

The handle is expected to be originating from device. Unlike an image view created using a constructor, the Vulkan image view is by default not deleted on destruction, use flags for different behavior.

Magnum::Vk::ImageView::ImageView(Device& device, const ImageViewCreateInfo& info) explicit


device Vulkan device to create the image on
info Image creation info

Magnum::Vk::ImageView::ImageView(NoCreateT) explicit

Construct without creating the image.

The constructed instance is equivalent to moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.



Destroys associated VkImageView handle, unless the instance was created using wrap() without HandleFlag::DestroyOnDestruction specified.

Magnum::Vk::ImageView::operator VkImageView()

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

VkImageView Magnum::Vk::ImageView::release()

Release the underlying Vulkan image view.

Releases ownership of the Vulkan image view and returns its handle so vkDestroyImageView() is not called on destruction. The internal state is then equivalent to moved-from state.