![]() |
VPP
0.7
A high-level modern C++ API for Vulkan
|
Class representing generic (untyped) Vulkan image. More...
#include <vppImage.hpp>
Public Types | |
enum | EUsageFlags { SOURCE = VK_IMAGE_USAGE_TRANSFER_SRC_BIT, TARGET = VK_IMAGE_USAGE_TRANSFER_DST_BIT, SAMPLED = VK_IMAGE_USAGE_SAMPLED_BIT, STORAGE = VK_IMAGE_USAGE_STORAGE_BIT, COLOR = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, DEPTH = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, TRANSIENT = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, INPUT = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT } |
Enumeration specifying how an image may be used. More... | |
Public Member Functions | |
Img () | |
Constructs null reference. | |
Img (const ImageInfo &imageInfo, const MemProfile &memProfile, const Device &hDevice, VkImageLayout initialLayout=VK_IMAGE_LAYOUT_UNDEFINED, const std::vector< unsigned int > &queueFamilyIndices=std::vector< unsigned int >()) | |
Constructs an image with attributes defined by an ImageInfo structure. More... | |
Img (const ImageInfo &imageInfo, const Device &hDevice, VkImage hImage) | |
Constructs an image from already existing Vulkan image handle. More... | |
VkImage | handle () const |
Retrieves the Vulkan handle. | |
bool | valid () const |
Checks whether this is a valid image. | |
const Device & | device () const |
Retrieves the device. | |
const ImageInfo & | info () const |
Retrieves all image attributes. | |
const VkExtent3D & | extent () const |
Retrieves image size. | |
VkFormat | format () const |
Retrieves image format. | |
Class representing generic (untyped) Vulkan image.
This class represents an image without encoding image attributes (e.g. format) in the C++ type. This makes image handling easier.
Many VPP operations require only such untyped reference to an image. On the other hand, there are contexts (like binding points in shaders) that require typed image references, i.e. instances of Image template.
You can always cast from typed image reference (Image) to untyped (Img), as Img is the base class of all Image template instances.
As for deciding whether to create/pass Img or Image reference, choose the variant appropriate for the usage of the reference. If the image has to be bound to a shader binding point, Image will be required. If the image will be only supplied to a command (e.g. cmdCopyImage()), Img will suffice.
This object is reference-counted and may be passed by value.
Enumeration specifying how an image may be used.
Every image has a parameter called usage which is a bitwise combination of values taken from EUsageFlags enumeration. It restricts possible usage of the image, but also allows performance optimization of it.
These values are identical to corresponding low-level Vulkan flags and may be used interchangeably.
vpp::Img::Img | ( | const ImageInfo & | imageInfo, |
const MemProfile & | memProfile, | ||
const Device & | hDevice, | ||
VkImageLayout | initialLayout = VK_IMAGE_LAYOUT_UNDEFINED , |
||
const std::vector< unsigned int > & | queueFamilyIndices = std::vector< unsigned int >() |
||
) |
Constructs an image with attributes defined by an ImageInfo structure.
The memProfile
argument specifies what kind of physical memory is needed for the image. Typically use MemProfile::DEVICE_STATIC value to allocate the image memory on GPU side.
An example:
Constructs an image from already existing Vulkan image handle.
You must still provide image metadata, as Vulkan does not have queries for it.
An example: