SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType > Class Template Referenceabstract

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

#include <GraphicsDevice.h>

Inheritance diagram for spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >:
spark::render::IGraphicsDevice

Public Types

using surface_type = SurfaceType
 
using adapter_type = GraphicsAdapterType
 
using swap_chain_type = SwapChainType
 
using command_queue_type = CommandQueueType
 
using command_buffer_type = typename command_queue_type::command_buffer_type
 
using factory_type = FactoryType
 
using descriptor_layout_type = typename factory_type::descriptor_layout_type
 
using vertex_buffer_type = typename factory_type::vertex_buffer_type
 
using index_buffer_type = typename factory_type::index_buffer_type
 
using buffer_type = typename factory_type::buffer_type
 
using image_type = typename factory_type::image_type
 
using sampler_type = typename factory_type::sampler_type
 
using render_pass_type = RenderPassType
 
using frame_buffer_type = typename render_pass_type::frame_buffer_type
 
using render_pipeline_type = typename render_pass_type::render_pipeline_type
 
using pipeline_layout_type = typename render_pipeline_type::pipeline_layout_type
 
using shader_program_type = typename render_pipeline_type::shader_program_type
 
using input_assembler_type = typename render_pipeline_type::input_assembler_type
 
using rasterizer_type = typename render_pipeline_type::rasterizer_type
 

Public Member Functions

DeviceStatestate () noexcept override=0
 Gets the device state used to manage the device resources.
 
const surface_type & surface () const noexcept override=0
 Gets the surface the device is rendering to.
 
const adapter_type & graphicsAdapter () const noexcept override=0
 Gets the graphics adapter the device uses for drawing.
 
const swap_chain_type & swapChain () const noexcept override=0
 Gets the graphics adapter that contains the front and back buffers used for presentation.
 
swap_chain_type & swapChain () noexcept override=0
 Gets the graphics adapter that contains the front and back buffers used for presentation.
 
const factory_type & factory () const noexcept override=0
 Gets the graphics factory used to create buffers, textures, samplers from the device.
 
const command_queue_type & graphicsQueue () const noexcept override=0
 Gets the queue instance used to process draw calls.
 
const command_queue_type & transferQueue () const noexcept override=0
 Gets the queue instance used for device-device transfers (e.g. between render-passes).
 
const command_queue_type & bufferQueue () const noexcept override=0
 Gets the queue instance used for buffer transfers (e.g. between CPU and GPU).
 
const command_queue_type & computeQueue () const noexcept override=0
 Gets the queue instance used for compute operations.
 
- Public Member Functions inherited from spark::render::IGraphicsDevice
virtual MultiSamplingLevel maximumMultiSamplingLevel (Format format) const noexcept=0
 Gets the maximum number of multi-sampling levels supported for the given format.
 
virtual double ticksPerMillisecond () const noexcept=0
 Gets the number of GPU ticks per millisecond.
 
virtual void wait () const =0
 Waits until the device is idle.
 

Detailed Description

template<typename FactoryType, typename SurfaceType, typename GraphicsAdapterType, typename SwapChainType, typename CommandQueueType, typename RenderPassType>
class spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >

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

Template Parameters
SurfaceTypeThe type of the surface the device is rendering to. (Implements ISurface)
GraphicsAdapterTypeThe type of the graphics adapter the device uses for drawing. (Implements IGraphicsAdapter)
SwapChainTypeThe type of the swap chain the device uses for presentation. (Implements ISwapChain)
CommandQueueTypeThe type of the command queue the device uses for draw calls. (Implements ICommandQueue)
RenderPassTypeThe type of the render pass the device uses for draw calls. (Implements IRenderPass)

The graphics device is the central instance of a renderer. It owns the device state, which contains objects required for communication between your application and the graphics driver. Most notably, those objects contain the ISwapChain instance and the ICommandQueue instances used for data and command transfer.

Member Function Documentation

◆ bufferQueue()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const command_queue_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::bufferQueue ( ) const
nodiscardoverridepure virtualnoexcept

Gets the queue instance used for buffer transfers (e.g. between CPU and GPU).

Returns
The ICommandQueue used for buffer transfers.
Note
This can be the same as the graphicsQueue if the device does not support dedicated transfer queues.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ computeQueue()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const command_queue_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::computeQueue ( ) const
nodiscardoverridepure virtualnoexcept

Gets the queue instance used for compute operations.

Returns
The ICommandQueue used for compute operations.
Note
This can be the same as the graphicsQueue if the device does not support dedicated compute queues.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ factory()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const factory_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::factory ( ) const
nodiscardoverridepure virtualnoexcept

Gets the graphics factory used to create buffers, textures, samplers from the device.

Returns
The IGraphicsFactory instance for the device.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ graphicsAdapter()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const adapter_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::graphicsAdapter ( ) const
nodiscardoverridepure virtualnoexcept

Gets the graphics adapter the device uses for drawing.

Returns
The IGraphicsAdapter the device uses for drawing.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ graphicsQueue()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const command_queue_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::graphicsQueue ( ) const
nodiscardoverridepure virtualnoexcept

Gets the queue instance used to process draw calls.

Returns
The ICommandQueue used to process draw calls.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ state()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
DeviceState & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::state ( )
nodiscardoverridepure virtualnoexcept

Gets the device state used to manage the device resources.

Returns
A reference to the DeviceState.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ surface()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const surface_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::surface ( ) const
nodiscardoverridepure virtualnoexcept

Gets the surface the device is rendering to.

Returns
The ISurface the device is rendering to.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ swapChain() [1/2]

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const swap_chain_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::swapChain ( ) const
nodiscardoverridepure virtualnoexcept

Gets the graphics adapter that contains the front and back buffers used for presentation.

Returns
A reference to the ISwapChain the device uses for presentation.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ swapChain() [2/2]

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
swap_chain_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::swapChain ( )
nodiscardoverridepure virtualnoexcept

Gets the graphics adapter that contains the front and back buffers used for presentation.

Returns
A reference to the ISwapChain the device uses for presentation.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.

◆ transferQueue()

template<typename FactoryType , typename SurfaceType , typename GraphicsAdapterType , typename SwapChainType , typename CommandQueueType , typename RenderPassType >
const command_queue_type & spark::render::GraphicsDevice< FactoryType, SurfaceType, GraphicsAdapterType, SwapChainType, CommandQueueType, RenderPassType >::transferQueue ( ) const
nodiscardoverridepure virtualnoexcept

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

Returns
The ICommandQueue used for device-device transfers.
Note
This can be the same as the graphicsQueue if the device does not support dedicated transfer queues.

Implements spark::render::IGraphicsDevice.

Implemented in spark::render::vk::VulkanDevice.