KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::VulkanImageBuffer Class Reference

Vulkan specific implemetation of ImageBuffer class. More...

#include <VulkanBuffer.h>

Inheritance diagram for Karma::VulkanImageBuffer:
Collaboration diagram for Karma::VulkanImageBuffer:

Public Member Functions

 VulkanImageBuffer (const char *filename)
 Creates a GPU memory buffer for storing image texture.
 
virtual ~VulkanImageBuffer ()
 Frees up device resources.
 
void CreateBuffer (VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory)
 Creates Vulkan buffer (VKbuffer) for image texture's use and allocates device memory appropriately.
 
uint32_t FindMemoryType (uint32_t typeFilter, VkMemoryPropertyFlags properties)
 Finds appropriate memory type with demanded properties. Basically a loop is run from counter i = 0 to VkPhysicalDeviceMemoryProperties.memoryTypeCount (number of valid elements in the memoryTypes array) and memoryType[i] is queried for appropriate properties. On condition satisfaction, counter i is returned.
 
const VkBuffer & GetBuffer () const
 
int GetTextureWidth () const
 Getter for the width (in pixels?) of the image texture.
 
int GetTextureHeight () const
 Getter for the height (in pixels?) of the image texture.
 
int GetTextureChannels () const
 Getter for desired channels (if non-zero, # of image components requested in result).
 
- Public Member Functions inherited from Karma::ImageBuffer
uint32_t GetBindingPointIndex () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Karma::ImageBuffer
static ImageBufferCreate (const char *filename)
 
- Protected Attributes inherited from Karma::ImageBuffer
uint32_t m_BindingPoint
 

Detailed Description

Vulkan specific implemetation of ImageBuffer class.

Constructor & Destructor Documentation

◆ VulkanImageBuffer()

Karma::VulkanImageBuffer::VulkanImageBuffer ( const char * filename)

Creates a GPU memory buffer for storing image texture.

Parameters
filenameThe path to the file, including filename, containing the image texture
Since
Karma 1.0.0

◆ ~VulkanImageBuffer()

Karma::VulkanImageBuffer::~VulkanImageBuffer ( )
virtual

Frees up device resources.

Since
Karma 1.0.0

Member Function Documentation

◆ CreateBuffer()

void Karma::VulkanImageBuffer::CreateBuffer ( VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags properties,
VkBuffer & buffer,
VkDeviceMemory & bufferMemory )

Creates Vulkan buffer (VKbuffer) for image texture's use and allocates device memory appropriately.

Parameters
sizeThe size, in bytes, of the buffer to be created
propertiesThe demanded properties (https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkBufferUsageFlagBits.html). For instance (VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
See also
VulkanUniformBuffer::BufferCreation()
Since
Karma 1.0.0

◆ FindMemoryType()

uint32_t Karma::VulkanImageBuffer::FindMemoryType ( uint32_t typeFilter,
VkMemoryPropertyFlags properties )

Finds appropriate memory type with demanded properties. Basically a loop is run from counter i = 0 to VkPhysicalDeviceMemoryProperties.memoryTypeCount (number of valid elements in the memoryTypes array) and memoryType[i] is queried for appropriate properties. On condition satisfaction, counter i is returned.

Parameters
typeFilterA bitmask, and contains one bit set for every supported memory type for the resource. Bit i is set if and only if the memory type i in the VkPhysicalDeviceMemoryProperties structure for the physical device is supported for the resource.
propertiesThe demanded properties (https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkBufferUsageFlagBits.html).
Returns
Memory type index i
Since
Karma 1.0.0

◆ GetTextureChannels()

int Karma::VulkanImageBuffer::GetTextureChannels ( ) const
inline

Getter for desired channels (if non-zero, # of image components requested in result).

See also
KarmaUtilities::GetImagePixelData
Since
Karma 1.0.0

◆ GetTextureHeight()

int Karma::VulkanImageBuffer::GetTextureHeight ( ) const
inline

Getter for the height (in pixels?) of the image texture.

Since
Karma 1.0.0

◆ GetTextureWidth()

int Karma::VulkanImageBuffer::GetTextureWidth ( ) const
inline

Getter for the width (in pixels?) of the image texture.

Since
Karma 1.0.0

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