vOOlkan
An object oriented approach to Vulkan
Vulkan::Image Class Reference

An Image is an object representing what can be passed to the swapchain: the content of the image is what will be drawn. More...

#include <Image.h>

Inheritance diagram for Vulkan::Image:
Vulkan::DepthImage Vulkan::TextureImage

Public Member Functions

 Image (const VkImage &image, const LogicalDevice &virtualGpu, VkFormat format, std::pair< unsigned int, unsigned int > resolution)
 
 Image (const Image &)=delete
 
Imageoperator= (const Image &)=delete
 
 Image (Image &&) noexcept
 
Imageoperator= (Image &&) noexcept
 
 ~Image ()
 
const VkImage & operator+ () const
 
VkFormat getFormat () const
 Returns the format of the image, which is the same format of all the images in the swapchain of this image. More...
 
const ImageViewgenerateImageView (std::string tag, const LogicalDevice &virtualGpu, VkImageAspectFlags type=VK_IMAGE_ASPECT_COLOR_BIT)
 Creates a new image view for this image, and adds it to the array of image views of this image, on last position. More...
 
void eliminateImageView (std::string tag)
 Eliminates the specified image view. More...
 
const ImageViewoperator[] (std::string tag) const
 Returns the image view associated with the tag. More...
 
const std::map< std::string, ImageView > & getImageViews () const
 Returns all the image views of this image. More...
 

Protected Member Functions

 Image ()
 
template<std::same_as< VkMemoryPropertyFlagBits >... P>
 Image (const LogicalDevice &virtualGpu, const PhysicalDevice &realGpu, VkFormat format, std::pair< unsigned int, unsigned int > resolution, VkImageTiling tiling, VkImageUsageFlags usage, P... memoryProperties)
 

Protected Attributes

VkImage image
 
VkFormat format
 
VkImageLayout layout
 
std::pair< unsigned int, unsigned int > resolution
 
std::map< std::string, ImageViewviews
 
VkDeviceMemory allocatedMemory
 
LogicalDevice const * virtualGpu
 
bool isSwapchainImage
 

Friends

void swap (Image &lhs, Image &rhs)
 

Detailed Description

An Image is an object representing what can be passed to the swapchain: the content of the image is what will be drawn.

An Image contains a list of ImageViews where we can actually draw. When an image is created it contains no ImageViews, but you can add those by using the generateImageView function.

Constructor & Destructor Documentation

◆ Image() [1/5]

Vulkan::Image::Image ( const VkImage &  image,
const LogicalDevice virtualGpu,
VkFormat  format,
std::pair< unsigned int, unsigned int >  resolution 
)

◆ Image() [2/5]

Vulkan::Image::Image ( const Image )
delete

◆ Image() [3/5]

Vulkan::Image::Image ( Image &&  movedFrom)
noexcept

◆ ~Image()

Vulkan::Image::~Image ( )

◆ Image() [4/5]

Vulkan::Image::Image ( )
protected

◆ Image() [5/5]

template<std::same_as< VkMemoryPropertyFlagBits >... P>
Vulkan::Image::Image ( const LogicalDevice virtualGpu,
const PhysicalDevice realGpu,
VkFormat  format,
std::pair< unsigned int, unsigned int >  resolution,
VkImageTiling  tiling,
VkImageUsageFlags  usage,
P...  memoryProperties 
)
inlineprotected

Member Function Documentation

◆ eliminateImageView()

void Vulkan::Image::eliminateImageView ( std::string  tag)

Eliminates the specified image view.

Parameters
tagThe image view to eliminate.

◆ generateImageView()

const Vulkan::ImageView & Vulkan::Image::generateImageView ( std::string  tag,
const LogicalDevice virtualGpu,
VkImageAspectFlags  type = VK_IMAGE_ASPECT_COLOR_BIT 
)

Creates a new image view for this image, and adds it to the array of image views of this image, on last position.

Parameters
tagA tag to retrieve this image view.
virtualGpuThe LogicalGpu of the Vulkan application.
Returns
The newly created image view.

◆ getFormat()

VkFormat Vulkan::Image::getFormat ( ) const

Returns the format of the image, which is the same format of all the images in the swapchain of this image.

Returns
The format of the image.

◆ getImageViews()

const std::map< std::string, Vulkan::ImageView > & Vulkan::Image::getImageViews ( ) const

Returns all the image views of this image.

Returns
All the image views of this image.

◆ operator+()

const VkImage & Vulkan::Image::operator+ ( ) const

◆ operator=() [1/2]

Image & Vulkan::Image::operator= ( const Image )
delete

◆ operator=() [2/2]

Vulkan::Image & Vulkan::Image::operator= ( Image &&  movedFrom)
noexcept

◆ operator[]()

const Vulkan::ImageView & Vulkan::Image::operator[] ( std::string  tag) const

Returns the image view associated with the tag.

Throws a VulkanException if the tag is not existent.

Parameters
tagThe tag of the image view to retrieve.
Returns
The image view associated with the tag.

Friends And Related Function Documentation

◆ swap

void swap ( Image lhs,
Image rhs 
)
friend

Member Data Documentation

◆ allocatedMemory

VkDeviceMemory Vulkan::Image::allocatedMemory
protected

◆ format

VkFormat Vulkan::Image::format
protected

◆ image

VkImage Vulkan::Image::image
protected

◆ isSwapchainImage

bool Vulkan::Image::isSwapchainImage
protected

◆ layout

VkImageLayout Vulkan::Image::layout
protected

◆ resolution

std::pair<unsigned int, unsigned int> Vulkan::Image::resolution
protected

◆ views

std::map<std::string, ImageView> Vulkan::Image::views
protected

◆ virtualGpu

LogicalDevice const* Vulkan::Image::virtualGpu
protected

The documentation for this class was generated from the following files: