Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::ComputePass Class Reference

The compute pass stores all resources which belong to a compute pipeline. More...

#include <ComputePass.h>

Inheritance diagram for EngineCore::ComputePass:
Collaboration diagram for EngineCore::ComputePass:

Public Member Functions

virtual ~ComputePass ()=default
 ComputePass (const std::string &name)
void create (VkDevice device, const VkPipelineLayoutCreateInfo *pPipelineLayoutCreateInfo, const VkDescriptorSetLayoutCreateInfo *pDescriptorSetLayoutCreateInfo, std::string shaderName, std::optional< const PipelineSpecializationData * > pSpecializationData)
 Creates a whole compute pass with a layout and everything. This is one of two steps needed to create a full compute shader.
uint32_t getThreadCount () const
 Gets the amount of threads this compute shader is running on on the GPU.
VkPipelineLayout & getPipelineLayout ()
 Gets the layout of this compute pipeline.
ComputePipelinegetComputePipeline ()
 Getter for the raw compute pipeline.
VkDescriptorSetLayout & getDescriptorSetLayout ()
 Gets the descriptor set layout associated with this pipeline.
VkPushConstantsInfo createPushConstantsInfo (uint32_t size, const void *pValues) const
 Used to create preconfigured push constants where you only pass in the size of the push constant and a pointer to the data.
void createDescriptorSet (VkDevice device, uint32_t frameInFlightIndex, VkDescriptorPool descriptorPool)
 Creates a vulkan descriptor set resource for a frame in flight into a specified descriptor pool.
DescriptorSetUpdaterupdateDescriptorSet (uint32_t frameInFlightIndex)
 Creates a descriptor set updater which is used to batch update descriptor set resources.
VkDescriptorSet getDescriptorSet (uint32_t frameInFlightIndex) const
 Getter for the descriptor set of this pipeline.
void bindDescriptorSets (VkCommandBuffer commandBuffer, uint32_t frameInFlightIndex)
 Binds the descriptor set of a frame in flight.
void cleanup (VkDevice device)
 Cleanup of owned resources using direct VkDevice handle.
void cleanup (ApplicationContext *context)
 Cleanup of owned resources using ApplicationContext.

Protected Member Functions

virtual void extractSpecializationData (std::optional< const PipelineSpecializationData * > pSpecializationData)
std::string getName () const

Protected Attributes

uint32_t threadCount = 32

Private Attributes

DescriptorSetUpdater descriptorSetBuilder {VK_NULL_HANDLE}
std::string name = "Generic Compute"
VkPipelineLayout pipelineLayout = VK_NULL_HANDLE
VkDescriptorSetLayout descriptorSetLayout = VK_NULL_HANDLE
ComputePipelinecomputePipeline = nullptr
bool cleanedUp = false
std::array< VkDescriptorSet, MAX_FRAMES_IN_FLIGHTdescriptorSet {VK_NULL_HANDLE}

Detailed Description

The compute pass stores all resources which belong to a compute pipeline.

Author
Konstantin Passig
Date
15.12.2025

Definition at line 26 of file ComputePass.h.

Constructor & Destructor Documentation

◆ ~ComputePass()

virtual EngineCore::ComputePass::~ComputePass ( )
virtualdefault

References name.

◆ ComputePass()

EngineCore::ComputePass::ComputePass ( const std::string & name)

Definition at line 10 of file ComputePass.cpp.

References name.

Referenced by EngineCore::DispatcherComputePass::DispatcherComputePass().

Here is the caller graph for this function:

Member Function Documentation

◆ bindDescriptorSets()

void EngineCore::ComputePass::bindDescriptorSets ( VkCommandBuffer commandBuffer,
uint32_t frameInFlightIndex )

Binds the descriptor set of a frame in flight.

Parameters
commandBufferthe command buffer to bind to
frameInFlightIndexwhich frame in flight resource to bind to
Author
Konstantin Passig
Date
15.12.2025

Definition at line 133 of file ComputePass.cpp.

References descriptorSet, and pipelineLayout.

Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().

Here is the caller graph for this function:

◆ cleanup() [1/2]

void EngineCore::ComputePass::cleanup ( ApplicationContext * context)

Cleanup of owned resources using ApplicationContext.

Parameters
contextthe vulkan application context which provides the vulkan device
Author
Konstantin Passig
Date
15.12.2025

Definition at line 162 of file ComputePass.cpp.

References cleanup(), and EngineCore::ApplicationContext::getVkDevice().

Here is the call graph for this function:

◆ cleanup() [2/2]

void EngineCore::ComputePass::cleanup ( VkDevice device)

Cleanup of owned resources using direct VkDevice handle.

Use this overload for tests or when ApplicationContext is not available.

Parameters
deviceThe Vulkan device to use for cleanup
Author
Konstantin Passig
Date
2026-01-12

Definition at line 137 of file ComputePass.cpp.

References cleanedUp, computePipeline, descriptorSetLayout, name, and pipelineLayout.

Referenced by cleanup().

Here is the caller graph for this function:

◆ create()

void EngineCore::ComputePass::create ( VkDevice device,
const VkPipelineLayoutCreateInfo * pPipelineLayoutCreateInfo,
const VkDescriptorSetLayoutCreateInfo * pDescriptorSetLayoutCreateInfo,
std::string shaderName,
std::optional< const PipelineSpecializationData * > pSpecializationData )

Creates a whole compute pass with a layout and everything. This is one of two steps needed to create a full compute shader.

Parameters
deviceThe vulkan device where all the vulkan objects are attached to
pPipelineLayoutCreateInfohow the compute pipeline is supposed to be setup
pDescriptorSetLayoutCreateInfothe descriptor set layout
shaderNamethe path to the compute shader which is being run by this pipeline
pSpecializationDataoptional specialization data

Definition at line 12 of file ComputePass.cpp.

References computePipeline, VulkanHelper::createDescriptorSetLayout(), VulkanHelper::createPipelineLayout(), descriptorSetLayout, extractSpecializationData(), name, and pipelineLayout.

Here is the call graph for this function:

◆ createDescriptorSet()

void EngineCore::ComputePass::createDescriptorSet ( VkDevice device,
uint32_t frameInFlightIndex,
VkDescriptorPool descriptorPool )

Creates a vulkan descriptor set resource for a frame in flight into a specified descriptor pool.

Parameters
devicethe vulkan device
frameInFlightIndexfor which frame in flight the resource should be created
descriptorPoolwhich descriptor pool will manage the descriptor set
Author
Konstantin Passig
Date
15.12.2025

Definition at line 110 of file ComputePass.cpp.

References VulkanHelper::allocateDescriptorSets(), descriptorSet, descriptorSetLayout, VulkanHelper::getDebugName(), and getName().

Here is the call graph for this function:

◆ createPushConstantsInfo()

VkPushConstantsInfo EngineCore::ComputePass::createPushConstantsInfo ( uint32_t size,
const void * pValues ) const

Used to create preconfigured push constants where you only pass in the size of the push constant and a pointer to the data.

Parameters
sizehow big is the data
pValueswhere is the data
Returns
A vulkan push constants struct
Author
Konstantin Passig
Date
15.12.2025

Definition at line 96 of file ComputePass.cpp.

References pipelineLayout.

Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().

Here is the caller graph for this function:

◆ extractSpecializationData()

void EngineCore::ComputePass::extractSpecializationData ( std::optional< const PipelineSpecializationData * > pSpecializationData)
protectedvirtual

Reimplemented in EngineCore::DispatcherComputePass.

Definition at line 166 of file ComputePass.cpp.

References threadCount.

Referenced by create().

Here is the caller graph for this function:

◆ getComputePipeline()

ComputePipeline * EngineCore::ComputePass::getComputePipeline ( )

Getter for the raw compute pipeline.

Returns
The compute pipeline wrapper
Author
Konstantin Passig
Date
15.12.2025

Definition at line 87 of file ComputePass.cpp.

References computePipeline.

Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().

Here is the caller graph for this function:

◆ getDescriptorSet()

VkDescriptorSet EngineCore::ComputePass::getDescriptorSet ( uint32_t frameInFlightIndex) const
nodiscard

Getter for the descriptor set of this pipeline.

Parameters
frameInFlightIndexwhich resource should be returned
Returns
Vulkan descriptor set
Author
Konstantin Passig
Date
15.12.2025

Definition at line 128 of file ComputePass.cpp.

References descriptorSet.

Referenced by updateDescriptorSet().

Here is the caller graph for this function:

◆ getDescriptorSetLayout()

VkDescriptorSetLayout & EngineCore::ComputePass::getDescriptorSetLayout ( )

Gets the descriptor set layout associated with this pipeline.

Returns
Vulkan descriptor set layout
Author
Konstantin Passig
Date
15.12.2025

Definition at line 91 of file ComputePass.cpp.

References descriptorSetLayout.

◆ getName()

std::string EngineCore::ComputePass::getName ( ) const
inlinenodiscardprotected

Definition at line 177 of file ComputePass.h.

References name.

Referenced by createDescriptorSet(), and EngineCore::DispatcherComputePass::extractSpecializationData().

Here is the caller graph for this function:

◆ getPipelineLayout()

VkPipelineLayout & EngineCore::ComputePass::getPipelineLayout ( )

Gets the layout of this compute pipeline.

Returns
Vulkan pipeline layout
Author
Konstantin Passig
Date
15.12.2025

Definition at line 83 of file ComputePass.cpp.

References pipelineLayout.

◆ getThreadCount()

uint32_t EngineCore::ComputePass::getThreadCount ( ) const
nodiscard

Gets the amount of threads this compute shader is running on on the GPU.

Returns
The amount of threads the compute shader on the gpu is running with
Author
Konstantin Passig
Date
15.12.2025

Definition at line 57 of file ComputePass.cpp.

References threadCount.

Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().

Here is the caller graph for this function:

◆ updateDescriptorSet()

DescriptorSetUpdater & EngineCore::ComputePass::updateDescriptorSet ( uint32_t frameInFlightIndex)

Creates a descriptor set updater which is used to batch update descriptor set resources.

Parameters
frameInFlightIndexwhich descriptor set to update
Returns
A builder for the batch update
Author
Konstantin Passig
Date
15.12.2025

Definition at line 122 of file ComputePass.cpp.

References computePipeline, descriptorSetBuilder, VulkanHelper::getDebugName(), and getDescriptorSet().

Here is the call graph for this function:

Member Data Documentation

◆ cleanedUp

bool EngineCore::ComputePass::cleanedUp = false
private

Definition at line 172 of file ComputePass.h.

Referenced by cleanup().

◆ computePipeline

ComputePipeline* EngineCore::ComputePass::computePipeline = nullptr
private

Definition at line 171 of file ComputePass.h.

Referenced by cleanup(), create(), getComputePipeline(), and updateDescriptorSet().

◆ descriptorSet

std::array<VkDescriptorSet, MAX_FRAMES_IN_FLIGHT> EngineCore::ComputePass::descriptorSet {VK_NULL_HANDLE}
private

Definition at line 174 of file ComputePass.h.

Referenced by bindDescriptorSets(), createDescriptorSet(), and getDescriptorSet().

◆ descriptorSetBuilder

DescriptorSetUpdater EngineCore::ComputePass::descriptorSetBuilder {VK_NULL_HANDLE}
private

Definition at line 166 of file ComputePass.h.

Referenced by updateDescriptorSet().

◆ descriptorSetLayout

VkDescriptorSetLayout EngineCore::ComputePass::descriptorSetLayout = VK_NULL_HANDLE
private

Definition at line 170 of file ComputePass.h.

Referenced by cleanup(), create(), createDescriptorSet(), and getDescriptorSetLayout().

◆ name

std::string EngineCore::ComputePass::name = "Generic Compute"
private

◆ pipelineLayout

VkPipelineLayout EngineCore::ComputePass::pipelineLayout = VK_NULL_HANDLE
private

◆ threadCount

uint32_t EngineCore::ComputePass::threadCount = 32
protected

The documentation for this class was generated from the following files:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Core/ComputePass.h
  • /home/magerbeton/Documents/gl3-vulkan/Engine/src/Engine/Core/ComputePass.cpp