sandbox
Loading...
Searching...
No Matches
default_filter.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_POST_FILTERS_DEFAULT_FILTER_HPP_
3#define LIBSBX_POST_FILTERS_DEFAULT_FILTER_HPP_
4
5#include <string>
6
7#include <libsbx/graphics/graphics_module.hpp>
8
9#include <libsbx/post/filter.hpp>
10
11namespace sbx::post {
12
13template<std::size_t Id>
14class default_filter final : public filter {
15
16 using base_type = filter;
17
18public:
19
20 default_filter(const std::vector<graphics::attachment_description>& attachments, const std::filesystem::path& path, const std::string& attachment_name)
21 : base_type{attachments, path},
22 _attachment_name{attachment_name} { }
23
24 ~default_filter() override = default;
25
26 auto render(graphics::command_buffer& command_buffer) -> void override {
27 EASY_BLOCK("default_filter::render");
28
29 auto& pipeline = base_type::pipeline();
30 auto& descriptor_handler = base_type::descriptor_handler();
31
32 auto& graphics_module = core::engine::get_module<graphics::graphics_module>();
33
34 pipeline.bind(command_buffer);
35
36 descriptor_handler.push("image", graphics_module.attachment(_attachment_name));
37
38 if (!descriptor_handler.update(pipeline)) {
39 return;
40 }
41
42 descriptor_handler.bind_descriptors(command_buffer);
43
44 command_buffer.draw(3, 1, 0, 0);
45 }
46
47private:
48
49 std::string _attachment_name;
50
51}; // class default_filter
52
53} // namespace sbx::post
54
55#endif // LIBSBX_POST_FILTERS_DEFAULT_FILTER_HPP_
Definition: command_buffer.hpp:15
Definition: default_filter.hpp:14
Definition: filter.hpp:19