Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
foray_renderstage.hpp
Go to the documentation of this file.
1#pragma once
2#include "../base/foray_framerenderinfo.hpp"
3#include "../core/foray_context.hpp"
4#include "../core/foray_descriptorset.hpp"
5#include "../core/foray_managedimage.hpp"
6#include "../foray_basics.hpp"
7#include "../osi/foray_env.hpp"
8#include "../core/foray_core_declares.hpp"
9#include <unordered_map>
10
11namespace foray::stages {
12
15 {
16 public:
17 RenderStage() = default;
18
26 inline virtual void RecordFrame(VkCommandBuffer cmdBuffer, base::FrameRenderInfo& renderInfo) {}
27
29 inline virtual void Destroy() {}
30
34 virtual void Resize(const VkExtent2D& extent);
35
37 std::vector<core::ManagedImage*> GetImageOutputs();
41 core::ManagedImage* GetImageOutput(std::string_view name, bool noThrow = false);
42
45 virtual void OnShadersRecompiled(const std::unordered_set<uint64_t>& recompiled);
46
47 virtual ~RenderStage(){}
48
49 protected:
51 virtual void ReloadShaders() {}
53 virtual void DestroyOutputImages();
54
56 std::unordered_map<std::string, core::ManagedImage*> mImageOutputs;
58 std::vector<uint64_t> mShaderKeys;
61 };
62} // namespace foray::stages
Context used for render processes. This object is rebuilt for every frame. /.
Definition foray_framerenderinfo.hpp:14
Wraps allocation and lifetime functionality of VkImage.
Definition foray_managedimage.hpp:13
Render stage base class giving a common interface for rendering processes.
Definition foray_renderstage.hpp:15
virtual ~RenderStage()
Definition foray_renderstage.hpp:47
std::unordered_map< std::string, core::ManagedImage * > mImageOutputs
Inheriting types should emplace their images onto this collection to provide them in GetImageOutput i...
Definition foray_renderstage.hpp:56
core::Context * mContext
Context object the renderstage is built upon.
Definition foray_renderstage.hpp:60
std::vector< uint64_t > mShaderKeys
Inheriting types should emplace their shader keys onto this collection such that if a shader has been...
Definition foray_renderstage.hpp:58
virtual void DestroyOutputImages()
Calls Destroy() on any image in mImageOutputs and clears mImageOutputs.
std::vector< core::ManagedImage * > GetImageOutputs()
Gets a vector to all color attachments that will be included in a texture array and can be referenced...
virtual void Destroy()
Destroy the render stage. Finalizes all components.
Definition foray_renderstage.hpp:29
virtual void OnShadersRecompiled(const std::unordered_set< uint64_t > &recompiled)
Notifies the stage that the shader compiler instance has recompiled a shader.
core::ManagedImage * GetImageOutput(std::string_view name, bool noThrow=false)
Gets an image output.
virtual void RecordFrame(VkCommandBuffer cmdBuffer, base::FrameRenderInfo &renderInfo)
Records a frame to cmdBuffer.
Definition foray_renderstage.hpp:26
virtual void Resize(const VkExtent2D &extent)
Default implementation accesses mImageOutputs and calls ManagedImage::Resize(extent) on any set image...
virtual void ReloadShaders()
Override this to reload all shaders and rebuild pipelines after a registered shader has been recompil...
Definition foray_renderstage.hpp:51
Definition foray_blitstage.hpp:4
Non owning context object.
Definition foray_context.hpp:16