17 MANDRILL_NON_COPYABLE(
Buffer)
26 MANDRILL_API
Buffer(ptr<Device> pDevice, VkDeviceSize size, VkBufferUsageFlags usage,
27 VkMemoryPropertyFlags properties);
42 MANDRILL_API
void copyFromHost(
const void* pData, VkDeviceSize size, VkDeviceSize offset = 0);
66 MANDRILL_API VkBufferUsageFlags
getUsage()
const
86 VkBufferDeviceAddressInfo ai = {
87 .sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO,
90 return vkGetBufferDeviceAddress(mpDevice->getDevice(), &ai);
99 if (!(mProperties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
100 Log::Error(
"Unable to access host map of buffer that is not host coherent.");
116 ptr<Device> mpDevice;
119 VkDeviceMemory mMemory;
120 VkBufferUsageFlags mUsage;
121 VkMemoryPropertyFlags mProperties;
Buffer class for managing Vulkan buffers. This class handles the creation and destruction of buffers,...
Definition Buffer.h:15
MANDRILL_API void copyFromHost(const void *pData, VkDeviceSize size, VkDeviceSize offset=0)
Copy data from host to the buffer. If the buffer was not created to have host-coherent memory,...
Definition Buffer.cpp:61
MANDRILL_API VkBuffer getBuffer() const
Get the buffer handle.
Definition Buffer.h:48
MANDRILL_API VkDeviceAddress getDeviceAddress() const
Get the device address of the buffer.
Definition Buffer.h:84
MANDRILL_API VkBufferUsageFlags getUsage() const
Get the buffer usage flags.
Definition Buffer.h:66
MANDRILL_API ~Buffer()
Destructor for buffer.
Definition Buffer.cpp:48
MANDRILL_API VkMemoryPropertyFlags getProperties() const
Get the memory property flags.
Definition Buffer.h:75
MANDRILL_API VkDeviceSize getSize() const
Get the size of the buffer in bytes.
Definition Buffer.h:110
MANDRILL_API void * getHostMap() const
If the buffer memory is host-coherent, this returns the pointor to the memory.
Definition Buffer.h:97
MANDRILL_API VkDeviceMemory getMemory() const
Get the memory handle.
Definition Buffer.h:57