Toast Engine
Loading...
Searching...
No Matches
post_process_target.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include "vulkan_common.hpp"
10
11#include <optional>
12#include <string>
13#include <string_view>
14
15namespace renderer {
16class VulkanCore;
17
20public:
22 [[nodiscard]]
23 static auto halfExtent(vk::Extent2D extent) noexcept -> vk::Extent2D {
24 const uint32_t width = (extent.width + 1) / 2;
25 const uint32_t height = (extent.height + 1) / 2;
26 return {width > 0 ? width : 1u, height > 0 ? height : 1u};
27 }
28
29 void create(const VulkanCore& core, vk::Extent2D extent, vk::Format format, std::string_view debug_name);
30
31 void beginScope(vk::CommandBuffer cmd) const;
32
33 void endScope(vk::CommandBuffer cmd) const;
34
35 [[nodiscard]]
36 auto view() const -> vk::ImageView {
37 return m_view.has_value() ? **m_view : vk::ImageView {};
38 }
39
40 [[nodiscard]]
41 auto extent() const noexcept -> vk::Extent2D {
42 return m_extent;
43 }
44
45 [[nodiscard]]
46 auto isReady() const noexcept -> bool {
47 return m_image.has_value() && m_view.has_value();
48 }
49
50private:
51 std::optional<vma::raii::Image> m_image;
52 std::optional<vk::raii::ImageView> m_view;
53 vk::Extent2D m_extent {};
54
55 mutable sync::ImageState m_state;
56};
57
58}
Definition post_process_target.hpp:19
static auto halfExtent(vk::Extent2D extent) noexcept -> vk::Extent2D
Rounded up so odd sizes cover the last row. Here because file local copies collide in the unity build...
Definition post_process_target.hpp:23
Definition vulkan_core.hpp:48