VPP  0.8
A high-level modern C++ API for Vulkan
vpp::ComputePipelineConfig Class Reference

Base class for custom compute pipelines. More...

#include <vppPipelineConfig.hpp>

Inheritance diagram for vpp::ComputePipelineConfig:
vpp::PipelineConfig

Additional Inherited Members

- Public Types inherited from vpp::PipelineConfig
enum  {
  POINT_LIST = VK_PRIMITIVE_TOPOLOGY_POINT_LIST, LINE_LIST = VK_PRIMITIVE_TOPOLOGY_LINE_LIST, LINE_STRIP = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, TRIANGLE_LIST = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
  TRIANGLE_STRIP = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, TRIANGLE_FAN = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, LINE_LIST_ADJ = VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, LINE_STRIP_ADJ = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY,
  TRIANGLE_LIST_ADJ = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY, TRIANGLE_STRIP_ADJ = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY, PATCH_LIST = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
}
 
- Public Member Functions inherited from vpp::PipelineConfig
VkPrimitiveTopology getPrimitiveTopology () const
 Retrieves selected primitive topology.
 
bool getEnablePrimitiveRestart () const
 Checks if the primitive restart feature is enabled.
 
std::uint32_t getTessPatchControlPoints () const
 
RenderGraphgetRenderGraph () const
 Retrieves a reference to the parent render graph of this pipeline.
 
std::uint32_t getProcessIndex () const
 Retrieves an index of associated Process node in the render graph.
 
template<class AssignmentListT >
void cmdBindVertexInput (const AssignmentListT &list, CommandBuffer hCmdBuffer=CommandBuffer())
 Issues a command which binds some data buffer containing vertex information to a binding point declared within the pipeline. More...
 
void cmdBindIndexInput (const VertexIndexBufferView &hVertexIndexBufferView, CommandBuffer hCmdBuffer=CommandBuffer())
 Issues a command which binds some data buffer containing indices for indexed draw to the pipeline. More...
 
- Protected Member Functions inherited from vpp::PipelineConfig
 PipelineConfig (const Process &boundProcess)
 Constructor, called only from subclass constructor. More...
 
void setBlendingMode (const BaseAttachment &dataNode, const VkPipelineColorBlendAttachmentState &blendConfig)
 Sets blending mode for specified color attachment. More...
 
void enableLogicOperation (bool bEnable, VkLogicOp logicOp)
 Sets logical operation mode for the rasterizer. More...
 
void setPrimitiveTopology (VkPrimitiveTopology v)
 Specifies what kind of geometric primitives are supplied to the pipeline as input. More...
 
void setEnablePrimitiveRestart (bool v)
 Enables primitive restart feature for indexed draws. More...
 
void setTessPatchControlPoints (std::uint32_t v)
 

Detailed Description

Base class for custom compute pipelines.

Compute pipelines are special kind of pipelines, designed for GPU computation. The main difference from regular pipelines is that compute pipelines are not associated with render graph. Another difference is that the only shader type allowed in compute pipelines is computeShader. Otherwise they are similar and can accept the same binding point types as regular pipelines.

You define your own computation pipeline classes in same way as rendering pipelines, by deriving from ComputePipelineConfig. You do not need to pass any argument to the constructor, though.

Command and functions specific to graphics inherited from PipelineConfig are not applicable to compute pipelines, so avoid calling them.

An example:

class MyPipelineConfig : public vpp::ComputePipelineConfig
{
public:
MyPipelineConfig ( const vpp::Device& hDevice )
m_computeShader ( this, { 32, 1, 1 }, & MyPipelineConfig::fComputeShader )
{}
void setDataBuffers (
vpp::ShaderDataBlock* pDataBlock,
const vpp::UniformBufferView& dataInput,
const vpp::StorageBufferView& dataOutput )
{
pDataBlock->update ( (
m_dataInput = dataInput,
m_dataOutput = dataOutput
) );
}
void fComputeShader ( vpp::ComputeShader* pShader )
{
using namespace vpp;
const IVec3 workgroupId = pShader->inWorkgroupId;
const IVec3 localId = pShader->inLocalInvocationId;
const Int g = workgroupId [ X ];
const Int l = localId [ X ];
const Int i = ( g << 5 ) + l;
const Float s = inData [ i ];
const Float d = s*s;
outData [ i ] = d;
}
private:
vpp::inUniformBuffer m_dataInput;
vpp::ioBuffer m_dataOutput;
vpp::computeShader m_computeShader;
};

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