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

Vulkan's index buffer class, used in agnostic Mesh instance. More...

#include <VulkanBuffer.h>

Inheritance diagram for Karma::VulkanIndexBuffer:
Collaboration diagram for Karma::VulkanIndexBuffer:

Public Member Functions

 VulkanIndexBuffer (uint32_t *indices, uint32_t count)
 Constructor.
 
virtual ~VulkanIndexBuffer ()
 Destructor involving destruction of index buffer and freeing up of memory.
 
virtual void Bind () const override
 Not useful for Vulkan API atm.
 
virtual void UnBind () const override
 Not useful for Vulkan API atm.
 
void CreateBuffer (VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory)
 Actual creation of buffer using Vulkan API. Memory is also allocated appropriately.
 
void CopyBuffer (VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size)
 Copy buffer.
 
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.
 
virtual uint32_t GetCount () const override
 Getter for the number of vertices to draw.
 
VkBuffer GetIndexBuffer () const
 Getter for indexbuffer.
 
VkDeviceMemory GetIndexBufferMemory () const
 Getter for index buffer memory.
 
size_t GetBufferSize ()
 Getter for indexbuffer size in bytes.
 

Additional Inherited Members

- Static Public Member Functions inherited from Karma::IndexBuffer
static IndexBufferCreate (uint32_t *vertices, uint32_t size)
 

Detailed Description

Vulkan's index buffer class, used in agnostic Mesh instance.

Since
Karma 1.0.0

Constructor & Destructor Documentation

◆ VulkanIndexBuffer()

Karma::VulkanIndexBuffer::VulkanIndexBuffer ( uint32_t * indices,
uint32_t count )

Constructor.

Initializes the relevant buffers and uploads them to GPU.

Parameters
indicesThe array of floats containing indexbuffer data
countThe length of the indexbuffer array
See also
VulkanVertexBuffer::VulkanVertexBuffer for the role played by the staging buffer.
Since
Karma 1.0.0

◆ ~VulkanIndexBuffer()

Karma::VulkanIndexBuffer::~VulkanIndexBuffer ( )
virtual

Destructor involving destruction of index buffer and freeing up of memory.

Since
Karma 1.0.0

Member Function Documentation

◆ Bind()

void Karma::VulkanIndexBuffer::Bind ( ) const
overridevirtual

Not useful for Vulkan API atm.

Todo
Ponder over Vulkan equivalent of glBindBuffer
Since
Karma 1.0.0

Implements Karma::IndexBuffer.

◆ CopyBuffer()

void Karma::VulkanIndexBuffer::CopyBuffer ( VkBuffer srcBuffer,
VkBuffer dstBuffer,
VkDeviceSize size )

Copy buffer.

Parameters
srcBufferThe source buffer to copy data from
dstBufferThe destination buffer to copy data to
sizeThe total size of data in bytes
Since
Karma 1.0.0

◆ CreateBuffer()

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

Actual creation of buffer using Vulkan API. Memory is also allocated appropriately.

Parameters
sizeThe size (in bytes) of the buffer object to be created
usageThe bitmask of VkBufferUsageFlagBits (https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkBufferUsageFlagBits.html) specifying allowed usages of the buffer.
propertiesThe bitmask of VkMemoryPropertyFlagBits of properties for this memory type of the buffer.
bufferThe pointer to a VkBuffer handle in which the resulting buffer object is returned.
bufferMemoryThe pointer to a VkDeviceMemory handle in which information about the allocated memory is returned.
Since
Karma 1.0.0

◆ FindMemoryType()

uint32_t Karma::VulkanIndexBuffer::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

◆ GetBufferSize()

size_t Karma::VulkanIndexBuffer::GetBufferSize ( )
inline

Getter for indexbuffer size in bytes.

Since
Karma 1.0.0

◆ GetCount()

virtual uint32_t Karma::VulkanIndexBuffer::GetCount ( ) const
inlineoverridevirtual

Getter for the number of vertices to draw.

Note
To be used in vkCmdDrawIndexed mostly
See also
KarmaGuiVulkanHandler::KarmaGui_ImplVulkan_RenderDrawData
Since
Karma 1.0.0

Implements Karma::IndexBuffer.

◆ GetIndexBuffer()

VkBuffer Karma::VulkanIndexBuffer::GetIndexBuffer ( ) const
inline

Getter for indexbuffer.

Since
Karma 1.0.0

◆ GetIndexBufferMemory()

VkDeviceMemory Karma::VulkanIndexBuffer::GetIndexBufferMemory ( ) const
inline

Getter for index buffer memory.

Since
Karma 1.0.0

◆ UnBind()

void Karma::VulkanIndexBuffer::UnBind ( ) const
overridevirtual

Not useful for Vulkan API atm.

Todo
Ponder over Vulkan equivalent of glBindBuffer
Since
Karma 1.0.0

Implements Karma::IndexBuffer.


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