Class BufferResource

Inheritance Relationships

Base Type

Class Documentation

class inexor::vulkan_renderer::BufferResource : public inexor::vulkan_renderer::RenderResource

Public Functions

inline BufferResource(std::string &&name, BufferUsage usage)
void add_vertex_attribute(VkFormat format, std::uint32_t offset)

Specifies that element offset of this vertex buffer is of format format.

Note

Calling this function is only valid on buffers of type BufferUsage::VERTEX_BUFFER.

inline void set_element_size(std::size_t element_size)

Specifies the element size of the buffer upfront if data is not to be uploaded immediately.

Parameters

element_size – The element size in bytes

template<typename T>
void upload_data(const T *data, std::size_t count)

Specifies the data that should be uploaded to this buffer at the start of the next frame.

Parameters
  • count – The number of elements (not bytes) to upload

  • data – A pointer to a contiguous block of memory that is at least count * sizeof(T) bytes long

template<typename T>
void upload_data(const std::vector<T> &data)

Specifies the data that should be uploaded to this buffer at the start of the next frame.

See

upload_data(const T *data, std::size_t count)

Note

This is equivalent to doing upload_data(data.data(), data.size() * sizeof(T))

Private Members

friend RenderGraph
const BufferUsage m_usage
std::vector<VkVertexInputAttributeDescription> m_vertex_attributes
const void *m_data = {nullptr}
std::size_t m_data_size = {0}
bool m_data_upload_needed = {false}
std::size_t m_element_size = {0}