Pyrogenesis  trunk
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Renderer::Backend::GL::CDeviceCommandContext Class Referencefinal

#include <DeviceCommandContext.h>

Inheritance diagram for Renderer::Backend::GL::CDeviceCommandContext:
Inheritance graph
[legend]
Collaboration diagram for Renderer::Backend::GL::CDeviceCommandContext:
Collaboration graph
[legend]

Classes

struct  BindUnit
 
class  ScopedBind
 
class  ScopedBufferBind
 
struct  VertexAttributeFormat
 

Public Types

using UploadBufferFunction = std::function< void(u8 *)>
 
- Public Types inherited from Renderer::Backend::IDeviceCommandContext
using UploadBufferFunction = std::function< void(u8 *)>
 

Public Member Functions

 ~CDeviceCommandContext ()
 
IDeviceGetDevice () override
 
void SetGraphicsPipelineState (const SGraphicsPipelineStateDesc &pipelineState)
 
void SetGraphicsPipelineState (IGraphicsPipelineState *pipelineState) override
 Binds the graphics pipeline state. More...
 
void BlitFramebuffer (IFramebuffer *destinationFramebuffer, IFramebuffer *sourceFramebuffer) override
 
void BeginFramebufferPass (IFramebuffer *framebuffer) override
 Starts a framebuffer pass, performs attachment load operations. More...
 
void EndFramebufferPass () override
 Finishes a framebuffer pass, performs attachment store operations. More...
 
void ClearFramebuffer (const bool color, const bool depth, const bool stencil) override
 Clears all mentioned attachments. More...
 
void ReadbackFramebufferSync (const uint32_t x, const uint32_t y, const uint32_t width, const uint32_t height, void *data) override
 
void UploadTexture (ITexture *texture, const Format dataFormat, const void *data, const size_t dataSize, const uint32_t level=0, const uint32_t layer=0) override
 
void UploadTextureRegion (ITexture *texture, const Format dataFormat, const void *data, const size_t dataSize, const uint32_t xOffset, const uint32_t yOffset, const uint32_t width, const uint32_t height, const uint32_t level=0, const uint32_t layer=0) override
 
void UploadBuffer (IBuffer *buffer, const void *data, const uint32_t dataSize) override
 
void UploadBuffer (IBuffer *buffer, const UploadBufferFunction &uploadFunction) override
 
void UploadBufferRegion (IBuffer *buffer, const void *data, const uint32_t dataOffset, const uint32_t dataSize) override
 
void UploadBufferRegion (IBuffer *buffer, const uint32_t dataOffset, const uint32_t dataSize, const UploadBufferFunction &uploadFunction) override
 
void SetScissors (const uint32_t scissorCount, const Rect *scissors) override
 
void SetViewports (const uint32_t viewportCount, const Rect *viewports) override
 
void SetVertexInputLayout (IVertexInputLayout *vertexInputLayout) override
 Binds the vertex input layout. More...
 
void SetVertexBuffer (const uint32_t bindingSlot, IBuffer *buffer, const uint32_t offset) override
 
void SetVertexBufferData (const uint32_t bindingSlot, const void *data, const uint32_t dataSize) override
 
void SetIndexBuffer (IBuffer *buffer) override
 
void SetIndexBufferData (const void *data, const uint32_t dataSize) override
 
void BeginPass () override
 
void EndPass () override
 
void Draw (const uint32_t firstVertex, const uint32_t vertexCount) override
 
void DrawIndexed (const uint32_t firstIndex, const uint32_t indexCount, const int32_t vertexOffset) override
 
void DrawInstanced (const uint32_t firstVertex, const uint32_t vertexCount, const uint32_t firstInstance, const uint32_t instanceCount) override
 
void DrawIndexedInstanced (const uint32_t firstIndex, const uint32_t indexCount, const uint32_t firstInstance, const uint32_t instanceCount, const int32_t vertexOffset) override
 
void DrawIndexedInRange (const uint32_t firstIndex, const uint32_t indexCount, const uint32_t start, const uint32_t end) override
 
void SetTexture (const int32_t bindingSlot, ITexture *texture) override
 
void SetUniform (const int32_t bindingSlot, const float value) override
 
void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY) override
 
void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ) override
 
void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ, const float valueW) override
 
void SetUniform (const int32_t bindingSlot, PS::span< const float > values) override
 
void BeginScopedLabel (const char *name) override
 
void EndScopedLabel () override
 
void Flush () override
 
void OnTextureDestroy (CTexture *texture)
 
- Public Member Functions inherited from Renderer::Backend::IDeviceCommandContext
virtual void SetScissors (const uint32_t scissorCount, const Rect *scissors)=0
 
virtual void SetViewports (const uint32_t viewportCount, const Rect *viewports)=0
 
- Public Member Functions inherited from Renderer::Backend::IDeviceObject< IDeviceCommandContext >
virtual ~IDeviceObject ()
 
TAs ()
 

Private Types

using BoundBuffer = std::pair< GLenum, GLuint >
 

Private Member Functions

 CDeviceCommandContext (CDevice *device)
 
void ResetStates ()
 
void SetGraphicsPipelineStateImpl (const SGraphicsPipelineStateDesc &pipelineStateDesc, const bool force)
 
void BindTexture (const uint32_t unit, const GLenum target, const GLuint handle)
 
void BindBuffer (const IBuffer::Type type, CBuffer *buffer)
 

Static Private Member Functions

static std::unique_ptr< CDeviceCommandContextCreate (CDevice *device)
 

Private Attributes

CDevicem_Device = nullptr
 
SGraphicsPipelineStateDesc m_GraphicsPipelineStateDesc {}
 
CFramebufferm_Framebuffer = nullptr
 
CShaderProgramm_ShaderProgram = nullptr
 
uint32_t m_ScissorCount = 0
 
std::array< Rect, 1 > m_Scissors
 
uint32_t m_ScopedLabelDepth = 0
 
CBufferm_VertexBuffer = nullptr
 
CBufferm_IndexBuffer = nullptr
 
const void * m_IndexBufferData = nullptr
 
bool m_InsideFramebufferPass = false
 
bool m_InsidePass = false
 
uint32_t m_ActiveTextureUnit = 0
 
std::array< BindUnit, 16 > m_BoundTextures
 
std::array< BoundBuffer, 2 > m_BoundBuffers
 
std::array< VertexAttributeFormat, static_cast< size_t >VertexAttributeStream::UV7)+1 > m_VertexAttributeFormat
 

Friends

class CDevice
 
class CTexture
 

Member Typedef Documentation

◆ BoundBuffer

using Renderer::Backend::GL::CDeviceCommandContext::BoundBuffer = std::pair<GLenum, GLuint>
private

◆ UploadBufferFunction

Constructor & Destructor Documentation

◆ ~CDeviceCommandContext()

Renderer::Backend::GL::CDeviceCommandContext::~CDeviceCommandContext ( )
default

◆ CDeviceCommandContext()

Renderer::Backend::GL::CDeviceCommandContext::CDeviceCommandContext ( CDevice device)
private

Member Function Documentation

◆ BeginFramebufferPass()

void Renderer::Backend::GL::CDeviceCommandContext::BeginFramebufferPass ( IFramebuffer framebuffer)
overridevirtual

Starts a framebuffer pass, performs attachment load operations.

It should be called as rarely as possible.

See also
IFramebuffer

Implements Renderer::Backend::IDeviceCommandContext.

◆ BeginPass()

void Renderer::Backend::GL::CDeviceCommandContext::BeginPass ( )
overridevirtual

◆ BeginScopedLabel()

void Renderer::Backend::GL::CDeviceCommandContext::BeginScopedLabel ( const char *  name)
overridevirtual

◆ BindBuffer()

void Renderer::Backend::GL::CDeviceCommandContext::BindBuffer ( const IBuffer::Type  type,
CBuffer buffer 
)
private

◆ BindTexture()

void Renderer::Backend::GL::CDeviceCommandContext::BindTexture ( const uint32_t  unit,
const GLenum  target,
const GLuint  handle 
)
private

◆ BlitFramebuffer()

void Renderer::Backend::GL::CDeviceCommandContext::BlitFramebuffer ( IFramebuffer destinationFramebuffer,
IFramebuffer sourceFramebuffer 
)
overridevirtual

◆ ClearFramebuffer()

void Renderer::Backend::GL::CDeviceCommandContext::ClearFramebuffer ( const bool  color,
const bool  depth,
const bool  stencil 
)
overridevirtual

Clears all mentioned attachments.

Prefer to use attachment load operations over this function. It should be called only inside a framebuffer pass.

Implements Renderer::Backend::IDeviceCommandContext.

◆ Create()

std::unique_ptr< CDeviceCommandContext > Renderer::Backend::GL::CDeviceCommandContext::Create ( CDevice device)
staticprivate

◆ Draw()

void Renderer::Backend::GL::CDeviceCommandContext::Draw ( const uint32_t  firstVertex,
const uint32_t  vertexCount 
)
overridevirtual

◆ DrawIndexed()

void Renderer::Backend::GL::CDeviceCommandContext::DrawIndexed ( const uint32_t  firstIndex,
const uint32_t  indexCount,
const int32_t  vertexOffset 
)
overridevirtual

◆ DrawIndexedInRange()

void Renderer::Backend::GL::CDeviceCommandContext::DrawIndexedInRange ( const uint32_t  firstIndex,
const uint32_t  indexCount,
const uint32_t  start,
const uint32_t  end 
)
overridevirtual

◆ DrawIndexedInstanced()

void Renderer::Backend::GL::CDeviceCommandContext::DrawIndexedInstanced ( const uint32_t  firstIndex,
const uint32_t  indexCount,
const uint32_t  firstInstance,
const uint32_t  instanceCount,
const int32_t  vertexOffset 
)
overridevirtual

◆ DrawInstanced()

void Renderer::Backend::GL::CDeviceCommandContext::DrawInstanced ( const uint32_t  firstVertex,
const uint32_t  vertexCount,
const uint32_t  firstInstance,
const uint32_t  instanceCount 
)
overridevirtual

◆ EndFramebufferPass()

void Renderer::Backend::GL::CDeviceCommandContext::EndFramebufferPass ( )
overridevirtual

Finishes a framebuffer pass, performs attachment store operations.

Implements Renderer::Backend::IDeviceCommandContext.

◆ EndPass()

void Renderer::Backend::GL::CDeviceCommandContext::EndPass ( )
overridevirtual

◆ EndScopedLabel()

void Renderer::Backend::GL::CDeviceCommandContext::EndScopedLabel ( )
overridevirtual

◆ Flush()

void Renderer::Backend::GL::CDeviceCommandContext::Flush ( )
overridevirtual

◆ GetDevice()

IDevice * Renderer::Backend::GL::CDeviceCommandContext::GetDevice ( )
overridevirtual

◆ OnTextureDestroy()

void Renderer::Backend::GL::CDeviceCommandContext::OnTextureDestroy ( CTexture texture)

◆ ReadbackFramebufferSync()

void Renderer::Backend::GL::CDeviceCommandContext::ReadbackFramebufferSync ( const uint32_t  x,
const uint32_t  y,
const uint32_t  width,
const uint32_t  height,
void *  data 
)
overridevirtual

◆ ResetStates()

void Renderer::Backend::GL::CDeviceCommandContext::ResetStates ( )
private

◆ SetGraphicsPipelineState() [1/2]

void Renderer::Backend::GL::CDeviceCommandContext::SetGraphicsPipelineState ( const SGraphicsPipelineStateDesc pipelineState)

◆ SetGraphicsPipelineState() [2/2]

void Renderer::Backend::GL::CDeviceCommandContext::SetGraphicsPipelineState ( IGraphicsPipelineState pipelineState)
overridevirtual

Binds the graphics pipeline state.

It should be called only inside a framebuffer pass and as rarely as possible.

Implements Renderer::Backend::IDeviceCommandContext.

◆ SetGraphicsPipelineStateImpl()

void Renderer::Backend::GL::CDeviceCommandContext::SetGraphicsPipelineStateImpl ( const SGraphicsPipelineStateDesc pipelineStateDesc,
const bool  force 
)
private

◆ SetIndexBuffer()

void Renderer::Backend::GL::CDeviceCommandContext::SetIndexBuffer ( IBuffer buffer)
overridevirtual

◆ SetIndexBufferData()

void Renderer::Backend::GL::CDeviceCommandContext::SetIndexBufferData ( const void *  data,
const uint32_t  dataSize 
)
overridevirtual

◆ SetScissors()

void Renderer::Backend::GL::CDeviceCommandContext::SetScissors ( const uint32_t  scissorCount,
const Rect *  scissors 
)
override

◆ SetTexture()

void Renderer::Backend::GL::CDeviceCommandContext::SetTexture ( const int32_t  bindingSlot,
ITexture texture 
)
overridevirtual

◆ SetUniform() [1/5]

void Renderer::Backend::GL::CDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  value 
)
overridevirtual

◆ SetUniform() [2/5]

void Renderer::Backend::GL::CDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY 
)
overridevirtual

◆ SetUniform() [3/5]

void Renderer::Backend::GL::CDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY,
const float  valueZ 
)
overridevirtual

◆ SetUniform() [4/5]

void Renderer::Backend::GL::CDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY,
const float  valueZ,
const float  valueW 
)
overridevirtual

◆ SetUniform() [5/5]

void Renderer::Backend::GL::CDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
PS::span< const float >  values 
)
overridevirtual

◆ SetVertexBuffer()

void Renderer::Backend::GL::CDeviceCommandContext::SetVertexBuffer ( const uint32_t  bindingSlot,
IBuffer buffer,
const uint32_t  offset 
)
overridevirtual

◆ SetVertexBufferData()

void Renderer::Backend::GL::CDeviceCommandContext::SetVertexBufferData ( const uint32_t  bindingSlot,
const void *  data,
const uint32_t  dataSize 
)
overridevirtual

◆ SetVertexInputLayout()

void Renderer::Backend::GL::CDeviceCommandContext::SetVertexInputLayout ( IVertexInputLayout vertexInputLayout)
overridevirtual

Binds the vertex input layout.

It should be compatible with the shader program's one. It should be called only inside a framebuffer pass and as rarely as possible.

Implements Renderer::Backend::IDeviceCommandContext.

◆ SetViewports()

void Renderer::Backend::GL::CDeviceCommandContext::SetViewports ( const uint32_t  viewportCount,
const Rect *  viewports 
)
override

◆ UploadBuffer() [1/2]

void Renderer::Backend::GL::CDeviceCommandContext::UploadBuffer ( IBuffer buffer,
const void *  data,
const uint32_t  dataSize 
)
overridevirtual

◆ UploadBuffer() [2/2]

void Renderer::Backend::GL::CDeviceCommandContext::UploadBuffer ( IBuffer buffer,
const UploadBufferFunction uploadFunction 
)
overridevirtual

◆ UploadBufferRegion() [1/2]

void Renderer::Backend::GL::CDeviceCommandContext::UploadBufferRegion ( IBuffer buffer,
const void *  data,
const uint32_t  dataOffset,
const uint32_t  dataSize 
)
overridevirtual

◆ UploadBufferRegion() [2/2]

void Renderer::Backend::GL::CDeviceCommandContext::UploadBufferRegion ( IBuffer buffer,
const uint32_t  dataOffset,
const uint32_t  dataSize,
const UploadBufferFunction uploadFunction 
)
overridevirtual

◆ UploadTexture()

void Renderer::Backend::GL::CDeviceCommandContext::UploadTexture ( ITexture texture,
const Format  dataFormat,
const void *  data,
const size_t  dataSize,
const uint32_t  level = 0,
const uint32_t  layer = 0 
)
overridevirtual

◆ UploadTextureRegion()

void Renderer::Backend::GL::CDeviceCommandContext::UploadTextureRegion ( ITexture texture,
const Format  dataFormat,
const void *  data,
const size_t  dataSize,
const uint32_t  xOffset,
const uint32_t  yOffset,
const uint32_t  width,
const uint32_t  height,
const uint32_t  level = 0,
const uint32_t  layer = 0 
)
overridevirtual

Friends And Related Function Documentation

◆ CDevice

friend class CDevice
friend

◆ CTexture

friend class CTexture
friend

Member Data Documentation

◆ m_ActiveTextureUnit

uint32_t Renderer::Backend::GL::CDeviceCommandContext::m_ActiveTextureUnit = 0
private

◆ m_BoundBuffers

std::array<BoundBuffer, 2> Renderer::Backend::GL::CDeviceCommandContext::m_BoundBuffers
private

◆ m_BoundTextures

std::array<BindUnit, 16> Renderer::Backend::GL::CDeviceCommandContext::m_BoundTextures
private

◆ m_Device

CDevice* Renderer::Backend::GL::CDeviceCommandContext::m_Device = nullptr
private

◆ m_Framebuffer

CFramebuffer* Renderer::Backend::GL::CDeviceCommandContext::m_Framebuffer = nullptr
private

◆ m_GraphicsPipelineStateDesc

SGraphicsPipelineStateDesc Renderer::Backend::GL::CDeviceCommandContext::m_GraphicsPipelineStateDesc {}
private

◆ m_IndexBuffer

CBuffer* Renderer::Backend::GL::CDeviceCommandContext::m_IndexBuffer = nullptr
private

◆ m_IndexBufferData

const void* Renderer::Backend::GL::CDeviceCommandContext::m_IndexBufferData = nullptr
private

◆ m_InsideFramebufferPass

bool Renderer::Backend::GL::CDeviceCommandContext::m_InsideFramebufferPass = false
private

◆ m_InsidePass

bool Renderer::Backend::GL::CDeviceCommandContext::m_InsidePass = false
private

◆ m_ScissorCount

uint32_t Renderer::Backend::GL::CDeviceCommandContext::m_ScissorCount = 0
private

◆ m_Scissors

std::array<Rect, 1> Renderer::Backend::GL::CDeviceCommandContext::m_Scissors
private

◆ m_ScopedLabelDepth

uint32_t Renderer::Backend::GL::CDeviceCommandContext::m_ScopedLabelDepth = 0
private

◆ m_ShaderProgram

CShaderProgram* Renderer::Backend::GL::CDeviceCommandContext::m_ShaderProgram = nullptr
private

◆ m_VertexAttributeFormat

std::array< VertexAttributeFormat, static_cast<size_t>VertexAttributeStream::UV7) + 1> Renderer::Backend::GL::CDeviceCommandContext::m_VertexAttributeFormat
private

◆ m_VertexBuffer

CBuffer* Renderer::Backend::GL::CDeviceCommandContext::m_VertexBuffer = nullptr
private

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