| Flutter Impeller |

render_pass_builder_vk.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_RENDER_PASS_BUILDER_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_RENDER_PASS_BUILDER_VK_H_
7
8 #include <map>
9 #include <optional>
10
11 #include "impeller/core/formats.h"
12 #include "impeller/renderer/backend/vulkan/context_vk.h"
13 #include "impeller/renderer/backend/vulkan/vk.h"
14
15 namespace impeller {
16
17 class RenderPassBuilderVK {
18 public:
19 RenderPassBuilderVK();
20
21 ~RenderPassBuilderVK();
22
23 RenderPassBuilderVK(const RenderPassBuilderVK&) = delete;
24
25 RenderPassBuilderVK& operator=(const RenderPassBuilderVK&) = delete;
26
27 RenderPassBuilderVK& SetColorAttachment(size_t index,
28 PixelFormat format,
29 SampleCount sample_count,
30 LoadAction load_action,
31 StoreAction store_action);
32
33 RenderPassBuilderVK& SetDepthStencilAttachment(PixelFormat format,
34 SampleCount sample_count,
35 LoadAction load_action,
36 StoreAction store_action);
37
38 RenderPassBuilderVK& SetStencilAttachment(PixelFormat format,
39 SampleCount sample_count,
40 LoadAction load_action,
41 StoreAction store_action);
42
43 vk::UniqueRenderPass Build(const vk::Device& device) const;
44
45 // Visible for testing.
46 const std::map<size_t, vk::AttachmentDescription>& GetColorAttachments()
47 const;
48
49 // Visible for testing.
50 const std::map<size_t, vk::AttachmentDescription>& GetResolves() const;
51
52 // Visible for testing.
53 const std::optional<vk::AttachmentDescription>& GetDepthStencil() const;
54
55 private:
56 std::map<size_t, vk::AttachmentDescription> colors_;
57 std::map<size_t, vk::AttachmentDescription> resolves_;
58 std::optional<vk::AttachmentDescription> depth_stencil_;
59 };
60
61 //------------------------------------------------------------------------------
62 /// @brief Inserts the appropriate barriers to ensure that subsequent
63 /// commands can read from the specified image (itself a framebuffer
64 /// attachment) as an input attachment.
65 ///
66 /// Unlike most barriers, this barrier may only be inserted within a
67 /// Vulkan render-pass.
68 ///
69 /// The type of barrier inserted depends on the subpass setup and
70 /// self-dependencies. Only use this utility method for inserting
71 /// barriers in render passes created by `RenderPassBuilderVK`.
72 ///
73 /// @param[in] buffer The buffer
74 /// @param[in] image The image
75 ///
76 void InsertBarrierForInputAttachmentRead(const vk::CommandBuffer& buffer,
77 const vk::Image& image);
78
79 } // namespace impeller
80
81 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_RENDER_PASS_BUILDER_VK_H_
impeller::StoreAction
StoreAction
Definition: formats.h:209
impeller::RenderPassBuilderVK::SetStencilAttachment
RenderPassBuilderVK & SetStencilAttachment(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action)
Definition: render_pass_builder_vk.cc:74
formats.h
impeller::RenderPassBuilderVK
Definition: render_pass_builder_vk.h:17
impeller::RenderPassBuilderVK::GetColorAttachments
const std::map< size_t, vk::AttachmentDescription > & GetColorAttachments() const
Definition: render_pass_builder_vk.cc:189
vk.h
impeller::RenderPassBuilderVK::operator=
RenderPassBuilderVK & operator=(const RenderPassBuilderVK &)=delete
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:100
impeller::RenderPassBuilderVK::SetDepthStencilAttachment
RenderPassBuilderVK & SetDepthStencilAttachment(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action)
Definition: render_pass_builder_vk.cc:56
impeller::RenderPassBuilderVK::GetDepthStencil
const std::optional< vk::AttachmentDescription > & GetDepthStencil() const
Definition: render_pass_builder_vk.cc:199
impeller::RenderPassBuilderVK::RenderPassBuilderVK
RenderPassBuilderVK()
impeller::InsertBarrierForInputAttachmentRead
void InsertBarrierForInputAttachmentRead(const vk::CommandBuffer &buffer, const vk::Image &image)
Inserts the appropriate barriers to ensure that subsequent commands can read from the specified image...
Definition: render_pass_builder_vk.cc:158
impeller::LoadAction
LoadAction
Definition: formats.h:203
impeller::RenderPassBuilderVK::GetResolves
const std::map< size_t, vk::AttachmentDescription > & GetResolves() const
Definition: render_pass_builder_vk.cc:194
impeller::RenderPassBuilderVK::SetColorAttachment
RenderPassBuilderVK & SetColorAttachment(size_t index, PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action)
Definition: render_pass_builder_vk.cc:29
impeller::RenderPassBuilderVK::~RenderPassBuilderVK
~RenderPassBuilderVK()
impeller::SampleCount
SampleCount
Definition: formats.h:296
impeller::RenderPassBuilderVK::Build
vk::UniqueRenderPass Build(const vk::Device &device) const
Definition: render_pass_builder_vk.cc:92
context_vk.h
impeller
Definition: aiks_blur_unittests.cc:20