Mandrill 2025.6.0
Loading...
Searching...
No Matches
Mandrill::Buffer Class Reference

Buffer class for managing Vulkan buffers. This class handles the creation and destruction of buffers, as well as basic memory management. More...

#include <Buffer.h>

Public Member Functions

MANDRILL_API Buffer (ptr< Device > pDevice, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties)
 Create a new buffer.
 
MANDRILL_API ~Buffer ()
 Destructor for buffer.
 
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, a staging buffer will be used to transfer the data.
 
MANDRILL_API VkBuffer getBuffer () const
 Get the buffer handle.
 
MANDRILL_API VkDeviceMemory getMemory () const
 Get the memory handle.
 
MANDRILL_API VkBufferUsageFlags getUsage () const
 Get the buffer usage flags.
 
MANDRILL_API VkMemoryPropertyFlags getProperties () const
 Get the memory property flags.
 
MANDRILL_API VkDeviceAddress getDeviceAddress () const
 Get the device address of the buffer.
 
MANDRILL_API void * getHostMap () const
 If the buffer memory is host-coherent, this returns the pointor to the memory.
 
MANDRILL_API VkDeviceSize getSize () const
 Get the size of the buffer in bytes.
 

Detailed Description

Buffer class for managing Vulkan buffers. This class handles the creation and destruction of buffers, as well as basic memory management.

Constructor & Destructor Documentation

◆ Buffer()

Buffer::Buffer ( ptr< Device pDevice,
VkDeviceSize  size,
VkBufferUsageFlags  usage,
VkMemoryPropertyFlags  properties 
)

Create a new buffer.

Parameters
pDeviceDevice to use
sizeSize of buffer in bytes
usageHow the buffer will be used
propertiesWhat properties the memory should have

Member Function Documentation

◆ copyFromHost()

void Buffer::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, a staging buffer will be used to transfer the data.

Parameters
pDataData to copy
sizeSize of data to copy in bytes
offsetOffset into the buffer where to place the data
Returns

◆ getBuffer()

MANDRILL_API VkBuffer Mandrill::Buffer::getBuffer ( ) const
inline

Get the buffer handle.

Returns
Vulkan buffer handle

◆ getDeviceAddress()

MANDRILL_API VkDeviceAddress Mandrill::Buffer::getDeviceAddress ( ) const
inline

Get the device address of the buffer.

Returns
A vulkan device address

◆ getHostMap()

MANDRILL_API void * Mandrill::Buffer::getHostMap ( ) const
inline

If the buffer memory is host-coherent, this returns the pointor to the memory.

Returns
Pointer to buffer memory, or nullptr

◆ getMemory()

MANDRILL_API VkDeviceMemory Mandrill::Buffer::getMemory ( ) const
inline

Get the memory handle.

Returns
Vulkan device memory handle

◆ getProperties()

MANDRILL_API VkMemoryPropertyFlags Mandrill::Buffer::getProperties ( ) const
inline

Get the memory property flags.

Returns
Memory property flags

◆ getSize()

MANDRILL_API VkDeviceSize Mandrill::Buffer::getSize ( ) const
inline

Get the size of the buffer in bytes.

Returns
Size of the buffer

◆ getUsage()

MANDRILL_API VkBufferUsageFlags Mandrill::Buffer::getUsage ( ) const
inline

Get the buffer usage flags.

Returns
Usage flags

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