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);
32 hi_axiom_not_null(device());
33 return device()->tone_mapper_pipeline->shaderStages;
40 vk::DescriptorType::eInputAttachment,
42 vk::ShaderStageFlagBits::eFragment}};
52 vk::DescriptorType::eInputAttachment,
53 &surface->colorDescriptorImageInfos[0],
59inline size_t gfx_pipeline_tone_mapper::getDescriptorSetVersion()
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() {}
93inline void gfx_pipeline_tone_mapper::device_shared::destroy(gfx_device
const *vulkanDevice)
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);
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
Universal Resource Locator.
Definition URL.hpp:51