SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::IGraphicsFactory Class Referenceabstract
Inheritance diagram for spark::render::IGraphicsFactory:
spark::render::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler > spark::render::GraphicsFactory< DescriptorLayoutType, RawBufferType, VertexBufferType, IndexBufferType, ImageType, SamplerType > spark::render::vk::VulkanFactory

Public Member Functions

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 .
 

Member Function Documentation

◆ createAttachment() [1/2]

std::unique_ptr< IImage > spark::render::IGraphicsFactory::createAttachment ( const std::string & name,
Format format,
const math::Vector2< unsigned > & size,
MultiSamplingLevel samples = MultiSamplingLevel::X1 ) const
inlinenodiscard

Creates an Image used as a render target attachment.

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

◆ createAttachment() [2/2]

std::unique_ptr< IImage > spark::render::IGraphicsFactory::createAttachment ( Format format,
const math::Vector2< unsigned > & size,
MultiSamplingLevel samples = MultiSamplingLevel::X1 ) const
inlinenodiscard

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.

◆ createBuffer() [1/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( BufferType type,
BufferUsage usage,
std::size_t element_size,
unsigned elements = 1,
bool allow_write = false ) const
inlinenodiscard

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.

◆ createBuffer() [2/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const IDescriptorSetLayout & descriptor_set,
unsigned binding,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to the specified descriptor_set and binding.

Parameters
descriptor_setThe layout of the descriptor set to bind the buffer to.
bindingThe binding of the descriptor set to bind the buffer to.
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.

◆ createBuffer() [3/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const IDescriptorSetLayout & descriptor_set,
unsigned binding,
BufferUsage usage,
unsigned elements = 1,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to the specified descriptor_set and binding.

Parameters
descriptor_setThe layout of the descriptor set to bind the buffer to.
bindingThe binding of the descriptor set to bind the buffer to.
usageThe buffer usage.
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.

◆ createBuffer() [4/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const IPipeline & pipeline,
unsigned space,
unsigned binding,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.

Parameters
pipelineThe pipeline that provides the descriptor set layout.
spaceThe space the descriptor set is bound to.
bindingThe binding of the descriptor set to bind the buffer to.
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.

◆ createBuffer() [5/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const IPipeline & pipeline,
unsigned space,
unsigned binding,
BufferUsage usage,
unsigned elements = 1,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.

Parameters
pipelineThe pipeline that provides the descriptor set layout.
spaceThe space the descriptor set is bound to.
bindingThe binding of the descriptor set to bind the buffer to.
usageThe buffer usage.
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.

◆ createBuffer() [6/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const std::string & name,
BufferType type,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer of type type.

Parameters
nameThe buffer name.
typeThe buffer type.
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.

◆ createBuffer() [7/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const std::string & name,
const IDescriptorSetLayout & descriptor_set,
unsigned binding,
BufferUsage usage,
std::size_t element_size,
unsigned elements,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.

Parameters
nameThe buffer name.
descriptor_setThe layout of the descriptor set to bind the buffer to.
bindingThe binding of the descriptor set to bind the buffer to.
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_writeThe buffer usage.
Returns
The created IBuffer.

◆ createBuffer() [8/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const std::string & name,
const IDescriptorSetLayout & descriptor_set,
unsigned binding,
BufferUsage usage,
unsigned elements = 1,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to the specified descriptor_set and binding.

Parameters
nameThe buffer name.
descriptor_setThe layout of the descriptor set to bind the buffer to.
bindingThe binding of the descriptor set to bind the buffer to.
usageThe buffer usage.
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.

◆ createBuffer() [9/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( 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
inlinenodiscard

Creates a IBuffer that can be bound to a descriptor set of the specified pipeline, space and binding.

Parameters
nameThe buffer name.
pipelineThe pipeline that provides the descriptor set layout.
spaceThe space the descriptor set is bound to.
bindingThe binding of the descriptor set to bind the buffer to.
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.

◆ createBuffer() [10/10]

std::unique_ptr< IBuffer > spark::render::IGraphicsFactory::createBuffer ( const std::string & name,
const IPipeline & pipeline,
unsigned space,
unsigned binding,
BufferUsage usage,
unsigned elements = 1,
bool allow_write = false ) const
inlinenodiscard

Creates a IBuffer that can be bound to the specified descriptor_set and binding.

Parameters
nameThe buffer name.
pipelineThe pipeline that provides the descriptor set layout.
spaceThe space the descriptor set is bound to.
bindingThe binding of the descriptor set to bind the buffer to.
usageThe buffer usage.
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.

◆ createIndexBuffer() [1/2]

std::unique_ptr< IIndexBuffer > spark::render::IGraphicsFactory::createIndexBuffer ( const IIndexBufferLayout & layout,
BufferUsage usage,
unsigned elements ) const
inlinenodiscard

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< IIndexBuffer > spark::render::IGraphicsFactory::createIndexBuffer ( const std::string & name,
const IIndexBufferLayout & layout,
BufferUsage usage,
unsigned elements ) const
inlinenodiscard

Creates a IVertexBuffer based on layout.

Parameters
nameThe buffer name.
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< ISampler > spark::render::IGraphicsFactory::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
inlinenodiscard

Creates a texture sampler .

Parameters
nameThe sampler name.
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.

◆ createSampler() [2/2]

std::unique_ptr< ISampler > spark::render::IGraphicsFactory::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
inlinenodiscard

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.

◆ createSamplers()

std::vector< std::unique_ptr< ISampler > > spark::render::IGraphicsFactory::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
inlinenodiscard

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.

◆ createTexture() [1/2]

std::unique_ptr< IImage > spark::render::IGraphicsFactory::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
inlinenodiscard

Creates a texture .

Parameters
nameThe image name.
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.

◆ createTexture() [2/2]

std::unique_ptr< IImage > spark::render::IGraphicsFactory::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
inlinenodiscard

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.

◆ createTextures()

std::vector< std::unique_ptr< IImage > > spark::render::IGraphicsFactory::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
inlinenodiscard

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.

◆ createVertexBuffer() [1/2]

std::unique_ptr< IVertexBuffer > spark::render::IGraphicsFactory::createVertexBuffer ( const IVertexBufferLayout & layout,
BufferUsage usage,
unsigned elements = 1 ) const
inlinenodiscard

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< IVertexBuffer > spark::render::IGraphicsFactory::createVertexBuffer ( const std::string & name,
const IVertexBufferLayout & layout,
BufferUsage usage,
unsigned elements = 1 ) const
inlinenodiscard

Creates a IVertexBuffer based on layout.

Parameters
nameThe buffer name.
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.