SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::vk::VulkanVertexBuffer Class Referencefinal

Vulkan implementation of a IVertexBuffer. More...

#include <VulkanVertexBuffer.h>

Inheritance diagram for spark::render::vk::VulkanVertexBuffer:
spark::render::vk::VulkanBuffer spark::render::vk::IVulkanVertexBuffer spark::render::vk::IVulkanBuffer spark::render::Resource< VkBuffer > spark::render::StateResource spark::render::vk::IVulkanBuffer spark::render::IVertexBuffer spark::render::IBuffer spark::render::IResource< VkBuffer > spark::render::IResource< VkBuffer > spark::render::IStateResource spark::render::IBuffer spark::render::IResource< VkBuffer > spark::render::IBuffer spark::render::IStateResource spark::render::IMappable spark::render::IDeviceMemory spark::render::IStateResource spark::render::IMappable spark::render::IDeviceMemory spark::render::IStateResource spark::render::IMappable spark::render::IDeviceMemory

Classes

struct  Impl
 

Public Member Functions

 VulkanVertexBuffer (VkBuffer buffer, const VulkanVertexBufferLayout &layout, unsigned elements, const VmaAllocator &allocator, const VmaAllocation &allocation, const std::string &name="")
 
 VulkanVertexBuffer (const VulkanVertexBuffer &other)=delete
 
 VulkanVertexBuffer (VulkanVertexBuffer &&other) noexcept=delete
 
VulkanVertexBufferoperator= (const VulkanVertexBuffer &other)=delete
 
VulkanVertexBufferoperator= (VulkanVertexBuffer &&other) noexcept=delete
 
const VulkanVertexBufferLayoutlayout () const noexcept override
 Gets the layout of the vertex buffer.
 
- Public Member Functions inherited from spark::render::vk::VulkanBuffer
 VulkanBuffer (VkBuffer buffer, BufferType type, unsigned elements, std::size_t element_size, std::size_t alignment, bool writable, const VmaAllocator &allocator, const VmaAllocation &allocation, const std::string &name)
 
 VulkanBuffer (const VulkanBuffer &other)=delete
 
 VulkanBuffer (VulkanBuffer &&other) noexcept=delete
 
VulkanBufferoperator= (const VulkanBuffer &other)=delete
 
VulkanBufferoperator= (VulkanBuffer &&other) noexcept=delete
 
BufferType type () const override
 Gets the type of the buffer.
 
unsigned elements () const noexcept override
 Get the number of sub-resources in the memory chunk.
 
std::size_t size () const noexcept override
 Gets the size (in bytes) of the memory chunk.
 
std::size_t elementSize () const noexcept override
 Gets the size (in bytes) of one element in the memory chunk. If there is only one element, this equals the result of IDeviceMemory::size().
 
std::size_t elementAlignment () const override
 Gets the alignment of one element in the memory chunk.
 
std::size_t alignedElementSize () const noexcept override
 Gets the real size (in bytes) of the memory chunk.
 
bool writable () const noexcept override
 Checks if the resource can be bound to a read/write descriptor.
 
void map (const void *data, std::size_t size, unsigned element) override
 Maps the memory at data into the internal memory of the object.
 
void map (std::span< const void * > data, std::size_t element_size, unsigned first_element) override
 Maps the memory at data into the internal memory of the object.
 
void map (void *data, size_t size, unsigned element, bool write) override
 Maps the memory at data into the internal memory of the object.
 
void map (std::span< void * > data, size_t element_size, unsigned first_element, bool write) override
 Maps the memory at data into the internal memory of the object.
 
- Public Member Functions inherited from spark::render::IMappable
virtual void map (const void *data, std::size_t size, unsigned int element)=0
 Maps the memory at data into the internal memory of the object.
 
virtual void map (std::span< const void * > data, std::size_t element_size, unsigned int first_element)=0
 Maps the memory blocks within data into the internal memory of the object.
 
virtual void map (void *data, size_t size, unsigned int element=0, bool write=true)=0
 Maps the memory at data into the internal memory of the object.
 
virtual void map (std::span< void * > data, size_t element_size, unsigned int first_element=0, bool write=true)=0
 Maps the memory blocks within data into the internal memory of the object.
 
- Public Member Functions inherited from spark::render::Resource< VkBuffer >
 Resource (VkBuffer handle) noexcept
 Initializes the managed resource with the given handle.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other) noexcept=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other) noexcept=delete
 
const VkBuffer & handle () const final
 Gets the managed resource handle.
 
- Public Member Functions inherited from spark::render::StateResource
 StateResource (std::string_view name) noexcept
 Initializes a new StateResource instance.
 
 StateResource (const StateResource &other)=delete
 
 StateResource (StateResource &&other) noexcept
 
StateResourceoperator= (const StateResource &other)=delete
 
StateResourceoperator= (StateResource &&other) noexcept
 
const std::string & name () const noexcept final
 Gets the name of the state resource.
 

Static Public Member Functions

static std::unique_ptr< IVulkanVertexBufferAllocate (const VulkanVertexBufferLayout &layout, unsigned elements, const VmaAllocator &allocator, const VkBufferCreateInfo &create_info, const VmaAllocationCreateInfo &allocation_info, VmaAllocationInfo *allocation_result=nullptr)
 
static std::unique_ptr< IVulkanVertexBufferAllocate (const std::string &name, const VulkanVertexBufferLayout &layout, unsigned elements, const VmaAllocator &allocator, const VkBufferCreateInfo &create_info, const VmaAllocationCreateInfo &allocation_info, VmaAllocationInfo *allocation_result=nullptr)
 
- Static Public Member Functions inherited from spark::render::vk::VulkanBuffer
static std::unique_ptr< IVulkanBufferAllocate (BufferType type, unsigned elements, std::size_t element_size, std::size_t alignment, bool writable, const VmaAllocator &allocator, const VkBufferCreateInfo &create_info, const VmaAllocationCreateInfo &allocation_info, VmaAllocationInfo *allocation_result=nullptr)
 
static std::unique_ptr< IVulkanBufferAllocate (const std::string &name, BufferType type, unsigned elements, std::size_t element_size, std::size_t alignment, bool writable, const VmaAllocator &allocator, const VkBufferCreateInfo &create_info, const VmaAllocationCreateInfo &allocation_info, VmaAllocationInfo *allocation_result=nullptr)
 

Additional Inherited Members

- Public Types inherited from spark::render::IResource< VkBuffer >
using handle_type
 
- Public Types inherited from spark::render::vk::IVulkanVertexBuffer
using vertex_buffer_layout_type = VulkanVertexBufferLayout
 
- Protected Member Functions inherited from spark::render::Resource< VkBuffer >
VkBuffer & handle () final
 Gets the managed resource handle.
 
- Protected Member Functions inherited from spark::render::StateResource
 StateResource () noexcept
 Initializes a new StateResource instance with an empty name.
 
std::string & name () noexcept
 Gets the name of the state resource.
 

Detailed Description

Vulkan implementation of a IVertexBuffer.

Constructor & Destructor Documentation

◆ VulkanVertexBuffer()

spark::render::vk::VulkanVertexBuffer::VulkanVertexBuffer ( VkBuffer buffer,
const VulkanVertexBufferLayout & layout,
unsigned elements,
const VmaAllocator & allocator,
const VmaAllocation & allocation,
const std::string & name = "" )
explicit
Parameters
buffer
layout
elements
allocator
allocation
name

Member Function Documentation

◆ Allocate() [1/2]

std::unique_ptr< IVulkanVertexBuffer > spark::render::vk::VulkanVertexBuffer::Allocate ( const std::string & name,
const VulkanVertexBufferLayout & layout,
unsigned elements,
const VmaAllocator & allocator,
const VkBufferCreateInfo & create_info,
const VmaAllocationCreateInfo & allocation_info,
VmaAllocationInfo * allocation_result = nullptr )
static
Parameters
name
layout
elements
allocator
create_info
allocation_info
allocation_result
Returns

◆ Allocate() [2/2]

std::unique_ptr< IVulkanVertexBuffer > spark::render::vk::VulkanVertexBuffer::Allocate ( const VulkanVertexBufferLayout & layout,
unsigned elements,
const VmaAllocator & allocator,
const VkBufferCreateInfo & create_info,
const VmaAllocationCreateInfo & allocation_info,
VmaAllocationInfo * allocation_result = nullptr )
static
Parameters
layout
elements
allocator
create_info
allocation_info
allocation_result
Returns

◆ layout()

const VulkanVertexBufferLayout & spark::render::vk::VulkanVertexBuffer::layout ( ) const
nodiscardoverridevirtualnoexcept

Gets the layout of the vertex buffer.

Returns
A IVertexBufferLayout representing the layout of the vertex buffer.

Implements spark::render::IVertexBuffer.