Class for buffer. More...
#include <Buffer.hpp>
 Collaboration diagram for ven::Buffer:Public Member Functions | |
| Buffer (Device &device, VkDeviceSize instanceSize, uint32_t instanceCount, VkBufferUsageFlags usageFlags, VkMemoryPropertyFlags memoryPropertyFlags, VkDeviceSize minOffsetAlignment=1) | |
| ~Buffer () | |
| Buffer (const Buffer &)=delete | |
| Buffer & | operator= (const Buffer &)=delete | 
| Buffer (Buffer &&)=delete | |
| Buffer & | operator= (Buffer &&)=delete | 
| VkResult | map (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) | 
| Map a memory range of this buffer.   | |
| void | unmap () | 
| Unmap a mapped memory range.   | |
| void | writeToBuffer (const void *data, VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) const | 
| Copies the specified data to the mapped buffer.   | |
| VkResult | flush (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) const | 
| Flush a memory range of the buffer to make it visible to the device.   | |
| VkDescriptorBufferInfo | descriptorInfo (const VkDeviceSize size=VK_WHOLE_SIZE, const VkDeviceSize offset=0) const | 
| Create a buffer info descriptor.   | |
| VkResult | invalidate (VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0) const | 
| Invalidate a memory range of the buffer to make it visible to the host.   | |
| void | writeToIndex (const void *data, const VkDeviceSize index) const | 
| Copies "instanceSize" bytes of data to the mapped buffer at an offset of index * alignmentSize.   | |
| VkResult | flushIndex (const VkDeviceSize index) const | 
| Flush the memory range at index * alignmentSize of the buffer to make it visible to the device.   | |
| VkDescriptorBufferInfo | descriptorInfoForIndex (const VkDeviceSize index) const | 
| Create a buffer info descriptor.   | |
| VkResult | invalidateIndex (const VkDeviceSize index) const | 
| Invalidate a memory range of the buffer to make it visible to the host.   | |
| VkBuffer | getBuffer () const | 
| void * | getMappedMemory () const | 
| uint32_t | getInstanceCount () const | 
| VkDeviceSize | getInstanceSize () const | 
| VkDeviceSize | getAlignmentSize () const | 
| VkBufferUsageFlags | getUsageFlags () const | 
| VkMemoryPropertyFlags | getMemoryPropertyFlags () const | 
| VkDeviceSize | getBufferSize () const | 
Static Private Member Functions | |
| static VkDeviceSize | getAlignment (const VkDeviceSize instanceSize, const VkDeviceSize minOffsetAlignment) | 
| Returns the minimum instance size required to be compatible with devices minOffsetAlignment.   | |
Private Attributes | |
| Device & | m_device | 
| void * | m_mapped = nullptr | 
| VkBuffer | m_buffer = VK_NULL_HANDLE | 
| VkDeviceMemory | m_memory = VK_NULL_HANDLE | 
| VkDeviceSize | m_bufferSize | 
| VkDeviceSize | m_instanceSize | 
| uint32_t | m_instanceCount | 
| VkDeviceSize | m_alignmentSize | 
| VkBufferUsageFlags | m_usageFlags | 
| VkMemoryPropertyFlags | m_memoryPropertyFlags | 
Class for buffer.
Definition at line 20 of file Buffer.hpp.
| ven::Buffer::Buffer | ( | Device & | device, | 
| VkDeviceSize | instanceSize, | ||
| uint32_t | instanceCount, | ||
| VkBufferUsageFlags | usageFlags, | ||
| VkMemoryPropertyFlags | memoryPropertyFlags, | ||
| VkDeviceSize | minOffsetAlignment = 1 ) | 
Definition at line 5 of file buffer.cpp.
References ven::Device::createBuffer(), m_alignmentSize, m_buffer, m_bufferSize, m_instanceCount, m_memory, m_memoryPropertyFlags, and m_usageFlags.
 Here is the call graph for this function:| ven::Buffer::~Buffer | ( | ) | 
Definition at line 11 of file buffer.cpp.
      
  | 
  delete | 
      
  | 
  delete | 
      
  | 
  inlinenodiscard | 
Create a buffer info descriptor.
| size | (Optional) Size of the memory range of the descriptor | 
| offset | (Optional) Byte offset from beginning | 
Definition at line 78 of file Buffer.hpp.
References m_buffer.
Referenced by descriptorInfoForIndex().
 Here is the caller graph for this function:
      
  | 
  inlinenodiscard | 
Create a buffer info descriptor.
| index | Specifies the region given by index * alignmentSize | 
Definition at line 117 of file Buffer.hpp.
References descriptorInfo(), and m_alignmentSize.
 Here is the call graph for this function:| VkResult ven::Buffer::flush | ( | VkDeviceSize | size = VK_WHOLE_SIZE, | 
| VkDeviceSize | offset = 0 ) const | 
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 45 of file buffer.cpp.
Referenced by flushIndex().
 Here is the caller graph for this function:
      
  | 
  inline | 
Flush the memory range at index * alignmentSize of the buffer to make it visible to the device.
| index | Used in offset calculation | 
Definition at line 107 of file Buffer.hpp.
References flush(), ven::Device::getProperties(), m_alignmentSize, and m_device.
 Here is the call graph for this function:
      
  | 
  inlinestaticprivate | 
Returns the minimum instance size required to be compatible with devices minOffsetAlignment.
| instanceSize | The size of an instance | 
| minOffsetAlignment | The minimum required alignment, in bytes, for the offset member (eg minUniformBufferOffsetAlignment) | 
Definition at line 149 of file Buffer.hpp.
      
  | 
  inlinenodiscard | 
Definition at line 134 of file Buffer.hpp.
References m_alignmentSize.
      
  | 
  inlinenodiscard | 
Definition at line 130 of file Buffer.hpp.
References m_buffer.
      
  | 
  inlinenodiscard | 
Definition at line 137 of file Buffer.hpp.
References m_bufferSize.
      
  | 
  inlinenodiscard | 
Definition at line 132 of file Buffer.hpp.
References m_instanceCount.
      
  | 
  inlinenodiscard | 
Definition at line 133 of file Buffer.hpp.
References m_instanceSize.
      
  | 
  inlinenodiscard | 
Definition at line 131 of file Buffer.hpp.
References m_mapped.
      
  | 
  inlinenodiscard | 
Definition at line 136 of file Buffer.hpp.
References m_memoryPropertyFlags.
      
  | 
  inlinenodiscard | 
Definition at line 135 of file Buffer.hpp.
References m_usageFlags.
      
  | 
  nodiscard | 
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 55 of file buffer.cpp.
Referenced by invalidateIndex().
 Here is the caller graph for this function:
      
  | 
  inlinenodiscard | 
Invalidate a memory range of the buffer to make it visible to the host.
| index | Specifies the region to invalidate: index * alignmentSize | 
Definition at line 128 of file Buffer.hpp.
References invalidate(), and m_alignmentSize.
 Here is the call graph for this function:| VkResult ven::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 18 of file buffer.cpp.
Referenced by ven::Model::createIndexBuffer(), and ven::Model::createVertexBuffer().
 Here is the caller graph for this function:| void ven::Buffer::unmap | ( | ) | 
Unmap a mapped memory range.
Definition at line 24 of file buffer.cpp.
| void ven::Buffer::writeToBuffer | ( | const void * | data, | 
| VkDeviceSize | size = VK_WHOLE_SIZE, | ||
| VkDeviceSize | offset = 0 ) const | 
Copies the specified data to the mapped buffer.
Default value writes whole buffer range
| data | Pointer to the data to copy | 
| size | (Optional) Size of the data to copy. Pass VK_WHOLE_SIZE to flush the complete buffer range. | 
| offset | (Optional) Byte offset from beginning of mapped region | 
Definition at line 32 of file buffer.cpp.
Referenced by writeToIndex().
 Here is the caller graph for this function:
      
  | 
  inline | 
Copies "instanceSize" bytes of data to the mapped buffer at an offset of index * alignmentSize.
| data | Pointer to the data to copy | 
| index | Used in offset calculation | 
Definition at line 100 of file Buffer.hpp.
References m_alignmentSize, m_instanceSize, and writeToBuffer().
 Here is the call graph for this function:
      
  | 
  private | 
Definition at line 159 of file Buffer.hpp.
Referenced by Buffer(), descriptorInfoForIndex(), flushIndex(), getAlignmentSize(), invalidateIndex(), and writeToIndex().
      
  | 
  private | 
Definition at line 153 of file Buffer.hpp.
Referenced by Buffer(), descriptorInfo(), and getBuffer().
      
  | 
  private | 
Definition at line 156 of file Buffer.hpp.
Referenced by Buffer(), and getBufferSize().
      
  | 
  private | 
Definition at line 151 of file Buffer.hpp.
Referenced by flushIndex().
      
  | 
  private | 
Definition at line 158 of file Buffer.hpp.
Referenced by Buffer(), and getInstanceCount().
      
  | 
  private | 
Definition at line 157 of file Buffer.hpp.
Referenced by getInstanceSize(), and writeToIndex().
      
  | 
  private | 
Definition at line 152 of file Buffer.hpp.
Referenced by getMappedMemory().
      
  | 
  private | 
Definition at line 154 of file Buffer.hpp.
Referenced by Buffer().
      
  | 
  private | 
Definition at line 161 of file Buffer.hpp.
Referenced by Buffer(), and getMemoryPropertyFlags().
      
  | 
  private | 
Definition at line 160 of file Buffer.hpp.
Referenced by Buffer(), and getUsageFlags().