Toast Engine
Loading...
Searching...
No Matches
fxaa_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 FxaaPass : public IPostProcessPass {
23public:
24 FxaaPass(const VulkanCore& core, vk::Format ldr_format, vk::Extent2D extent);
25
26 [[nodiscard]]
27 auto name() const -> std::string_view override {
28 return "FXAA";
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::vec2 inverse_source_size {0.0f};
39 float contrast_threshold = 0.0312f;
40 float relative_threshold = 0.125f;
41 float subpixel_blending = 0.75f;
42 glm::vec2 pad0 {0.0f};
43 };
44
45 void createResources(const VulkanCore& core);
46 void createTarget(const VulkanCore& core, vk::Extent2D extent);
47
48 const VulkanCore* m_core = nullptr;
49 vk::Format m_ldr_format = vk::Format::eUndefined;
50
51 ShaderLayout m_shader_layout;
52 VulkanPipeline m_pipeline;
53
54 vk::raii::Sampler m_sampler = nullptr;
55 std::vector<vk::raii::DescriptorSet> m_descriptor_sets;
56 std::vector<vk::ImageView> m_bound_views;
57
58 PostProcessTarget m_target;
59};
60
61}
auto record(vk::CommandBuffer cmd, uint32_t frame_index, vk::ImageView source_view) -> vk::ImageView override
Definition fxaa_pass.cpp:91
Definition post_process_pass_base.hpp:14
Definition post_process_target.hpp:19
Definition shader_layout.hpp:12
Definition vulkan_core.hpp:48
Definition vulkan_pipeline.hpp:19