LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::IGraphicsFactory Class Referenceabstract

The interface for a graphics factory. More...

#include <rendering_api.hpp>

Inherited by LiteFX::Rendering::GraphicsFactory< DirectX12DescriptorLayout, IDirectX12Buffer, IDirectX12VertexBuffer, IDirectX12IndexBuffer, IDirectX12Image, IDirectX12Sampler >, LiteFX::Rendering::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler >, and LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >.

Public Member Functions

virtual ~IGraphicsFactory () noexcept=default
 
UniquePtr< IBuffercreateBuffer (const BufferType &type, const BufferUsage &usage, const size_t &elementSize, const UInt32 &elements=1, const bool &allowWrite=false) const
 Creates a buffer of type type . More...
 
UniquePtr< IBuffercreateBuffer (const String &name, const BufferType &type, const BufferUsage &usage, const size_t &elementSize, const UInt32 &elements=1, const bool &allowWrite=false) const
 Creates a buffer of type type . More...
 
UniquePtr< IVertexBuffercreateVertexBuffer (const IVertexBufferLayout &layout, const BufferUsage &usage, const UInt32 &elements=1) const
 Creates a vertex buffer, based on the layout More...
 
UniquePtr< IVertexBuffercreateVertexBuffer (const String &name, const IVertexBufferLayout &layout, const BufferUsage &usage, const UInt32 &elements=1) const
 Creates a vertex buffer, based on the layout More...
 
UniquePtr< IIndexBuffercreateIndexBuffer (const IIndexBufferLayout &layout, const BufferUsage &usage, const UInt32 &elements) const
 Creates an index buffer, based on the layout . More...
 
UniquePtr< IIndexBuffercreateIndexBuffer (const String &name, const IIndexBufferLayout &layout, const BufferUsage &usage, const UInt32 &elements) const
 Creates an index buffer, based on the layout . More...
 
UniquePtr< IImagecreateAttachment (const Format &format, const Size2d &size, const MultiSamplingLevel &samples=MultiSamplingLevel::x1) const
 Creates an image that is used as render target attachment. More...
 
UniquePtr< IImagecreateAttachment (const String &name, const Format &format, const Size2d &size, const MultiSamplingLevel &samples=MultiSamplingLevel::x1) const
 Creates an image that is used as render target attachment. More...
 
UniquePtr< IImagecreateTexture (const Format &format, const Size3d &size, const ImageDimensions &dimension=ImageDimensions::DIM_2, const UInt32 &levels=1, const UInt32 &layers=1, const MultiSamplingLevel &samples=MultiSamplingLevel::x1, const bool &allowWrite=false) const
 Creates a texture, based on the layout . More...
 
UniquePtr< IImagecreateTexture (const String &name, const Format &format, const Size3d &size, const ImageDimensions &dimension=ImageDimensions::DIM_2, const UInt32 &levels=1, const UInt32 &layers=1, const MultiSamplingLevel &samples=MultiSamplingLevel::x1, const bool &allowWrite=false) const
 Creates a texture, based on the layout . More...
 
Array< UniquePtr< IImage > > createTextures (const UInt32 &elements, const Format &format, const Size3d &size, const ImageDimensions &dimension=ImageDimensions::DIM_2, const UInt32 &layers=1, const UInt32 &levels=1, const MultiSamplingLevel &samples=MultiSamplingLevel::x1, const bool &allowWrite=false) const
 Creates an array of textures, based on the layout . More...
 
UniquePtr< ISamplercreateSampler (const FilterMode &magFilter=FilterMode::Nearest, const FilterMode &minFilter=FilterMode::Nearest, const BorderMode &borderU=BorderMode::Repeat, const BorderMode &borderV=BorderMode::Repeat, const BorderMode &borderW=BorderMode::Repeat, const MipMapMode &mipMapMode=MipMapMode::Nearest, const Float &mipMapBias=0.f, const Float &maxLod=std::numeric_limits< Float >::max(), const Float &minLod=0.f, const Float &anisotropy=0.f) const
 Creates a texture sampler, based on the layout . More...
 
UniquePtr< ISamplercreateSampler (const String &name, const FilterMode &magFilter=FilterMode::Nearest, const FilterMode &minFilter=FilterMode::Nearest, const BorderMode &borderU=BorderMode::Repeat, const BorderMode &borderV=BorderMode::Repeat, const BorderMode &borderW=BorderMode::Repeat, const MipMapMode &mipMapMode=MipMapMode::Nearest, const Float &mipMapBias=0.f, const Float &maxLod=std::numeric_limits< Float >::max(), const Float &minLod=0.f, const Float &anisotropy=0.f) const
 Creates a texture sampler, based on the layout . More...
 
Array< UniquePtr< ISampler > > createSamplers (const UInt32 &elements, const FilterMode &magFilter=FilterMode::Nearest, const FilterMode &minFilter=FilterMode::Nearest, const BorderMode &borderU=BorderMode::Repeat, const BorderMode &borderV=BorderMode::Repeat, const BorderMode &borderW=BorderMode::Repeat, const MipMapMode &mipMapMode=MipMapMode::Nearest, const Float &mipMapBias=0.f, const Float &maxLod=std::numeric_limits< Float >::max(), const Float &minLod=0.f, const Float &anisotropy=0.f) const
 Creates an array of texture samplers, based on the layout . More...
 

Detailed Description

The interface for a graphics factory.

Constructor & Destructor Documentation

◆ ~IGraphicsFactory()

virtual LiteFX::Rendering::IGraphicsFactory::~IGraphicsFactory ( )
virtualdefaultnoexcept

Member Function Documentation

◆ createAttachment() [1/2]

UniquePtr< IImage > LiteFX::Rendering::IGraphicsFactory::createAttachment ( const Format &  format,
const Size2d size,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1 
) const
inline

Creates an image that is used as render target attachment.

Parameters
formatThe format of the image.
sizeThe extent of the image.
samplesThe number of samples, the image should be sampled with.
Returns
The instance of the attachment image.

◆ createAttachment() [2/2]

UniquePtr< IImage > LiteFX::Rendering::IGraphicsFactory::createAttachment ( const String name,
const Format &  format,
const Size2d size,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1 
) const
inline

Creates an image that is used as render target attachment.

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

◆ createBuffer() [1/2]

UniquePtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const BufferType &  type,
const BufferUsage &  usage,
const size_t &  elementSize,
const UInt32 elements = 1,
const bool &  allowWrite = false 
) const
inline

Creates a buffer of type type .

Parameters
typeThe type of the buffer.
usageThe buffer usage.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
allowWriteAllows the resource to be bound to a read/write descriptor.
Returns
The instance of the buffer.

◆ createBuffer() [2/2]

UniquePtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const String name,
const BufferType &  type,
const BufferUsage &  usage,
const size_t &  elementSize,
const UInt32 elements = 1,
const bool &  allowWrite = false 
) const
inline

Creates a buffer of type type .

Parameters
nameThe name of the buffer.
typeThe type of the buffer.
usageThe buffer usage.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
allowWriteAllows the resource to be bound to a read/write descriptor.
Returns
The instance of the buffer.

◆ createIndexBuffer() [1/2]

UniquePtr< IIndexBuffer > LiteFX::Rendering::IGraphicsFactory::createIndexBuffer ( const IIndexBufferLayout layout,
const BufferUsage &  usage,
const UInt32 elements 
) const
inline

Creates an index buffer, based on the layout .

An index buffer can be used by different RenderPipelines, 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.

Parameters
layoutThe layout of the index buffer.
usageThe buffer usage.
elementsThe number of elements within the vertex buffer (i.e. the number of indices).
Returns
The instance of the index buffer.

◆ createIndexBuffer() [2/2]

UniquePtr< IIndexBuffer > LiteFX::Rendering::IGraphicsFactory::createIndexBuffer ( const String name,
const IIndexBufferLayout layout,
const BufferUsage &  usage,
const UInt32 elements 
) const
inline

Creates an index buffer, based on the layout .

An index buffer can be used by different RenderPipelines, 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.

Parameters
nameThe name of the buffer.
layoutThe layout of the index buffer.
usageThe buffer usage.
elementsThe number of elements within the vertex buffer (i.e. the number of indices).
Returns
The instance of the index buffer.

◆ createSampler() [1/2]

UniquePtr< ISampler > LiteFX::Rendering::IGraphicsFactory::createSampler ( const FilterMode &  magFilter = FilterMode::Nearest,
const FilterMode &  minFilter = FilterMode::Nearest,
const BorderMode &  borderU = BorderMode::Repeat,
const BorderMode &  borderV = BorderMode::Repeat,
const BorderMode &  borderW = BorderMode::Repeat,
const MipMapMode &  mipMapMode = MipMapMode::Nearest,
const Float mipMapBias = 0.f,
const Float maxLod = std::numeric_limits<Float>::max(),
const Float minLod = 0.f,
const Float anisotropy = 0.f 
) const
inline

Creates a texture sampler, based on the layout .

Parameters
magFilterThe filter operation used for magnifying.
minFilterThe filter operation used for minifying.
borderUThe border mode along the U-axis.
borderVThe border mode along the V-axis.
borderWThe border mode along the W-axis.
mipMapModeThe mip map mode.
mipMapBiasThe mip map bias.
maxLodThe maximum level of detail value.
minLodThe minimum level of detail value.
anisotropyThe level of anisotropic filtering.
Returns
The instance of the sampler.
See also
createSamplers

◆ createSampler() [2/2]

UniquePtr< ISampler > LiteFX::Rendering::IGraphicsFactory::createSampler ( const String name,
const FilterMode &  magFilter = FilterMode::Nearest,
const FilterMode &  minFilter = FilterMode::Nearest,
const BorderMode &  borderU = BorderMode::Repeat,
const BorderMode &  borderV = BorderMode::Repeat,
const BorderMode &  borderW = BorderMode::Repeat,
const MipMapMode &  mipMapMode = MipMapMode::Nearest,
const Float mipMapBias = 0.f,
const Float maxLod = std::numeric_limits<Float>::max(),
const Float minLod = 0.f,
const Float anisotropy = 0.f 
) const
inline

Creates a texture sampler, based on the layout .

Parameters
nameThe name of the sampler.
magFilterThe filter operation used for magnifying.
minFilterThe filter operation used for minifying.
borderUThe border mode along the U-axis.
borderVThe border mode along the V-axis.
borderWThe border mode along the W-axis.
mipMapModeThe mip map mode.
mipMapBiasThe mip map bias.
maxLodThe maximum level of detail value.
minLodThe minimum level of detail value.
anisotropyThe level of anisotropic filtering.
Returns
The instance of the sampler.
See also
createSamplers

◆ createSamplers()

Array< UniquePtr< ISampler > > LiteFX::Rendering::IGraphicsFactory::createSamplers ( const UInt32 elements,
const FilterMode &  magFilter = FilterMode::Nearest,
const FilterMode &  minFilter = FilterMode::Nearest,
const BorderMode &  borderU = BorderMode::Repeat,
const BorderMode &  borderV = BorderMode::Repeat,
const BorderMode &  borderW = BorderMode::Repeat,
const MipMapMode &  mipMapMode = MipMapMode::Nearest,
const Float mipMapBias = 0.f,
const Float maxLod = std::numeric_limits<Float>::max(),
const Float minLod = 0.f,
const Float anisotropy = 0.f 
) const
inline

Creates an array of texture samplers, based on the layout .

Parameters
elementsThe number of samplers to create.
magFilterThe filter operation used for magnifying.
minFilterThe filter operation used for minifying.
borderUThe border mode along the U-axis.
borderVThe border mode along the V-axis.
borderWThe border mode along the W-axis.
mipMapModeThe mip map mode.
mipMapBiasThe mip map bias.
maxLodThe maximum level of detail value.
minLodThe minimum level of detail value.
anisotropyThe level of anisotropic filtering.
Returns
An array of sampler instances.
See also
createSampler

◆ createTexture() [1/2]

UniquePtr< IImage > LiteFX::Rendering::IGraphicsFactory::createTexture ( const Format &  format,
const Size3d size,
const ImageDimensions &  dimension = ImageDimensions::DIM_2,
const UInt32 levels = 1,
const UInt32 layers = 1,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1,
const bool &  allowWrite = false 
) const
inline

Creates a texture, based on the layout .

A texture in LiteFX 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 createBuffer first that holds the actual image bytes. You than can transfer/copy the contents into the texture.

Parameters
formatThe format of the texture image.
sizeThe dimensions of the texture.
dimensionThe dimensionality of the texture.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the texture.
samplesThe number of samples, the texture should be sampled with.
allowWriteAllows the resource to be bound to a read/write descriptor.
Returns
The instance of the texture.
See also
createTextures

◆ createTexture() [2/2]

UniquePtr< IImage > LiteFX::Rendering::IGraphicsFactory::createTexture ( const String name,
const Format &  format,
const Size3d size,
const ImageDimensions &  dimension = ImageDimensions::DIM_2,
const UInt32 levels = 1,
const UInt32 layers = 1,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1,
const bool &  allowWrite = false 
) const
inline

Creates a texture, based on the layout .

A texture in LiteFX 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 createBuffer first that holds the actual image bytes. You than can transfer/copy the contents into the texture.

Parameters
nameThe name of the texture image.
formatThe format of the texture image.
sizeThe dimensions of the texture.
dimensionThe dimensionality of the texture.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the texture.
samplesThe number of samples, the texture should be sampled with.
allowWriteAllows the resource to be bound to a read/write descriptor.
Returns
The instance of the texture.
See also
createTextures

◆ createTextures()

Array< UniquePtr< IImage > > LiteFX::Rendering::IGraphicsFactory::createTextures ( const UInt32 elements,
const Format &  format,
const Size3d size,
const ImageDimensions &  dimension = ImageDimensions::DIM_2,
const UInt32 layers = 1,
const UInt32 levels = 1,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1,
const bool &  allowWrite = false 
) const
inline

Creates an array of textures, based on the layout .

Parameters
layoutThe layout of the textures.
elementsThe number of textures to create.
formatThe format of the texture images.
sizeThe dimensions of the textures.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the textures.
samplesThe number of samples, the textures should be sampled with.
allowWriteAllows the resource to be bound to a read/write descriptor.
Returns
An array of texture instances.
See also
createTexture

◆ createVertexBuffer() [1/2]

UniquePtr< IVertexBuffer > LiteFX::Rendering::IGraphicsFactory::createVertexBuffer ( const IVertexBufferLayout layout,
const BufferUsage &  usage,
const UInt32 elements = 1 
) const
inline

Creates a vertex buffer, based on the layout

A vertex buffer can be used by different RenderPipelines, 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.

Parameters
layoutThe layout of the vertex buffer.
usageThe buffer usage.
elementsThe number of elements within the vertex buffer (i.e. the number of vertices).
Returns
The instance of the vertex buffer.

◆ createVertexBuffer() [2/2]

UniquePtr< IVertexBuffer > LiteFX::Rendering::IGraphicsFactory::createVertexBuffer ( const String name,
const IVertexBufferLayout layout,
const BufferUsage &  usage,
const UInt32 elements = 1 
) const
inline

Creates a vertex buffer, based on the layout

A vertex buffer can be used by different RenderPipelines, 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.

Parameters
nameThe name of the buffer.
layoutThe layout of the vertex buffer.
usageThe buffer usage.
elementsThe number of elements within the vertex buffer (i.e. the number of vertices).
Returns
The instance of the vertex buffer.