LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier > Class Template Referenceabstract

Represents the graphics device that a rendering back-end is doing work on. More...

#include <rendering.hpp>

Inherits LiteFX::Rendering::IGraphicsDevice.

Public Types

using surface_type = TSurface
 
using adapter_type = TGraphicsAdapter
 
using swap_chain_type = TSwapChain
 
using command_queue_type = TCommandQueue
 
using command_buffer_type = command_queue_type::command_buffer_type
 
using factory_type = TFactory
 
using barrier_type = TBarrier
 
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 render_pass_type = TRenderPass
 
using frame_buffer_type = render_pass_type::frame_buffer_type
 
using render_pipeline_type = render_pass_type::render_pipeline_type
 
using compute_pipeline_type = TComputePipeline
 
using pipeline_layout_type = render_pipeline_type::pipeline_layout_type
 
using shader_program_type = render_pipeline_type::shader_program_type
 
using input_assembler_type = render_pipeline_type::input_assembler_type
 
using rasterizer_type = render_pipeline_type::rasterizer_type
 
using shader_program_type = render_pipeline_type::shader_program_type
 

Public Member Functions

virtual ~GraphicsDevice () noexcept=default
 
virtual const surface_typesurface () const noexcept=0
 Returns the surface, the device draws to. More...
 
virtual const adapter_typeadapter () const noexcept=0
 Returns the graphics adapter, the device uses for drawing. More...
 
virtual const swap_chain_typeswapChain () const noexcept=0
 Returns the swap chain, that contains the back and front buffers used for presentation. More...
 
virtual swap_chain_typeswapChain () noexcept=0
 Returns the swap chain, that contains the back and front buffers used for presentation. More...
 
virtual const factory_typefactory () const noexcept=0
 Returns the factory instance, used to create instances from the device. More...
 
virtual const command_queue_typegraphicsQueue () const noexcept=0
 Returns the instance of the queue, used to process draw calls. More...
 
virtual const command_queue_typetransferQueue () const noexcept=0
 Returns the instance of the queue used for device-device transfers (e.g. between render-passes). More...
 
virtual const command_queue_typebufferQueue () const noexcept=0
 Returns the instance of the queue used for host-device transfers. More...
 
virtual const command_queue_typecomputeQueue () const noexcept=0
 Returns the instance of the queue used for compute calls. More...
 
virtual UniquePtr< barrier_typemakeBarrier () const noexcept=0
 
- Public Member Functions inherited from LiteFX::Rendering::IGraphicsDevice
virtual ~IGraphicsDevice () noexcept=default
 
virtual DeviceStatestate () const noexcept=0
 Returns the device state that can be used to manage resources. More...
 
virtual const ISurfacesurface () const noexcept=0
 Returns the surface, the device draws to. More...
 
virtual const IGraphicsAdapteradapter () const noexcept=0
 Returns the graphics adapter, the device uses for drawing. More...
 
virtual const ISwapChainswapChain () const noexcept=0
 Returns the swap chain, that contains the back and front buffers used for presentation. More...
 
virtual ISwapChainswapChain () noexcept=0
 Returns the swap chain, that contains the back and front buffers used for presentation. More...
 
virtual const IGraphicsFactoryfactory () const noexcept=0
 Returns the factory instance, used to create instances from the device. More...
 
virtual const ICommandQueuegraphicsQueue () const noexcept=0
 Returns the instance of the queue, used to process draw calls. More...
 
virtual const ICommandQueuetransferQueue () const noexcept=0
 Returns the instance of the queue used for device-device transfers (e.g. between render-passes). More...
 
virtual const ICommandQueuebufferQueue () const noexcept=0
 Returns the instance of the queue used for host-device transfers. More...
 
virtual const ICommandQueuecomputeQueue () const noexcept=0
 Returns the instance of the queue used for compute calls. More...
 
UniquePtr< IBarriermakeBarrier () const noexcept
 Creates a memory barrier instance. More...
 
virtual MultiSamplingLevel maximumMultiSamplingLevel (const Format &format) const noexcept=0
 Queries the device for the maximum supported number of multi-sampling levels. More...
 
virtual void wait () const =0
 Waits until the device is idle. More...
 

Detailed Description

template<typename TFactory, typename TSurface, typename TGraphicsAdapter, typename TSwapChain, typename TCommandQueue, typename TRenderPass, typename TComputePipeline, typename TBarrier>
requires rtti::implements<TSurface, ISurface> && rtti::implements<TGraphicsAdapter, IGraphicsAdapter> && rtti::implements<TSwapChain, SwapChain<typename TFactory::image_type, typename TRenderPass::frame_buffer_type>> && rtti::implements<TCommandQueue, CommandQueue<typename TCommandQueue::command_buffer_type>> && rtti::implements<TFactory, GraphicsFactory<typename TFactory::descriptor_layout_type, typename TFactory::buffer_type, typename TFactory::vertex_buffer_type, typename TFactory::index_buffer_type, typename TFactory::image_type, typename TFactory::sampler_type>> && rtti::implements<TRenderPass, RenderPass<typename TRenderPass::render_pipeline_type, typename TRenderPass::frame_buffer_type, typename TRenderPass::input_attachment_mapping_type>> && rtti::implements<TComputePipeline, ComputePipeline<typename TComputePipeline::pipeline_layout_type, typename TComputePipeline::shader_program_type>> && rtti::implements<TBarrier, Barrier<typename TFactory::buffer_type, typename TFactory::image_type>>
class LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >

Represents the graphics device that a rendering back-end is doing work on.

The graphics device is the central instance of a renderer. It has two major roles. First, it maintains the GraphicsFactory instance, that is used to facilitate common objects. Second, it owns the device state, which contains objects required for communication between your application and the graphics driver. Most notably, those objects contain the SwapChain instance and the CommandQueue instances used for data and command transfer.

Template Parameters
TFactoryThe type of the graphics factory. Must implement GraphicsFactory.
TSurfaceThe type of the surface. Must implement ISurface.
TGraphicsAdapterThe type of the graphics adapter. Must implement IGraphicsAdapter.
TSwapChainThe type of the swap chain. Must implement SwapChain.
TCommandQueueThe type of the command queue. Must implement CommandQueue.
TRenderPassThe type of the render pass. Must implement RenderPass.
TComputePipelineThe type of the compute pipeline. Must implement ComputePipeline.
TBarrierThe type of the memory barrier. Must implement Barrier.

Member Typedef Documentation

◆ adapter_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::adapter_type = TGraphicsAdapter

◆ barrier_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::barrier_type = TBarrier

◆ buffer_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::buffer_type = factory_type::buffer_type

◆ command_buffer_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::command_buffer_type = command_queue_type::command_buffer_type

◆ command_queue_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::command_queue_type = TCommandQueue

◆ compute_pipeline_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::compute_pipeline_type = TComputePipeline

◆ descriptor_layout_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::descriptor_layout_type = factory_type::descriptor_layout_type

◆ factory_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::factory_type = TFactory

◆ frame_buffer_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::frame_buffer_type = render_pass_type::frame_buffer_type

◆ image_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::image_type = factory_type::image_type

◆ index_buffer_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::index_buffer_type = factory_type::index_buffer_type

◆ input_assembler_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::input_assembler_type = render_pipeline_type::input_assembler_type

◆ pipeline_layout_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::pipeline_layout_type = render_pipeline_type::pipeline_layout_type

◆ rasterizer_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::rasterizer_type = render_pipeline_type::rasterizer_type

◆ render_pass_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::render_pass_type = TRenderPass

◆ render_pipeline_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::render_pipeline_type = render_pass_type::render_pipeline_type

◆ sampler_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::sampler_type = factory_type::sampler_type

◆ shader_program_type [1/2]

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::shader_program_type = render_pipeline_type::shader_program_type

◆ shader_program_type [2/2]

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::shader_program_type = render_pipeline_type::shader_program_type

◆ surface_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::surface_type = TSurface

◆ swap_chain_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::swap_chain_type = TSwapChain

◆ vertex_buffer_type

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
using LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::vertex_buffer_type = factory_type::vertex_buffer_type

Constructor & Destructor Documentation

◆ ~GraphicsDevice()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::~GraphicsDevice ( )
virtualdefaultnoexcept

Member Function Documentation

◆ adapter()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const adapter_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::adapter ( ) const
pure virtualnoexcept

Returns the graphics adapter, the device uses for drawing.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ bufferQueue()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const command_queue_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::bufferQueue ( ) const
pure virtualnoexcept

Returns the instance of the queue used for host-device transfers.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ computeQueue()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const command_queue_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::computeQueue ( ) const
pure virtualnoexcept

Returns the instance of the queue used for compute calls.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ factory()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const factory_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::factory ( ) const
pure virtualnoexcept

Returns the factory instance, used to create instances from the device.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ graphicsQueue()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const command_queue_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::graphicsQueue ( ) const
pure virtualnoexcept

Returns the instance of the queue, used to process draw calls.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ makeBarrier()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual UniquePtr< barrier_type > LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::makeBarrier ( ) const
pure virtualnoexcept

◆ surface()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const surface_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::surface ( ) const
pure virtualnoexcept

◆ swapChain() [1/2]

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const swap_chain_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::swapChain ( ) const
pure virtualnoexcept

Returns the swap chain, that contains the back and front buffers used for presentation.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ swapChain() [2/2]

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual swap_chain_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::swapChain ( )
pure virtualnoexcept

Returns the swap chain, that contains the back and front buffers used for presentation.

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.

◆ transferQueue()

template<typename TFactory , typename TSurface , typename TGraphicsAdapter , typename TSwapChain , typename TCommandQueue , typename TRenderPass , typename TComputePipeline , typename TBarrier >
virtual const command_queue_type & LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TComputePipeline, TBarrier >::transferQueue ( ) const
pure virtualnoexcept

Returns the instance of the queue used for device-device transfers (e.g. between render-passes).

Implements LiteFX::Rendering::IGraphicsDevice.

Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.