Pyrogenesis  trunk
Public Member Functions | Protected Attributes | List of all members
Renderer::Backend::Dummy::CDevice Class Reference

#include <Device.h>

Inheritance diagram for Renderer::Backend::Dummy::CDevice:
Inheritance graph
[legend]
Collaboration diagram for Renderer::Backend::Dummy::CDevice:
Collaboration graph
[legend]

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< 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 bool dynamic) 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 ()
 

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 bool  dynamic 
)
overridevirtual

◆ CreateCommandContext()

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

◆ 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 AttachmentLoadOp  colorAttachmentLoadOp,
const AttachmentStoreOp  colorAttachmentStoreOp,
const AttachmentLoadOp  depthStencilAttachmentLoadOp,
const AttachmentStoreOp  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: