Flutter Engine
The Flutter Engine
recording_render_pass.cc
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
6
7#include <utility>
8
9namespace impeller {
10
12 std::shared_ptr<RenderPass> delegate,
13 const std::shared_ptr<const Context>& context,
14 const RenderTarget& render_target)
15 : RenderPass(context, render_target), delegate_(std::move(delegate)) {}
16
17// |RenderPass|
19 const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline) {
20 pending_.pipeline = pipeline;
21 if (delegate_) {
22 delegate_->SetPipeline(pipeline);
23 }
24}
25
26void RecordingRenderPass::SetCommandLabel(std::string_view label) {
27#ifdef IMPELLER_DEBUG
28 pending_.label = std::string(label);
29#endif // IMPELLER_DEBUG
30 if (delegate_) {
31 delegate_->SetCommandLabel(label);
32 }
33}
34
35// |RenderPass|
37 pending_.stencil_reference = value;
38 if (delegate_) {
39 delegate_->SetStencilReference(value);
40 }
41}
42
43// |RenderPass|
45 pending_.base_vertex = value;
46 if (delegate_) {
47 delegate_->SetBaseVertex(value);
48 }
49}
50
51// |RenderPass|
53 pending_.viewport = viewport;
54 if (delegate_) {
55 delegate_->SetViewport(viewport);
56 }
57}
58
59// |RenderPass|
61 pending_.scissor = scissor;
62 if (delegate_) {
63 delegate_->SetScissor(scissor);
64 }
65}
66
67// |RenderPass|
69 pending_.instance_count = count;
70 if (delegate_) {
71 delegate_->SetInstanceCount(count);
72 }
73}
74
75// |RenderPass|
77 pending_.vertex_buffer = buffer;
78 if (delegate_) {
79 return delegate_->SetVertexBuffer(buffer);
80 }
81 return true;
82}
83
84// |RenderPass|
86 commands_.emplace_back(std::move(pending_));
87 pending_ = {};
88 if (delegate_) {
89 return delegate_->Draw();
90 }
91 return fml::Status();
92}
93
94// |RenderPass|
95void RecordingRenderPass::OnSetLabel(std::string label) {
96 return;
97}
98
99// |RenderPass|
101 if (delegate_) {
102 return delegate_->EncodeCommands();
103 }
104 return true;
105}
106
107// |RenderPass|
110 const ShaderUniformSlot& slot,
111 const ShaderMetadata& metadata,
112 BufferView view) {
113 pending_.BindResource(stage, type, slot, metadata, view);
114 if (delegate_) {
115 return delegate_->BindResource(stage, type, slot, metadata, view);
116 }
117 return true;
118}
119
120// |RenderPass|
122 ShaderStage stage,
124 const ShaderUniformSlot& slot,
125 const std::shared_ptr<const ShaderMetadata>& metadata,
126 BufferView view) {
127 pending_.BindResource(stage, type, slot, metadata, view);
128 if (delegate_) {
129 return delegate_->BindResource(stage, type, slot, metadata, view);
130 }
131 return true;
132}
133
134// |RenderPass|
136 ShaderStage stage,
138 const SampledImageSlot& slot,
139 const ShaderMetadata& metadata,
140 std::shared_ptr<const Texture> texture,
141 const std::unique_ptr<const Sampler>& sampler) {
142 pending_.BindResource(stage, type, slot, metadata, texture, sampler);
143 if (delegate_) {
144 return delegate_->BindResource(stage, type, slot, metadata, texture,
145 sampler);
146 }
147 return true;
148}
149
150} // namespace impeller
int count
Definition: FontMgrTest.cpp:50
GLenum type
To do anything rendering related with Impeller, you need a context.
Definition: context.h:45
void SetStencilReference(uint32_t value) override
RecordingRenderPass(std::shared_ptr< RenderPass > delegate, const std::shared_ptr< const Context > &context, const RenderTarget &render_target)
void SetCommandLabel(std::string_view label) override
The debugging label to use for the command.
bool SetVertexBuffer(VertexBuffer buffer) override
Specify the vertex and index buffer to use for this command.
fml::Status Draw() override
Record the currently pending command.
void SetBaseVertex(uint64_t value) override
bool OnEncodeCommands(const Context &context) const override
void SetInstanceCount(size_t count) override
void SetViewport(Viewport viewport) override
void OnSetLabel(std::string label) override
bool BindResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline) override
The pipeline to use for this command.
void SetScissor(IRect scissor) override
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
MockDelegate delegate_
uint8_t value
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
Task::Status Status
Definition: TaskList.cpp:15
Definition: ref_ptr.h:256
std::shared_ptr< Pipeline< PipelineDescriptor > > pipeline
Definition: command.h:96
uint64_t base_vertex
Definition: command.h:126
uint32_t stencil_reference
Definition: command.h:122
std::optional< Viewport > viewport
Definition: command.h:133
VertexBuffer vertex_buffer
The bound per-vertex data and optional index buffer.
Definition: command.h:151
std::optional< IRect > scissor
Definition: command.h:139
bool BindResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata &metadata, BufferView view) override
size_t instance_count
Definition: command.h:147
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