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

Vulkan implementation of IGraphicsFactory. More...

#include <VulkanFactory.h>

Inheritance diagram for spark::render::vk::VulkanFactory:
spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler > spark::render::IGraphicsFactory

Classes

struct  Impl
 

Public Member Functions

 VulkanFactory (const VulkanDevice &device)
 Creates a new VulkanFactory.
 
 VulkanFactory (const VulkanFactory &other)=delete
 
 VulkanFactory (VulkanFactory &&other) noexcept=delete
 
VulkanFactoryoperator= (const VulkanFactory &other)=delete
 
VulkanFactoryoperator= (VulkanFactory &&other) noexcept=delete
 
std::unique_ptr< IVulkanBuffercreateBuffer (BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write) const override
 Creates a IBuffer of type type.
 
std::unique_ptr< IVulkanBuffercreateBuffer (const std::string &name, BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write) const override
 Creates a IBuffer of type type.
 
std::unique_ptr< IVulkanVertexBuffercreateVertexBuffer (const VulkanVertexBufferLayout &layout, BufferUsage usage, unsigned elements) const override
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IVulkanVertexBuffercreateVertexBuffer (const std::string &name, const VulkanVertexBufferLayout &layout, BufferUsage usage, unsigned elements) const override
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IVulkanIndexBuffercreateIndexBuffer (const VulkanIndexBufferLayout &layout, BufferUsage usage, unsigned elements) const override
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IVulkanIndexBuffercreateIndexBuffer (const std::string &name, const VulkanIndexBufferLayout &layout, BufferUsage usage, unsigned elements) const override
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IVulkanImagecreateAttachment (Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples) const override
 Creates an Image used as a render target attachment.
 
std::unique_ptr< IVulkanImagecreateAttachment (const std::string &name, Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples) const override
 Creates an Image used as a render target attachment.
 
std::unique_ptr< IVulkanImagecreateTexture (Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension, unsigned levels, unsigned layers, MultiSamplingLevel samples, bool allow_write) const override
 Creates a texture .
 
std::unique_ptr< IVulkanImagecreateTexture (const std::string &name, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension, unsigned levels, unsigned layers, MultiSamplingLevel samples, bool allow_write) const override
 Creates a texture .
 
std::vector< std::unique_ptr< IVulkanImage > > createTextures (std::size_t elements, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension, unsigned layers, unsigned levels, MultiSamplingLevel samples, bool allow_write) const override
 Creates an array of textures .
 
std::unique_ptr< IVulkanSamplercreateSampler (FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode, float mip_map_bias, float max_lod, float min_lod, float anisotropy) const override
 Creates a texture sampler .
 
std::unique_ptr< IVulkanSamplercreateSampler (const std::string &name, FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode, float mip_map_bias, float max_lod, float min_lod, float anisotropy) const override
 Creates a texture sampler .
 
std::vector< std::unique_ptr< IVulkanSampler > > createSamplers (std::size_t elements, FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode, float mip_map_bias, float max_lod, float min_lod, float anisotropy) const override
 Creates an array of texture samplers .
 
- Public Member Functions inherited from spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >
virtual std::unique_ptr< vertex_buffer_type > createVertexBuffer (const vertex_buffer_layout_type &layout, BufferUsage usage, unsigned elements=1) const=0
 Creates a IVertexBuffer based on layout.
 
virtual std::unique_ptr< vertex_buffer_type > createVertexBuffer (const std::string &name, const vertex_buffer_layout_type &layout, BufferUsage usage, unsigned elements=1) const=0
 Creates a IVertexBuffer based on layout.
 
virtual std::unique_ptr< index_buffer_type > createIndexBuffer (const index_buffer_layout_type &layout, BufferUsage usage, unsigned elements) const=0
 Creates a IVertexBuffer based on layout.
 
virtual std::unique_ptr< index_buffer_type > createIndexBuffer (const std::string &name, const index_buffer_layout_type &layout, BufferUsage usage, unsigned elements) const=0
 Creates a IVertexBuffer based on layout.
 
- Public Member Functions inherited from spark::render::IGraphicsFactory
std::unique_ptr< IBuffercreateBuffer (BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements=1, bool allow_write=false) const
 Creates a IBuffer of type type.
 
std::unique_ptr< IBuffercreateBuffer (const std::string &name, BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
 Creates a IBuffer of type type.
 
std::unique_ptr< IBuffercreateBuffer (const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
 Creates a IBuffer that can be bound to the specified descriptor_set and binding.
 
std::unique_ptr< IBuffercreateBuffer (const std::string &name, const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
 Creates a IBuffer that can be bound to the specified descriptor_set and binding.
 
std::unique_ptr< IBuffercreateBuffer (const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
 Creates a IBuffer that can be bound to the specified descriptor_set and binding.
 
std::unique_ptr< IBuffercreateBuffer (const std::string &name, const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
 Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.
 
std::unique_ptr< IBuffercreateBuffer (const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
 Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.
 
std::unique_ptr< IBuffercreateBuffer (const std::string &name, const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
 Creates a IBuffer that can be bound to the specified descriptor_set and binding.
 
std::unique_ptr< IBuffercreateBuffer (const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
 Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.
 
std::unique_ptr< IBuffercreateBuffer (const std::string &name, const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements=1, bool allow_write=false) const
 Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.
 
std::unique_ptr< IVertexBuffercreateVertexBuffer (const IVertexBufferLayout &layout, BufferUsage usage, unsigned elements=1) const
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IVertexBuffercreateVertexBuffer (const std::string &name, const IVertexBufferLayout &layout, BufferUsage usage, unsigned elements=1) const
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IIndexBuffercreateIndexBuffer (const IIndexBufferLayout &layout, BufferUsage usage, unsigned elements) const
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IIndexBuffercreateIndexBuffer (const std::string &name, const IIndexBufferLayout &layout, BufferUsage usage, unsigned elements) const
 Creates a IVertexBuffer based on layout.
 
std::unique_ptr< IImagecreateAttachment (Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const
 Creates an Image used as a render target attachment.
 
std::unique_ptr< IImagecreateAttachment (const std::string &name, Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const
 Creates an Image used as a render target attachment.
 
std::unique_ptr< IImagecreateTexture (Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned levels=1, unsigned layers=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const
 Creates a texture .
 
std::unique_ptr< IImagecreateTexture (const std::string &name, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned levels=1, unsigned layers=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const
 Creates a texture .
 
std::vector< std::unique_ptr< IImage > > createTextures (std::size_t elements, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned layers=1, unsigned levels=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const
 Creates an array of textures .
 
std::unique_ptr< ISamplercreateSampler (FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const
 Creates a texture sampler .
 
std::unique_ptr< ISamplercreateSampler (const std::string &name, FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const
 Creates a texture sampler .
 
std::vector< std::unique_ptr< ISampler > > createSamplers (std::size_t elements, FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const
 Creates an array of texture samplers .
 

Additional Inherited Members

- Public Types inherited from spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >
using descriptor_layout_type
 
using vertex_buffer_type
 
using vertex_buffer_layout_type
 
using index_buffer_type
 
using index_buffer_layout_type
 
using buffer_type
 
using image_type
 
using sampler_type
 

Detailed Description

Vulkan implementation of IGraphicsFactory.

Constructor & Destructor Documentation

◆ VulkanFactory()

spark::render::vk::VulkanFactory::VulkanFactory ( const VulkanDevice & device)
explicit

Creates a new VulkanFactory.

Parameters
deviceThe device the factory should produce objects for.

Member Function Documentation

◆ createAttachment() [1/2]

std::unique_ptr< IVulkanImage > spark::render::vk::VulkanFactory::createAttachment ( const std::string & name,
Format format,
const math::Vector2< unsigned > & size,
MultiSamplingLevel samples ) const
nodiscardoverridevirtual

Creates an Image used as a render target attachment.

Parameters
formatThe image format.
sizeThe extent of the image.
samplesThe number of samples the image should be sampled with.
Returns
The created IImage.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createAttachment() [2/2]

std::unique_ptr< IVulkanImage > spark::render::vk::VulkanFactory::createAttachment ( Format format,
const math::Vector2< unsigned > & size,
MultiSamplingLevel samples ) const
nodiscardoverridevirtual

Creates an Image used as a render target attachment.

Parameters
formatThe image format.
sizeThe extent of the image.
samplesThe number of samples the image should be sampled with.
Returns
The created IImage.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createBuffer() [1/2]

std::unique_ptr< IVulkanBuffer > spark::render::vk::VulkanFactory::createBuffer ( BufferType type,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write ) const
nodiscardoverridevirtual

Creates a IBuffer of type type.

Parameters
typeThe type of buffer to create.
usageThe buffer usage.
element_sizeThe size of each element in the buffer. (in bytes)
elementsThe number of elements in the buffer. (if the buffer is an array).
allow_writetrue to allow the resource to be bound to a read/write descriptor.
Returns
The created IBuffer.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createBuffer() [2/2]

std::unique_ptr< IVulkanBuffer > spark::render::vk::VulkanFactory::createBuffer ( const std::string & name,
BufferType type,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write ) const
nodiscardoverridevirtual

Creates a IBuffer of type type.

Parameters
typeThe type of buffer to create.
usageThe buffer usage.
element_sizeThe size of each element in the buffer. (in bytes)
elementsThe number of elements in the buffer. (if the buffer is an array).
allow_writetrue to allow the resource to be bound to a read/write descriptor.
Returns
The created IBuffer.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createIndexBuffer() [1/2]

std::unique_ptr< IVulkanIndexBuffer > spark::render::vk::VulkanFactory::createIndexBuffer ( const std::string & name,
const VulkanIndexBufferLayout & layout,
BufferUsage usage,
unsigned elements ) const
nodiscardoverride

Creates a IVertexBuffer based on layout.

Parameters
layoutThe vertex buffer layout.
usageThe buffer usage.
elementsThe number of elements in the buffer. (if the buffer is an array).
Returns
The created IVertexBuffer.

An index buffer can be used by different render pipelines as long as they share a common input assembler state. The size of the buffer is computed from the element size index buffer layout, times the number of elements given by the elements parameter.

◆ createIndexBuffer() [2/2]

std::unique_ptr< IVulkanIndexBuffer > spark::render::vk::VulkanFactory::createIndexBuffer ( const VulkanIndexBufferLayout & layout,
BufferUsage usage,
unsigned elements ) const
nodiscardoverride

Creates a IVertexBuffer based on layout.

Parameters
layoutThe vertex buffer layout.
usageThe buffer usage.
elementsThe number of elements in the buffer. (if the buffer is an array).
Returns
The created IVertexBuffer.

An index buffer can be used by different render pipelines as long as they share a common input assembler state. The size of the buffer is computed from the element size index buffer layout, times the number of elements given by the elements parameter.

◆ createSampler() [1/2]

std::unique_ptr< IVulkanSampler > spark::render::vk::VulkanFactory::createSampler ( const std::string & name,
FilterMode mag_filter,
FilterMode min_filter,
BorderMode border_u,
BorderMode border_v,
BorderMode border_w,
MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy ) const
nodiscardoverridevirtual

Creates a texture sampler .

Parameters
mag_filterThe filter mode to use for magnification.
min_filterThe filter mode to use for minification.
border_uThe border mode to use along the u-axis.
border_vThe border mode to use along the v-axis.
border_wThe border mode to use along the w-axis.
mip_map_modeThe mip map mode to use.
mip_map_biasThe mip map bias to use.
max_lodThe maximum level of detail to use.
min_lodThe minimum level of detail to use.
anisotropyThe anisotropy level to use.
Returns
The created ISampler.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createSampler() [2/2]

std::unique_ptr< IVulkanSampler > spark::render::vk::VulkanFactory::createSampler ( FilterMode mag_filter,
FilterMode min_filter,
BorderMode border_u,
BorderMode border_v,
BorderMode border_w,
MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy ) const
nodiscardoverridevirtual

Creates a texture sampler .

Parameters
mag_filterThe filter mode to use for magnification.
min_filterThe filter mode to use for minification.
border_uThe border mode to use along the u-axis.
border_vThe border mode to use along the v-axis.
border_wThe border mode to use along the w-axis.
mip_map_modeThe mip map mode to use.
mip_map_biasThe mip map bias to use.
max_lodThe maximum level of detail to use.
min_lodThe minimum level of detail to use.
anisotropyThe anisotropy level to use.
Returns
The created ISampler.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createSamplers()

std::vector< std::unique_ptr< IVulkanSampler > > spark::render::vk::VulkanFactory::createSamplers ( std::size_t elements,
FilterMode mag_filter,
FilterMode min_filter,
BorderMode border_u,
BorderMode border_v,
BorderMode border_w,
MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy ) const
nodiscardoverridevirtual

Creates an array of texture samplers .

Parameters
elementsThe number of samplers to create.
mag_filterThe filter mode to use for magnification of each sampler.
min_filterThe filter mode to use for minification of each sampler.
border_uThe border mode to use along the u-axis of each sampler.
border_vThe border mode to use along the v-axis of each sampler.
border_wThe border mode to use along the w-axis of each sampler.
mip_map_modeThe mip map mode to use of each sampler.
mip_map_biasThe mip map bias to use of each sampler.
max_lodThe maximum level of detail to use of each sampler.
min_lodThe minimum level of detail to use of each sampler.
anisotropyThe anisotropy level to use of each sampler.
Returns
The created std::vector of samplers.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createTexture() [1/2]

std::unique_ptr< IVulkanImage > spark::render::vk::VulkanFactory::createTexture ( const std::string & name,
Format format,
const math::Vector3< unsigned > & size,
ImageDimensions dimension,
unsigned levels,
unsigned layers,
MultiSamplingLevel samples,
bool allow_write ) const
nodiscardoverridevirtual

Creates a texture .

Parameters
formatThe image format.
sizeThe extent of the image.
dimensionThe image dimension.
levelsThe number of mipmap levels.
layersThe number of layers.
samplesThe number of samples the image should be sampled with.
allow_writetrue to allow the resource to be bound to a read/write descriptor.
Returns
The created IImage.

A texture is always backed by GPU-only visible memory and thus can only be transferred to/from. Thus you typically have to create a buffer using IGraphicsFactory::createBuffer() first that holds the actual image bytes. You than can transfer/copy the contents into the texture.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createTexture() [2/2]

std::unique_ptr< IVulkanImage > spark::render::vk::VulkanFactory::createTexture ( Format format,
const math::Vector3< unsigned > & size,
ImageDimensions dimension,
unsigned levels,
unsigned layers,
MultiSamplingLevel samples,
bool allow_write ) const
nodiscardoverridevirtual

Creates a texture .

Parameters
formatThe image format.
sizeThe extent of the image.
dimensionThe image dimension.
levelsThe number of mipmap levels.
layersThe number of layers.
samplesThe number of samples the image should be sampled with.
allow_writetrue to allow the resource to be bound to a read/write descriptor.
Returns
The created IImage.

A texture is always backed by GPU-only visible memory and thus can only be transferred to/from. Thus you typically have to create a buffer using IGraphicsFactory::createBuffer() first that holds the actual image bytes. You than can transfer/copy the contents into the texture.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createTextures()

std::vector< std::unique_ptr< IVulkanImage > > spark::render::vk::VulkanFactory::createTextures ( std::size_t elements,
Format format,
const math::Vector3< unsigned > & size,
ImageDimensions dimension,
unsigned layers,
unsigned levels,
MultiSamplingLevel samples,
bool allow_write ) const
nodiscardoverridevirtual

Creates an array of textures .

Parameters
elementsThe number of textures to create.
formatThe images format.
sizeThe extent of each image.
dimensionThe dimension of each image.
layersThe number of layers of each image.
levelsThe number of mipmap levels of each image.
samplesThe number of samples of each image.
allow_writetrue to allow the resource to be bound to a read/write descriptor.
Returns
The created std::vector of textures.

Implements spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >.

◆ createVertexBuffer() [1/2]

std::unique_ptr< IVulkanVertexBuffer > spark::render::vk::VulkanFactory::createVertexBuffer ( const std::string & name,
const VulkanVertexBufferLayout & layout,
BufferUsage usage,
unsigned elements ) const
nodiscardoverride

Creates a IVertexBuffer based on layout.

Parameters
layoutThe vertex buffer layout.
usageThe buffer usage.
elementsThe number of elements in the buffer. (if the buffer is an array).
Returns
The created IVertexBuffer.

A vertex buffer can be used by different render pipelines as long as they share a common input assembler state. The size of the buffer is computed from the element size vertex buffer layout, times the number of elements given by the elements parameter.

◆ createVertexBuffer() [2/2]

std::unique_ptr< IVulkanVertexBuffer > spark::render::vk::VulkanFactory::createVertexBuffer ( const VulkanVertexBufferLayout & layout,
BufferUsage usage,
unsigned elements ) const
nodiscardoverride

Creates a IVertexBuffer based on layout.

Parameters
layoutThe vertex buffer layout.
usageThe buffer usage.
elementsThe number of elements in the buffer. (if the buffer is an array).
Returns
The created IVertexBuffer.

A vertex buffer can be used by different render pipelines as long as they share a common input assembler state. The size of the buffer is computed from the element size vertex buffer layout, times the number of elements given by the elements parameter.