SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType > Class Template Referenceabstract

Describes a factory that creates objects for a IGraphicsDevice. More...

#include <GraphicsFactory.h>

Inheritance diagram for spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >:
spark::render::IGraphicsFactory

Public Types

using descriptor_layout_type = DescriptorLayoutType
 
using vertex_buffer_type = VertexBufferType
 
using vertex_buffer_layout_type = typename vertex_buffer_type::vertex_buffer_layout_type
 
using index_buffer_type = IndexBufferType
 
using index_buffer_layout_type = typename index_buffer_type::index_buffer_layout_type
 
using buffer_type = RawBufferType
 
using image_type = ImageType
 
using sampler_type = SamplerType
 

Public Member Functions

virtual std::unique_ptr< buffer_type > createBuffer (BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const =0
 Creates a IBuffer of type type.
 
virtual std::unique_ptr< buffer_type > createBuffer (const std::string &name, BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const =0
 Creates a IBuffer of type type.
 
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.
 
virtual std::unique_ptr< image_type > createAttachment (Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const =0
 Creates an Image used as a render target attachment.
 
virtual std::unique_ptr< image_type > createAttachment (const std::string &name, Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const =0
 Creates an Image used as a render target attachment.
 
virtual std::unique_ptr< image_type > createTexture (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 =0
 Creates a texture .
 
virtual std::unique_ptr< image_type > createTexture (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 =0
 Creates a texture .
 
virtual std::vector< std::unique_ptr< image_type > > 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 =0
 Creates an array of textures .
 
virtual std::unique_ptr< sampler_type > createSampler (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 =0
 Creates a texture sampler .
 
virtual std::unique_ptr< sampler_type > createSampler (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 =0
 Creates a texture sampler .
 
virtual std::vector< std::unique_ptr< sampler_type > > 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 =0
 Creates an array of texture samplers .
 
- 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 .
 

Detailed Description

template<typename DescriptorLayoutType, typename RawBufferType, typename VertexBufferType, typename IndexBufferType, typename ImageType, typename SamplerType>
class spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >

Describes a factory that creates objects for a IGraphicsDevice.

Template Parameters
DescriptorLayoutTypeType of the descriptor layout. (inherits from IDescriptorSetLayout)
RawBufferTypeType of the raw buffer. (inherits from IBuffer)
VertexBufferTypeType of the vertex buffer. (inherits from IVertexBuffer)
IndexBufferTypeType of the index buffer. (inherits from IIndexBuffer)
ImageTypeType of the image. (inherits from IImage)
SamplerTypeType of the sampler. (inherits from ISampler)

Member Function Documentation

◆ createAttachment() [1/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< image_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createAttachment ( const std::string & name,
Format format,
const math::Vector2< unsigned > & size,
MultiSamplingLevel samples = MultiSamplingLevel::X1 ) const
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createAttachment() [2/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< image_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createAttachment ( Format format,
const math::Vector2< unsigned > & size,
MultiSamplingLevel samples = MultiSamplingLevel::X1 ) const
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createBuffer() [1/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< buffer_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createBuffer ( BufferType type,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write = false ) const
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createBuffer() [2/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< buffer_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createBuffer ( const std::string & name,
BufferType type,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write = false ) const
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createIndexBuffer() [1/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< index_buffer_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createIndexBuffer ( const index_buffer_layout_type & layout,
BufferUsage usage,
unsigned elements ) const
nodiscardpure virtual

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.

◆ createIndexBuffer() [2/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< index_buffer_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createIndexBuffer ( const std::string & name,
const index_buffer_layout_type & layout,
BufferUsage usage,
unsigned elements ) const
nodiscardpure virtual

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]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< sampler_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createSampler ( 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
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createSampler() [2/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< sampler_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createSampler ( 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
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createSamplers()

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::vector< std::unique_ptr< sampler_type > > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::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
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createTexture() [1/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< image_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createTexture ( 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
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createTexture() [2/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< image_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createTexture ( 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
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createTextures()

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::vector< std::unique_ptr< image_type > > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::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
nodiscardpure virtual

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.

Implemented in spark::render::vk::VulkanFactory.

◆ createVertexBuffer() [1/2]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< vertex_buffer_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createVertexBuffer ( const std::string & name,
const vertex_buffer_layout_type & layout,
BufferUsage usage,
unsigned elements = 1 ) const
nodiscardpure virtual

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]

template<typename DescriptorLayoutType , typename RawBufferType , typename VertexBufferType , typename IndexBufferType , typename ImageType , typename SamplerType >
virtual std::unique_ptr< vertex_buffer_type > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType >::createVertexBuffer ( const vertex_buffer_layout_type & layout,
BufferUsage usage,
unsigned elements = 1 ) const
nodiscardpure virtual

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.