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

#include <IDeviceCommandContext.h>

Inheritance diagram for Renderer::Backend::IDeviceCommandContext:
Collaboration diagram for Renderer::Backend::IDeviceCommandContext:

Classes

struct  Rect
 

Public Types

using UploadBufferFunction = std::function< void(u8 *)>
 

Public Member Functions

virtual void SetGraphicsPipelineState (IGraphicsPipelineState *pipelineState)=0
 Binds the graphics pipeline state. More...
 
virtual void SetComputePipelineState (IComputePipelineState *pipelineState)=0
 Binds the graphics pipeline state. More...
 
virtual void BlitFramebuffer (IFramebuffer *sourceFramebuffer, IFramebuffer *destinationFramebuffer, const Rect &sourceRegion, const Rect &destinationRegion, const Sampler::Filter filter)=0
 Copies source region into destination region automatically applying compatible format conversion and scaling using a provided filter. More...
 
virtual void ResolveFramebuffer (IFramebuffer *sourceFramebuffer, IFramebuffer *destinationFramebuffer)=0
 Resolves multisample source framebuffer attachments to destination attachments. More...
 
virtual void BeginFramebufferPass (IFramebuffer *framebuffer)=0
 Starts a framebuffer pass, performs attachment load operations. More...
 
virtual void EndFramebufferPass ()=0
 Finishes a framebuffer pass, performs attachment store operations. More...
 
virtual void ClearFramebuffer (const bool color, const bool depth, const bool stencil)=0
 Clears all mentioned attachments. More...
 
virtual void ReadbackFramebufferSync (const uint32_t x, const uint32_t y, const uint32_t width, const uint32_t height, void *data)=0
 Readbacks the current backbuffer to data in R8G8B8_UNORM format somewhen between the function call and Flush (inclusively). More...
 
virtual void UploadTexture (ITexture *texture, const Format dataFormat, const void *data, const size_t dataSize, const uint32_t level=0, const uint32_t layer=0)=0
 
virtual 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)=0
 
virtual void UploadBuffer (IBuffer *buffer, const void *data, const uint32_t dataSize)=0
 
virtual void UploadBuffer (IBuffer *buffer, const UploadBufferFunction &uploadFunction)=0
 
virtual void UploadBufferRegion (IBuffer *buffer, const void *data, const uint32_t dataOffset, const uint32_t dataSize)=0
 
virtual void UploadBufferRegion (IBuffer *buffer, const uint32_t dataOffset, const uint32_t dataSize, const UploadBufferFunction &uploadFunction)=0
 
virtual void SetScissors (const uint32_t scissorCount, const Rect *scissors)=0
 
virtual void SetViewports (const uint32_t viewportCount, const Rect *viewports)=0
 
virtual void SetVertexInputLayout (IVertexInputLayout *vertexInputLayout)=0
 Binds the vertex input layout. More...
 
virtual void SetVertexBuffer (const uint32_t bindingSlot, IBuffer *buffer, const uint32_t offset)=0
 
virtual void SetVertexBufferData (const uint32_t bindingSlot, const void *data, const uint32_t dataSize)=0
 
virtual void SetIndexBuffer (IBuffer *buffer)=0
 
virtual void SetIndexBufferData (const void *data, const uint32_t dataSize)=0
 
virtual void BeginPass ()=0
 
virtual void EndPass ()=0
 
virtual void Draw (const uint32_t firstVertex, const uint32_t vertexCount)=0
 
virtual void DrawIndexed (const uint32_t firstIndex, const uint32_t indexCount, const int32_t vertexOffset)=0
 
virtual void DrawInstanced (const uint32_t firstVertex, const uint32_t vertexCount, const uint32_t firstInstance, const uint32_t instanceCount)=0
 
virtual void DrawIndexedInstanced (const uint32_t firstIndex, const uint32_t indexCount, const uint32_t firstInstance, const uint32_t instanceCount, const int32_t vertexOffset)=0
 
virtual void DrawIndexedInRange (const uint32_t firstIndex, const uint32_t indexCount, const uint32_t start, const uint32_t end)=0
 
virtual void BeginComputePass ()=0
 Starts a compute pass, can't be called inside a framebuffer pass. More...
 
virtual void EndComputePass ()=0
 Finishes a compute pass. More...
 
virtual void Dispatch (const uint32_t groupCountX, const uint32_t groupCountY, const uint32_t groupCountZ)=0
 Dispatches groupCountX * groupCountY * groupCountZ compute groups. More...
 
virtual void SetTexture (const int32_t bindingSlot, ITexture *texture)=0
 Sets a read-only texture to the binding slot. More...
 
virtual void SetStorageTexture (const int32_t bindingSlot, ITexture *texture)=0
 Sets a read & write resource to the binding slot. More...
 
virtual void SetUniform (const int32_t bindingSlot, const float value)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ, const float valueW)=0
 
virtual void SetUniform (const int32_t bindingSlot, PS::span< const float > values)=0
 
virtual void BeginScopedLabel (const char *name)=0
 
virtual void EndScopedLabel ()=0
 
virtual void Flush ()=0
 
- Public Member Functions inherited from Renderer::Backend::IDeviceObject< IDeviceCommandContext >
virtual ~IDeviceObject ()
 
virtual IDeviceGetDevice ()=0
 
TAs ()
 

Member Typedef Documentation

◆ UploadBufferFunction

Member Function Documentation

◆ BeginComputePass()

virtual void Renderer::Backend::IDeviceCommandContext::BeginComputePass ( )
pure virtual

Starts a compute pass, can't be called inside a framebuffer pass.

It should be called as rarely as possible.

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

◆ BeginFramebufferPass()

virtual void Renderer::Backend::IDeviceCommandContext::BeginFramebufferPass ( IFramebuffer framebuffer)
pure virtual

Starts a framebuffer pass, performs attachment load operations.

It should be called as rarely as possible.

See also
IFramebuffer

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

◆ BeginPass()

virtual void Renderer::Backend::IDeviceCommandContext::BeginPass ( )
pure virtual

◆ BeginScopedLabel()

virtual void Renderer::Backend::IDeviceCommandContext::BeginScopedLabel ( const char *  name)
pure virtual

◆ BlitFramebuffer()

virtual void Renderer::Backend::IDeviceCommandContext::BlitFramebuffer ( IFramebuffer sourceFramebuffer,
IFramebuffer destinationFramebuffer,
const Rect sourceRegion,
const Rect destinationRegion,
const Sampler::Filter  filter 
)
pure virtual

Copies source region into destination region automatically applying compatible format conversion and scaling using a provided filter.

A backbuffer can't be a source.

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

◆ ClearFramebuffer()

virtual void Renderer::Backend::IDeviceCommandContext::ClearFramebuffer ( const bool  color,
const bool  depth,
const bool  stencil 
)
pure virtual

Clears all mentioned attachments.

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

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

◆ Dispatch()

virtual void Renderer::Backend::IDeviceCommandContext::Dispatch ( const uint32_t  groupCountX,
const uint32_t  groupCountY,
const uint32_t  groupCountZ 
)
pure virtual

Dispatches groupCountX * groupCountY * groupCountZ compute groups.

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

◆ Draw()

virtual void Renderer::Backend::IDeviceCommandContext::Draw ( const uint32_t  firstVertex,
const uint32_t  vertexCount 
)
pure virtual

◆ DrawIndexed()

virtual void Renderer::Backend::IDeviceCommandContext::DrawIndexed ( const uint32_t  firstIndex,
const uint32_t  indexCount,
const int32_t  vertexOffset 
)
pure virtual

◆ DrawIndexedInRange()

virtual void Renderer::Backend::IDeviceCommandContext::DrawIndexedInRange ( const uint32_t  firstIndex,
const uint32_t  indexCount,
const uint32_t  start,
const uint32_t  end 
)
pure virtual

◆ DrawIndexedInstanced()

virtual void Renderer::Backend::IDeviceCommandContext::DrawIndexedInstanced ( const uint32_t  firstIndex,
const uint32_t  indexCount,
const uint32_t  firstInstance,
const uint32_t  instanceCount,
const int32_t  vertexOffset 
)
pure virtual

◆ DrawInstanced()

virtual void Renderer::Backend::IDeviceCommandContext::DrawInstanced ( const uint32_t  firstVertex,
const uint32_t  vertexCount,
const uint32_t  firstInstance,
const uint32_t  instanceCount 
)
pure virtual

◆ EndComputePass()

virtual void Renderer::Backend::IDeviceCommandContext::EndComputePass ( )
pure virtual

◆ EndFramebufferPass()

virtual void Renderer::Backend::IDeviceCommandContext::EndFramebufferPass ( )
pure virtual

Finishes a framebuffer pass, performs attachment store operations.

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

◆ EndPass()

virtual void Renderer::Backend::IDeviceCommandContext::EndPass ( )
pure virtual

◆ EndScopedLabel()

virtual void Renderer::Backend::IDeviceCommandContext::EndScopedLabel ( )
pure virtual

◆ Flush()

virtual void Renderer::Backend::IDeviceCommandContext::Flush ( )
pure virtual

◆ ReadbackFramebufferSync()

virtual void Renderer::Backend::IDeviceCommandContext::ReadbackFramebufferSync ( const uint32_t  x,
const uint32_t  y,
const uint32_t  width,
const uint32_t  height,
void *  data 
)
pure virtual

Readbacks the current backbuffer to data in R8G8B8_UNORM format somewhen between the function call and Flush (inclusively).

Because of that the data pointer should be valid in that time period and have enough space to fit the readback result.

Note
this operation is very slow and should not be used regularly. TODO: ideally we should do readback on Present or even asynchronously but a client doesn't support that yet.

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

◆ ResolveFramebuffer()

virtual void Renderer::Backend::IDeviceCommandContext::ResolveFramebuffer ( IFramebuffer sourceFramebuffer,
IFramebuffer destinationFramebuffer 
)
pure virtual

Resolves multisample source framebuffer attachments to destination attachments.

Source attachments should have a sample count > 1 and destination attachments should have a sample count = 1. A backbuffer can't be a source.

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

◆ SetComputePipelineState()

virtual void Renderer::Backend::IDeviceCommandContext::SetComputePipelineState ( IComputePipelineState pipelineState)
pure virtual

Binds the graphics pipeline state.

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

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

◆ SetGraphicsPipelineState()

virtual void Renderer::Backend::IDeviceCommandContext::SetGraphicsPipelineState ( IGraphicsPipelineState pipelineState)
pure virtual

Binds the graphics pipeline state.

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

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

◆ SetIndexBuffer()

virtual void Renderer::Backend::IDeviceCommandContext::SetIndexBuffer ( IBuffer buffer)
pure virtual

◆ SetIndexBufferData()

virtual void Renderer::Backend::IDeviceCommandContext::SetIndexBufferData ( const void *  data,
const uint32_t  dataSize 
)
pure virtual

◆ SetScissors()

virtual void Renderer::Backend::IDeviceCommandContext::SetScissors ( const uint32_t  scissorCount,
const Rect scissors 
)
pure virtual

◆ SetStorageTexture()

virtual void Renderer::Backend::IDeviceCommandContext::SetStorageTexture ( const int32_t  bindingSlot,
ITexture texture 
)
pure virtual

◆ SetTexture()

virtual void Renderer::Backend::IDeviceCommandContext::SetTexture ( const int32_t  bindingSlot,
ITexture texture 
)
pure virtual

◆ SetUniform() [1/5]

virtual void Renderer::Backend::IDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  value 
)
pure virtual

◆ SetUniform() [2/5]

virtual void Renderer::Backend::IDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY 
)
pure virtual

◆ SetUniform() [3/5]

virtual void Renderer::Backend::IDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY,
const float  valueZ 
)
pure virtual

◆ SetUniform() [4/5]

virtual void Renderer::Backend::IDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY,
const float  valueZ,
const float  valueW 
)
pure virtual

◆ SetUniform() [5/5]

virtual void Renderer::Backend::IDeviceCommandContext::SetUniform ( const int32_t  bindingSlot,
PS::span< const float >  values 
)
pure virtual

◆ SetVertexBuffer()

virtual void Renderer::Backend::IDeviceCommandContext::SetVertexBuffer ( const uint32_t  bindingSlot,
IBuffer buffer,
const uint32_t  offset 
)
pure virtual

◆ SetVertexBufferData()

virtual void Renderer::Backend::IDeviceCommandContext::SetVertexBufferData ( const uint32_t  bindingSlot,
const void *  data,
const uint32_t  dataSize 
)
pure virtual

◆ SetVertexInputLayout()

virtual void Renderer::Backend::IDeviceCommandContext::SetVertexInputLayout ( IVertexInputLayout vertexInputLayout)
pure virtual

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.

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

◆ SetViewports()

virtual void Renderer::Backend::IDeviceCommandContext::SetViewports ( const uint32_t  viewportCount,
const Rect viewports 
)
pure virtual

◆ UploadBuffer() [1/2]

virtual void Renderer::Backend::IDeviceCommandContext::UploadBuffer ( IBuffer buffer,
const UploadBufferFunction uploadFunction 
)
pure virtual

◆ UploadBuffer() [2/2]

virtual void Renderer::Backend::IDeviceCommandContext::UploadBuffer ( IBuffer buffer,
const void *  data,
const uint32_t  dataSize 
)
pure virtual

◆ UploadBufferRegion() [1/2]

virtual void Renderer::Backend::IDeviceCommandContext::UploadBufferRegion ( IBuffer buffer,
const uint32_t  dataOffset,
const uint32_t  dataSize,
const UploadBufferFunction uploadFunction 
)
pure virtual

◆ UploadBufferRegion() [2/2]

virtual void Renderer::Backend::IDeviceCommandContext::UploadBufferRegion ( IBuffer buffer,
const void *  data,
const uint32_t  dataOffset,
const uint32_t  dataSize 
)
pure virtual

◆ UploadTexture()

virtual void Renderer::Backend::IDeviceCommandContext::UploadTexture ( ITexture texture,
const Format  dataFormat,
const void *  data,
const size_t  dataSize,
const uint32_t  level = 0,
const uint32_t  layer = 0 
)
pure virtual

◆ UploadTextureRegion()

virtual void Renderer::Backend::IDeviceCommandContext::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 
)
pure virtual

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