HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
gfx_pipeline_tone_mapper_vulkan_intf.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_intf.hpp"
8#include "../container/container.hpp"
9#include "../geometry/geometry.hpp"
10#include "../image/image.hpp"
11#include "../macros.hpp"
12#include <vma/vk_mem_alloc.h>
13#include <vulkan/vulkan.hpp>
14#include <span>
15
16hi_export_module(hikogui.GFX : gfx_pipeline_tone_mapper_intf);
17
18hi_export namespace hi { inline namespace v1 {
19
22class gfx_pipeline_tone_mapper : public gfx_pipeline {
23public:
25 float saturation = 1.0;
26
27 static std::vector<vk::PushConstantRange> pushConstantRanges()
28 {
29 return {{vk::ShaderStageFlagBits::eFragment, 0, sizeof(push_constants)}};
30 }
31};
32
33struct device_shared final {
34 gfx_device const &device;
35
36 vk::ShaderModule vertexShaderModule;
37 vk::ShaderModule fragmentShaderModule;
39
40 device_shared(gfx_device const &device);
42
43 device_shared(device_shared const &) = delete;
44 device_shared &operator=(device_shared const &) = delete;
45 device_shared(device_shared &&) = delete;
46 device_shared &operator=(device_shared &&) = delete;
47
51 void destroy(gfx_device const *vulkanDevice);
52
53 void drawInCommandBuffer(vk::CommandBuffer const &commandBuffer);
54
55private:
56 void buildShaders();
57 void teardownShaders(gfx_device const*vulkanDevice);
58};
59
60 ~gfx_pipeline_tone_mapper() = default;
62 gfx_pipeline_tone_mapper& operator=(const gfx_pipeline_tone_mapper&) = delete;
65
66 gfx_pipeline_tone_mapper(gfx_surface *surface) : gfx_pipeline(surface) {}
67
68 void draw_in_command_buffer(vk::CommandBuffer commandBuffer, draw_context const& context) override;
69
70protected:
71 push_constants _push_constants;
72
73 [[nodiscard]] std::vector<vk::PipelineShaderStageCreateInfo> createShaderStages() const override;
74 [[nodiscard]] std::vector<vk::DescriptorSetLayoutBinding> createDescriptorSetLayoutBindings() const override;
75 [[nodiscard]] std::vector<vk::WriteDescriptorSet> createWriteDescriptorSet() const override;
76 [[nodiscard]] size_t getDescriptorSetVersion() const override;
77 [[nodiscard]] std::vector<vk::PushConstantRange> createPushConstantRanges() const override;
78 [[nodiscard]] vk::PipelineDepthStencilStateCreateInfo getPipelineDepthStencilStateCreateInfo() const override;
79};
80
81}} // namespace hi::inline v1::gfx_pipeline_tone_mapper
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Draw context for drawing using the HikoGUI shaders.
Definition draw_context_intf.hpp:209
Definition gfx_pipeline_tone_mapper_vulkan_intf.hpp:22
Definition gfx_pipeline_tone_mapper_vulkan_intf.hpp:24
Definition gfx_pipeline_tone_mapper_vulkan_intf.hpp:33
void destroy(gfx_device const *vulkanDevice)
Definition gfx_pipeline_tone_mapper_vulkan_impl.hpp:96