Toast Engine
Loading...
Searching...
No Matches
ssr_pass.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
11#include "../shader_layout.hpp"
12#include "../vulkan_common.hpp"
13#include "../vulkan_pipeline.hpp"
14
15#include <glm/glm.hpp>
16#include <optional>
17#include <vector>
18
19namespace renderer {
20class VulkanCore;
21
22class SsrPass : public IPostProcessPass {
23public:
24 SsrPass(const VulkanCore& core, vk::Format scene_format, vk::Extent2D extent);
25
26 [[nodiscard]]
27 auto name() const -> std::string_view override {
28 return "SSR";
29 }
30
31 auto record(vk::CommandBuffer cmd, uint32_t frame_index, vk::ImageView source_view) -> vk::ImageView override;
32
33 void onResize(vk::Extent2D extent) override;
34
35private:
37 struct Params {
38 glm::mat4 view_projection {1.0f};
39 glm::mat4 inverse_view_projection {1.0f};
40 glm::vec4 camera_position {0.0f};
42 glm::vec4 tuning {0.0f};
44 glm::vec4 marching {0.0f};
45 };
46
48 static constexpr vk::Format k_reflection_format = vk::Format::eR16G16B16A16Sfloat;
49
50 void createResources(const VulkanCore& core);
51 void createTargets(const VulkanCore& core, vk::Extent2D extent);
52
53 const VulkanCore* m_core = nullptr;
54 vk::Format m_scene_format = vk::Format::eUndefined;
55
56 ShaderLayout m_shader_layout;
57 VulkanPipeline m_trace_pipeline;
58 VulkanPipeline m_composite_pipeline;
59
60 vk::raii::Sampler m_sampler = nullptr;
61 vk::raii::Sampler m_point_sampler = nullptr;
62
63 std::vector<vk::raii::DescriptorSet> m_descriptor_sets;
64 std::vector<vk::ImageView> m_bound_views;
65
66 PostProcessTarget m_reflection_target;
67 PostProcessTarget m_target;
68};
69
70}
Definition post_process_pass_base.hpp:14
Definition post_process_target.hpp:19
Definition shader_layout.hpp:12
auto record(vk::CommandBuffer cmd, uint32_t frame_index, vk::ImageView source_view) -> vk::ImageView override
Definition ssr_pass.cpp:119
Definition vulkan_core.hpp:48
Definition vulkan_pipeline.hpp:19