Toast Engine
Loading...
Searching...
No Matches
taa_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 <array>
16#include <glm/glm.hpp>
17#include <vector>
18
19namespace renderer {
20class VulkanCore;
21
22class TaaPass : public IPostProcessPass {
23public:
25 static constexpr uint32_t k_render_mode_motion = 26;
26
27 TaaPass(const VulkanCore& core, vk::Format scene_format, vk::Extent2D extent);
28
29 [[nodiscard]]
30 auto name() const -> std::string_view override {
31 return "TAA";
32 }
33
34 auto record(vk::CommandBuffer cmd, uint32_t frame_index, vk::ImageView source_view) -> vk::ImageView override;
35
36 void onResize(vk::Extent2D extent) override;
37
38private:
40 struct Params {
41 glm::mat4 reprojection {1.0f};
42 glm::vec4 texel {0.0f};
43 glm::vec4 tuning {0.0f};
44 };
45
46 void createResources(const VulkanCore& core);
47 void createTargets(const VulkanCore& core, vk::Extent2D extent);
48
49 const VulkanCore* m_core = nullptr;
50 vk::Format m_scene_format = vk::Format::eUndefined;
51
52 ShaderLayout m_shader_layout;
53 VulkanPipeline m_pipeline;
54
55 vk::raii::Sampler m_linear_sampler = nullptr;
56 vk::raii::Sampler m_point_sampler = nullptr;
57
58 std::vector<vk::raii::DescriptorSet> m_descriptor_sets;
60 std::vector<std::array<vk::ImageView, 2>> m_bound_views;
61
63 std::array<PostProcessTarget, 2> m_targets;
64 uint32_t m_write = 0;
65
66 bool m_history_valid = false;
67 uint64_t m_last_sequence = 0;
68 glm::mat4 m_last_view_projection {1.0f};
69};
70
71}
Definition post_process_pass_base.hpp:14
static constexpr uint32_t k_render_mode_motion
Mirrors the editor RenderMode.MotionVectors index.
Definition taa_pass.hpp:25
auto record(vk::CommandBuffer cmd, uint32_t frame_index, vk::ImageView source_view) -> vk::ImageView override
Definition taa_pass.cpp:100
Definition vulkan_core.hpp:48