NDEVR
API Documentation
VulkanImageData

A pointer to an Image and functions relating to that image within the Vulkan logic space. More...

Inheritance diagram for VulkanImageData:
[legend]
Collaboration diagram for VulkanImageData:
[legend]

Public Member Functions

 VulkanImageData (const ConstPointer< VulkanDevice > &instance)
 Constructs an empty Vulkan image on the given device.
 VulkanImageData (const ConstPointer< VulkanDevice > &instance, Buffer< String > &image_ids, uint04 mip_map_depth)
 Constructs a Vulkan image array from multiple image files.
 VulkanImageData (const ConstPointer< VulkanDevice > &instance, const StringView &image_id, uint04 mip_map_depth)
 Constructs a Vulkan image from a single image file.
 VulkanImageData (const ConstPointer< VulkanDevice > &instance, Vector< 2, uint04 > size, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties)
 Constructs a new Vulkan image with the given properties.
 VulkanImageData (const ConstPointer< VulkanDevice > &instance, VkImage image, Vector< 2, uint04 > size, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, bool image_owner)
 Constructs a Vulkan image wrapping an existing VkImage handle.
 VulkanImageData (VulkanImageData &&instance) noexcept
 Move constructor.
 ~VulkanImageData ()
 Destructor.
uint04 arrayLayers () const
 Returns the number of array layers.
void checkAndUpdateMemory (VkMemoryPropertyFlags properties, bool bind_image)
 Checks and updates the memory allocation to match the required properties.
void cleanup (bool destroy_memory=true)
 Releases Vulkan resources.
void clear (const RGBColor &color=RGBColor(0, 0, 0, 0), VkCommandBuffer_T *command=nullptr)
 Clears the image to the given color.
void createImage (VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties)
 Creates the Vulkan image object with the specified properties.
ConstPointer< VulkanDevicedevice () const
 Returns the Vulkan device.
VkFormat getFormat () const
 Returns the Vulkan format of this image.
Vector< 2, uint04getMipSize (uint04 level) const
 Calculates the dimensions of a specific mip level.
const TimegetModifiedTime () const
 Returns the last modification time of the image data.
bool hasAlpha () const
 Returns whether the image has an alpha channel.
VkImageLayout layout (uint04 mip_level=0) const
 Returns the current layout of the specified mip level.
uint04 mipMapDepth () const
 Returns the mip map depth.
void rawSetLayout (VkImageLayout layout)
 Directly sets the tracked layout without issuing a transition command.
void setArrayLayers (uint04 array_layers)
 Sets the number of array layers.
void setData (const StringView &image_id, uint04 layer)
 Loads image data from a file into a specific array layer.
void setData (VkImage image, bool image_owner)
 Assigns an existing VkImage to this object.
void setDevice (const ConstPointer< VulkanDevice > &instance)
 Sets the Vulkan device for this image.
void setFormat (VkFormat format)
 Sets the Vulkan format for this image.
void setImageProperties (Vector< 2, uint04 > size, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties)
 Configures the image properties and allocates resources.
void setMipMapDepth (uint04 depth)
 Sets the mip map depth.
void setMultiSampleCount (uint04 count)
 Sets the multi-sample count.
Vector< 2, uint04size () const final override
 Returns the image dimensions.
void transitionImageLayout (VkImageLayout newLayout, uint04 miplevel, uint04 level, VkCommandBuffer_T *command=nullptr)
 Transitions a specific mip level range to a new layout.
void transitionImageLayout (VkImageLayout newLayout, VkCommandBuffer_T *command=nullptr)
 Transitions the entire image to a new layout.
VkDeviceMemory vkMemory () const
 Returns the device memory backing this image.
VkImage vulkanImage () const
 Returns the underlying VkImage handle.
Public Member Functions inherited from Image
virtual ~Image ()
 Virtual destructor for proper cleanup of derived Image classes.
virtual uint04 pixelSize () const
 Returns the number of bytes per pixel in this image.
virtual uint01scanLine (uint04 row)
 Returns a pointer to the raw pixel data for a given scanline (row).

Static Public Member Functions

static VkSampleCountFlagBits getSampleBitflags (uint04 multi_sample_count)
 Converts a multi-sample count to Vulkan sample count flags.

Detailed Description

A pointer to an Image and functions relating to that image within the Vulkan logic space.


Definition at line 53 of file VulkanImage.h.

Constructor & Destructor Documentation

◆ VulkanImageData() [1/6]

VulkanImageData::VulkanImageData ( const ConstPointer< VulkanDevice > & instance)

Constructs an empty Vulkan image on the given device.

Parameters
[in]instanceThe Vulkan device.

Referenced by VulkanImageData().

◆ VulkanImageData() [2/6]

VulkanImageData::VulkanImageData ( VulkanImageData && instance)
noexcept

Move constructor.

Parameters
[in]instanceThe image to move from.

References VulkanImageData().

◆ VulkanImageData() [3/6]

VulkanImageData::VulkanImageData ( const ConstPointer< VulkanDevice > & instance,
const StringView & image_id,
uint04 mip_map_depth )

Constructs a Vulkan image from a single image file.

Parameters
[in]instanceThe Vulkan device.
[in]image_idThe image file identifier.
[in]mip_map_depthThe number of mip map levels.

◆ VulkanImageData() [4/6]

VulkanImageData::VulkanImageData ( const ConstPointer< VulkanDevice > & instance,
Buffer< String > & image_ids,
uint04 mip_map_depth )

Constructs a Vulkan image array from multiple image files.

Parameters
[in]instanceThe Vulkan device.
[in]image_idsThe image file identifiers.
[in]mip_map_depthThe number of mip map levels.

◆ VulkanImageData() [5/6]

VulkanImageData::VulkanImageData ( const ConstPointer< VulkanDevice > & instance,
VkImage image,
Vector< 2, uint04 > size,
VkFormat format,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties,
bool image_owner )

Constructs a Vulkan image wrapping an existing VkImage handle.

Parameters
[in]instanceThe Vulkan device.
[in]imageThe existing VkImage handle.
[in]sizeThe image dimensions.
[in]formatThe Vulkan image format.
[in]tilingThe image tiling mode.
[in]usageThe image usage flags.
[in]propertiesThe memory property flags.
[in]image_ownerWhether this object owns the VkImage.

References size().

◆ VulkanImageData() [6/6]

VulkanImageData::VulkanImageData ( const ConstPointer< VulkanDevice > & instance,
Vector< 2, uint04 > size,
VkFormat format,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties )

Constructs a new Vulkan image with the given properties.

Parameters
[in]instanceThe Vulkan device.
[in]sizeThe image dimensions.
[in]formatThe Vulkan image format.
[in]tilingThe image tiling mode.
[in]usageThe image usage flags.
[in]propertiesThe memory property flags.

References size().

◆ ~VulkanImageData()

VulkanImageData::~VulkanImageData ( )

Destructor.

Frees GPU resources.

Member Function Documentation

◆ arrayLayers()

uint04 VulkanImageData::arrayLayers ( ) const
inline

Returns the number of array layers.

Returns
The array layer count.

Definition at line 102 of file VulkanImage.h.

◆ checkAndUpdateMemory()

void VulkanImageData::checkAndUpdateMemory ( VkMemoryPropertyFlags properties,
bool bind_image )

Checks and updates the memory allocation to match the required properties.

Parameters
[in]propertiesThe required memory property flags.
[in]bind_imageWhether to bind the image to the new memory.

◆ cleanup()

void VulkanImageData::cleanup ( bool destroy_memory = true)

Releases Vulkan resources.

Parameters
[in]destroy_memoryWhether to also free the device memory.

◆ clear()

void VulkanImageData::clear ( const RGBColor & color = RGBColor(0, 0, 0, 0),
VkCommandBuffer_T * command = nullptr )

Clears the image to the given color.

Parameters
[in]colorThe clear color.
[in]commandOptional command buffer to record the clear into.

◆ createImage()

void VulkanImageData::createImage ( VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties )

Creates the Vulkan image object with the specified properties.

Parameters
[in]tilingThe image tiling mode.
[in]usageThe image usage flags.
[in]propertiesThe memory property flags.

◆ device()

ConstPointer< VulkanDevice > VulkanImageData::device ( ) const
inline

Returns the Vulkan device.

Returns
A const pointer to the device.

Definition at line 127 of file VulkanImage.h.

References device().

Referenced by device().

◆ getFormat()

VkFormat VulkanImageData::getFormat ( ) const

Returns the Vulkan format of this image.

Returns
The VkFormat.

◆ getMipSize()

Vector< 2, uint04 > VulkanImageData::getMipSize ( uint04 level) const

Calculates the dimensions of a specific mip level.

Parameters
[in]levelThe mip level index.
Returns
The dimensions at that mip level.

◆ getModifiedTime()

const Time & VulkanImageData::getModifiedTime ( ) const
inline

Returns the last modification time of the image data.

Returns
A const reference to the modification time.

Definition at line 108 of file VulkanImage.h.

◆ getSampleBitflags()

VkSampleCountFlagBits VulkanImageData::getSampleBitflags ( uint04 multi_sample_count)
static

Converts a multi-sample count to Vulkan sample count flags.

Parameters
[in]multi_sample_countThe desired sample count.
Returns
The corresponding VkSampleCountFlagBits.

◆ hasAlpha()

bool VulkanImageData::hasAlpha ( ) const
inline

Returns whether the image has an alpha channel.

Returns
True if alpha is present.

Definition at line 166 of file VulkanImage.h.

◆ layout()

VkImageLayout VulkanImageData::layout ( uint04 mip_level = 0) const

Returns the current layout of the specified mip level.

Parameters
[in]mip_levelThe mip level to query.
Returns
The VkImageLayout.

Referenced by rawSetLayout().

◆ mipMapDepth()

uint04 VulkanImageData::mipMapDepth ( ) const
inline

Returns the mip map depth.

Returns
The mip map level count.

Definition at line 97 of file VulkanImage.h.

◆ rawSetLayout()

void VulkanImageData::rawSetLayout ( VkImageLayout layout)

Directly sets the tracked layout without issuing a transition command.

Parameters
[in]layoutThe layout to record.

References layout().

◆ setArrayLayers()

void VulkanImageData::setArrayLayers ( uint04 array_layers)
inline

Sets the number of array layers.

Parameters
[in]array_layersThe array layer count.

Definition at line 104 of file VulkanImage.h.

◆ setData() [1/2]

void VulkanImageData::setData ( const StringView & image_id,
uint04 layer )

Loads image data from a file into a specific array layer.

Parameters
[in]image_idThe image file identifier.
[in]layerThe array layer index.

◆ setData() [2/2]

void VulkanImageData::setData ( VkImage image,
bool image_owner )

Assigns an existing VkImage to this object.

Parameters
[in]imageThe VkImage handle.
[in]image_ownerWhether this object owns the image.

◆ setDevice()

void VulkanImageData::setDevice ( const ConstPointer< VulkanDevice > & instance)

Sets the Vulkan device for this image.

Parameters
[in]instanceThe Vulkan device.

◆ setFormat()

void VulkanImageData::setFormat ( VkFormat format)

Sets the Vulkan format for this image.

Parameters
[in]formatThe VkFormat.

◆ setImageProperties()

void VulkanImageData::setImageProperties ( Vector< 2, uint04 > size,
VkFormat format,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties )

Configures the image properties and allocates resources.

Parameters
[in]sizeThe image dimensions.
[in]formatThe Vulkan image format.
[in]tilingThe image tiling mode.
[in]usageThe image usage flags.
[in]propertiesThe memory property flags.

References size().

◆ setMipMapDepth()

void VulkanImageData::setMipMapDepth ( uint04 depth)
inline

Sets the mip map depth.

Parameters
[in]depthThe mip map level count.

Definition at line 99 of file VulkanImage.h.

◆ setMultiSampleCount()

void VulkanImageData::setMultiSampleCount ( uint04 count)
inline

Sets the multi-sample count.

Parameters
[in]countThe sample count.

Definition at line 156 of file VulkanImage.h.

◆ size()

Vector< 2, uint04 > VulkanImageData::size ( ) const
finaloverridevirtual

Returns the image dimensions.

Returns
The width and height.

Reimplemented from Image.

Referenced by VulkanImageData(), VulkanImageData(), and setImageProperties().

◆ transitionImageLayout() [1/2]

void VulkanImageData::transitionImageLayout ( VkImageLayout newLayout,
uint04 miplevel,
uint04 level,
VkCommandBuffer_T * command = nullptr )

Transitions a specific mip level range to a new layout.

Parameters
[in]newLayoutThe target image layout.
[in]miplevelThe starting mip level.
[in]levelThe number of mip levels to transition.
[in]commandOptional command buffer to record the transition into.

◆ transitionImageLayout() [2/2]

void VulkanImageData::transitionImageLayout ( VkImageLayout newLayout,
VkCommandBuffer_T * command = nullptr )

Transitions the entire image to a new layout.

Parameters
[in]newLayoutThe target image layout.
[in]commandOptional command buffer to record the transition into.

◆ vkMemory()

VkDeviceMemory VulkanImageData::vkMemory ( ) const
inline

Returns the device memory backing this image.

Returns
The VkDeviceMemory.

Definition at line 132 of file VulkanImage.h.

◆ vulkanImage()

VkImage VulkanImageData::vulkanImage ( ) const
inline

Returns the underlying VkImage handle.

Returns
The VkImage.

Definition at line 130 of file VulkanImage.h.


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