NDEVR
API Documentation
VulkanComputePipeline

A generic, reusable Vulkan compute pipeline wrapper. More...

Public Member Functions

void addPushConstantRange (uint04 size)
 Declare a push constant range accessible from the compute stage.
void addStorageBuffer (uint04 binding)
 Declare an SSBO binding in the descriptor set layout.
void bindBuffer (uint04 binding, VkBuffer vk_buffer, VkDeviceSize size)
 Update a descriptor set binding to point to the given buffer.
void cleanup ()
 Free all Vulkan resources.
void create (const VulkanShader &shader)
 Create the descriptor set layout, pipeline layout, descriptor pool, descriptor set, and compute pipeline from the given SPIR-V shader module.
void dispatch (VkCommandBuffer cmd, uint04 gx, uint04 gy, uint04 gz) const
 Record a pipeline bind + dispatch into a command buffer.
void pushConstants (VkCommandBuffer cmd, const void *data, uint04 size) const
 Record push constants into a command buffer.

Static Public Member Functions

static void computeBarrier (VkCommandBuffer cmd)
 Insert a compute-to-compute memory barrier (SSBO write → read).

Detailed Description

A generic, reusable Vulkan compute pipeline wrapper.


Manages a descriptor set layout, descriptor pool, descriptor set, push constant range, pipeline layout, and VkComputePipeline. Call addStorageBuffer() / addPushConstantRange() before create(), then bind buffers and dispatch.

Definition at line 47 of file VulkanComputePipeline.h.

Member Function Documentation

◆ addPushConstantRange()

void VulkanComputePipeline::addPushConstantRange ( uint04 size)

Declare a push constant range accessible from the compute stage.

Parameters
sizeSize in bytes of the push constant block

◆ addStorageBuffer()

void VulkanComputePipeline::addStorageBuffer ( uint04 binding)

Declare an SSBO binding in the descriptor set layout.

Parameters
bindingThe binding index in the shader (layout(binding = N))

◆ bindBuffer()

void VulkanComputePipeline::bindBuffer ( uint04 binding,
VkBuffer vk_buffer,
VkDeviceSize size )

Update a descriptor set binding to point to the given buffer.

Parameters
bindingThe SSBO binding index
vk_bufferThe VkBuffer to bind
sizeSize in bytes of the buffer region

◆ create()

void VulkanComputePipeline::create ( const VulkanShader & shader)

Create the descriptor set layout, pipeline layout, descriptor pool, descriptor set, and compute pipeline from the given SPIR-V shader module.

Parameters
shaderA VulkanShader loaded with a compute shader SPIR-V module

◆ dispatch()

void VulkanComputePipeline::dispatch ( VkCommandBuffer cmd,
uint04 gx,
uint04 gy,
uint04 gz ) const

Record a pipeline bind + dispatch into a command buffer.

Parameters
cmdThe command buffer
gxNumber of workgroups in X
gyNumber of workgroups in Y
gzNumber of workgroups in Z

◆ pushConstants()

void VulkanComputePipeline::pushConstants ( VkCommandBuffer cmd,
const void * data,
uint04 size ) const

Record push constants into a command buffer.

Parameters
cmdThe command buffer
dataPointer to the push constant data
sizeSize in bytes (must match addPushConstantRange)

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