Flutter Engine
 
Loading...
Searching...
No Matches
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::testing {
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 pending_.pipeline = pipeline;
20 if (delegate_) {
21 delegate_->SetPipeline(pipeline);
22 }
23}
24
25void RecordingRenderPass::SetCommandLabel(std::string_view label) {
26#ifdef IMPELLER_DEBUG
27 pending_.label = std::string(label);
28#endif // IMPELLER_DEBUG
29 if (delegate_) {
30 delegate_->SetCommandLabel(label);
31 }
32}
33
34// |RenderPass|
36 pending_.stencil_reference = value;
37 if (delegate_) {
38 delegate_->SetStencilReference(value);
39 }
40}
41
42// |RenderPass|
44 pending_.base_vertex = value;
45 if (delegate_) {
46 delegate_->SetBaseVertex(value);
47 }
48}
49
50// |RenderPass|
52 pending_.viewport = viewport;
53 if (delegate_) {
54 delegate_->SetViewport(viewport);
55 }
56}
57
58// |RenderPass|
60 pending_.scissor = scissor;
61 if (delegate_) {
62 delegate_->SetScissor(scissor);
63 }
64}
65
66// |RenderPass|
68 pending_.instance_count = count;
69 if (delegate_) {
70 delegate_->SetInstanceCount(count);
71 }
72}
73
74// |RenderPass|
76 if (delegate_) {
77 return delegate_->SetVertexBuffer(buffer);
78 }
79 return true;
80}
81
82// |RenderPass|
84 commands_.emplace_back(std::move(pending_));
85 pending_ = {};
86 if (delegate_) {
87 return delegate_->Draw();
88 }
89 return fml::Status();
90}
91
92// |RenderPass|
93void RecordingRenderPass::OnSetLabel(std::string_view label) {
94 return;
95}
96
97// |RenderPass|
99 if (delegate_) {
100 return delegate_->EncodeCommands();
101 }
102 return true;
103}
104
105// |RenderPass|
108 const ShaderUniformSlot& slot,
109 const ShaderMetadata* metadata,
111 if (delegate_) {
112 return delegate_->BindResource(stage, type, slot, metadata, view);
113 }
114 return true;
115}
116
117// |RenderPass|
119 ShaderStage stage,
121 const ShaderUniformSlot& slot,
122 std::unique_ptr<ShaderMetadata> metadata,
124 if (delegate_) {
125 return delegate_->BindDynamicResource(stage, type, slot,
126 std::move(metadata), view);
127 }
128 return true;
129}
130
131// |RenderPass|
133 ShaderStage stage,
135 const SampledImageSlot& slot,
136 std::unique_ptr<ShaderMetadata> metadata,
137 std::shared_ptr<const Texture> texture,
138 raw_ptr<const Sampler> sampler) {
139 if (delegate_) {
140 return delegate_->BindDynamicResource(
141 stage, type, slot, std::move(metadata), texture, sampler);
142 }
143 return true;
144}
145
148 const SampledImageSlot& slot,
149 const ShaderMetadata* metadata,
150 std::shared_ptr<const Texture> texture,
151 raw_ptr<const Sampler> sampler) {
152 if (delegate_) {
153 return delegate_->BindResource(stage, type, slot, metadata, texture,
154 sampler);
155 }
156 return true;
157}
158
159} // namespace impeller::testing
GLenum type
To do anything rendering related with Impeller, you need a context.
Definition context.h:65
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:30
void SetBaseVertex(uint64_t value) override
RecordingRenderPass(std::shared_ptr< RenderPass > delegate, const std::shared_ptr< const Context > &context, const RenderTarget &render_target)
fml::Status Draw() override
Record the currently pending command.
void SetCommandLabel(std::string_view label) override
The debugging label to use for the command.
bool BindDynamicResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, std::unique_ptr< ShaderMetadata > metadata, BufferView view) override
Bind with dynamically generated shader metadata.
void SetScissor(IRect32 scissor) override
void SetViewport(Viewport viewport) override
bool BindResource(ShaderStage stage, DescriptorType type, const ShaderUniformSlot &slot, const ShaderMetadata *metadata, BufferView view) override
bool SetVertexBuffer(VertexBuffer buffer) override
Specify the vertex and index buffer to use for this command.
bool OnEncodeCommands(const Context &context) const override
void OnSetLabel(std::string_view label) override
void SetStencilReference(uint32_t value) override
void SetPipeline(PipelineRef pipeline) override
The pipeline to use for this command.
int32_t value
MockDelegate delegate_
FlView * view
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 disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98
Definition ref_ptr.h:261
std::optional< IRect32 > scissor
Definition command.h:114
uint64_t base_vertex
Definition command.h:126
uint32_t stencil_reference
Definition command.h:149
std::optional< Viewport > viewport
Definition command.h:107
uint32_t instance_count
Definition command.h:140
PipelineRef pipeline
Definition command.h:84
Metadata required to bind a combined texture and sampler.
Metadata required to bind a buffer.