|
Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
|
Inline wrapper class for managing a Vulkan buffer and its associated device memory. More...
#include <Buffer.hpp>
Public Member Functions | |
| VulkanBuffer ()=default | |
| Default constructor. | |
| VulkanBuffer (VkDevice dev, VkPhysicalDevice phys, VkDeviceSize bufferSize, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties) | |
| Construct and initialize a new Vulkan Buffer object. | |
| VulkanBuffer (VkDevice dev, VkBuffer buf, VkDeviceMemory mem) | |
| Construct a Vulkan Buffer object wrapping existing Vulkan resources. | |
| ~VulkanBuffer () | |
| Destroy the Vulkan Buffer object and releases Vulkan handles. | |
| VulkanBuffer (const VulkanBuffer &)=delete | |
| VulkanBuffer & | operator= (const VulkanBuffer &)=delete |
| VulkanBuffer (VulkanBuffer &&other) noexcept | |
| Move constructor. | |
| VulkanBuffer & | operator= (VulkanBuffer &&other) noexcept |
| Move assignment operator. | |
| void | create (VkDevice dev, VkPhysicalDevice phys, VkDeviceSize bufferSize, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties) |
| Creates and allocates the Vulkan buffer. | |
| void | upload (const void *srcData, VkDeviceSize dataSize, VkDeviceSize offset=0) |
| Uploads data to host-visible memory in the buffer. | |
| void | destroy () |
| Frees the buffer and associated memory. | |
| VkBuffer | get () const |
| Gets raw Vulkan buffer. | |
| VulkanBuffer ()=default | |
| Construct a new Vulkan Buffer object. | |
| ~VulkanBuffer () | |
| Destroy the Vulkan Buffer object and release resources. | |
| VulkanBuffer (const VulkanBuffer &)=delete | |
| VulkanBuffer & | operator= (const VulkanBuffer &)=delete |
| VulkanBuffer (VulkanBuffer &&other) noexcept | |
| Move constructor. | |
| VulkanBuffer & | operator= (VulkanBuffer &&other) noexcept |
| Move assignment operator. | |
| void | create (VkDevice device, VkPhysicalDevice physicalDevice, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties) |
| Creates and allocates the buffer. | |
| void | destroy () |
| Frees the buffer and memory. | |
| void | uploadData (const void *srcData, VkDeviceSize dataSize) |
| Maps buffer memory and uploads data. | |
| VkBuffer | get () const |
| Gets raw Vulkan buffer. | |
| VkDeviceMemory | getMemory () const |
| Gets Vulkan device memory. | |
| VkDeviceSize | getSize () const |
| Gets buffer size. | |
Public Attributes | |
| VkBuffer | buffer = VK_NULL_HANDLE |
| Vulkan buffer handle. | |
| VkDeviceMemory | memory = VK_NULL_HANDLE |
| Vulkan device memory handle. | |
| VkDevice | device = VK_NULL_HANDLE |
| Reference to logical device. | |
| VkDeviceSize | size = 0 |
| Size of the buffer in bytes. | |
Private Member Functions | |
| uint32_t | findMemoryType (uint32_t typeFilter, VkMemoryPropertyFlags properties) |
| Locates suitable memory type. | |
Static Private Member Functions | |
| static uint32_t | findMemoryType (VkPhysicalDevice phys, uint32_t typeFilter, VkMemoryPropertyFlags properties) |
| Locates the correct memory type on physical device. | |
Private Attributes | |
| VkPhysicalDevice | physicalDevice = VK_NULL_HANDLE |
| Reference to physical device. | |
| VkDeviceSize | bufferSize = 0 |
| Size allocated in bytes. | |
Inline wrapper class for managing a Vulkan buffer and its associated device memory.
Manages a Vulkan buffer handle and its allocated GPU memory.
|
default |
Default constructor.
|
inline |
Construct and initialize a new Vulkan Buffer object.
| dev | Logical device context. |
| phys | Physical device. |
| bufferSize | Size of the buffer. |
| usage | Usage flags. |
| properties | Memory properties. |
|
inline |
Construct a Vulkan Buffer object wrapping existing Vulkan resources.
| dev | Logical device. |
| buf | Existing Vulkan buffer. |
| mem | Existing Vulkan device memory. |
|
inline |
Destroy the Vulkan Buffer object and releases Vulkan handles.
Destroy the Vulkan Buffer:: Vulkan Buffer object and release Vulkan handles.
|
delete |
|
inlinenoexcept |
Move constructor.
| other | Other buffer. |
| other | Buffer to move from. |
|
default |
Construct a new Vulkan Buffer object.
| VulkanBuffer::~VulkanBuffer | ( | ) |
Destroy the Vulkan Buffer object and release resources.
|
delete |
|
noexcept |
Move constructor.
| other | Buffer to move from. |
|
inline |
Creates and allocates the Vulkan buffer.
Creates and allocates the buffer.
| dev | Logical device. |
| phys | Physical device. |
| bufferSize | Size of buffer. |
| usage | Usage flags. |
| properties | Memory properties. |
| dev | Vulkan logical device context. |
| phys | Vulkan physical device. |
| size | Buffer size. |
| usage | Usage flags. |
| properties | Memory properties. |
| void VulkanBuffer::create | ( | VkDevice | device, |
| VkPhysicalDevice | physicalDevice, | ||
| VkDeviceSize | size, | ||
| VkBufferUsageFlags | usage, | ||
| VkMemoryPropertyFlags | properties ) |
Creates and allocates the buffer.
| device | Vulkan logical device context. |
| physicalDevice | Vulkan physical device. |
| size | Size in bytes. |
| usage | Usage bitmask flags. |
| properties | Memory properties. |
|
inline |
Frees the buffer and associated memory.
Safely destroys the buffer and memory.
| void VulkanBuffer::destroy | ( | ) |
Frees the buffer and memory.
|
private |
Locates suitable memory type.
Selects the correct memory type on physical device.
| typeFilter | Type filter bitmask. |
| properties | Desired memory properties. |
| typeFilter | Bitmask filtering memory types. |
| properties | Desired memory properties. |
|
inlinestaticprivate |
Locates the correct memory type on physical device.
| phys | Physical device. |
| typeFilter | Type filter mask. |
| properties | Desired memory properties. |
|
inline |
Gets raw Vulkan buffer.
|
inline |
Gets raw Vulkan buffer.
|
inline |
Gets Vulkan device memory.
|
inline |
Gets buffer size.
|
delete |
|
delete |
|
inlinenoexcept |
Move assignment operator.
| other | Other buffer. |
| other | Buffer to move. |
|
noexcept |
Move assignment operator.
| other | Buffer to move. |
|
inline |
Uploads data to host-visible memory in the buffer.
| srcData | Source pointer. |
| dataSize | Size of data to transfer. |
| offset | Transfer offset. |
| void VulkanBuffer::uploadData | ( | const void * | srcData, |
| VkDeviceSize | dataSize ) |
Maps buffer memory and uploads data.
Uploads data to the buffer.
| srcData | Source pointer. |
| dataSize | Size of data to transfer. |
| srcData | Source pointer. |
| dataSize | Transfer size. |
| VkBuffer VulkanBuffer::buffer = VK_NULL_HANDLE |
Vulkan buffer handle.
Raw buffer handle.
|
private |
Size allocated in bytes.
| VkDevice VulkanBuffer::device = VK_NULL_HANDLE |
Reference to logical device.
| VkDeviceMemory VulkanBuffer::memory = VK_NULL_HANDLE |
Vulkan device memory handle.
Raw memory handle.
|
private |
Reference to physical device.
| VkDeviceSize VulkanBuffer::size = 0 |
Size of the buffer in bytes.