Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
foray_computestage.hpp
Go to the documentation of this file.
1#pragma once
2#include "../core/foray_shadermodule.hpp"
3#include "../foray_glm.hpp"
4#include "../util/foray_pipelinelayout.hpp"
6
7namespace foray::stages {
17 {
18 public:
21 void Init(core::Context* context);
22
24 virtual void RecordFrame(VkCommandBuffer cmdBuffer, base::FrameRenderInfo& renderInfo) override;
25
26 virtual void Destroy() override;
27 protected:
29
32
33 VkPipeline mPipeline = nullptr;
34
36 inline virtual void ApiInitShader(){};
38 inline virtual void ApiCreateDescriptorSet(){};
40 inline virtual void ApiCreatePipelineLayout(){};
42 inline virtual void ApiBeforeFrame(VkCommandBuffer cmdBuffer, base::FrameRenderInfo& renderInfo){};
45 inline virtual void ApiBeforeDispatch(VkCommandBuffer cmdBuffer, base::FrameRenderInfo& renderInfo, glm::uvec3& groupSize){};
46
47 virtual void CreatePipeline();
48
49 virtual void ReloadShaders() override;
50 };
51} // namespace foray::stages
Context used for render processes. This object is rebuilt for every frame. /.
Definition foray_framerenderinfo.hpp:14
Helps with the creation of a VkDescriptorSetLayout and VkDescriptorSet.
Definition foray_descriptorset.hpp:15
Wraps shader code driver handle (VkShaderModule). See ShaderManager for compiling shaders dynamically...
Definition foray_shadermodule.hpp:11
Base class for compute shaders.
Definition foray_computestage.hpp:17
virtual void ApiBeforeFrame(VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo)
Prepare resources used in the compute shader.
Definition foray_computestage.hpp:42
virtual void Destroy() override
Destroy the render stage. Finalizes all components.
virtual void ApiInitShader()
Load a shader into mShader module.
Definition foray_computestage.hpp:36
virtual void ApiCreatePipelineLayout()
Configure and create the pipelinelayout.
Definition foray_computestage.hpp:40
core::ShaderModule mShader
Definition foray_computestage.hpp:28
virtual void ApiBeforeDispatch(VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo, glm::uvec3 &groupSize)
Push constants and configure the Group size.
Definition foray_computestage.hpp:45
void Init(core::Context *context)
Init.
virtual void ApiCreateDescriptorSet()
Create the descriptor set.
Definition foray_computestage.hpp:38
util::PipelineLayout mPipelineLayout
Definition foray_computestage.hpp:31
VkPipeline mPipeline
Definition foray_computestage.hpp:33
virtual void RecordFrame(VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo) override
Calls ApiBeforeFrame(), binds pipeline and descriptor set, calls ApiBeforeDispatch()
core::DescriptorSet mDescriptorSet
Definition foray_computestage.hpp:30
virtual void ReloadShaders() override
Override this to reload all shaders and rebuild pipelines after a registered shader has been recompil...
Render stage base class giving a common interface for rendering processes.
Definition foray_renderstage.hpp:15
Class that holds memory ownership of a vulkan pipeline layout.
Definition foray_pipelinelayout.hpp:12
Definition foray_blitstage.hpp:4
Non owning context object.
Definition foray_context.hpp:16