LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice > Class Template Referenceabstract

Defines a back-end, that provides a device instance for a certain surface and graphics adapter. More...

#include <rendering.hpp>

Inherits LiteFX::Rendering::IRenderBackend.

Public Types

using device_type = TGraphicsDevice
 
using surface_type = device_type::surface_type
 
using adapter_type = device_type::adapter_type
 
using swap_chain_type = device_type::swap_chain_type
 
using command_queue_type = device_type::command_queue_type
 
using command_buffer_type = device_type::command_buffer_type
 
using factory_type = device_type::factory_type
 
using barrier_type = device_type::barrier_type
 
using descriptor_layout_type = factory_type::descriptor_layout_type
 
using vertex_buffer_type = factory_type::vertex_buffer_type
 
using index_buffer_type = factory_type::index_buffer_type
 
using buffer_type = factory_type::buffer_type
 
using image_type = factory_type::image_type
 
using sampler_type = factory_type::sampler_type
 
using frame_buffer_type = device_type::frame_buffer_type
 
using render_pass_type = device_type::render_pass_type
 
using pipeline_layout_type = device_type::pipeline_layout_type
 
using render_pipeline_type = device_type::render_pipeline_type
 
using compute_pipeline_type = device_type::compute_pipeline_type
 
using shader_program_type = device_type::shader_program_type
 
using input_assembler_type = device_type::input_assembler_type
 
using rasterizer_type = device_type::rasterizer_type
 

Public Member Functions

virtual ~RenderBackend () noexcept=default
 
virtual Array< const adapter_type * > listAdapters () const =0
 
virtual const adapter_typefindAdapter (const Optional< UInt64 > &adapterId=std::nullopt) const =0
 Finds an adapter using its unique ID. More...
 
virtual void registerDevice (String name, UniquePtr< device_type > &&device)=0
 
template<typename ... TArgs>
device_typecreateDevice (String name, const adapter_type &adapter, UniquePtr< surface_type > &&surface, TArgs &&... _args)
 Creates a new graphics device. More...
 
virtual void releaseDevice (const String &name)=0
 Destroys and removes a device from the backend. More...
 
virtual device_typedevice (const String &name) noexcept=0
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
virtual const device_typedevice (const String &name) const noexcept=0
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
virtual const device_typeoperator[] (const String &name) const noexcept
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
virtual device_typeoperator[] (const String &name) noexcept
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
- Public Member Functions inherited from LiteFX::Rendering::IRenderBackend
virtual ~IRenderBackend () noexcept=default
 
Array< const IGraphicsAdapter * > listAdapters () const
 Lists all available graphics adapters. More...
 
virtual const IGraphicsAdapterfindAdapter (const Optional< UInt64 > &adapterId=std::nullopt) const =0
 Finds an adapter using its unique ID. More...
 
virtual IGraphicsDevicedevice (const String &name) noexcept=0
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
virtual const IGraphicsDevicedevice (const String &name) const noexcept=0
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
virtual const IGraphicsDeviceoperator[] (const String &name) const noexcept
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
virtual IGraphicsDeviceoperator[] (const String &name) noexcept
 Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found. More...
 
- Public Member Functions inherited from LiteFX::IBackend
virtual ~IBackend () noexcept=default
 
virtual BackendType type () const noexcept=0
 Gets the type of the backend. More...
 
const BackendState & state () const noexcept
 Returns the state of the backend. More...
 
virtual String name () const noexcept=0
 Gets the name of the backend. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LiteFX::IBackend
BackendState & state () noexcept
 Returns the state of the backend. More...
 
virtual void activate ()=0
 Called by the parent App, if the backend is started. More...
 
virtual void deactivate ()=0
 Called by the parent App, if the backend is stopped. More...
 

Detailed Description

template<typename TBackend, typename TGraphicsDevice>
requires rtti::implements<TGraphicsDevice, GraphicsDevice<typename TGraphicsDevice::factory_type, typename TGraphicsDevice::surface_type, typename TGraphicsDevice::adapter_type, typename TGraphicsDevice::swap_chain_type, typename TGraphicsDevice::command_queue_type, typename TGraphicsDevice::render_pass_type, typename TGraphicsDevice::compute_pipeline_type, typename TGraphicsDevice::barrier_type>>
class LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >

Defines a back-end, that provides a device instance for a certain surface and graphics adapter.

Template Parameters
TBackendThe type of the backend derived from the interface. Must implement IRenderBackend.
TGraphicsDeviceThe type of the graphics device. Must implement GraphicsDevice.

Member Typedef Documentation

◆ adapter_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::adapter_type = device_type::adapter_type

◆ barrier_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::barrier_type = device_type::barrier_type

◆ buffer_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::buffer_type = factory_type::buffer_type

◆ command_buffer_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::command_buffer_type = device_type::command_buffer_type

◆ command_queue_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::command_queue_type = device_type::command_queue_type

◆ compute_pipeline_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::compute_pipeline_type = device_type::compute_pipeline_type

◆ descriptor_layout_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::descriptor_layout_type = factory_type::descriptor_layout_type

◆ device_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::device_type = TGraphicsDevice

◆ factory_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::factory_type = device_type::factory_type

◆ frame_buffer_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::frame_buffer_type = device_type::frame_buffer_type

◆ image_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::image_type = factory_type::image_type

◆ index_buffer_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::index_buffer_type = factory_type::index_buffer_type

◆ input_assembler_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::input_assembler_type = device_type::input_assembler_type

◆ pipeline_layout_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::pipeline_layout_type = device_type::pipeline_layout_type

◆ rasterizer_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::rasterizer_type = device_type::rasterizer_type

◆ render_pass_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::render_pass_type = device_type::render_pass_type

◆ render_pipeline_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::render_pipeline_type = device_type::render_pipeline_type

◆ sampler_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::sampler_type = factory_type::sampler_type

◆ shader_program_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::shader_program_type = device_type::shader_program_type

◆ surface_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::surface_type = device_type::surface_type

◆ swap_chain_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::swap_chain_type = device_type::swap_chain_type

◆ vertex_buffer_type

template<typename TBackend , typename TGraphicsDevice >
using LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::vertex_buffer_type = factory_type::vertex_buffer_type

Constructor & Destructor Documentation

◆ ~RenderBackend()

template<typename TBackend , typename TGraphicsDevice >
virtual LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::~RenderBackend ( )
virtualdefaultnoexcept

Member Function Documentation

◆ createDevice()

template<typename TBackend , typename TGraphicsDevice >
template<typename ... TArgs>
device_type * LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::createDevice ( String  name,
const adapter_type adapter,
UniquePtr< surface_type > &&  surface,
TArgs &&...  _args 
)
inline

Creates a new graphics device.

Parameters
_argsThe arguments that are passed to the graphics device constructor.
Returns
A pointer of the created graphics device instance.

◆ device() [1/2]

template<typename TBackend , typename TGraphicsDevice >
virtual const device_type * LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::device ( const String name) const
pure virtualnoexcept

Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found.

Implements LiteFX::Rendering::IRenderBackend.

Implemented in LiteFX::Rendering::Backends::DirectX12Backend, and LiteFX::Rendering::Backends::VulkanBackend.

◆ device() [2/2]

template<typename TBackend , typename TGraphicsDevice >
virtual device_type * LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::device ( const String name)
pure virtualnoexcept

Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found.

Implements LiteFX::Rendering::IRenderBackend.

Implemented in LiteFX::Rendering::Backends::DirectX12Backend, and LiteFX::Rendering::Backends::VulkanBackend.

◆ findAdapter()

template<typename TBackend , typename TGraphicsDevice >
virtual const adapter_type * LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::findAdapter ( const Optional< UInt64 > &  adapterId = std::nullopt) const
pure virtual

◆ listAdapters()

template<typename TBackend , typename TGraphicsDevice >
virtual Array< const adapter_type * > LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::listAdapters ( ) const
pure virtual

◆ operator[]() [1/2]

template<typename TBackend , typename TGraphicsDevice >
virtual const device_type * LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::operator[] ( const String name) const
inlinevirtualnoexcept

Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found.

Reimplemented from LiteFX::Rendering::IRenderBackend.

◆ operator[]() [2/2]

template<typename TBackend , typename TGraphicsDevice >
virtual device_type * LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::operator[] ( const String name)
inlinevirtualnoexcept

Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could be found.

Reimplemented from LiteFX::Rendering::IRenderBackend.

◆ registerDevice()

template<typename TBackend , typename TGraphicsDevice >
virtual void LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::registerDevice ( String  name,
UniquePtr< device_type > &&  device 
)
pure virtual

◆ releaseDevice()

template<typename TBackend , typename TGraphicsDevice >
virtual void LiteFX::Rendering::RenderBackend< TBackend, TGraphicsDevice >::releaseDevice ( const String name)
pure virtual

Destroys and removes a device from the backend.

Parameters
nameThe name of the device.

Implemented in LiteFX::Rendering::Backends::DirectX12Backend, and LiteFX::Rendering::Backends::VulkanBackend.