HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
gfx_pipeline_tone_mapper_vulkan.hpp
1// Copyright Take Vos 2020-2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "gfx_pipeline_vulkan.hpp"
8#include "../container/module.hpp"
9#include "../macros.hpp"
10#include <vma/vk_mem_alloc.h>
11#include <span>
12
13namespace hi { inline namespace v1 {
14
17class gfx_pipeline_tone_mapper : public gfx_pipeline {
18public:
20 float saturation = 1.0;
21
22 static std::vector<vk::PushConstantRange> pushConstantRanges()
23 {
24 return {{vk::ShaderStageFlagBits::eFragment, 0, sizeof(push_constants)}};
25 }
26};
27
29 gfx_device const &device;
30
31 vk::ShaderModule vertexShaderModule;
32 vk::ShaderModule fragmentShaderModule;
34
35 device_shared(gfx_device const &device);
37
38 device_shared(device_shared const &) = delete;
39 device_shared &operator=(device_shared const &) = delete;
40 device_shared(device_shared &&) = delete;
41 device_shared &operator=(device_shared &&) = delete;
42
46 void destroy(gfx_device const *vulkanDevice);
47
48 void drawInCommandBuffer(vk::CommandBuffer const &commandBuffer);
49
50private:
51 void buildShaders();
52 void teardownShaders(gfx_device const*vulkanDevice);
53};
54
55 ~gfx_pipeline_tone_mapper() = default;
57 gfx_pipeline_tone_mapper& operator=(const gfx_pipeline_tone_mapper&) = delete;
60
61 gfx_pipeline_tone_mapper(gfx_surface *surface) : gfx_pipeline(surface) {}
62
63 void draw_in_command_buffer(vk::CommandBuffer commandBuffer, draw_context const& context) override;
64
65protected:
66 push_constants _push_constants;
67
68 [[nodiscard]] std::vector<vk::PipelineShaderStageCreateInfo> createShaderStages() const override;
69 [[nodiscard]] std::vector<vk::DescriptorSetLayoutBinding> createDescriptorSetLayoutBindings() const override;
70 [[nodiscard]] std::vector<vk::WriteDescriptorSet> createWriteDescriptorSet() const override;
71 [[nodiscard]] size_t getDescriptorSetVersion() const override;
72 [[nodiscard]] std::vector<vk::PushConstantRange> createPushConstantRanges() const override;
73 [[nodiscard]] vk::PipelineDepthStencilStateCreateInfo getPipelineDepthStencilStateCreateInfo() const override;
74};
75
76}} // namespace hi::inline v1::gfx_pipeline_tone_mapper
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:208
Definition gfx_pipeline_tone_mapper_vulkan.hpp:17
Definition gfx_pipeline_tone_mapper_vulkan.hpp:19
Definition gfx_pipeline_tone_mapper_vulkan.hpp:28
void destroy(gfx_device const *vulkanDevice)
Definition gfx_pipeline_tone_mapper_vulkan_impl.hpp:93