LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler > Class Template Referenceabstract

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

#include <rendering.hpp>

Inherits LiteFX::Rendering::IGraphicsFactory.

Public Types

using descriptor_layout_type = TDescriptorLayout
 
using vertex_buffer_type = TVertexBuffer
 
using vertex_buffer_layout_type = vertex_buffer_type::vertex_buffer_layout_type
 
using index_buffer_type = TIndexBuffer
 
using index_buffer_layout_type = index_buffer_type::index_buffer_layout_type
 
using buffer_type = TBuffer
 
using image_type = TImage
 
using sampler_type = TSampler
 

Public Member Functions

virtual ~GraphicsFactory () noexcept=default
 
virtual UniquePtr< TBuffer > createBuffer (const BufferType &type, const BufferUsage &usage, const size_t &elementSize, const UInt32 &elements=1, const bool &allowWrite=false) const =0
 
virtual UniquePtr< TBuffer > createBuffer (const String &name, const BufferType &type, const BufferUsage &usage, const size_t &elementSize, const UInt32 &elements=1, const bool &allowWrite=false) const =0
 
virtual UniquePtr< TVertexBuffer > createVertexBuffer (const vertex_buffer_layout_type &layout, const BufferUsage &usage, const UInt32 &elements=1) const =0
 
virtual UniquePtr< TVertexBuffer > createVertexBuffer (const String &name, const vertex_buffer_layout_type &layout, const BufferUsage &usage, const UInt32 &elements=1) const =0
 
virtual UniquePtr< TIndexBuffer > createIndexBuffer (const index_buffer_layout_type &layout, const BufferUsage &usage, const UInt32 &elements) const =0
 
virtual UniquePtr< TIndexBuffer > createIndexBuffer (const String &name, const index_buffer_layout_type &layout, const BufferUsage &usage, const UInt32 &elements) const =0
 
virtual UniquePtr< TImage > createAttachment (const Format &format, const Size2d &size, const MultiSamplingLevel &samples=MultiSamplingLevel::x1) const =0
 
virtual UniquePtr< TImage > createAttachment (const String &name, const Format &format, const Size2d &size, const MultiSamplingLevel &samples=MultiSamplingLevel::x1) const =0
 
virtual UniquePtr< TImage > 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 =0
 
virtual UniquePtr< TImage > 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 =0
 
virtual Array< UniquePtr< TImage > > 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 =0
 
virtual UniquePtr< TSampler > 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 =0
 
virtual UniquePtr< TSampler > 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 =0
 
virtual Array< UniquePtr< TSampler > > 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 =0
 
- Public Member Functions inherited from LiteFX::Rendering::IGraphicsFactory
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

template<typename TDescriptorLayout, typename TBuffer, typename TVertexBuffer, typename TIndexBuffer, typename TImage, typename TSampler>
requires rtti::implements<TDescriptorLayout, IDescriptorLayout> && std::derived_from<TVertexBuffer, VertexBuffer<typename TVertexBuffer::vertex_buffer_layout_type>> && std::derived_from<TIndexBuffer, IndexBuffer<typename TIndexBuffer::index_buffer_layout_type>> && std::derived_from<TImage, IImage> && std::derived_from<TBuffer, IBuffer> && std::derived_from<TSampler, ISampler>
class LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >

Describes a factory that creates objects for a GraphicsDevice.

Initial resource states depend on the provided BufferUsage. Staging and Dynamic resources are always initialized in ResourceState::GenericRead state, while Resource and Readback resources are initialized in ResourceState::CopyDestination state. Images (and attachments) can only be used as Resource, so they are always created as copy destination. Images require a transfer from a buffer, followed by an explicit Barrier into the state required by the shader. Attachments are implicitly transitioned at the beginning and end of a render pass, so you typically do not need to create an explicit barrier for them.

Template Parameters
TDescriptorLayoutThe type of the descriptor layout. Must implement IDescriptorLayout.
TVertexBufferThe type of the vertex buffer. Must implement VertexBuffer.
TIndexBufferThe type of the index buffer. Must implement IndexBuffer.
TImageThe type of the image. Must inherit from IImage.
TBufferThe type of the buffer. Must inherit from IBuffer.
TSamplerThe type of the sampler. Must inherit from ISampler.

Member Typedef Documentation

◆ buffer_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::buffer_type = TBuffer

◆ descriptor_layout_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::descriptor_layout_type = TDescriptorLayout

◆ image_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::image_type = TImage

◆ index_buffer_layout_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::index_buffer_layout_type = index_buffer_type::index_buffer_layout_type

◆ index_buffer_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::index_buffer_type = TIndexBuffer

◆ sampler_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::sampler_type = TSampler

◆ vertex_buffer_layout_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::vertex_buffer_layout_type = vertex_buffer_type::vertex_buffer_layout_type

◆ vertex_buffer_type

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
using LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::vertex_buffer_type = TVertexBuffer

Constructor & Destructor Documentation

◆ ~GraphicsFactory()

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::~GraphicsFactory ( )
virtualdefaultnoexcept

Member Function Documentation

◆ createAttachment() [1/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TImage > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createAttachment ( const Format &  format,
const Size2d size,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1 
) const
pure virtual

◆ createAttachment() [2/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TImage > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createAttachment ( const String name,
const Format &  format,
const Size2d size,
const MultiSamplingLevel &  samples = MultiSamplingLevel::x1 
) const
pure virtual

◆ createBuffer() [1/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TBuffer > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createBuffer ( const BufferType &  type,
const BufferUsage &  usage,
const size_t &  elementSize,
const UInt32 elements = 1,
const bool &  allowWrite = false 
) const
pure virtual

◆ createBuffer() [2/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TBuffer > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createBuffer ( const String name,
const BufferType &  type,
const BufferUsage &  usage,
const size_t &  elementSize,
const UInt32 elements = 1,
const bool &  allowWrite = false 
) const
pure virtual

◆ createIndexBuffer() [1/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TIndexBuffer > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createIndexBuffer ( const index_buffer_layout_type layout,
const BufferUsage &  usage,
const UInt32 elements 
) const
pure virtual

◆ createIndexBuffer() [2/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TIndexBuffer > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createIndexBuffer ( const String name,
const index_buffer_layout_type layout,
const BufferUsage &  usage,
const UInt32 elements 
) const
pure virtual

◆ createSampler() [1/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TSampler > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::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
pure virtual

◆ createSampler() [2/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TSampler > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::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
pure virtual

◆ createSamplers()

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual Array< UniquePtr< TSampler > > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::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
pure virtual

◆ createTexture() [1/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TImage > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::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
pure virtual

◆ createTexture() [2/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TImage > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::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
pure virtual

◆ createTextures()

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual Array< UniquePtr< TImage > > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::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
pure virtual

◆ createVertexBuffer() [1/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TVertexBuffer > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createVertexBuffer ( const String name,
const vertex_buffer_layout_type layout,
const BufferUsage &  usage,
const UInt32 elements = 1 
) const
pure virtual

◆ createVertexBuffer() [2/2]

template<typename TDescriptorLayout , typename TBuffer , typename TVertexBuffer , typename TIndexBuffer , typename TImage , typename TSampler >
virtual UniquePtr< TVertexBuffer > LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler >::createVertexBuffer ( const vertex_buffer_layout_type layout,
const BufferUsage &  usage,
const UInt32 elements = 1 
) const
pure virtual