|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
The compute pass stores all resources which belong to a compute pipeline. More...
#include <ComputePass.h>
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. | |
| ComputePipeline * | getComputePipeline () |
| 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. | |
| DescriptorSetUpdater & | updateDescriptorSet (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 |
| ComputePipeline * | computePipeline = nullptr |
| bool | cleanedUp = false |
| std::array< VkDescriptorSet, MAX_FRAMES_IN_FLIGHT > | descriptorSet {VK_NULL_HANDLE} |
The compute pass stores all resources which belong to a compute pipeline.
Definition at line 26 of file ComputePass.h.
|
virtualdefault |
References name.
| EngineCore::ComputePass::ComputePass | ( | const std::string & | name | ) |
Definition at line 10 of file ComputePass.cpp.
References name.
Referenced by EngineCore::DispatcherComputePass::DispatcherComputePass().
| void EngineCore::ComputePass::bindDescriptorSets | ( | VkCommandBuffer | commandBuffer, |
| uint32_t | frameInFlightIndex ) |
Binds the descriptor set of a frame in flight.
| commandBuffer | the command buffer to bind to |
| frameInFlightIndex | which frame in flight resource to bind to |
Definition at line 133 of file ComputePass.cpp.
References descriptorSet, and pipelineLayout.
Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().
| void EngineCore::ComputePass::cleanup | ( | ApplicationContext * | context | ) |
Cleanup of owned resources using ApplicationContext.
| context | the vulkan application context which provides the vulkan device |
Definition at line 162 of file ComputePass.cpp.
References cleanup(), and EngineCore::ApplicationContext::getVkDevice().
| 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.
| device | The Vulkan device to use for cleanup |
Definition at line 137 of file ComputePass.cpp.
References cleanedUp, computePipeline, descriptorSetLayout, name, and pipelineLayout.
Referenced by cleanup().
| 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.
| device | The vulkan device where all the vulkan objects are attached to |
| pPipelineLayoutCreateInfo | how the compute pipeline is supposed to be setup |
| pDescriptorSetLayoutCreateInfo | the descriptor set layout |
| shaderName | the path to the compute shader which is being run by this pipeline |
| pSpecializationData | optional specialization data |
Definition at line 12 of file ComputePass.cpp.
References computePipeline, VulkanHelper::createDescriptorSetLayout(), VulkanHelper::createPipelineLayout(), descriptorSetLayout, extractSpecializationData(), name, and pipelineLayout.
| 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.
| device | the vulkan device |
| frameInFlightIndex | for which frame in flight the resource should be created |
| descriptorPool | which descriptor pool will manage the descriptor set |
Definition at line 110 of file ComputePass.cpp.
References VulkanHelper::allocateDescriptorSets(), descriptorSet, descriptorSetLayout, VulkanHelper::getDebugName(), and getName().
| 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.
| size | how big is the data |
| pValues | where is the data |
Definition at line 96 of file ComputePass.cpp.
References pipelineLayout.
Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().
|
protectedvirtual |
Reimplemented in EngineCore::DispatcherComputePass.
Definition at line 166 of file ComputePass.cpp.
References threadCount.
Referenced by create().
| ComputePipeline * EngineCore::ComputePass::getComputePipeline | ( | ) |
Getter for the raw compute pipeline.
Definition at line 87 of file ComputePass.cpp.
References computePipeline.
Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().
|
nodiscard |
Getter for the descriptor set of this pipeline.
| frameInFlightIndex | which resource should be returned |
Definition at line 128 of file ComputePass.cpp.
References descriptorSet.
Referenced by updateDescriptorSet().
| VkDescriptorSetLayout & EngineCore::ComputePass::getDescriptorSetLayout | ( | ) |
Gets the descriptor set layout associated with this pipeline.
Definition at line 91 of file ComputePass.cpp.
References descriptorSetLayout.
|
inlinenodiscardprotected |
Definition at line 177 of file ComputePass.h.
References name.
Referenced by createDescriptorSet(), and EngineCore::DispatcherComputePass::extractSpecializationData().
| VkPipelineLayout & EngineCore::ComputePass::getPipelineLayout | ( | ) |
Gets the layout of this compute pipeline.
Definition at line 83 of file ComputePass.cpp.
References pipelineLayout.
|
nodiscard |
Gets the amount of threads this compute shader is running on on the GPU.
Definition at line 57 of file ComputePass.cpp.
References threadCount.
Referenced by EngineCore::Renderer::recordPass2Culling(), EngineCore::Renderer::recordVSInstancedDrawingPipeline(), and EngineCore::Renderer::renderToXr().
| DescriptorSetUpdater & EngineCore::ComputePass::updateDescriptorSet | ( | uint32_t | frameInFlightIndex | ) |
Creates a descriptor set updater which is used to batch update descriptor set resources.
| frameInFlightIndex | which descriptor set to update |
Definition at line 122 of file ComputePass.cpp.
References computePipeline, descriptorSetBuilder, VulkanHelper::getDebugName(), and getDescriptorSet().
|
private |
Definition at line 172 of file ComputePass.h.
Referenced by cleanup().
|
private |
Definition at line 171 of file ComputePass.h.
Referenced by cleanup(), create(), getComputePipeline(), and updateDescriptorSet().
|
private |
Definition at line 174 of file ComputePass.h.
Referenced by bindDescriptorSets(), createDescriptorSet(), and getDescriptorSet().
|
private |
Definition at line 166 of file ComputePass.h.
Referenced by updateDescriptorSet().
|
private |
Definition at line 170 of file ComputePass.h.
Referenced by cleanup(), create(), createDescriptorSet(), and getDescriptorSetLayout().
|
private |
Definition at line 168 of file ComputePass.h.
Referenced by cleanup(), ComputePass(), create(), EngineCore::DispatcherComputePass::DispatcherComputePass(), getName(), and ~ComputePass().
|
private |
Definition at line 169 of file ComputePass.h.
Referenced by bindDescriptorSets(), cleanup(), create(), createPushConstantsInfo(), and getPipelineLayout().
|
protected |
Definition at line 179 of file ComputePass.h.
Referenced by extractSpecializationData(), EngineCore::DispatcherComputePass::extractSpecializationData(), and getThreadCount().