tp::ComputeList class

Provides an interface to directly record compute 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::cmdExecuteComputePass.

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

If the list was provided as a parameter to tp::ComputeInlineCallback using the function callback variant, tp::ComputeList::beginRecording and tp::ComputeList::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

ComputeList()
Constructs a null tp::ComputeList.

Public functions

void beginRecording(CommandPool* commandPool)
Begins recording commands to the list, using the given command pool.
void cmdBindComputePipeline(const Pipeline& pipeline)
Binds a compute tp::Pipeline for use in the subsequent dispatch commands.
void cmdDispatch(uint32_t groupCountX, uint32_t groupCountY = 1, uint32_t groupCountZ = 1)
Records a dispatch of groupCountX * groupCountY * groupCountZ compute workgroups.
void cmdDispatchIndirect(const BufferView& dispatchParamBuffer)
Records an indirect dispatch with the parameters sourced from a buffer.
void cmdPipelineBarrier(ArrayParameter<const std::pair<ComputeAccessMask, ComputeAccessMask>> dependencies)
Inserts a pipeline barrier that synchronizes the given dependencies of future commands on past commands.
void cmdWriteTimestamp(const TimestampQuery& query, PipelineStage stage = PipelineStage::BottomOfPipe)
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::ComputeList::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::ComputeList::cmdBindComputePipeline(const Pipeline& pipeline)

Binds a compute tp::Pipeline for use in the subsequent dispatch commands.

Parameters
pipeline The pipeline object to bind.

void tp::ComputeList::cmdDispatch(uint32_t groupCountX, uint32_t groupCountY = 1, uint32_t groupCountZ = 1)

Records a dispatch of groupCountX * groupCountY * groupCountZ compute workgroups.

void tp::ComputeList::cmdDispatchIndirect(const BufferView& dispatchParamBuffer)

Records an indirect dispatch with the parameters sourced from a buffer.

Parameters
dispatchParamBuffer The buffer containing dispatch parameters in the form of VkDispatchIndirectCommand.

void tp::ComputeList::cmdPipelineBarrier(ArrayParameter<const std::pair<ComputeAccessMask, ComputeAccessMask>> dependencies)

Inserts a pipeline barrier that synchronizes the given dependencies of future commands on past commands.

Parameters
dependencies The global execution and memory dependencies to synchronize.

void tp::ComputeList::cmdWriteTimestamp(const TimestampQuery& query, PipelineStage stage = PipelineStage::BottomOfPipe)

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::ComputeList::endRecording()

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