Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
foray::stages::ComputeStageBase Class Reference

Base class for compute shaders. More...

#include <foray_computestage.hpp>

Inheritance diagram for foray::stages::ComputeStageBase:
foray::stages::RenderStage

Public Member Functions

void Init (core::Context *context)
 Init.
 
virtual void RecordFrame (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo) override
 Calls ApiBeforeFrame(), binds pipeline and descriptor set, calls ApiBeforeDispatch()
 
virtual void Destroy () override
 Destroy the render stage. Finalizes all components.
 
- Public Member Functions inherited from foray::stages::RenderStage
 RenderStage ()=default
 
virtual void Resize (const VkExtent2D &extent)
 Default implementation accesses mImageOutputs and calls ManagedImage::Resize(extent) on any set image.
 
std::vector< core::ManagedImage * > GetImageOutputs ()
 Gets a vector to all color attachments that will be included in a texture array and can be referenced in the shader pass.
 
core::ManagedImageGetImageOutput (std::string_view name, bool noThrow=false)
 Gets an image output.
 
virtual void OnShadersRecompiled (const std::unordered_set< uint64_t > &recompiled)
 Notifies the stage that the shader compiler instance has recompiled a shader.
 
virtual ~RenderStage ()
 

Protected Member Functions

virtual void ApiInitShader ()
 Load a shader into mShader module.
 
virtual void ApiCreateDescriptorSet ()
 Create the descriptor set.
 
virtual void ApiCreatePipelineLayout ()
 Configure and create the pipelinelayout.
 
virtual void ApiBeforeFrame (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo)
 Prepare resources used in the compute shader.
 
virtual void ApiBeforeDispatch (VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo, glm::uvec3 &groupSize)
 Push constants and configure the Group size.
 
virtual void CreatePipeline ()
 
virtual void ReloadShaders () override
 Override this to reload all shaders and rebuild pipelines after a registered shader has been recompiled.
 
- Protected Member Functions inherited from foray::stages::RenderStage
virtual void DestroyOutputImages ()
 Calls Destroy() on any image in mImageOutputs and clears mImageOutputs.
 

Protected Attributes

core::ShaderModule mShader
 
core::DescriptorSet mDescriptorSet
 
util::PipelineLayout mPipelineLayout
 
VkPipeline mPipeline = nullptr
 
- Protected Attributes inherited from foray::stages::RenderStage
std::unordered_map< std::string, core::ManagedImage * > mImageOutputs
 Inheriting types should emplace their images onto this collection to provide them in GetImageOutput interface.
 
std::vector< uint64_t > mShaderKeys
 Inheriting types should emplace their shader keys onto this collection such that if a shader has been recompiled, ReloadShaders() will be called.
 
core::ContextmContext = nullptr
 Context object the renderstage is built upon.
 

Detailed Description

Base class for compute shaders.

Features

Inheriting

Member Function Documentation

◆ ApiBeforeDispatch()

virtual void foray::stages::ComputeStageBase::ApiBeforeDispatch ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo,
glm::uvec3 &  groupSize 
)
inlineprotectedvirtual

Push constants and configure the Group size.

Parameters
groupSizeCompute workgroup counts

◆ ApiBeforeFrame()

virtual void foray::stages::ComputeStageBase::ApiBeforeFrame ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo 
)
inlineprotectedvirtual

Prepare resources used in the compute shader.

◆ ApiCreateDescriptorSet()

virtual void foray::stages::ComputeStageBase::ApiCreateDescriptorSet ( )
inlineprotectedvirtual

Create the descriptor set.

◆ ApiCreatePipelineLayout()

virtual void foray::stages::ComputeStageBase::ApiCreatePipelineLayout ( )
inlineprotectedvirtual

Configure and create the pipelinelayout.

◆ ApiInitShader()

virtual void foray::stages::ComputeStageBase::ApiInitShader ( )
inlineprotectedvirtual

Load a shader into mShader module.

◆ CreatePipeline()

virtual void foray::stages::ComputeStageBase::CreatePipeline ( )
protectedvirtual

◆ Destroy()

virtual void foray::stages::ComputeStageBase::Destroy ( )
overridevirtual

Destroy the render stage. Finalizes all components.

Reimplemented from foray::stages::RenderStage.

◆ Init()

void foray::stages::ComputeStageBase::Init ( core::Context context)

◆ RecordFrame()

virtual void foray::stages::ComputeStageBase::RecordFrame ( VkCommandBuffer  cmdBuffer,
base::FrameRenderInfo renderInfo 
)
overridevirtual

Calls ApiBeforeFrame(), binds pipeline and descriptor set, calls ApiBeforeDispatch()

Reimplemented from foray::stages::RenderStage.

◆ ReloadShaders()

virtual void foray::stages::ComputeStageBase::ReloadShaders ( )
overrideprotectedvirtual

Override this to reload all shaders and rebuild pipelines after a registered shader has been recompiled.

Reimplemented from foray::stages::RenderStage.

Member Data Documentation

◆ mDescriptorSet

core::DescriptorSet foray::stages::ComputeStageBase::mDescriptorSet
protected

◆ mPipeline

VkPipeline foray::stages::ComputeStageBase::mPipeline = nullptr
protected

◆ mPipelineLayout

util::PipelineLayout foray::stages::ComputeStageBase::mPipelineLayout
protected

◆ mShader

core::ShaderModule foray::stages::ComputeStageBase::mShader
protected

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