tp::RenderList class

Provides an interface to directly record graphics commands into a Vulkan VkCommandBuffer inside a compute pass.

The behavior and expected usage differs depending on the variant of the commandRecording parameter passed to tp::Job::cmdExecuteRenderPass.

If the list was provided through the tp::ArrayView<tp::RenderList> variant, then tp::RenderList::beginRecording must be called before the first and tp::RenderList::endRecording after the last recorded command.

If the list was provided as a parameter to tp::RenderInlineCallback using the function callback variant, tp::RenderList::beginRecording and tp::RenderList::endRecording must not be called. Any changed state (cmdBind..., cmdSet...) persists between all inline lists within the same tp::Job.

Base classes

class CommandList
An abstract class that implements common functionality for recording commands inside either a compute or render pass. See tp::ComputeList and tp::RenderList for further details.

Constructors, destructors, conversion operators

RenderList()
Constructs a null tp::RenderList.

Public functions

void beginRecording(CommandPool* commandPool)
Begins recording commands to the list, using the given command pool.
void cmdBeginQueries(ArrayParameter<const RenderQuery*const> queries)
Begins the scope of one or more render queries.
void cmdBindGraphicsPipeline(const Pipeline& pipeline)
Binds a graphics tp::Pipeline for use in subsequent draw commands.
void cmdBindIndexBuffer(const BufferView& buffer, IndexType indexType)
Binds an index buffer for use in subsequent indexed draw commands.
void cmdBindVertexBuffers(ArrayParameter<const BufferView> buffers, uint32_t firstBinding = 0)
Binds the given vertex buffers for use in subsequent draw commands.
void cmdDraw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t firstVertex = 0, uint32_t firstInstance = 0)
Records a non-indexed draw.
void cmdDrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t firstIndex = 0, int32_t vertexOffset = 0, uint32_t firstInstance = 0)
Records an indexed draw.
void cmdDrawIndexedIndirect(const BufferView& drawParamBuffer, uint32_t drawCount = 1, uint32_t stride = sizeof(VkDrawIndexedIndirectCommand))
Records indirect indexed draws with the parameters sourced from a buffer.
void cmdDrawIndexedIndirectCount(const BufferView& drawParamBuffer, const BufferView& countBuffer, uint32_t maxDrawCount, uint32_t stride)
Records indirect indexed draws, with both the parameters and the draw count sourced from buffers.
void cmdDrawIndirect(const BufferView& drawParamBuffer, uint32_t drawCount = 1, uint32_t stride = sizeof(VkDrawIndirectCommand))
Records indirect draws with the parameters sourced from a buffer.
void cmdDrawIndirectCount(const BufferView& drawParamBuffer, const BufferView& countBuffer, uint32_t maxDrawCount, uint32_t stride)
Records indirect draws, with both the parameters and the draw count sourced from buffers.
void cmdEndQueries(ArrayParameter<const RenderQuery*const> queries)
Ends the scope of one or more render queries, writing the result to their provided objects.
void cmdSetBlendConstants(float blendConstants[4])
Sets the blend constants pipeline dynamic state.
void cmdSetDepthBias(float constantFactor = 0.0f, float slopeFactor = 0.0f, float biasClamp = 0.0f)
Sets the depth bias pipeline dynamic state.
void cmdSetDepthBounds(float minDepthBounds = 0.0f, float maxDepthBounds = 1.0f)
Sets the depth bounds pipeline dynamic state.
void cmdSetLineWidth(float width = 1.0f)
Sets the line width pipeline dynamic state.
void cmdSetScissor(ArrayParameter<const Rect2D> scissors, uint32_t firstScissor = 0)
Sets the scissor test rectangles.
void cmdSetViewport(ArrayParameter<const Viewport> viewports, uint32_t firstViewport = 0)
Sets the viewport(s) to render to.
void cmdWriteTimestamp(const TimestampQuery& query, PipelineStage stage)
Queries the time on the device as part of the given pipeline stage and writes the result to the provided query object.
void endRecording()
Ends recording commands to the list. No other methods can be called after this point.

Function documentation

void tp::RenderList::beginRecording(CommandPool* commandPool)

Begins recording commands to the list, using the given command pool.

Parameters
commandPool The command pool to use for memory allocations for command recording. Cannot be nullptr.

void tp::RenderList::cmdBeginQueries(ArrayParameter<const RenderQuery*const> queries)

Begins the scope of one or more render queries.

Parameters
queries The render query objects to begin.

void tp::RenderList::cmdBindGraphicsPipeline(const Pipeline& pipeline)

Binds a graphics tp::Pipeline for use in subsequent draw commands.

Parameters
pipeline The pipeline object to bind.

void tp::RenderList::cmdBindIndexBuffer(const BufferView& buffer, IndexType indexType)

Binds an index buffer for use in subsequent indexed draw commands.

Parameters
buffer The index buffer to bind.
indexType The type of the index data inside the buffer.

void tp::RenderList::cmdBindVertexBuffers(ArrayParameter<const BufferView> buffers, uint32_t firstBinding = 0)

Binds the given vertex buffers for use in subsequent draw commands.

Parameters
buffers The vertex buffers to bind.
firstBinding The index of the first vertex buffer binding to update.

void tp::RenderList::cmdDraw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t firstVertex = 0, uint32_t firstInstance = 0)

Records a non-indexed draw.

Parameters
vertexCount The number of vertices to draw.
instanceCount The number of instances to draw.
firstVertex The index of the first vertex to draw.
firstInstance The index of the first instance to draw.

void tp::RenderList::cmdDrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t firstIndex = 0, int32_t vertexOffset = 0, uint32_t firstInstance = 0)

Records an indexed draw.

Parameters
indexCount The number of indexed vertices to draw.
instanceCount The number of instances to draw.
firstIndex The index of the first value in the index buffer to draw.
vertexOffset The value added to the vertex index before indexing into the vertex buffer.
firstInstance The index of the first instance to draw.

void tp::RenderList::cmdDrawIndexedIndirect(const BufferView& drawParamBuffer, uint32_t drawCount = 1, uint32_t stride = sizeof(VkDrawIndexedIndirectCommand))

Records indirect indexed draws with the parameters sourced from a buffer.

Parameters
drawParamBuffer The buffer containing draw parameters in the form of VkDrawIndexedIndirectCommand.
drawCount The number of draws to execute.
stride The stride in bytes between successive sets of draw parameters.

void tp::RenderList::cmdDrawIndexedIndirectCount(const BufferView& drawParamBuffer, const BufferView& countBuffer, uint32_t maxDrawCount, uint32_t stride)

Records indirect indexed draws, with both the parameters and the draw count sourced from buffers.

Parameters
drawParamBuffer The buffer containing draw parameters in the form of VkDrawIndexedIndirectCommand.
countBuffer The buffer containing the draw count in the form of a single unsigned 32-bit integer.
maxDrawCount The maximum number of draws that can be executed.
stride The stride in bytes between successive sets of draw parameters.

void tp::RenderList::cmdDrawIndirect(const BufferView& drawParamBuffer, uint32_t drawCount = 1, uint32_t stride = sizeof(VkDrawIndirectCommand))

Records indirect draws with the parameters sourced from a buffer.

Parameters
drawParamBuffer The buffer containing draw parameters in the form of VkDrawIndirectCommand.
drawCount The number of draws to execute.
stride The stride in bytes between successive sets of draw parameters.

void tp::RenderList::cmdDrawIndirectCount(const BufferView& drawParamBuffer, const BufferView& countBuffer, uint32_t maxDrawCount, uint32_t stride)

Records indirect draws, with both the parameters and the draw count sourced from buffers.

Parameters
drawParamBuffer The buffer containing draw parameters in the form of VkDrawIndirectCommand.
countBuffer The buffer containing the draw count in the form of a single unsigned 32-bit integer.
maxDrawCount The maximum number of draws that can be executed.
stride The stride in bytes between successive sets of draw parameters.

void tp::RenderList::cmdEndQueries(ArrayParameter<const RenderQuery*const> queries)

Ends the scope of one or more render queries, writing the result to their provided objects.

Parameters
queries The render query objects that the result will be written to.

void tp::RenderList::cmdSetBlendConstants(float blendConstants[4])

Sets the blend constants pipeline dynamic state.

Parameters
blendConstants The constants used for certain blend factors during blending operations.

void tp::RenderList::cmdSetDepthBias(float constantFactor = 0.0f, float slopeFactor = 0.0f, float biasClamp = 0.0f)

Sets the depth bias pipeline dynamic state.

Parameters
constantFactor Controls the constant depth value added to each fragment.
slopeFactor Controls the slope dependent depth value added to each fragment.
biasClamp Sets the maximum depth bias of a fragment.

void tp::RenderList::cmdSetDepthBounds(float minDepthBounds = 0.0f, float maxDepthBounds = 1.0f)

Sets the depth bounds pipeline dynamic state.

Parameters
minDepthBounds The minimum depth value.
maxDepthBounds The maximum depth value.

void tp::RenderList::cmdSetLineWidth(float width = 1.0f)

Sets the line width pipeline dynamic state.

Parameters
width The width of the rasterized line segments in pixels.

void tp::RenderList::cmdSetScissor(ArrayParameter<const Rect2D> scissors, uint32_t firstScissor = 0)

Sets the scissor test rectangles.

Parameters
scissors The scissors to set.
firstScissor The index of the first scissor rectangle to update.

void tp::RenderList::cmdSetViewport(ArrayParameter<const Viewport> viewports, uint32_t firstViewport = 0)

Sets the viewport(s) to render to.

Parameters
viewports The viewports to set.
firstViewport The index of the first viewport to update.

void tp::RenderList::cmdWriteTimestamp(const TimestampQuery& query, PipelineStage stage)

Queries the time on the device as part of the given pipeline stage and writes the result to the provided query object.

Parameters
query The timestamp query object that the result will be written to.
stage The pipeline stage at which the timestamp should be measured. This means a time point at which all the previously submitted commands have finished executing the given pipeline stage.

void tp::RenderList::endRecording()

Ends recording commands to the list. No other methods can be called after this point.