Flutter Engine
The Flutter Engine
render_pass_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_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_RENDER_PASS_VK_H_
7
15#include "vulkan/vulkan_handles.hpp"
16
17namespace impeller {
18
19class CommandBufferVK;
20class SamplerVK;
21
22class RenderPassVK final : public RenderPass {
23 public:
24 // |RenderPass|
25 ~RenderPassVK() override;
26
27 private:
28 friend class CommandBufferVK;
29
30 std::shared_ptr<CommandBufferVK> command_buffer_;
31 std::string debug_label_;
33 bool is_valid_ = false;
34
35 vk::CommandBuffer command_buffer_vk_;
36 std::shared_ptr<Texture> color_image_vk_;
37 std::shared_ptr<Texture> resolve_image_vk_;
38
39 // Per-command state.
40 std::array<vk::DescriptorImageInfo, kMaxBindings> image_workspace_;
41 std::array<vk::DescriptorBufferInfo, kMaxBindings> buffer_workspace_;
42 std::array<vk::WriteDescriptorSet, kMaxBindings + kMaxBindings>
43 write_workspace_;
44 size_t bound_image_offset_ = 0u;
45 size_t bound_buffer_offset_ = 0u;
46 size_t descriptor_write_offset_ = 0u;
47 size_t instance_count_ = 1u;
48 size_t base_vertex_ = 0u;
49 size_t vertex_count_ = 0u;
50 bool has_index_buffer_ = false;
51 bool has_label_ = false;
52 const Pipeline<PipelineDescriptor>* pipeline_;
53 bool pipeline_uses_input_attachments_ = false;
54 std::shared_ptr<SamplerVK> immutable_sampler_;
55
56 RenderPassVK(const std::shared_ptr<const Context>& context,
57 const RenderTarget& target,
58 std::shared_ptr<CommandBufferVK> command_buffer);
59
60 // |RenderPass|
61 void SetPipeline(
62 const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline) override;
63
64 // |RenderPass|
65 void SetCommandLabel(std::string_view label) override;
66
67 // |RenderPass|
68 void SetStencilReference(uint32_t value) override;
69
70 // |RenderPass|
71 void SetBaseVertex(uint64_t value) override;
72
73 // |RenderPass|
74 void SetViewport(Viewport viewport) override;
75
76 // |RenderPass|
77 void SetScissor(IRect scissor) override;
78
79 // |RenderPass|
80 void SetInstanceCount(size_t count) override;
81
82 // |RenderPass|
83 bool SetVertexBuffer(VertexBuffer buffer) override;
84
85 // |RenderPass|
86 fml::Status Draw() override;
87
88 // |RenderPass|
89 void ReserveCommands(size_t command_count) override {}
90
91 // |ResourceBinder|
92 bool BindResource(ShaderStage stage,
94 const ShaderUniformSlot& slot,
95 const ShaderMetadata& metadata,
96 BufferView view) override;
97
98 // |RenderPass|
99 bool BindResource(ShaderStage stage,
101 const ShaderUniformSlot& slot,
102 const std::shared_ptr<const ShaderMetadata>& metadata,
103 BufferView view) override;
104
105 // |ResourceBinder|
106 bool BindResource(ShaderStage stage,
108 const SampledImageSlot& slot,
109 const ShaderMetadata& metadata,
110 std::shared_ptr<const Texture> texture,
111 const std::unique_ptr<const Sampler>& sampler) override;
112
113 bool BindResource(size_t binding,
115 const BufferView& view);
116
117 // |RenderPass|
118 bool IsValid() const override;
119
120 // |RenderPass|
121 void OnSetLabel(std::string label) override;
122
123 // |RenderPass|
124 bool OnEncodeCommands(const Context& context) const override;
125
126 SharedHandleVK<vk::RenderPass> CreateVKRenderPass(
127 const ContextVK& context,
128 const SharedHandleVK<vk::RenderPass>& recycled_renderpass,
129 const std::shared_ptr<CommandBufferVK>& command_buffer) const;
130
131 SharedHandleVK<vk::Framebuffer> CreateVKFramebuffer(
132 const ContextVK& context,
133 const vk::RenderPass& pass) const;
134
135 RenderPassVK(const RenderPassVK&) = delete;
136
137 RenderPassVK& operator=(const RenderPassVK&) = delete;
138};
139
140} // namespace impeller
141
142#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_RENDER_PASS_VK_H_
int count
Definition: FontMgrTest.cpp:50
GLenum type
To do anything rendering related with Impeller, you need a context.
Definition: context.h:45
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
static void Draw(SkCanvas *canvas, const SkRect &rect)
uint8_t value
uint32_t * target
FlTexture * texture
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
std::shared_ptr< SharedObjectVKT< T > > SharedHandleVK
Metadata required to bind a combined texture and sampler.
Definition: shader_types.h:98
Metadata required to bind a buffer.
Definition: shader_types.h:81