![]() |
PeriDyno 1.0.0
|
Encapsulates access to a Vulkan buffer backed up by device memory. More...
#include <VulkanBuffer.h>
Public Member Functions | |
Buffer (VkDevice dev=nullptr) | |
~Buffer () | |
VkResult | map (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) |
void | unmap () |
VkResult | bind (VkDeviceSize offset=0) |
void | setupDescriptor (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) |
void | copyTo (void *data, VkDeviceSize size) |
VkResult | flush (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) |
VkResult | invalidate (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) |
void | destroy () |
Public Attributes | |
VkDevice | device |
VkBuffer | buffer = VK_NULL_HANDLE |
VkDeviceMemory | memory = VK_NULL_HANDLE |
VkDescriptorBufferInfo | descriptor |
VkDeviceSize | size = 0 |
VkDeviceSize | alignment = 0 |
VkDeviceSize | offset = 0 |
VmaAllocation | allocation = VK_NULL_HANDLE |
VmaAllocator | allocator = VK_NULL_HANDLE |
VkBool32 | usePool = VK_FALSE |
void * | mapped = nullptr |
VkBufferUsageFlags | usageFlags |
Usage flags to be filled by external source at buffer creation (to query at some later point) | |
VkMemoryPropertyFlags | memoryPropertyFlags |
Memory property flags to be filled by external source at buffer creation (to query at some later point) | |
Encapsulates access to a Vulkan buffer backed up by device memory.
Definition at line 27 of file VulkanBuffer.h.
vks::Buffer::Buffer | ( | VkDevice | dev = nullptr | ) |
vks::Buffer::~Buffer | ( | ) |
VkResult vks::Buffer::bind | ( | VkDeviceSize | offset = 0 | ) |
Attach the allocated memory block to the buffer
offset | (Optional) Byte offset (from the beginning) for the memory region to bind |
Definition at line 77 of file VulkanBuffer.cpp.
void vks::Buffer::copyTo | ( | void * | data, |
VkDeviceSize | size ) |
Copies the specified data to the mapped buffer
data | Pointer to the data to copy |
size | Size of the data to copy in machine units |
Definition at line 107 of file VulkanBuffer.cpp.
void vks::Buffer::destroy | ( | ) |
Release all Vulkan resources held by this buffer
Definition at line 164 of file VulkanBuffer.cpp.
VkResult vks::Buffer::flush | ( | VkDeviceSize | size = VK_WHOLE_SIZE, |
VkDeviceSize | offset = 0 ) |
Flush a memory range of the buffer to make it visible to the device
size | (Optional) Size of the memory range to flush. Pass VK_WHOLE_SIZE to flush the complete buffer range. |
offset | (Optional) Byte offset from beginning |
Definition at line 123 of file VulkanBuffer.cpp.
VkResult vks::Buffer::invalidate | ( | VkDeviceSize | size = VK_WHOLE_SIZE, |
VkDeviceSize | offset = 0 ) |
Invalidate a memory range of the buffer to make it visible to the host
size | (Optional) Size of the memory range to invalidate. Pass VK_WHOLE_SIZE to invalidate the complete buffer range. |
offset | (Optional) Byte offset from beginning |
Definition at line 147 of file VulkanBuffer.cpp.
VkResult vks::Buffer::map | ( | VkDeviceSize | size = VK_WHOLE_SIZE, |
VkDeviceSize | offset = 0 ) |
Map a memory range of this buffer. If successful, mapped points to the specified buffer range.
size | (Optional) Size of the memory range to map. Pass VK_WHOLE_SIZE to map the complete buffer range. |
offset | (Optional) Byte offset from beginning |
Definition at line 44 of file VulkanBuffer.cpp.
void vks::Buffer::setupDescriptor | ( | VkDeviceSize | size = VK_WHOLE_SIZE, |
VkDeviceSize | offset = 0 ) |
Setup the default descriptor for this buffer
size | (Optional) Size of the memory range of the descriptor |
offset | (Optional) Byte offset from beginning |
Definition at line 93 of file VulkanBuffer.cpp.
void vks::Buffer::unmap | ( | ) |
Unmap a mapped memory range
Definition at line 58 of file VulkanBuffer.cpp.
VkDeviceSize vks::Buffer::alignment = 0 |
Definition at line 46 of file VulkanBuffer.h.
VmaAllocation vks::Buffer::allocation = VK_NULL_HANDLE |
Definition at line 48 of file VulkanBuffer.h.
VmaAllocator vks::Buffer::allocator = VK_NULL_HANDLE |
Definition at line 49 of file VulkanBuffer.h.
VkBuffer vks::Buffer::buffer = VK_NULL_HANDLE |
Definition at line 42 of file VulkanBuffer.h.
VkDescriptorBufferInfo vks::Buffer::descriptor |
Definition at line 44 of file VulkanBuffer.h.
VkDevice vks::Buffer::device |
Definition at line 41 of file VulkanBuffer.h.
void* vks::Buffer::mapped = nullptr |
Definition at line 51 of file VulkanBuffer.h.
VkDeviceMemory vks::Buffer::memory = VK_NULL_HANDLE |
Definition at line 43 of file VulkanBuffer.h.
VkMemoryPropertyFlags vks::Buffer::memoryPropertyFlags |
Memory property flags to be filled by external source at buffer creation (to query at some later point)
Definition at line 55 of file VulkanBuffer.h.
VkDeviceSize vks::Buffer::offset = 0 |
Definition at line 47 of file VulkanBuffer.h.
VkDeviceSize vks::Buffer::size = 0 |
Definition at line 45 of file VulkanBuffer.h.
VkBufferUsageFlags vks::Buffer::usageFlags |
Usage flags to be filled by external source at buffer creation (to query at some later point)
Definition at line 53 of file VulkanBuffer.h.
VkBool32 vks::Buffer::usePool = VK_FALSE |
Definition at line 50 of file VulkanBuffer.h.