Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Renderer::Backend::Dummy::CDevice Class Reference

#include <Device.h>

Inheritance diagram for Renderer::Backend::Dummy::CDevice:
Collaboration diagram for Renderer::Backend::Dummy::CDevice:

Public Member Functions

 CDevice ()
 
 ~CDevice () override
 
Backend GetBackend () const override
 
const std::string & GetName () const override
 
const std::string & GetVersion () const override
 
const std::string & GetDriverInformation () const override
 
const std::vector< std::string > & GetExtensions () const override
 
void Report (const ScriptRequest &rq, JS::HandleValue settings) override
 
std::unique_ptr< IDeviceCommandContextCreateCommandContext () override
 
std::unique_ptr< IGraphicsPipelineStateCreateGraphicsPipelineState (const SGraphicsPipelineStateDesc &pipelineStateDesc) override
 Creates a graphics pipeline state. More...
 
std::unique_ptr< IComputePipelineStateCreateComputePipelineState (const SComputePipelineStateDesc &pipelineStateDesc) override
 Creates a compute pipeline state. More...
 
std::unique_ptr< IVertexInputLayoutCreateVertexInputLayout (const PS::span< const SVertexAttributeFormat > attributes) override
 Creates a vertex input layout. More...
 
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) override
 
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) override
 
std::unique_ptr< IFramebufferCreateFramebuffer (const char *name, SColorAttachment *colorAttachment, SDepthStencilAttachment *depthStencilAttachment) override
 
std::unique_ptr< IBufferCreateBuffer (const char *name, const IBuffer::Type type, const uint32_t size, const uint32_t usage) override
 
std::unique_ptr< IShaderProgramCreateShaderProgram (const CStr &name, const CShaderDefines &defines) override
 
bool AcquireNextBackbuffer () override
 Acquires a backbuffer for rendering a frame. More...
 
IFramebufferGetCurrentBackbuffer (const AttachmentLoadOp, const AttachmentStoreOp, const AttachmentLoadOp, const AttachmentStoreOp) override
 Returns a framebuffer for the current backbuffer with the required attachment operations. More...
 
void Present () override
 Presents the backbuffer to the swapchain queue to be flipped on a screen. More...
 
void OnWindowResize (const uint32_t width, const uint32_t height) override
 Should be called on window surface resize. More...
 
bool IsTextureFormatSupported (const Format format) const override
 
bool IsFramebufferFormatSupported (const Format format) const override
 
Format GetPreferredDepthStencilFormat (const uint32_t usage, const bool depth, const bool stencil) const override
 Returns the most suitable format for the usage. More...
 
const CapabilitiesGetCapabilities () const override
 
- Public Member Functions inherited from Renderer::Backend::IDevice
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
 

Protected Attributes

std::string m_Name
 
std::string m_Version
 
std::string m_DriverInformation
 
std::vector< std::string > m_Extensions
 
std::unique_ptr< IFramebufferm_Backbuffer
 
Capabilities m_Capabilities {}
 

Constructor & Destructor Documentation

◆ CDevice()

Renderer::Backend::Dummy::CDevice::CDevice ( )

◆ ~CDevice()

Renderer::Backend::Dummy::CDevice::~CDevice ( )
overridedefault

Member Function Documentation

◆ AcquireNextBackbuffer()

bool Renderer::Backend::Dummy::CDevice::AcquireNextBackbuffer ( )
overridevirtual

Acquires a backbuffer for rendering a frame.

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

Implements Renderer::Backend::IDevice.

◆ CreateBuffer()

std::unique_ptr< IBuffer > Renderer::Backend::Dummy::CDevice::CreateBuffer ( const char *  name,
const IBuffer::Type  type,
const uint32_t  size,
const uint32_t  usage 
)
overridevirtual

◆ CreateCommandContext()

std::unique_ptr< IDeviceCommandContext > Renderer::Backend::Dummy::CDevice::CreateCommandContext ( )
overridevirtual

◆ CreateComputePipelineState()

std::unique_ptr< IComputePipelineState > Renderer::Backend::Dummy::CDevice::CreateComputePipelineState ( const SComputePipelineStateDesc pipelineStateDesc)
overridevirtual

Creates a compute pipeline state.

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

Implements Renderer::Backend::IDevice.

◆ CreateFramebuffer()

std::unique_ptr< IFramebuffer > Renderer::Backend::Dummy::CDevice::CreateFramebuffer ( const char *  name,
SColorAttachment colorAttachment,
SDepthStencilAttachment depthStencilAttachment 
)
overridevirtual
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.

Implements Renderer::Backend::IDevice.

◆ CreateGraphicsPipelineState()

std::unique_ptr< IGraphicsPipelineState > Renderer::Backend::Dummy::CDevice::CreateGraphicsPipelineState ( const SGraphicsPipelineStateDesc pipelineStateDesc)
overridevirtual

Creates a graphics pipeline state.

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

Implements Renderer::Backend::IDevice.

◆ CreateShaderProgram()

std::unique_ptr< IShaderProgram > Renderer::Backend::Dummy::CDevice::CreateShaderProgram ( const CStr &  name,
const CShaderDefines defines 
)
overridevirtual

◆ CreateTexture()

std::unique_ptr< ITexture > Renderer::Backend::Dummy::CDevice::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 
)
overridevirtual

◆ CreateTexture2D()

std::unique_ptr< ITexture > Renderer::Backend::Dummy::CDevice::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 
)
overridevirtual

◆ CreateVertexInputLayout()

std::unique_ptr< IVertexInputLayout > Renderer::Backend::Dummy::CDevice::CreateVertexInputLayout ( const PS::span< const SVertexAttributeFormat attributes)
overridevirtual

Creates a vertex input layout.

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

Implements Renderer::Backend::IDevice.

◆ GetBackend()

Backend Renderer::Backend::Dummy::CDevice::GetBackend ( ) const
inlineoverridevirtual

◆ GetCapabilities()

const Capabilities & Renderer::Backend::Dummy::CDevice::GetCapabilities ( ) const
inlineoverridevirtual

◆ GetCurrentBackbuffer()

IFramebuffer * Renderer::Backend::Dummy::CDevice::GetCurrentBackbuffer ( const  colorAttachmentLoadOp,
const  colorAttachmentStoreOp,
const  depthStencilAttachmentLoadOp,
const  depthStencilAttachmentStoreOp 
)
overridevirtual

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.

Implements Renderer::Backend::IDevice.

◆ GetDriverInformation()

const std::string & Renderer::Backend::Dummy::CDevice::GetDriverInformation ( ) const
inlineoverridevirtual

◆ GetExtensions()

const std::vector< std::string > & Renderer::Backend::Dummy::CDevice::GetExtensions ( ) const
inlineoverridevirtual

◆ GetName()

const std::string & Renderer::Backend::Dummy::CDevice::GetName ( ) const
inlineoverridevirtual

◆ GetPreferredDepthStencilFormat()

Format Renderer::Backend::Dummy::CDevice::GetPreferredDepthStencilFormat ( const uint32_t  usage,
const bool  depth,
const bool  stencil 
) const
overridevirtual

Returns the most suitable format for the usage.

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

Implements Renderer::Backend::IDevice.

◆ GetVersion()

const std::string & Renderer::Backend::Dummy::CDevice::GetVersion ( ) const
inlineoverridevirtual

◆ IsFramebufferFormatSupported()

bool Renderer::Backend::Dummy::CDevice::IsFramebufferFormatSupported ( const Format  format) const
overridevirtual

◆ IsTextureFormatSupported()

bool Renderer::Backend::Dummy::CDevice::IsTextureFormatSupported ( const Format  format) const
overridevirtual

◆ OnWindowResize()

void Renderer::Backend::Dummy::CDevice::OnWindowResize ( const uint32_t  width,
const uint32_t  height 
)
overridevirtual

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.

Implements Renderer::Backend::IDevice.

◆ Present()

void Renderer::Backend::Dummy::CDevice::Present ( )
overridevirtual

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

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

Implements Renderer::Backend::IDevice.

◆ Report()

void Renderer::Backend::Dummy::CDevice::Report ( const ScriptRequest rq,
JS::HandleValue  settings 
)
overridevirtual

Member Data Documentation

◆ m_Backbuffer

std::unique_ptr<IFramebuffer> Renderer::Backend::Dummy::CDevice::m_Backbuffer
protected

◆ m_Capabilities

Capabilities Renderer::Backend::Dummy::CDevice::m_Capabilities {}
protected

◆ m_DriverInformation

std::string Renderer::Backend::Dummy::CDevice::m_DriverInformation
protected

◆ m_Extensions

std::vector<std::string> Renderer::Backend::Dummy::CDevice::m_Extensions
protected

◆ m_Name

std::string Renderer::Backend::Dummy::CDevice::m_Name
protected

◆ m_Version

std::string Renderer::Backend::Dummy::CDevice::m_Version
protected

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