Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Renderer::Backend::IDevice Class Referenceabstract

#include <IDevice.h>

Inheritance diagram for Renderer::Backend::IDevice:

Classes

struct  Capabilities
 

Public Member Functions

virtual ~IDevice ()
 
virtual Backend GetBackend () const =0
 
virtual const std::string & GetName () const =0
 
virtual const std::string & GetVersion () const =0
 
virtual const std::string & GetDriverInformation () const =0
 
virtual const std::vector< std::string > & GetExtensions () const =0
 
virtual void Report (const ScriptRequest &rq, JS::HandleValue settings)=0
 
virtual std::unique_ptr< IDeviceCommandContextCreateCommandContext ()=0
 
virtual std::unique_ptr< IGraphicsPipelineStateCreateGraphicsPipelineState (const SGraphicsPipelineStateDesc &pipelineStateDesc)=0
 Creates a graphics pipeline state. More...
 
virtual std::unique_ptr< IComputePipelineStateCreateComputePipelineState (const SComputePipelineStateDesc &pipelineStateDesc)=0
 Creates a compute pipeline state. More...
 
virtual std::unique_ptr< IVertexInputLayoutCreateVertexInputLayout (const PS::span< const SVertexAttributeFormat > attributes)=0
 Creates a vertex input layout. More...
 
virtual std::unique_ptr< ITextureCreateTexture (const char *name, const ITexture::Type type, const uint32_t usage, const Format format, const uint32_t width, const uint32_t height, const Sampler::Desc &defaultSamplerDesc, const uint32_t MIPLevelCount, const uint32_t sampleCount)=0
 
virtual std::unique_ptr< ITextureCreateTexture2D (const char *name, const uint32_t usage, const Format format, const uint32_t width, const uint32_t height, const Sampler::Desc &defaultSamplerDesc, const uint32_t MIPLevelCount=1, const uint32_t sampleCount=1)=0
 
virtual std::unique_ptr< IFramebufferCreateFramebuffer (const char *name, SColorAttachment *colorAttachment, SDepthStencilAttachment *depthStencilAttachment)=0
 
virtual std::unique_ptr< IBufferCreateBuffer (const char *name, const IBuffer::Type type, const uint32_t size, const uint32_t usage)=0
 
virtual std::unique_ptr< IShaderProgramCreateShaderProgram (const CStr &name, const CShaderDefines &defines)=0
 
virtual bool AcquireNextBackbuffer ()=0
 Acquires a backbuffer for rendering a frame. More...
 
virtual IFramebufferGetCurrentBackbuffer (const AttachmentLoadOp colorAttachmentLoadOp, const AttachmentStoreOp colorAttachmentStoreOp, const AttachmentLoadOp depthStencilAttachmentLoadOp, const AttachmentStoreOp depthStencilAttachmentStoreOp)=0
 Returns a framebuffer for the current backbuffer with the required attachment operations. More...
 
virtual void Present ()=0
 Presents the backbuffer to the swapchain queue to be flipped on a screen. More...
 
virtual void OnWindowResize (const uint32_t width, const uint32_t height)=0
 Should be called on window surface resize. More...
 
virtual bool IsTextureFormatSupported (const Format format) const =0
 
virtual bool IsFramebufferFormatSupported (const Format format) const =0
 
virtual Format GetPreferredDepthStencilFormat (const uint32_t usage, const bool depth, const bool stencil) const =0
 Returns the most suitable format for the usage. More...
 
virtual const CapabilitiesGetCapabilities () const =0
 

Constructor & Destructor Documentation

◆ ~IDevice()

virtual Renderer::Backend::IDevice::~IDevice ( )
inlinevirtual

Member Function Documentation

◆ AcquireNextBackbuffer()

virtual bool Renderer::Backend::IDevice::AcquireNextBackbuffer ( )
pure virtual

Acquires a backbuffer for rendering a frame.

Returns
True if it was successfully acquired and we can render to it.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ CreateBuffer()

virtual std::unique_ptr< IBuffer > Renderer::Backend::IDevice::CreateBuffer ( const char *  name,
const IBuffer::Type  type,
const uint32_t  size,
const uint32_t  usage 
)
pure virtual

◆ CreateCommandContext()

virtual std::unique_ptr< IDeviceCommandContext > Renderer::Backend::IDevice::CreateCommandContext ( )
pure virtual

◆ CreateComputePipelineState()

virtual std::unique_ptr< IComputePipelineState > Renderer::Backend::IDevice::CreateComputePipelineState ( const SComputePipelineStateDesc pipelineStateDesc)
pure virtual

Creates a compute pipeline state.

It's a caller responsibility to guarantee a lifespan of IShaderProgram stored in the description.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ CreateFramebuffer()

virtual std::unique_ptr< IFramebuffer > Renderer::Backend::IDevice::CreateFramebuffer ( const char *  name,
SColorAttachment colorAttachment,
SDepthStencilAttachment depthStencilAttachment 
)
pure virtual
See also
IFramebuffer

The color attachment and the depth-stencil attachment should not be nullptr at the same time. There should not be many different clear colors along all color attachments for all framebuffers created for the device.

Returns
A valid framebuffer if it was created successfully else nullptr.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ CreateGraphicsPipelineState()

virtual std::unique_ptr< IGraphicsPipelineState > Renderer::Backend::IDevice::CreateGraphicsPipelineState ( const SGraphicsPipelineStateDesc pipelineStateDesc)
pure virtual

Creates a graphics pipeline state.

It's a caller responsibility to guarantee a lifespan of IShaderProgram stored in the description.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ CreateShaderProgram()

virtual std::unique_ptr< IShaderProgram > Renderer::Backend::IDevice::CreateShaderProgram ( const CStr &  name,
const CShaderDefines defines 
)
pure virtual

◆ CreateTexture()

virtual std::unique_ptr< ITexture > Renderer::Backend::IDevice::CreateTexture ( const char *  name,
const ITexture::Type  type,
const uint32_t  usage,
const Format  format,
const uint32_t  width,
const uint32_t  height,
const Sampler::Desc defaultSamplerDesc,
const uint32_t  MIPLevelCount,
const uint32_t  sampleCount 
)
pure virtual

◆ CreateTexture2D()

virtual std::unique_ptr< ITexture > Renderer::Backend::IDevice::CreateTexture2D ( const char *  name,
const uint32_t  usage,
const Format  format,
const uint32_t  width,
const uint32_t  height,
const Sampler::Desc defaultSamplerDesc,
const uint32_t  MIPLevelCount = 1,
const uint32_t  sampleCount = 1 
)
pure virtual

◆ CreateVertexInputLayout()

virtual std::unique_ptr< IVertexInputLayout > Renderer::Backend::IDevice::CreateVertexInputLayout ( const PS::span< const SVertexAttributeFormat attributes)
pure virtual

Creates a vertex input layout.

It's recommended to use as few different layouts as posible.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ GetBackend()

virtual Backend Renderer::Backend::IDevice::GetBackend ( ) const
pure virtual

◆ GetCapabilities()

virtual const Capabilities & Renderer::Backend::IDevice::GetCapabilities ( ) const
pure virtual

◆ GetCurrentBackbuffer()

virtual IFramebuffer * Renderer::Backend::IDevice::GetCurrentBackbuffer ( const AttachmentLoadOp  colorAttachmentLoadOp,
const AttachmentStoreOp  colorAttachmentStoreOp,
const AttachmentLoadOp  depthStencilAttachmentLoadOp,
const AttachmentStoreOp  depthStencilAttachmentStoreOp 
)
pure virtual

Returns a framebuffer for the current backbuffer with the required attachment operations.

It should not be called if the last AcquireNextBackbuffer call returned false.

It's guaranteed that for the same acquired backbuffer this function returns a framebuffer with the same attachments and properties except load and store operations.

Returns
The last successfully acquired framebuffer that wasn't presented.

Implemented in Renderer::Backend::GL::CDevice, Renderer::Backend::Vulkan::CDevice, and Renderer::Backend::Dummy::CDevice.

◆ GetDriverInformation()

virtual const std::string & Renderer::Backend::IDevice::GetDriverInformation ( ) const
pure virtual

◆ GetExtensions()

virtual const std::vector< std::string > & Renderer::Backend::IDevice::GetExtensions ( ) const
pure virtual

◆ GetName()

virtual const std::string & Renderer::Backend::IDevice::GetName ( ) const
pure virtual

◆ GetPreferredDepthStencilFormat()

virtual Format Renderer::Backend::IDevice::GetPreferredDepthStencilFormat ( const uint32_t  usage,
const bool  depth,
const bool  stencil 
) const
pure virtual

Returns the most suitable format for the usage.

Returns Format::UNDEFINED if there is no such format.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ GetVersion()

virtual const std::string & Renderer::Backend::IDevice::GetVersion ( ) const
pure virtual

◆ IsFramebufferFormatSupported()

virtual bool Renderer::Backend::IDevice::IsFramebufferFormatSupported ( const Format  format) const
pure virtual

◆ IsTextureFormatSupported()

virtual bool Renderer::Backend::IDevice::IsTextureFormatSupported ( const Format  format) const
pure virtual

◆ OnWindowResize()

virtual void Renderer::Backend::IDevice::OnWindowResize ( const uint32_t  width,
const uint32_t  height 
)
pure virtual

Should be called on window surface resize.

It's the device owner responsibility to call that function. Shouldn't be called during rendering to an acquired backbuffer.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ Present()

virtual void Renderer::Backend::IDevice::Present ( )
pure virtual

Presents the backbuffer to the swapchain queue to be flipped on a screen.

Should be called only if the last AcquireNextBackbuffer call returned true.

Implemented in Renderer::Backend::Dummy::CDevice, Renderer::Backend::GL::CDevice, and Renderer::Backend::Vulkan::CDevice.

◆ Report()

virtual void Renderer::Backend::IDevice::Report ( const ScriptRequest rq,
JS::HandleValue  settings 
)
pure virtual

The documentation for this class was generated from the following file: