CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::GLCommandBuffer Class Referencefinal

#include <CeresEngine/RenderAPI/OpenGL/GLCommandBuffer.hpp>

Inheritance diagram for CeresEngine::GLCommandBuffer:
CeresEngine::GPUCommandBuffer CeresEngine::GLDeviceObject< GLCommandBuffer, GPUCommandBuffer > CeresEngine::TDeviceObject< GPUCommandBufferDescriptor > CeresEngine::GLObject< ChildTypeName, ParentType > CeresEngine::GPUDeviceObject CeresEngine::GPUObject

Public Member Functions

 GLCommandBuffer (GLDevicePtr device, const GPUCommandBufferDescriptor &descriptor)
 
 ~GLCommandBuffer () final
 
void bindResourceSet (GPUResourceSet &resourceSet, UInt32 firstSet=0, Int32 offset=-1) final
 
void bindVertexBuffer (GPUBuffer &vertexBuffer, UInt32 offset=0, UInt32 slot=0) final
 
void bindIndexBuffer (GPUBuffer &indexBuffer, UInt32 offset=0, IndexType indexType=IndexType::UInt32) final
 
void draw (UInt32 vertexCount, UInt32 instanceCount=1, UInt32 firstVertex=0, UInt32 firstInstance=0) final
 
void draw (GPUBuffer &buffer, UInt32 drawCount, UInt32 bufferOffset=0, UInt32 stride=sizeof(GPUDrawIndirectCommand)) final
 
void drawIndexed (UInt32 indexCount, UInt32 instanceCount=1, UInt32 firstVertex=0, Int32 vertexOffset=0, UInt32 firstInstance=0) final
 
void drawIndexed (GPUBuffer &buffer, UInt32 drawCount, UInt32 bufferOffset=0, UInt32 stride=sizeof(GPUDrawIndexedIndirectCommand)) final
 
void dispatch (UInt32 groupCountX, UInt32 groupCountY, UInt32 groupCountZ) final
 
void setViewport (const Viewport &viewport) final
 
void setViewports (const SmallVector< Viewport, 16 > &viewports) final
 
void setScissor (const Scissor &scissor) final
 
void setScissors (const SmallVector< Scissor, 16 > &scissors) final
 
void drawMeshTasks (UInt32 groupCountX, UInt32 groupCountY, UInt32 groupCountZ) final
 Draw mesh task work items.
 
void drawMeshTasksIndirect (GPUBuffer &buffer, UInt64 offset, UInt32 drawCount, UInt32 stride) final
 Issue an indirect mesh tasks draw into a command buffer.
 
void drawMeshTasksIndirect (GPUBuffer &buffer, UInt64 offset, GPUBuffer &countBuffer, UInt64 countBufferOffset, uint32_t maxDrawCount, uint32_t stride) final
 Issue an indirect mesh tasks draw into a command buffer.
 
void updateBuffer (GPUBuffer &dstBuffer, std::uint64_t dstOffset, const void *data, std::uint16_t dataSize) final
 
void copyBuffer (GPUBuffer &dstBuffer, std::uint64_t dstOffset, GPUBuffer &srcBuffer, std::uint64_t srcOffset, std::uint64_t size) final
 
void fillBuffer (GPUBuffer &dstBuffer, std::uint64_t dstOffset, std::uint32_t value, std::uint64_t fillSize=~0u) final
 
void copyBufferFromImage (GPUBuffer &dstBuffer, std::uint64_t dstOffset, GPUImage &srcImage, const GPUImageRegion &srcImageRegion, std::uint32_t rowStride=0, std::uint32_t layerStride=0) final
 
void copyImage (GPUImage &dstImage, const GPUImageLocation &dstLocation, GPUImage &srcImage, const GPUImageLocation &srcLocation, const TExtent3< UInt32 > &extent) final
 
void copyImageFromBuffer (GPUImage &dstImage, const GPUImageRegion &dstRegion, GPUBuffer &srcBuffer, std::uint64_t srcOffset, std::uint32_t rowStride=0, std::uint32_t layerStride=0) final
 
void resolveImage (GPUImage &dstImage, const GPUImageLocation &dstLocation, GPUImage &srcImage, const GPUImageLocation &srcLocation, const TExtent3< UInt32 > &extent) final
 
void clear (GPUImage &image) final
 
void generateMips (GPUImage &image) final
 
void generateMips (GPUImage &image, const GPUImageSubresource &subresource) final
 
void barrier (GPUImage &image, GPUImageLayout layout) final
 
void begin () final
 
void end () final
 
void wait () final
 
void bindVAO (GLuint vao)
 
void bindGraphicsPipeline (GLGraphicsPipeline &graphicsPipeline)
 
- Public Member Functions inherited from CeresEngine::GPUCommandBuffer
 GPUCommandBuffer (const GPUCommandBuffer &)=delete
 Deleted copy constructor.
 
GPUCommandBufferoperator= (const GPUCommandBuffer &)=delete
 
 GPUCommandBuffer (GPUCommandBuffer &&)=delete
 Deleted move constructor.
 
GPUCommandBufferoperator= (GPUCommandBuffer &&)=delete
 
void bindResourceSet (const GPUResourceSetPtr &resourceSet, const UInt32 firstSet=0, const Int32 offset=-1)
 
void bindVertexBuffer (const GPUBufferPtr &vertexBuffer, const UInt32 offset=0, const UInt32 slot=0)
 
virtual void bindVertexBuffer (const GPUVertexBuffer &vertexBuffer)
 Binds a vertex buffer for drawing.
 
void bindIndexBuffer (const GPUBufferPtr &indexBuffer, const UInt32 offset=0, const IndexType indexType=IndexType::UInt32)
 
virtual void bindIndexBuffer (const GPUIndexBuffer &indexBuffer)
 Binds a index buffer for drawing.
 
void draw (const GPUIndirectBuffer &buffer, UInt32 drawCount, UInt32 stride=sizeof(GPUDrawIndirectCommand))
 
void drawIndexed (const GPUIndirectBuffer &buffer, UInt32 drawCount, UInt32 stride=sizeof(GPUDrawIndexedIndirectCommand))
 
void buildAccelerationStructures ()
 
void buildAccelerationStructuresIndirect ()
 
void copyAccelerationStructure ()
 
void copyAccelerationStructureToMemory ()
 
void copyMemoryToAccelerationStructure ()
 
void writeAccelerationStructuresProperties ()
 
void setRayTracingPipelineStackSize ()
 
void traceRays ()
 
void traceRaysIndirect ()
 
template<typename Func >
decltype(autorecord (Func &&recorder)
 Records a sequence of commands to be executed by the GPU.
 
 TDeviceObject (GPUDevice &device, const Descriptor &descriptor)
 Inherited constructors.
 
 TDeviceObject (const TDeviceObject &)=delete
 Inherited constructors.
 
 TDeviceObject (TDeviceObject &&)=delete
 Inherited constructors.
 
- Public Member Functions inherited from CeresEngine::TDeviceObject< GPUCommandBufferDescriptor >
 TDeviceObject (GPUDevice &device, const Descriptor &descriptor)
 Initializes a new RenderAPI device object instance.
 
 TDeviceObject (const TDeviceObject &)=delete
 
 TDeviceObject (TDeviceObject &&)=delete
 
 ~TDeviceObject () override=default
 
TDeviceObjectoperator= (const TDeviceObject &)=delete
 
TDeviceObjectoperator= (TDeviceObject &&)=delete
 
- Public Member Functions inherited from CeresEngine::GPUDeviceObject
 GPUDeviceObject (GPUDevice &device)
 
 ~GPUDeviceObject () override
 
- Public Member Functions inherited from CeresEngine::GPUObject
 GPUObject ()=default
 
virtual ~GPUObject ()=default
 
 GPUObject (const GPUObject &)=delete
 
GPUObjectoperator= (const GPUObject &)=delete
 
 GPUObject (GPUObject &&)=delete
 
GPUObjectoperator= (GPUObject &&)=delete
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Releases the object by decrementing it's reference count by one.
 

Private Attributes

const GPUCommandBufferDescriptor descriptorGL
 A structure that describes the command buffer and it's properties.
 
GLuint mVAO = 0
 
GLGraphicsPipelinemGraphicsPipeline = nullptr
 
IndexType indexType = IndexType::UInt32
 

Friends

class GLCommandQueue
 

Additional Inherited Members

- Public Types inherited from CeresEngine::TDeviceObject< GPUCommandBufferDescriptor >
using Descriptor = GPUCommandBufferDescriptor
 An type-alias to the descriptor struct type.
 
- Static Public Member Functions inherited from CeresEngine::GLObject< ChildTypeName, ParentType >
static RC< ChildTypeNamecast (const RC< ParentType > &ptr)
 Casts a RC containing a ParentType pointer to a pointer to a pointer to a ChildTypeName.
 
static RC< ChildTypeNamesafeCast (const RC< ParentType > &ptr)
 Safely casts a RC containing a ParentType pointer to a pointer to a pointer to a ChildTypeName.
 
static ChildTypeNamecast (ParentType &object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static const ChildTypeNamecast (const ParentType &object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static ChildTypeNamecast (ParentType *object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static const ChildTypeNamecast (const ParentType *object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static ChildTypeNamesafeCast (ParentType *object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
static const ChildTypeNamesafeCast (const ParentType *object)
 Casts a object of type ParentType to a object of type ChildTypeName.
 
- Public Attributes inherited from CeresEngine::GPUCommandBuffer
Event< void()> didFinish
 An event triggered whenever the command buffer has finished execution.
 
- Public Attributes inherited from CeresEngine::TDeviceObject< GPUCommandBufferDescriptor >
const Descriptordescriptor
 A structure that describes the object and it's properties.
 
- Public Attributes inherited from CeresEngine::GPUDeviceObject
GPUDevicedevice
 The owning device this object was created from.
 
- Protected Member Functions inherited from CeresEngine::GPUObject
virtual void destroy () noexcept
 A internal method called by the system when the object reference count reaches zero.
 
- Protected Member Functions inherited from CeresEngine::GLDeviceObject< GLCommandBuffer, GPUCommandBuffer >
 GLDeviceObject (GLDevicePtr device)
 Creates a new GLDeviceObject from the given device.
 
- Protected Attributes inherited from CeresEngine::GLDeviceObject< GLCommandBuffer, GPUCommandBuffer >
GLDevicedeviceGL
 The owning GLDevice instance.
 

Constructor & Destructor Documentation

◆ GLCommandBuffer()

CeresEngine::GLCommandBuffer::GLCommandBuffer ( GLDevicePtr  device,
const GPUCommandBufferDescriptor descriptor 
)

◆ ~GLCommandBuffer()

CeresEngine::GLCommandBuffer::~GLCommandBuffer ( )
final

Member Function Documentation

◆ barrier()

void CeresEngine::GLCommandBuffer::barrier ( GPUImage image,
GPUImageLayout  layout 
)
finalvirtual

◆ begin()

void CeresEngine::GLCommandBuffer::begin ( )
finalvirtual

◆ bindGraphicsPipeline()

void CeresEngine::GLCommandBuffer::bindGraphicsPipeline ( GLGraphicsPipeline graphicsPipeline)

◆ bindIndexBuffer()

void CeresEngine::GLCommandBuffer::bindIndexBuffer ( GPUBuffer indexBuffer,
UInt32  offset = 0,
IndexType  indexType = IndexType::UInt32 
)
finalvirtual

◆ bindResourceSet()

void CeresEngine::GLCommandBuffer::bindResourceSet ( GPUResourceSet resourceSet,
UInt32  firstSet = 0,
Int32  offset = -1 
)
finalvirtual

◆ bindVAO()

void CeresEngine::GLCommandBuffer::bindVAO ( GLuint  vao)

◆ bindVertexBuffer()

void CeresEngine::GLCommandBuffer::bindVertexBuffer ( GPUBuffer vertexBuffer,
UInt32  offset = 0,
UInt32  slot = 0 
)
finalvirtual

◆ clear()

void CeresEngine::GLCommandBuffer::clear ( GPUImage image)
finalvirtual

◆ copyBuffer()

void CeresEngine::GLCommandBuffer::copyBuffer ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
GPUBuffer srcBuffer,
std::uint64_t  srcOffset,
std::uint64_t  size 
)
finalvirtual

◆ copyBufferFromImage()

void CeresEngine::GLCommandBuffer::copyBufferFromImage ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
GPUImage srcImage,
const GPUImageRegion srcImageRegion,
std::uint32_t  rowStride = 0,
std::uint32_t  layerStride = 0 
)
finalvirtual

◆ copyImage()

void CeresEngine::GLCommandBuffer::copyImage ( GPUImage dstImage,
const GPUImageLocation dstLocation,
GPUImage srcImage,
const GPUImageLocation srcLocation,
const TExtent3< UInt32 > &  extent 
)
finalvirtual

◆ copyImageFromBuffer()

void CeresEngine::GLCommandBuffer::copyImageFromBuffer ( GPUImage dstImage,
const GPUImageRegion dstRegion,
GPUBuffer srcBuffer,
std::uint64_t  srcOffset,
std::uint32_t  rowStride = 0,
std::uint32_t  layerStride = 0 
)
finalvirtual

◆ dispatch()

void CeresEngine::GLCommandBuffer::dispatch ( UInt32  groupCountX,
UInt32  groupCountY,
UInt32  groupCountZ 
)
finalvirtual

◆ draw() [1/2]

void CeresEngine::GLCommandBuffer::draw ( GPUBuffer buffer,
UInt32  drawCount,
UInt32  bufferOffset = 0,
UInt32  stride = sizeof(GPUDrawIndirectCommand) 
)
finalvirtual

◆ draw() [2/2]

void CeresEngine::GLCommandBuffer::draw ( UInt32  vertexCount,
UInt32  instanceCount = 1,
UInt32  firstVertex = 0,
UInt32  firstInstance = 0 
)
finalvirtual

◆ drawIndexed() [1/2]

void CeresEngine::GLCommandBuffer::drawIndexed ( GPUBuffer buffer,
UInt32  drawCount,
UInt32  bufferOffset = 0,
UInt32  stride = sizeof(GPUDrawIndexedIndirectCommand) 
)
finalvirtual

◆ drawIndexed() [2/2]

void CeresEngine::GLCommandBuffer::drawIndexed ( UInt32  indexCount,
UInt32  instanceCount = 1,
UInt32  firstVertex = 0,
Int32  vertexOffset = 0,
UInt32  firstInstance = 0 
)
finalvirtual

◆ drawMeshTasks()

void CeresEngine::GLCommandBuffer::drawMeshTasks ( UInt32  groupCountX,
UInt32  groupCountY,
UInt32  groupCountZ 
)
finalvirtual

Draw mesh task work items.

Parameters
groupCountXThe number of local workgroups to dispatch in the X dimension.
groupCountYThe number of local workgroups to dispatch in the Y dimension.
groupCountZThe number of local workgroups to dispatch in the Z dimension.

Implements CeresEngine::GPUCommandBuffer.

◆ drawMeshTasksIndirect() [1/2]

void CeresEngine::GLCommandBuffer::drawMeshTasksIndirect ( GPUBuffer buffer,
UInt64  offset,
GPUBuffer countBuffer,
UInt64  countBufferOffset,
uint32_t  maxDrawCount,
uint32_t  stride 
)
finalvirtual

Issue an indirect mesh tasks draw into a command buffer.

Parameters
bufferThe buffer containing draw parameters.
offsetThe byte offset into buffer where parameters begin.
drawCountThe number of draws to execute, and can be zero.
strideThe byte stride between successive sets of draw parameters.

Implements CeresEngine::GPUCommandBuffer.

◆ drawMeshTasksIndirect() [2/2]

void CeresEngine::GLCommandBuffer::drawMeshTasksIndirect ( GPUBuffer buffer,
UInt64  offset,
UInt32  drawCount,
UInt32  stride 
)
finalvirtual

Issue an indirect mesh tasks draw into a command buffer.

Parameters
bufferThe buffer containing draw parameters.
offsetThe byte offset into buffer where parameters begin.
drawCountThe number of draws to execute, and can be zero.
strideThe byte stride between successive sets of draw parameters.

Implements CeresEngine::GPUCommandBuffer.

◆ end()

void CeresEngine::GLCommandBuffer::end ( )
finalvirtual

◆ fillBuffer()

void CeresEngine::GLCommandBuffer::fillBuffer ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
std::uint32_t  value,
std::uint64_t  fillSize = ~0u 
)
finalvirtual

◆ generateMips() [1/2]

void CeresEngine::GLCommandBuffer::generateMips ( GPUImage image)
finalvirtual

◆ generateMips() [2/2]

void CeresEngine::GLCommandBuffer::generateMips ( GPUImage image,
const GPUImageSubresource subresource 
)
finalvirtual

◆ resolveImage()

void CeresEngine::GLCommandBuffer::resolveImage ( GPUImage dstImage,
const GPUImageLocation dstLocation,
GPUImage srcImage,
const GPUImageLocation srcLocation,
const TExtent3< UInt32 > &  extent 
)
finalvirtual

◆ setScissor()

void CeresEngine::GLCommandBuffer::setScissor ( const Scissor scissor)
finalvirtual

Reimplemented from CeresEngine::GPUCommandBuffer.

◆ setScissors()

void CeresEngine::GLCommandBuffer::setScissors ( const SmallVector< Scissor, 16 > &  scissors)
finalvirtual

◆ setViewport()

void CeresEngine::GLCommandBuffer::setViewport ( const Viewport viewport)
finalvirtual

Reimplemented from CeresEngine::GPUCommandBuffer.

◆ setViewports()

void CeresEngine::GLCommandBuffer::setViewports ( const SmallVector< Viewport, 16 > &  viewports)
finalvirtual

◆ updateBuffer()

void CeresEngine::GLCommandBuffer::updateBuffer ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
const void data,
std::uint16_t  dataSize 
)
finalvirtual

◆ wait()

void CeresEngine::GLCommandBuffer::wait ( )
finalvirtual

Friends And Related Symbol Documentation

◆ GLCommandQueue

Member Data Documentation

◆ descriptorGL

const GPUCommandBufferDescriptor CeresEngine::GLCommandBuffer::descriptorGL
private

A structure that describes the command buffer and it's properties.

◆ indexType

IndexType CeresEngine::GLCommandBuffer::indexType = IndexType::UInt32
private

◆ mGraphicsPipeline

GLGraphicsPipeline* CeresEngine::GLCommandBuffer::mGraphicsPipeline = nullptr
private

◆ mVAO

GLuint CeresEngine::GLCommandBuffer::mVAO = 0
private

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