7#include "gfx_pipeline_tone_mapper_vulkan_intf.hpp"
8#include "gfx_surface_vulkan_intf.hpp"
9#include "gfx_device_vulkan_impl.hpp"
10#include "draw_context_intf.hpp"
11#include "../macros.hpp"
12#include <vulkan/vulkan.hpp>
14hi_export_module(hikogui.GFX : gfx_pipeline_tone_mapper_impl);
16hi_export
namespace hi {
inline namespace v1 {
18inline void gfx_pipeline_tone_mapper::draw_in_command_buffer(vk::CommandBuffer commandBuffer,
draw_context const& context)
20 gfx_pipeline::draw_in_command_buffer(commandBuffer, context);
22 hi_axiom_not_null(device());
23 device()->tone_mapper_pipeline->drawInCommandBuffer(commandBuffer);
25 _push_constants.saturation = context.saturation;
26 commandBuffer.pushConstants(pipelineLayout, vk::ShaderStageFlagBits::eFragment, 0,
sizeof(
push_constants), &_push_constants);
28 device()->cmdBeginDebugUtilsLabelEXT(commandBuffer,
"tone mapping");
29 commandBuffer.draw(3, 1, 0, 0);
30 device()->cmdEndDebugUtilsLabelEXT(commandBuffer);
33inline std::vector<vk::PipelineShaderStageCreateInfo> gfx_pipeline_tone_mapper::createShaderStages()
const
35 hi_axiom_not_null(device());
36 return device()->tone_mapper_pipeline->shaderStages;
39inline std::vector<vk::DescriptorSetLayoutBinding> gfx_pipeline_tone_mapper::createDescriptorSetLayoutBindings()
const
43 vk::DescriptorType::eInputAttachment,
45 vk::ShaderStageFlagBits::eFragment}};
48inline std::vector<vk::WriteDescriptorSet> gfx_pipeline_tone_mapper::createWriteDescriptorSet()
const
55 vk::DescriptorType::eInputAttachment,
56 &surface->colorDescriptorImageInfos[0],
62inline size_t gfx_pipeline_tone_mapper::getDescriptorSetVersion()
const
67inline std::vector<vk::PushConstantRange> gfx_pipeline_tone_mapper::createPushConstantRanges()
const
69 return push_constants::pushConstantRanges();
72inline vk::PipelineDepthStencilStateCreateInfo gfx_pipeline_tone_mapper::getPipelineDepthStencilStateCreateInfo()
const
76 vk::PipelineDepthStencilStateCreateFlags(),
79 vk::CompareOp::eAlways,
89inline gfx_pipeline_tone_mapper::device_shared::device_shared(gfx_device
const &device) : device(device)
94inline gfx_pipeline_tone_mapper::device_shared::~device_shared() {}
98 hi_assert_not_null(vulkanDevice);
100 teardownShaders(vulkanDevice);
103inline void gfx_pipeline_tone_mapper::device_shared::drawInCommandBuffer(vk::CommandBuffer
const &commandBuffer)
105 commandBuffer.bindIndexBuffer(device.quadIndexBuffer, 0, vk::IndexType::eUint16);
108inline void gfx_pipeline_tone_mapper::device_shared::buildShaders()
110 vertexShaderModule = device.loadShader(
URL(
"resource:tone_mapper_vulkan.vert.spv"));
111 fragmentShaderModule = device.loadShader(
URL(
"resource:tone_mapper_vulkan.frag.spv"));
114 {vk::PipelineShaderStageCreateFlags(), vk::ShaderStageFlagBits::eVertex, vertexShaderModule,
"main"},
115 {vk::PipelineShaderStageCreateFlags(), vk::ShaderStageFlagBits::eFragment, fragmentShaderModule,
"main"}};
118inline void gfx_pipeline_tone_mapper::device_shared::teardownShaders(gfx_device
const*vulkanDevice)
120 hi_assert_not_null(vulkanDevice);
122 vulkanDevice->destroy(vertexShaderModule);
123 vulkanDevice->destroy(fragmentShaderModule);
The HikoGUI namespace.
Definition array_generic.hpp:21
The HikoGUI API version 1.
Definition array_generic.hpp:22
Draw context for drawing using the HikoGUI shaders.
Definition draw_context_intf.hpp:209
Definition gfx_pipeline_tone_mapper_vulkan_intf.hpp:24
void destroy(gfx_device const *vulkanDevice)
Definition gfx_pipeline_tone_mapper_vulkan_impl.hpp:96
Universal Resource Locator.
Definition URL.hpp:58