7#include "gfx_pipeline_tone_mapper_vulkan.hpp"
8#include "gfx_surface_vulkan.hpp"
9#include "gfx_device_vulkan_impl.hpp"
10#include "draw_context.hpp"
11#include "../macros.hpp"
13namespace hi {
inline namespace v1 {
15inline void gfx_pipeline_tone_mapper::draw_in_command_buffer(vk::CommandBuffer commandBuffer,
draw_context const& context)
17 gfx_pipeline::draw_in_command_buffer(commandBuffer, context);
19 hi_axiom_not_null(device());
20 device()->tone_mapper_pipeline->drawInCommandBuffer(commandBuffer);
22 _push_constants.saturation = context.saturation;
23 commandBuffer.pushConstants(pipelineLayout, vk::ShaderStageFlagBits::eFragment, 0,
sizeof(
push_constants), &_push_constants);
25 device()->cmdBeginDebugUtilsLabelEXT(commandBuffer,
"tone mapping");
26 commandBuffer.draw(3, 1, 0, 0);
27 device()->cmdEndDebugUtilsLabelEXT(commandBuffer);
30inline std::vector<vk::PipelineShaderStageCreateInfo> gfx_pipeline_tone_mapper::createShaderStages()
const
32 hi_axiom_not_null(device());
33 return device()->tone_mapper_pipeline->shaderStages;
36inline std::vector<vk::DescriptorSetLayoutBinding> gfx_pipeline_tone_mapper::createDescriptorSetLayoutBindings()
const
40 vk::DescriptorType::eInputAttachment,
42 vk::ShaderStageFlagBits::eFragment}};
45inline std::vector<vk::WriteDescriptorSet> gfx_pipeline_tone_mapper::createWriteDescriptorSet()
const
52 vk::DescriptorType::eInputAttachment,
53 &surface->colorDescriptorImageInfos[0],
59inline size_t gfx_pipeline_tone_mapper::getDescriptorSetVersion()
const
64inline std::vector<vk::PushConstantRange> gfx_pipeline_tone_mapper::createPushConstantRanges()
const
66 return push_constants::pushConstantRanges();
69inline vk::PipelineDepthStencilStateCreateInfo gfx_pipeline_tone_mapper::getPipelineDepthStencilStateCreateInfo()
const
73 vk::PipelineDepthStencilStateCreateFlags(),
76 vk::CompareOp::eAlways,
86inline gfx_pipeline_tone_mapper::device_shared::device_shared(gfx_device
const &device) : device(device)
91inline gfx_pipeline_tone_mapper::device_shared::~device_shared() {}
95 hi_assert_not_null(vulkanDevice);
97 teardownShaders(vulkanDevice);
100inline void gfx_pipeline_tone_mapper::device_shared::drawInCommandBuffer(vk::CommandBuffer
const &commandBuffer)
102 commandBuffer.bindIndexBuffer(device.quadIndexBuffer, 0, vk::IndexType::eUint16);
105inline void gfx_pipeline_tone_mapper::device_shared::buildShaders()
107 vertexShaderModule = device.loadShader(
URL(
"resource:shaders/tone_mapper.vert.spv"));
108 fragmentShaderModule = device.loadShader(
URL(
"resource:shaders/tone_mapper.frag.spv"));
111 {vk::PipelineShaderStageCreateFlags(), vk::ShaderStageFlagBits::eVertex, vertexShaderModule,
"main"},
112 {vk::PipelineShaderStageCreateFlags(), vk::ShaderStageFlagBits::eFragment, fragmentShaderModule,
"main"}};
115inline void gfx_pipeline_tone_mapper::device_shared::teardownShaders(gfx_device
const*vulkanDevice)
117 hi_assert_not_null(vulkanDevice);
119 vulkanDevice->destroy(vertexShaderModule);
120 vulkanDevice->destroy(fragmentShaderModule);
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:208
Definition gfx_pipeline_tone_mapper_vulkan.hpp:19
void destroy(gfx_device const *vulkanDevice)
Definition gfx_pipeline_tone_mapper_vulkan_impl.hpp:93
Universal Resource Locator.
Definition URL.hpp:51