CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::GPUCommandBuffer Class Referenceabstract

#include <CeresEngine/RenderAPI/GPUCommandBuffer.hpp>

Inheritance diagram for CeresEngine::GPUCommandBuffer:
CeresEngine::TDeviceObject< GPUCommandBufferDescriptor > CeresEngine::GPUDeviceObject CeresEngine::GPUObject CeresEngine::GLCommandBuffer CeresEngine::MKCommandBuffer CeresEngine::MTCommandBuffer CeresEngine::NLCommandBuffer CeresEngine::VKCommandBuffer CeresEngine::WGCommandBuffer

Public Member Functions

 GPUCommandBuffer (const GPUCommandBuffer &)=delete
 Deleted copy constructor.
 
GPUCommandBufferoperator= (const GPUCommandBuffer &)=delete
 
 GPUCommandBuffer (GPUCommandBuffer &&)=delete
 Deleted move constructor.
 
GPUCommandBufferoperator= (GPUCommandBuffer &&)=delete
 
virtual void bindResourceSet (GPUResourceSet &resourceSet, UInt32 firstSet=0, Int32 offset=-1)=0
 Binds the specified resource heap to the graphics pipeline.
 
void bindResourceSet (const GPUResourceSetPtr &resourceSet, const UInt32 firstSet=0, const Int32 offset=-1)
 
virtual void bindVertexBuffer (GPUBuffer &vertexBuffer, UInt32 offset=0, UInt32 slot=0)=0
 Binds a vertex buffer for drawing.
 
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.
 
virtual void bindIndexBuffer (GPUBuffer &indexBuffer, UInt32 offset=0, IndexType indexType=IndexType::UInt32)=0
 Binds a index 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.
 
virtual void draw (UInt32 vertexCount, UInt32 instanceCount=1, UInt32 firstVertex=0, UInt32 firstInstance=0)=0
 Submits a draw command using the bound vertex buffer.
 
virtual void draw (GPUBuffer &buffer, UInt32 drawCount, UInt32 bufferOffset=0, UInt32 stride=sizeof(GPUDrawIndirectCommand))=0
 Submits an indirect draw command using the bound vertex buffer.
 
void draw (const GPUIndirectBuffer &buffer, UInt32 drawCount, UInt32 stride=sizeof(GPUDrawIndirectCommand))
 
virtual void drawIndexed (UInt32 indexCount, UInt32 instanceCount=1, UInt32 firstVertex=0, Int32 vertexOffset=0, UInt32 firstInstance=0)=0
 Submits a draw command using the bound vertex and index buffer.
 
virtual void drawIndexed (GPUBuffer &buffer, UInt32 drawCount, UInt32 bufferOffset=0, UInt32 stride=sizeof(GPUDrawIndexedIndirectCommand))=0
 Submits an indirect indexed draw command using the bound vertex and index buffer.
 
void drawIndexed (const GPUIndirectBuffer &buffer, UInt32 drawCount, UInt32 stride=sizeof(GPUDrawIndexedIndirectCommand))
 
virtual void dispatch (UInt32 groupCountX, UInt32 groupCountY, UInt32 groupCountZ)=0
 Dispatches a compute command.
 
virtual void setViewport (const Viewport &viewport)
 Sets a single viewport.
 
virtual void setViewports (const SmallVector< Viewport, 16 > &viewports)=0
 Sets an array of viewports.
 
virtual void setScissor (const Scissor &scissor)
 Sets a single scissor rectangle.
 
virtual void setScissors (const SmallVector< Scissor, 16 > &scissors)=0
 Sets an array of scissor rectangles, but only if the scissor test was enabled in the previously set graphics pipeline (otherwise, this function has no effect).
 
void buildAccelerationStructures ()
 
void buildAccelerationStructuresIndirect ()
 
void copyAccelerationStructure ()
 
void copyAccelerationStructureToMemory ()
 
void copyMemoryToAccelerationStructure ()
 
void writeAccelerationStructuresProperties ()
 
void setRayTracingPipelineStackSize ()
 
void traceRays ()
 
void traceRaysIndirect ()
 
virtual void drawMeshTasks (UInt32 groupCountX, UInt32 groupCountY, UInt32 groupCountZ)=0
 Draw mesh task work items.
 
virtual void drawMeshTasksIndirect (GPUBuffer &buffer, UInt64 offset, UInt32 drawCount, UInt32 stride)=0
 Issue an indirect mesh tasks draw into a command buffer.
 
virtual void drawMeshTasksIndirect (GPUBuffer &buffer, UInt64 offset, GPUBuffer &countBuffer, UInt64 countBufferOffset, uint32_t maxDrawCount, uint32_t stride)=0
 Perform an indirect mesh tasks draw with the draw count sourced from a buffer.
 
virtual void updateBuffer (GPUBuffer &dstBuffer, std::uint64_t dstOffset, const void *data, std::uint16_t dataSize)=0
 Updates the data of the specified buffer during encoding the command buffer.
 
virtual void copyBuffer (GPUBuffer &dstBuffer, std::uint64_t dstOffset, GPUBuffer &srcBuffer, std::uint64_t srcOffset, std::uint64_t size)=0
 Encodes a buffer copy command for the specified buffer region.
 
virtual void fillBuffer (GPUBuffer &dstBuffer, std::uint64_t dstOffset, std::uint32_t value, std::uint64_t fillSize=~0u)=0
 Fills the destination buffer with copies of the specified 32-bit value.
 
virtual void copyBufferFromImage (GPUBuffer &dstBuffer, std::uint64_t dstOffset, GPUImage &srcImage, const GPUImageRegion &srcImageRegion, std::uint32_t rowStride=0, std::uint32_t layerStride=0)=0
 Encodes a buffer copy command that blits data from a source image.
 
virtual void copyImage (GPUImage &dstImage, const GPUImageLocation &dstLocation, GPUImage &srcImage, const GPUImageLocation &srcLocation, const TExtent3< UInt32 > &extent)=0
 Encodes a image copy command for the specified image regions.
 
virtual void copyImageFromBuffer (GPUImage &dstImage, const GPUImageRegion &dstRegion, GPUBuffer &srcBuffer, std::uint64_t srcOffset, std::uint32_t rowStride=0, std::uint32_t layerStride=0)=0
 Encodes a image copy command that blits data from a source buffer.
 
virtual void resolveImage (GPUImage &dstImage, const GPUImageLocation &dstLocation, GPUImage &srcImage, const GPUImageLocation &srcLocation, const TExtent3< UInt32 > &extent)=0
 
virtual void clear (GPUImage &image)=0
 
virtual void generateMips (GPUImage &image)=0
 Generates all MIP-maps for the specified image.
 
virtual void generateMips (GPUImage &texture, const GPUImageSubresource &subresource)=0
 Generates a range of MIP-maps for the specified texture.
 
virtual void barrier (GPUImage &image, GPUImageLayout layout)=0
 
virtual void begin ()=0
 Begins with the encoding (also referred to as "recording") of this command buffer.
 
virtual void end ()=0
 Ends the encoding (also referred to as "recording") of this command buffer.
 
virtual void wait ()=0
 
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.
 

Public Attributes

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.
 

Additional Inherited Members

- Public Types inherited from CeresEngine::TDeviceObject< GPUCommandBufferDescriptor >
using Descriptor = GPUCommandBufferDescriptor
 An type-alias to the descriptor struct type.
 
- 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.
 

Constructor & Destructor Documentation

◆ GPUCommandBuffer() [1/2]

CeresEngine::GPUCommandBuffer::GPUCommandBuffer ( const GPUCommandBuffer )
delete

Deleted copy constructor.

◆ GPUCommandBuffer() [2/2]

CeresEngine::GPUCommandBuffer::GPUCommandBuffer ( GPUCommandBuffer &&  )
delete

Deleted move constructor.

Member Function Documentation

◆ barrier()

◆ begin()

virtual void CeresEngine::GPUCommandBuffer::begin ( )
pure virtual

Begins with the encoding (also referred to as "recording") of this command buffer.

Remarks
All functions of the CommandBuffer interface must be used between a call to begin() and end().
This function also resets all previously encoded commands.
See also
end

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ bindIndexBuffer() [1/3]

void CeresEngine::GPUCommandBuffer::bindIndexBuffer ( const GPUBufferPtr indexBuffer,
const UInt32  offset = 0,
const IndexType  indexType = IndexType::UInt32 
)
inline

◆ bindIndexBuffer() [2/3]

virtual void CeresEngine::GPUCommandBuffer::bindIndexBuffer ( const GPUIndexBuffer indexBuffer)
virtual

Binds a index buffer for drawing.

Parameters
indexBufferThe index buffer to be bound

◆ bindIndexBuffer() [3/3]

virtual void CeresEngine::GPUCommandBuffer::bindIndexBuffer ( GPUBuffer indexBuffer,
UInt32  offset = 0,
IndexType  indexType = IndexType::UInt32 
)
pure virtual

Binds a index buffer for drawing.

Parameters
indexBufferThe index buffer to be bound
offsetThe amount of bytes to offset the buffer
indexTypeThe index buffer type. By default uses uint32.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ bindResourceSet() [1/2]

void CeresEngine::GPUCommandBuffer::bindResourceSet ( const GPUResourceSetPtr resourceSet,
const UInt32  firstSet = 0,
const Int32  offset = -1 
)
inline

◆ bindResourceSet() [2/2]

virtual void CeresEngine::GPUCommandBuffer::bindResourceSet ( GPUResourceSet resourceSet,
UInt32  firstSet = 0,
Int32  offset = -1 
)
pure virtual

Binds the specified resource heap to the graphics pipeline.

Parameters
resourceSetSpecifies the resource heap that contains all shader resources that will be bound to the shader pipeline.
firstSetSpecifies the set number of the first layout resource.
offsetThe offset to apply to the buffer before binding
Remarks
This may invalidate the previously bound resource heap for both the graphics and compute pipeline.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ bindVertexBuffer() [1/3]

void CeresEngine::GPUCommandBuffer::bindVertexBuffer ( const GPUBufferPtr vertexBuffer,
const UInt32  offset = 0,
const UInt32  slot = 0 
)
inline

◆ bindVertexBuffer() [2/3]

virtual void CeresEngine::GPUCommandBuffer::bindVertexBuffer ( const GPUVertexBuffer vertexBuffer)
virtual

Binds a vertex buffer for drawing.

Parameters
vertexBufferThe vertex buffer to be bound

◆ bindVertexBuffer() [3/3]

virtual void CeresEngine::GPUCommandBuffer::bindVertexBuffer ( GPUBuffer vertexBuffer,
UInt32  offset = 0,
UInt32  slot = 0 
)
pure virtual

Binds a vertex buffer for drawing.

Parameters
vertexBufferThe vertex buffer to be bound.
offsetThe amount of bytes to offset the buffer.
slotThe slot to bind the vertex buffer to.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ buildAccelerationStructures()

void CeresEngine::GPUCommandBuffer::buildAccelerationStructures ( )

◆ buildAccelerationStructuresIndirect()

void CeresEngine::GPUCommandBuffer::buildAccelerationStructuresIndirect ( )

◆ clear()

◆ copyAccelerationStructure()

void CeresEngine::GPUCommandBuffer::copyAccelerationStructure ( )

◆ copyAccelerationStructureToMemory()

void CeresEngine::GPUCommandBuffer::copyAccelerationStructureToMemory ( )

◆ copyBuffer()

virtual void CeresEngine::GPUCommandBuffer::copyBuffer ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
GPUBuffer srcBuffer,
std::uint64_t  srcOffset,
std::uint64_t  size 
)
pure virtual

Encodes a buffer copy command for the specified buffer region.

Parameters
dstBufferSpecifies the destination buffer whose data is to be updated.
dstOffsetSpecifies the destination offset (in bytes) at which the destination buffer is to be updated. This offset plus the size (i.e. dstOffset + size) must be less than or equal to the size of the destination buffer.
srcBufferSpecifies the source buffer whose data is to be read from.
srcOffsetSpecifies the source offset (in bytes) at which the source buffer is to be read from. This offset plus the size (i.e. srcOffset + size) must be less than or equal to the size of the source buffer.
sizeSpecifies the size of the buffer region to copy.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ copyBufferFromImage()

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

Encodes a buffer copy command that blits data from a source image.

Parameters
dstBufferSpecifies the destination buffer whose data is to be updated. This buffer must have been created with the usage flag BufferUsage::Destination.
dstOffsetSpecifies the destination offset (in bytes) at which the source buffer is to be updated. This must be a multiple of 4.
srcImageSpecifies the source image whose data is to be read from. This image must have been created with the usage flag ImageUsage::Source and its format must not be compressed or packed.
srcImageRegionSpecifies the source region where the image is to be read from. Note that the numMipLevels attribute of this parameter must be 1.
rowStrideSpecifies an optional stride (in bytes) per row in the source buffer. By default 0.
layerStrideSpecifies an optional stride (in bytes) per layer in the source buffer. This must be a multiple of rowStride. If rowStride is zero, then layerStride must also be zero. By default 0.
Remarks
This is called "copy buffer from image" instead of "copy image to buffer" to be uniform with the notation buffer := image, or memcpy(destination, source, size).
If rowStride is 0, the source data is considered to be tightly packed for each array layer and the required alignment is managed automatically.
If rowStride is not 0, it must be greater than or equal to the size (in bytes) of each row in the image region with respect to the image's format.
The same rules of rowStride also apply to layerStride.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ copyImage()

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

Encodes a image copy command for the specified image regions.

Parameters
dstImageSpecifies the destination image whose data is to be updated.
dstLocationSpecifies the destination location, including MIP-map level and offset. Its offset plus the extent (i.e. dstLocation.offset + extent) must be less than or equal to the size of the destination image.
srcImageSpecifies the source image whose data is to be read from.
srcLocationSpecifies the source location, including MIP-map level and offset. Its offset plus the extent (i.e. srcLocation.offset + extent) must be less than or equal to the size of the source image.
extentSpecifies the extent of the image region to copy (see ImageDescriptor::extent). For this function, the extent also includes the array layers, i.e. y component for 1D arrays (ImageType::Image1DArray), and z component for 2D and cube arrays (ImageType::Image2DArray and ImageType::ImageCubeArray).

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ copyImageFromBuffer()

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

Encodes a image copy command that blits data from a source buffer.

Parameters
dstImageSpecifies the destination image whose data is to be updated. This image must have been created with the usage flag ImageUsage::Destination and its format must not be compressed or packed.
dstRegionSpecifies the destination region where the image is to be updated. Note that the numMipLevels attribute of this parameter must be 1.
srcBufferSpecifies the source buffer whose data is to be read from. This buffer must have been created with the usage flag BufferUsage::Source.
srcOffsetSpecifies the source offset (in bytes) at which the source buffer is to be read from. This must be a multiple of 4.
rowStrideSpecifies an optional stride (in bytes) per row in the source buffer. By default 0.
layerStrideSpecifies an optional stride (in bytes) per layer in the source buffer. This must be a multiple of rowStride. If rowStride is zero, then layerStride must also be zero. By default 0.
Remarks
This is called "copy image from buffer" instead of "copy buffer to image" to be uniform with the notation image := buffer, or memcpy(destination, source, size).
If rowStride is 0, the source data is considered to be tightly packed for each array layer and the required alignment is managed automatically.
If rowStride is not 0, it must be greater than or equal to the size (in bytes) of each row in the image region with respect to the image's format.
The same rules of rowStride also apply to layerStride.
See also
CopyBufferFromImage
GetMemoryFootprint

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ copyMemoryToAccelerationStructure()

void CeresEngine::GPUCommandBuffer::copyMemoryToAccelerationStructure ( )

◆ dispatch()

virtual void CeresEngine::GPUCommandBuffer::dispatch ( UInt32  groupCountX,
UInt32  groupCountY,
UInt32  groupCountZ 
)
pure virtual

Dispatches a compute command.

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.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ draw() [1/3]

void CeresEngine::GPUCommandBuffer::draw ( const GPUIndirectBuffer buffer,
UInt32  drawCount,
UInt32  stride = sizeof(GPUDrawIndirectCommand) 
)

◆ draw() [2/3]

virtual void CeresEngine::GPUCommandBuffer::draw ( GPUBuffer buffer,
UInt32  drawCount,
UInt32  bufferOffset = 0,
UInt32  stride = sizeof(GPUDrawIndirectCommand) 
)
pure virtual

Submits an indirect draw command using the bound vertex buffer.

Parameters
bufferA buffer that holds drawCount structs of type DrawIndirectCommand. This buffer must have been created with BufferUsage::Indirect usage flag.
drawCountThe number of draws to execute, and can be zero.
bufferOffsetThe byte offset into buffer where parameters begin.
strideThe byte stride between successive sets of draw parameters.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ draw() [3/3]

virtual void CeresEngine::GPUCommandBuffer::draw ( UInt32  vertexCount,
UInt32  instanceCount = 1,
UInt32  firstVertex = 0,
UInt32  firstInstance = 0 
)
pure virtual

Submits a draw command using the bound vertex buffer.

Note
Instancing is automatically enabled/disabled based on instanceCount.
Parameters
vertexCountThe number of vertices per instance
instanceCountThe number of instances to be drawn
firstVertexThe vertex to start the draw command from
firstInstanceThe instance to start the draw command from

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ drawIndexed() [1/3]

void CeresEngine::GPUCommandBuffer::drawIndexed ( const GPUIndirectBuffer buffer,
UInt32  drawCount,
UInt32  stride = sizeof(GPUDrawIndexedIndirectCommand) 
)

◆ drawIndexed() [2/3]

virtual void CeresEngine::GPUCommandBuffer::drawIndexed ( GPUBuffer buffer,
UInt32  drawCount,
UInt32  bufferOffset = 0,
UInt32  stride = sizeof(GPUDrawIndexedIndirectCommand) 
)
pure virtual

Submits an indirect indexed draw command using the bound vertex and index buffer.

Parameters
bufferA buffer that holds drawCount structs of type DrawIndexedIndirectCommand. This buffer must have been created with BufferUsage::Indirect usage flag.
drawCountThe number of draws to execute, and can be zero.
bufferOffsetThe byte offset into buffer where parameters begin.
strideThe byte stride between successive sets of draw parameters.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ drawIndexed() [3/3]

virtual void CeresEngine::GPUCommandBuffer::drawIndexed ( UInt32  indexCount,
UInt32  instanceCount = 1,
UInt32  firstVertex = 0,
Int32  vertexOffset = 0,
UInt32  firstInstance = 0 
)
pure virtual

Submits a draw command using the bound vertex and index buffer.

Note
Instancing is automatically enabled/disabled based on instanceCount.
Parameters
indexCountThe number of vertex indices per instance
instanceCountThe number of instances to be drawn
firstVertexThe vertex to start the draw command from
vertexOffsetThe offset to the first vertex
firstInstanceThe instance to start the draw command from

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ drawMeshTasks()

virtual void CeresEngine::GPUCommandBuffer::drawMeshTasks ( UInt32  groupCountX,
UInt32  groupCountY,
UInt32  groupCountZ 
)
pure virtual

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.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, and CeresEngine::VKCommandBuffer.

◆ drawMeshTasksIndirect() [1/2]

virtual void CeresEngine::GPUCommandBuffer::drawMeshTasksIndirect ( GPUBuffer buffer,
UInt64  offset,
GPUBuffer countBuffer,
UInt64  countBufferOffset,
uint32_t  maxDrawCount,
uint32_t  stride 
)
pure virtual

Perform an indirect mesh tasks draw with the draw count sourced from a buffer.

Parameters
buffer
offsetThe byte offset into buffer where parameters begin.
countBufferThe buffer containing the draw count.
countBufferOffsetThe byte offset into countBuffer where the draw count begins.
maxDrawCountSpecifies the maximum number of draws that will be executed. The actual number of executed draw calls is the minimum of the count specified in countBuffer and maxDrawCount.
strideThe byte stride between successive sets of draw parameters.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, and CeresEngine::VKCommandBuffer.

◆ drawMeshTasksIndirect() [2/2]

virtual void CeresEngine::GPUCommandBuffer::drawMeshTasksIndirect ( GPUBuffer buffer,
UInt64  offset,
UInt32  drawCount,
UInt32  stride 
)
pure virtual

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.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, and CeresEngine::VKCommandBuffer.

◆ end()

virtual void CeresEngine::GPUCommandBuffer::end ( )
pure virtual

Ends the encoding (also referred to as "recording") of this command buffer.

Remarks
After this call, the command buffer can be submitted to the CommandQueue or executed by a primary command buffer.
See also
begin
CommandQueue::submit(CommandBuffer&)

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ fillBuffer()

virtual void CeresEngine::GPUCommandBuffer::fillBuffer ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
std::uint32_t  value,
std::uint64_t  fillSize = ~0u 
)
pure virtual

Fills the destination buffer with copies of the specified 32-bit value.

Parameters
dstBufferSpecifies the destination buffer whose data is to be updated. This command works with all kinds of buffers, but for performance reasons it is recommended to create this buffer with the usage flag BufferUsage::Storage.
dstOffsetSpecifies the destination offset (in bytes) at which the destination buffer is to be updated.
valueSpecifies the 32-bit value to fill the buffer with.
fillSizeSpecifies the fill size (in bytes) of the buffer region. This must be a multiple of 4. By default ~0u. If this is equal to ~0u, dstOffset is ignored and the entire buffer will be filled.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ generateMips() [1/2]

virtual void CeresEngine::GPUCommandBuffer::generateMips ( GPUImage image)
pure virtual

Generates all MIP-maps for the specified image.

Parameters
imageSpecifies the image whose MIP-maps are to be generated. This image must have been created with the binding flags ImageUsage::Sampled and ImageUsage::ColorAttachment.
Remarks
You can only call this method outside of a render pass.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ generateMips() [2/2]

virtual void CeresEngine::GPUCommandBuffer::generateMips ( GPUImage texture,
const GPUImageSubresource subresource 
)
pure virtual

Generates a range of MIP-maps for the specified texture.

Parameters
textureSpecifies the image whose MIP-maps are to be generated. This image must have been created with the usage flags ImageUsageFlag::Sampled and ImageUsageFlag::Attachment.
subresourceSpecifies the texture subresource, i.e. the range of MIP-maps that are to be updated.
Remarks
This function guarantees to generate only the MIP-maps in the specified range (specified by subresource). However, this function may introduce a performance penalty compared to generating the full MIP chain if texture views are not natively supported by the backend. It is therefore recommended to use this function only if the range of MIP-maps is significantly smaller than the entire MIP chain, e.g. only a single slice of a large 2D array texture, and use the primary generateMips function otherwise.
You can only call this method outside of a render pass.
See also
generateMips(Image&)

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ operator=() [1/2]

GPUCommandBuffer & CeresEngine::GPUCommandBuffer::operator= ( const GPUCommandBuffer )
delete

◆ operator=() [2/2]

GPUCommandBuffer & CeresEngine::GPUCommandBuffer::operator= ( GPUCommandBuffer &&  )
delete

◆ record()

template<typename Func >
decltype(auto) CeresEngine::GPUCommandBuffer::record ( Func &&  recorder)
inline

Records a sequence of commands to be executed by the GPU.

Parameters
recorderA block to be executed by the command buffer.

◆ resolveImage()

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

◆ setRayTracingPipelineStackSize()

void CeresEngine::GPUCommandBuffer::setRayTracingPipelineStackSize ( )

◆ setScissor()

virtual void CeresEngine::GPUCommandBuffer::setScissor ( const Scissor scissor)
virtual

Sets a single scissor rectangle.

Remarks
Similar to scissors but only a single scissor rectangle is set.
This must only be used if the currently bound graphics pipeline state was created with scissors being empty. Otherwise, the behavior is undefined.
See also
scissors
GraphicsPipelineDescriptor::scissors

Reimplemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ setScissors()

virtual void CeresEngine::GPUCommandBuffer::setScissors ( const SmallVector< Scissor, 16 > &  scissors)
pure virtual

Sets an array of scissor rectangles, but only if the scissor test was enabled in the previously set graphics pipeline (otherwise, this function has no effect).

Parameters
scissorsThe scissor rectangles to be set. Most render system have a limit of 16 viewports.
Remarks
This must only be used if the currently bound graphics pipeline state was created with scissors being empty. Otherwise, the behavior is undefined.
See also
GraphicsPipelineDescriptor::scissors
RasterizerDescriptor::scissorTestEnabled

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ setViewport()

virtual void CeresEngine::GPUCommandBuffer::setViewport ( const Viewport viewport)
virtual

Sets a single viewport.

Remarks
Similar to viewports but only a single viewport is set.
This must only be used if the currently bound graphics pipeline state was created with viewports being empty. Otherwise, the behavior is undefined.
See also
GraphicsPipelineDescriptor::viewports

Reimplemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ setViewports()

virtual void CeresEngine::GPUCommandBuffer::setViewports ( const SmallVector< Viewport, 16 > &  viewports)
pure virtual

Sets an array of viewports.

Parameters
viewportsThe viewports to be set. Most render system have a limit of 16 viewports.
Remarks
This must only be used if the currently bound graphics pipeline state was created with viewports being empty. Otherwise, the behavior is undefined.
See also
GraphicsPipelineDescriptor::viewports
RenderingLimits::maxViewports

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ TDeviceObject() [1/3]

Inherited constructors.

◆ TDeviceObject() [2/3]

CeresEngine::TDeviceObject< TDescriptor, TParent >::TDeviceObject ( GPUDevice device,
const Descriptor descriptor 
)
inlineexplicit

Inherited constructors.

◆ TDeviceObject() [3/3]

CeresEngine::TDeviceObject< TDescriptor, TParent >::TDeviceObject ( TDeviceObject &&  )
delete

Inherited constructors.

◆ traceRays()

void CeresEngine::GPUCommandBuffer::traceRays ( )

◆ traceRaysIndirect()

void CeresEngine::GPUCommandBuffer::traceRaysIndirect ( )

◆ updateBuffer()

virtual void CeresEngine::GPUCommandBuffer::updateBuffer ( GPUBuffer dstBuffer,
std::uint64_t  dstOffset,
const void data,
std::uint16_t  dataSize 
)
pure virtual

Updates the data of the specified buffer during encoding the command buffer.

Parameters
dstBufferSpecifies the destination buffer whose data is to be updated.
dstOffsetSpecifies the destination offset (in bytes) at which the buffer is to be updated. This offset plus the data block size (i.e. dstOffset + dataSize) must be less than or equal to the size of the buffer.
dataRaw pointer to the data with which the buffer is to be updated. This must not be nullptr!
dataSizeSpecifies the size (in bytes) of the data block which is to be updated. This is limited to 2^16 = 65536 bytes, because it may be written to the command buffer itself before it is copied to the destination buffer (depending on the backend).
Remarks
To update buffers larger than 65536 bytes, use writeBuffer() or Buffer::map.

Implemented in CeresEngine::MTCommandBuffer, CeresEngine::MKCommandBuffer, CeresEngine::NLCommandBuffer, CeresEngine::GLCommandBuffer, CeresEngine::VKCommandBuffer, and CeresEngine::WGCommandBuffer.

◆ wait()

◆ writeAccelerationStructuresProperties()

void CeresEngine::GPUCommandBuffer::writeAccelerationStructuresProperties ( )

Member Data Documentation

◆ didFinish

Event<void()> CeresEngine::GPUCommandBuffer::didFinish

An event triggered whenever the command buffer has finished execution.


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