| Flutter Impeller |

content_context.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
5 #include "impeller/entity/contents/content_context.h"
6
7 #include <format>
8 #include <memory>
9 #include <utility>
10
11 #include "fml/trace_event.h"
12 #include "impeller/base/validation.h"
13 #include "impeller/core/formats.h"
14 #include "impeller/core/texture_descriptor.h"
15 #include "impeller/entity/contents/framebuffer_blend_contents.h"
16 #include "impeller/entity/contents/pipelines.h"
17 #include "impeller/entity/contents/text_shadow_cache.h"
18 #include "impeller/entity/entity.h"
19 #include "impeller/entity/render_target_cache.h"
20 #include "impeller/renderer/command_buffer.h"
21 #include "impeller/renderer/pipeline_descriptor.h"
22 #include "impeller/renderer/pipeline_library.h"
23 #include "impeller/renderer/render_target.h"
24 #include "impeller/renderer/texture_util.h"
25 #include "impeller/tessellator/tessellator.h"
26 #include "impeller/typographer/typographer_context.h"
27
28 namespace impeller {
29
30 namespace {
31
32 /// A generic version of `Variants` which mostly exists to reduce code size.
33 class GenericVariants {
34 public:
35 void Set(const ContentContextOptions& options,
36 std::unique_ptr<GenericRenderPipelineHandle> pipeline) {
37 uint64_t p_key = options.ToKey();
38 for (const auto& [key, pipeline] : pipelines_) {
39 if (key == p_key) {
40 return;
41 }
42 }
43 pipelines_.push_back(std::make_pair(p_key, std::move(pipeline)));
44 }
45
46 void SetDefault(const ContentContextOptions& options,
47 std::unique_ptr<GenericRenderPipelineHandle> pipeline) {
48 default_options_ = options;
49 if (pipeline) {
50 Set(options, std::move(pipeline));
51 }
52 }
53
54 GenericRenderPipelineHandle* Get(const ContentContextOptions& options) const {
55 uint64_t p_key = options.ToKey();
56 for (const auto& [key, pipeline] : pipelines_) {
57 if (key == p_key) {
58 return pipeline.get();
59 }
60 }
61 return nullptr;
62 }
63
64 void SetDefaultDescriptor(std::optional<PipelineDescriptor> desc) {
65 desc_ = std::move(desc);
66 }
67
68 size_t GetPipelineCount() const { return pipelines_.size(); }
69
70 bool IsDefault(const ContentContextOptions& opts) {
71 return default_options_.has_value() &&
72 opts.ToKey() == default_options_.value().ToKey();
73 }
74
75 protected:
76 std::optional<PipelineDescriptor> desc_;
77 std::optional<ContentContextOptions> default_options_;
78 std::vector<std::pair<uint64_t, std::unique_ptr<GenericRenderPipelineHandle>>>
79 pipelines_;
80 };
81
82 /// Holds multiple Pipelines associated with the same PipelineHandle types.
83 ///
84 /// For example, it may have multiple
85 /// RenderPipelineHandle<SolidFillVertexShader, SolidFillFragmentShader>
86 /// instances for different blend modes. From them you can access the
87 /// Pipeline.
88 ///
89 /// See also:
90 /// - impeller::ContentContextOptions - options from which variants are
91 /// created.
92 /// - impeller::Pipeline::CreateVariant
93 /// - impeller::RenderPipelineHandle<> - The type of objects this typically
94 /// contains.
95 template <class PipelineHandleT>
96 class Variants : public GenericVariants {
97 static_assert(
98 ShaderStageCompatibilityChecker<
99 typename PipelineHandleT::VertexShader,
100 typename PipelineHandleT::FragmentShader>::Check(),
101 "The output slots for the fragment shader don't have matches in the "
102 "vertex shader's output slots. This will result in a linker error.");
103
104 public:
105 Variants() = default;
106
107 void Set(const ContentContextOptions& options,
108 std::unique_ptr<PipelineHandleT> pipeline) {
109 GenericVariants::Set(options, std::move(pipeline));
110 }
111
112 void SetDefault(const ContentContextOptions& options,
113 std::unique_ptr<PipelineHandleT> pipeline) {
114 GenericVariants::SetDefault(options, std::move(pipeline));
115 }
116
117 void CreateDefault(const Context& context,
118 const ContentContextOptions& options,
119 const std::vector<Scalar>& constants = {}) {
120 std::optional<PipelineDescriptor> desc =
121 PipelineHandleT::Builder::MakeDefaultPipelineDescriptor(context,
122 constants);
123 if (!desc.has_value()) {
124 VALIDATION_LOG << "Failed to create default pipeline.";
125 return;
126 }
127 options.ApplyToPipelineDescriptor(*desc);
128 desc_ = desc;
129 if (context.GetFlags().lazy_shader_mode) {
130 SetDefault(options, nullptr);
131 } else {
132 SetDefault(options, std::make_unique<PipelineHandleT>(context, desc_,
133 /*async=*/true));
134 }
135 }
136
137 PipelineHandleT* Get(const ContentContextOptions& options) const {
138 return static_cast<PipelineHandleT*>(GenericVariants::Get(options));
139 }
140
141 PipelineHandleT* GetDefault(const Context& context) {
142 if (!default_options_.has_value()) {
143 return nullptr;
144 }
145 PipelineHandleT* result = Get(default_options_.value());
146 if (result != nullptr) {
147 return result;
148 }
149 SetDefault(default_options_.value(), std::make_unique<PipelineHandleT>(
150 context, desc_, /*async=*/false));
151 // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
152 return Get(default_options_.value());
153 }
154
155 private:
156 Variants(const Variants&) = delete;
157
158 Variants& operator=(const Variants&) = delete;
159 };
160
161 template <class RenderPipelineHandleT>
162 RenderPipelineHandleT* CreateIfNeeded(
163 const ContentContext* context,
164 Variants<RenderPipelineHandleT>& container,
165 ContentContextOptions opts) {
166 if (!context->IsValid()) {
167 return nullptr;
168 }
169
170 if (RenderPipelineHandleT* found = container.Get(opts)) {
171 return found;
172 }
173
174 RenderPipelineHandleT* default_handle =
175 container.GetDefault(*context->GetContext());
176 if (container.IsDefault(opts)) {
177 return default_handle;
178 }
179
180 // The default must always be initialized in the constructor.
181 FML_CHECK(default_handle != nullptr);
182
183 const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline =
184 default_handle->WaitAndGet();
185 if (!pipeline) {
186 return nullptr;
187 }
188
189 auto variant_future = pipeline->CreateVariant(
190 /*async=*/false, [&opts, variants_count = container.GetPipelineCount()](
191 PipelineDescriptor& desc) {
192 opts.ApplyToPipelineDescriptor(desc);
193 desc.SetLabel(std::format("{} V#{}", desc.GetLabel(), variants_count));
194 });
195 std::unique_ptr<RenderPipelineHandleT> variant =
196 std::make_unique<RenderPipelineHandleT>(std::move(variant_future));
197 container.Set(opts, std::move(variant));
198 return container.Get(opts);
199 }
200
201 template <class TypedPipeline>
202 PipelineRef GetPipeline(const ContentContext* context,
203 Variants<TypedPipeline>& container,
204 ContentContextOptions opts) {
205 TypedPipeline* pipeline = CreateIfNeeded(context, container, opts);
206 if (!pipeline) {
207 return raw_ptr<Pipeline<PipelineDescriptor>>();
208 }
209 return raw_ptr(pipeline->WaitAndGet());
210 }
211
212 } // namespace
213
214 struct ContentContext::Pipelines {
215 // clang-format off
216 Variants<BlendColorBurnPipeline> blend_colorburn;
217 Variants<BlendColorDodgePipeline> blend_colordodge;
218 Variants<BlendColorPipeline> blend_color;
219 Variants<BlendDarkenPipeline> blend_darken;
220 Variants<BlendDifferencePipeline> blend_difference;
221 Variants<BlendExclusionPipeline> blend_exclusion;
222 Variants<BlendHardLightPipeline> blend_hardlight;
223 Variants<BlendHuePipeline> blend_hue;
224 Variants<BlendLightenPipeline> blend_lighten;
225 Variants<BlendLuminosityPipeline> blend_luminosity;
226 Variants<BlendMultiplyPipeline> blend_multiply;
227 Variants<BlendOverlayPipeline> blend_overlay;
228 Variants<BlendSaturationPipeline> blend_saturation;
229 Variants<BlendScreenPipeline> blend_screen;
230 Variants<BlendSoftLightPipeline> blend_softlight;
231 Variants<BorderMaskBlurPipeline> border_mask_blur;
232 Variants<ClipPipeline> clip;
233 Variants<ColorMatrixColorFilterPipeline> color_matrix_color_filter;
234 Variants<ConicalGradientFillConicalPipeline> conical_gradient_fill;
235 Variants<ConicalGradientFillRadialPipeline> conical_gradient_fill_radial;
236 Variants<ConicalGradientFillStripPipeline> conical_gradient_fill_strip;
237 Variants<ConicalGradientFillStripRadialPipeline> conical_gradient_fill_strip_and_radial;
238 Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill;
239 Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill_radial;
240 Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill_strip_and_radial;
241 Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill_strip;
242 Variants<ConicalGradientUniformFillConicalPipeline> conical_gradient_uniform_fill;
243 Variants<ConicalGradientUniformFillRadialPipeline> conical_gradient_uniform_fill_radial;
244 Variants<ConicalGradientUniformFillStripPipeline> conical_gradient_uniform_fill_strip;
245 Variants<ConicalGradientUniformFillStripRadialPipeline> conical_gradient_uniform_fill_strip_and_radial;
246 Variants<FastGradientPipeline> fast_gradient;
247 Variants<FramebufferBlendColorBurnPipeline> framebuffer_blend_colorburn;
248 Variants<FramebufferBlendColorDodgePipeline> framebuffer_blend_colordodge;
249 Variants<FramebufferBlendColorPipeline> framebuffer_blend_color;
250 Variants<FramebufferBlendDarkenPipeline> framebuffer_blend_darken;
251 Variants<FramebufferBlendDifferencePipeline> framebuffer_blend_difference;
252 Variants<FramebufferBlendExclusionPipeline> framebuffer_blend_exclusion;
253 Variants<FramebufferBlendHardLightPipeline> framebuffer_blend_hardlight;
254 Variants<FramebufferBlendHuePipeline> framebuffer_blend_hue;
255 Variants<FramebufferBlendLightenPipeline> framebuffer_blend_lighten;
256 Variants<FramebufferBlendLuminosityPipeline> framebuffer_blend_luminosity;
257 Variants<FramebufferBlendMultiplyPipeline> framebuffer_blend_multiply;
258 Variants<FramebufferBlendOverlayPipeline> framebuffer_blend_overlay;
259 Variants<FramebufferBlendSaturationPipeline> framebuffer_blend_saturation;
260 Variants<FramebufferBlendScreenPipeline> framebuffer_blend_screen;
261 Variants<FramebufferBlendSoftLightPipeline> framebuffer_blend_softlight;
262 Variants<GaussianBlurPipeline> gaussian_blur;
263 Variants<GlyphAtlasPipeline> glyph_atlas;
264 Variants<LinePipeline> line;
265 Variants<LinearGradientFillPipeline> linear_gradient_fill;
266 Variants<LinearGradientSSBOFillPipeline> linear_gradient_ssbo_fill;
267 Variants<LinearGradientUniformFillPipeline> linear_gradient_uniform_fill;
268 Variants<LinearToSrgbFilterPipeline> linear_to_srgb_filter;
269 Variants<MorphologyFilterPipeline> morphology_filter;
270 Variants<PorterDuffBlendPipeline> clear_blend;
271 Variants<PorterDuffBlendPipeline> destination_a_top_blend;
272 Variants<PorterDuffBlendPipeline> destination_blend;
273 Variants<PorterDuffBlendPipeline> destination_in_blend;
274 Variants<PorterDuffBlendPipeline> destination_out_blend;
275 Variants<PorterDuffBlendPipeline> destination_over_blend;
276 Variants<PorterDuffBlendPipeline> modulate_blend;
277 Variants<PorterDuffBlendPipeline> plus_blend;
278 Variants<PorterDuffBlendPipeline> screen_blend;
279 Variants<PorterDuffBlendPipeline> source_a_top_blend;
280 Variants<PorterDuffBlendPipeline> source_blend;
281 Variants<PorterDuffBlendPipeline> source_in_blend;
282 Variants<PorterDuffBlendPipeline> source_out_blend;
283 Variants<PorterDuffBlendPipeline> source_over_blend;
284 Variants<PorterDuffBlendPipeline> xor_blend;
285 Variants<RadialGradientFillPipeline> radial_gradient_fill;
286 Variants<RadialGradientSSBOFillPipeline> radial_gradient_ssbo_fill;
287 Variants<RadialGradientUniformFillPipeline> radial_gradient_uniform_fill;
288 Variants<RRectBlurPipeline> rrect_blur;
289 Variants<RSuperellipseBlurPipeline> rsuperellipse_blur;
290 Variants<SolidFillPipeline> solid_fill;
291 Variants<SrgbToLinearFilterPipeline> srgb_to_linear_filter;
292 Variants<SweepGradientFillPipeline> sweep_gradient_fill;
293 Variants<SweepGradientSSBOFillPipeline> sweep_gradient_ssbo_fill;
294 Variants<SweepGradientUniformFillPipeline> sweep_gradient_uniform_fill;
295 Variants<TextureDownsamplePipeline> texture_downsample;
296 Variants<TexturePipeline> texture;
297 Variants<TextureStrictSrcPipeline> texture_strict_src;
298 Variants<TiledTexturePipeline> tiled_texture;
299 Variants<VerticesUber1Shader> vertices_uber_1_;
300 Variants<VerticesUber2Shader> vertices_uber_2_;
301 Variants<YUVToRGBFilterPipeline> yuv_to_rgb_filter;
302
303 #ifdef IMPELLER_ENABLE_OPENGLES
304 Variants<TiledTextureExternalPipeline> tiled_texture_external;
305 Variants<TextureDownsampleGlesPipeline> texture_downsample_gles;
306 Variants<TiledTextureUvExternalPipeline> tiled_texture_uv_external;
307 #endif // IMPELLER_ENABLE_OPENGLES
308 // clang-format on
309 };
310
311 void ContentContextOptions::ApplyToPipelineDescriptor(
312 PipelineDescriptor& desc) const {
313 auto pipeline_blend = blend_mode;
314 if (blend_mode > Entity::kLastPipelineBlendMode) {
315 VALIDATION_LOG << "Cannot use blend mode " << static_cast<int>(blend_mode)
316 << " as a pipeline blend.";
317 pipeline_blend = BlendMode::kSrcOver;
318 }
319
320 desc.SetSampleCount(sample_count);
321
322 ColorAttachmentDescriptor color0 = *desc.GetColorAttachmentDescriptor(0u);
323 color0.format = color_attachment_pixel_format;
324 color0.alpha_blend_op = BlendOperation::kAdd;
325 color0.color_blend_op = BlendOperation::kAdd;
326 color0.write_mask = ColorWriteMaskBits::kAll;
327
328 switch (pipeline_blend) {
329 case BlendMode::kClear:
330 if (is_for_rrect_blur_clear) {
331 color0.alpha_blend_op = BlendOperation::kReverseSubtract;
332 color0.color_blend_op = BlendOperation::kReverseSubtract;
333 color0.dst_alpha_blend_factor = BlendFactor::kOne;
334 color0.dst_color_blend_factor = BlendFactor::kOne;
335 color0.src_alpha_blend_factor = BlendFactor::kDestinationColor;
336 color0.src_color_blend_factor = BlendFactor::kDestinationColor;
337 } else {
338 color0.dst_alpha_blend_factor = BlendFactor::kZero;
339 color0.dst_color_blend_factor = BlendFactor::kZero;
340 color0.src_alpha_blend_factor = BlendFactor::kZero;
341 color0.src_color_blend_factor = BlendFactor::kZero;
342 }
343 break;
344 case BlendMode::kSrc:
345 color0.blending_enabled = false;
346 color0.dst_alpha_blend_factor = BlendFactor::kZero;
347 color0.dst_color_blend_factor = BlendFactor::kZero;
348 color0.src_alpha_blend_factor = BlendFactor::kOne;
349 color0.src_color_blend_factor = BlendFactor::kOne;
350 break;
351 case BlendMode::kDst:
352 color0.dst_alpha_blend_factor = BlendFactor::kOne;
353 color0.dst_color_blend_factor = BlendFactor::kOne;
354 color0.src_alpha_blend_factor = BlendFactor::kZero;
355 color0.src_color_blend_factor = BlendFactor::kZero;
356 color0.write_mask = ColorWriteMaskBits::kNone;
357 break;
358 case BlendMode::kSrcOver:
359 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
360 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
361 color0.src_alpha_blend_factor = BlendFactor::kOne;
362 color0.src_color_blend_factor = BlendFactor::kOne;
363 break;
364 case BlendMode::kDstOver:
365 color0.dst_alpha_blend_factor = BlendFactor::kOne;
366 color0.dst_color_blend_factor = BlendFactor::kOne;
367 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
368 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
369 break;
370 case BlendMode::kSrcIn:
371 color0.dst_alpha_blend_factor = BlendFactor::kZero;
372 color0.dst_color_blend_factor = BlendFactor::kZero;
373 color0.src_alpha_blend_factor = BlendFactor::kDestinationAlpha;
374 color0.src_color_blend_factor = BlendFactor::kDestinationAlpha;
375 break;
376 case BlendMode::kDstIn:
377 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
378 color0.dst_color_blend_factor = BlendFactor::kSourceAlpha;
379 color0.src_alpha_blend_factor = BlendFactor::kZero;
380 color0.src_color_blend_factor = BlendFactor::kZero;
381 break;
382 case BlendMode::kSrcOut:
383 color0.dst_alpha_blend_factor = BlendFactor::kZero;
384 color0.dst_color_blend_factor = BlendFactor::kZero;
385 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
386 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
387 break;
388 case BlendMode::kDstOut:
389 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
390 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
391 color0.src_alpha_blend_factor = BlendFactor::kZero;
392 color0.src_color_blend_factor = BlendFactor::kZero;
393 break;
394 case BlendMode::kSrcATop:
395 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
396 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
397 color0.src_alpha_blend_factor = BlendFactor::kDestinationAlpha;
398 color0.src_color_blend_factor = BlendFactor::kDestinationAlpha;
399 break;
400 case BlendMode::kDstATop:
401 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
402 color0.dst_color_blend_factor = BlendFactor::kSourceAlpha;
403 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
404 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
405 break;
406 case BlendMode::kXor:
407 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
408 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
409 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
410 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
411 break;
412 case BlendMode::kPlus:
413 color0.dst_alpha_blend_factor = BlendFactor::kOne;
414 color0.dst_color_blend_factor = BlendFactor::kOne;
415 color0.src_alpha_blend_factor = BlendFactor::kOne;
416 color0.src_color_blend_factor = BlendFactor::kOne;
417 break;
418 case BlendMode::kModulate:
419 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
420 color0.dst_color_blend_factor = BlendFactor::kSourceColor;
421 color0.src_alpha_blend_factor = BlendFactor::kZero;
422 color0.src_color_blend_factor = BlendFactor::kZero;
423 break;
424 default:
425 FML_UNREACHABLE();
426 }
427 desc.SetColorAttachmentDescriptor(0u, color0);
428
429 if (!has_depth_stencil_attachments) {
430 desc.ClearDepthAttachment();
431 desc.ClearStencilAttachments();
432 }
433
434 auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
435 auto maybe_depth = desc.GetDepthStencilAttachmentDescriptor();
436 FML_DCHECK(has_depth_stencil_attachments == maybe_depth.has_value())
437 << "Depth attachment doesn't match expected pipeline state. "
438 "has_depth_stencil_attachments="
439 << has_depth_stencil_attachments;
440 FML_DCHECK(has_depth_stencil_attachments == maybe_stencil.has_value())
441 << "Stencil attachment doesn't match expected pipeline state. "
442 "has_depth_stencil_attachments="
443 << has_depth_stencil_attachments;
444 if (maybe_stencil.has_value()) {
445 StencilAttachmentDescriptor front_stencil = maybe_stencil.value();
446 StencilAttachmentDescriptor back_stencil = front_stencil;
447
448 switch (stencil_mode) {
449 case StencilMode::kIgnore:
450 front_stencil.stencil_compare = CompareFunction::kAlways;
451 front_stencil.depth_stencil_pass = StencilOperation::kKeep;
452 desc.SetStencilAttachmentDescriptors(front_stencil);
453 break;
454 case StencilMode::kStencilNonZeroFill:
455 // The stencil ref should be 0 on commands that use this mode.
456 front_stencil.stencil_compare = CompareFunction::kAlways;
457 front_stencil.depth_stencil_pass = StencilOperation::kIncrementWrap;
458 back_stencil.stencil_compare = CompareFunction::kAlways;
459 back_stencil.depth_stencil_pass = StencilOperation::kDecrementWrap;
460 desc.SetStencilAttachmentDescriptors(front_stencil, back_stencil);
461 break;
462 case StencilMode::kStencilEvenOddFill:
463 // The stencil ref should be 0 on commands that use this mode.
464 front_stencil.stencil_compare = CompareFunction::kEqual;
465 front_stencil.depth_stencil_pass = StencilOperation::kIncrementWrap;
466 front_stencil.stencil_failure = StencilOperation::kDecrementWrap;
467 desc.SetStencilAttachmentDescriptors(front_stencil);
468 break;
469 case StencilMode::kCoverCompare:
470 // The stencil ref should be 0 on commands that use this mode.
471 front_stencil.stencil_compare = CompareFunction::kNotEqual;
472 front_stencil.depth_stencil_pass =
473 StencilOperation::kSetToReferenceValue;
474 desc.SetStencilAttachmentDescriptors(front_stencil);
475 break;
476 case StencilMode::kCoverCompareInverted:
477 // The stencil ref should be 0 on commands that use this mode.
478 front_stencil.stencil_compare = CompareFunction::kEqual;
479 front_stencil.stencil_failure = StencilOperation::kSetToReferenceValue;
480 desc.SetStencilAttachmentDescriptors(front_stencil);
481 break;
482 case StencilMode::kOverdrawPreventionIncrement:
483 front_stencil.stencil_compare = CompareFunction::kEqual;
484 front_stencil.depth_stencil_pass = StencilOperation::kIncrementClamp;
485 desc.SetStencilAttachmentDescriptors(front_stencil);
486 break;
487 case StencilMode::kOverdrawPreventionRestore:
488 front_stencil.stencil_compare = CompareFunction::kLess;
489 front_stencil.depth_stencil_pass =
490 StencilOperation::kSetToReferenceValue;
491 desc.SetStencilAttachmentDescriptors(front_stencil);
492 break;
493 }
494 }
495 if (maybe_depth.has_value()) {
496 DepthAttachmentDescriptor depth = maybe_depth.value();
497 depth.depth_write_enabled = depth_write_enabled;
498 depth.depth_compare = depth_compare;
499 desc.SetDepthStencilAttachmentDescriptor(depth);
500 }
501
502 desc.SetPrimitiveType(primitive_type);
503 desc.SetPolygonMode(PolygonMode::kFill);
504 }
505
506 std::array<std::vector<Scalar>, 15> GetPorterDuffSpecConstants(
507 bool supports_decal) {
508 Scalar x = supports_decal ? 1 : 0;
509 return {{
510 {x, 0, 0, 0, 0, 0}, // Clear
511 {x, 1, 0, 0, 0, 0}, // Source
512 {x, 0, 0, 1, 0, 0}, // Destination
513 {x, 1, 0, 1, -1, 0}, // SourceOver
514 {x, 1, -1, 1, 0, 0}, // DestinationOver
515 {x, 0, 1, 0, 0, 0}, // SourceIn
516 {x, 0, 0, 0, 1, 0}, // DestinationIn
517 {x, 1, -1, 0, 0, 0}, // SourceOut
518 {x, 0, 0, 1, -1, 0}, // DestinationOut
519 {x, 0, 1, 1, -1, 0}, // SourceATop
520 {x, 1, -1, 0, 1, 0}, // DestinationATop
521 {x, 1, -1, 1, -1, 0}, // Xor
522 {x, 1, 0, 1, 0, 0}, // Plus
523 {x, 0, 0, 0, 0, 1}, // Modulate
524 {x, 0, 0, 1, 0, -1}, // Screen
525 }};
526 }
527
528 template <typename PipelineT>
529 static std::unique_ptr<PipelineT> CreateDefaultPipeline(
530 const Context& context) {
531 auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
532 if (!desc.has_value()) {
533 return nullptr;
534 }
535 // Apply default ContentContextOptions to the descriptor.
536 const auto default_color_format =
537 context.GetCapabilities()->GetDefaultColorFormat();
538 ContentContextOptions{.sample_count = SampleCount::kCount4,
539 .primitive_type = PrimitiveType::kTriangleStrip,
540 .color_attachment_pixel_format = default_color_format}
541 .ApplyToPipelineDescriptor(*desc);
542 return std::make_unique<PipelineT>(context, desc);
543 }
544
545 ContentContext::ContentContext(
546 std::shared_ptr<Context> context,
547 std::shared_ptr<TypographerContext> typographer_context,
548 std::shared_ptr<RenderTargetAllocator> render_target_allocator)
549 : context_(std::move(context)),
550 lazy_glyph_atlas_(
551 std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
552 pipelines_(new Pipelines()),
553 tessellator_(std::make_shared<Tessellator>()),
554 render_target_cache_(render_target_allocator == nullptr
555 ? std::make_shared<RenderTargetCache>(
556 context_->GetResourceAllocator())
557 : std::move(render_target_allocator)),
558 data_host_buffer_(HostBuffer::Create(
559 context_->GetResourceAllocator(),
560 context_->GetIdleWaiter(),
561 context_->GetCapabilities()->GetMinimumUniformAlignment())),
562 text_shadow_cache_(std::make_unique<TextShadowCache>()) {
563 if (!context_ || !context_->IsValid()) {
564 return;
565 }
566
567 // On most backends, indexes and other data can be allocated into the same
568 // buffers. However, some backends (namely WebGL) require indexes used in
569 // indexed draws to be allocated separately from other data. For those
570 // backends, we allocate a separate host buffer just for indexes.
571 indexes_host_buffer_ =
572 context_->GetCapabilities()->NeedsPartitionedHostBuffer()
573 ? HostBuffer::Create(
574 context_->GetResourceAllocator(), context_->GetIdleWaiter(),
575 context_->GetCapabilities()->GetMinimumUniformAlignment())
576 : data_host_buffer_;
577 {
578 TextureDescriptor desc;
579 desc.storage_mode = StorageMode::kDevicePrivate;
580 desc.format = PixelFormat::kR8G8B8A8UNormInt;
581 desc.size = ISize{1, 1};
582 empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
583
584 std::array<uint8_t, 4> data = Color::BlackTransparent().ToR8G8B8A8();
585 std::shared_ptr<CommandBuffer> cmd_buffer =
586 GetContext()->CreateCommandBuffer();
587 std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
588 HostBuffer& data_host_buffer = GetTransientsDataBuffer();
589 BufferView buffer_view = data_host_buffer.Emplace(data);
590 blit_pass->AddCopy(buffer_view, empty_texture_);
591
592 if (!blit_pass->EncodeCommands() || !GetContext()
593 ->GetCommandQueue()
594 ->Submit({std::move(cmd_buffer)})
595 .ok()) {
596 VALIDATION_LOG << "Failed to create empty texture.";
597 }
598 }
599
600 auto options = ContentContextOptions{
601 .sample_count = SampleCount::kCount4,
602 .color_attachment_pixel_format =
603 context_->GetCapabilities()->GetDefaultColorFormat()};
604 auto options_trianglestrip = ContentContextOptions{
605 .sample_count = SampleCount::kCount4,
606 .primitive_type = PrimitiveType::kTriangleStrip,
607 .color_attachment_pixel_format =
608 context_->GetCapabilities()->GetDefaultColorFormat()};
609 auto options_no_msaa_no_depth_stencil = ContentContextOptions{
610 .sample_count = SampleCount::kCount1,
611 .primitive_type = PrimitiveType::kTriangleStrip,
612 .color_attachment_pixel_format =
613 context_->GetCapabilities()->GetDefaultColorFormat(),
614 .has_depth_stencil_attachments = false};
615 const auto supports_decal = static_cast<Scalar>(
616 context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
617
618 // Futures for the following pipelines may block in case the first frame is
619 // rendered without the pipelines being ready. Put pipelines that are more
620 // likely to be used first.
621 {
622 pipelines_->glyph_atlas.CreateDefault(
623 *context_, options,
624 {static_cast<Scalar>(
625 GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
626 PixelFormat::kA8UNormInt)});
627 pipelines_->solid_fill.CreateDefault(*context_, options);
628 pipelines_->texture.CreateDefault(*context_, options);
629 pipelines_->fast_gradient.CreateDefault(*context_, options);
630 pipelines_->line.CreateDefault(*context_, options);
631
632 if (context_->GetCapabilities()->SupportsSSBO()) {
633 pipelines_->linear_gradient_ssbo_fill.CreateDefault(*context_, options);
634 pipelines_->radial_gradient_ssbo_fill.CreateDefault(*context_, options);
635 pipelines_->conical_gradient_ssbo_fill.CreateDefault(*context_, options,
636 {3.0});
637 pipelines_->conical_gradient_ssbo_fill_radial.CreateDefault(
638 *context_, options, {1.0});
639 pipelines_->conical_gradient_ssbo_fill_strip.CreateDefault(
640 *context_, options, {2.0});
641 pipelines_->conical_gradient_ssbo_fill_strip_and_radial.CreateDefault(
642 *context_, options, {0.0});
643 pipelines_->sweep_gradient_ssbo_fill.CreateDefault(*context_, options);
644 } else {
645 pipelines_->linear_gradient_uniform_fill.CreateDefault(*context_,
646 options);
647 pipelines_->radial_gradient_uniform_fill.CreateDefault(*context_,
648 options);
649 pipelines_->conical_gradient_uniform_fill.CreateDefault(*context_,
650 options);
651 pipelines_->conical_gradient_uniform_fill_radial.CreateDefault(*context_,
652 options);
653 pipelines_->conical_gradient_uniform_fill_strip.CreateDefault(*context_,
654 options);
655 pipelines_->conical_gradient_uniform_fill_strip_and_radial.CreateDefault(
656 *context_, options);
657 pipelines_->sweep_gradient_uniform_fill.CreateDefault(*context_, options);
658
659 pipelines_->linear_gradient_fill.CreateDefault(*context_, options);
660 pipelines_->radial_gradient_fill.CreateDefault(*context_, options);
661 pipelines_->conical_gradient_fill.CreateDefault(*context_, options);
662 pipelines_->conical_gradient_fill_radial.CreateDefault(*context_,
663 options);
664 pipelines_->conical_gradient_fill_strip.CreateDefault(*context_, options);
665 pipelines_->conical_gradient_fill_strip_and_radial.CreateDefault(
666 *context_, options);
667 pipelines_->sweep_gradient_fill.CreateDefault(*context_, options);
668 }
669
670 /// Setup default clip pipeline.
671 auto clip_pipeline_descriptor =
672 ClipPipeline::Builder::MakeDefaultPipelineDescriptor(*context_);
673 if (!clip_pipeline_descriptor.has_value()) {
674 return;
675 }
676 ContentContextOptions{
677 .sample_count = SampleCount::kCount4,
678 .color_attachment_pixel_format =
679 context_->GetCapabilities()->GetDefaultColorFormat()}
680 .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
681 // Disable write to all color attachments.
682 auto clip_color_attachments =
683 clip_pipeline_descriptor->GetColorAttachmentDescriptors();
684 for (auto& color_attachment : clip_color_attachments) {
685 color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
686 }
687 clip_pipeline_descriptor->SetColorAttachmentDescriptors(
688 std::move(clip_color_attachments));
689 if (GetContext()->GetFlags().lazy_shader_mode) {
690 pipelines_->clip.SetDefaultDescriptor(clip_pipeline_descriptor);
691 pipelines_->clip.SetDefault(options, nullptr);
692 } else {
693 pipelines_->clip.SetDefault(
694 options,
695 std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
696 }
697 pipelines_->texture_downsample.CreateDefault(
698 *context_, options_no_msaa_no_depth_stencil);
699 pipelines_->rrect_blur.CreateDefault(*context_, options_trianglestrip);
700 pipelines_->rsuperellipse_blur.CreateDefault(*context_,
701 options_trianglestrip);
702 pipelines_->texture_strict_src.CreateDefault(*context_, options);
703 pipelines_->tiled_texture.CreateDefault(*context_, options,
704 {supports_decal});
705 pipelines_->gaussian_blur.CreateDefault(
706 *context_, options_no_msaa_no_depth_stencil, {supports_decal});
707 pipelines_->border_mask_blur.CreateDefault(*context_,
708 options_trianglestrip);
709 pipelines_->color_matrix_color_filter.CreateDefault(*context_,
710 options_trianglestrip);
711 pipelines_->vertices_uber_1_.CreateDefault(*context_, options,
712 {supports_decal});
713 pipelines_->vertices_uber_2_.CreateDefault(*context_, options,
714 {supports_decal});
715
716 const std::array<std::vector<Scalar>, 15> porter_duff_constants =
717 GetPorterDuffSpecConstants(supports_decal);
718 pipelines_->clear_blend.CreateDefault(*context_, options_trianglestrip,
719 porter_duff_constants[0]);
720 pipelines_->source_blend.CreateDefault(*context_, options_trianglestrip,
721 porter_duff_constants[1]);
722 pipelines_->destination_blend.CreateDefault(
723 *context_, options_trianglestrip, porter_duff_constants[2]);
724 pipelines_->source_over_blend.CreateDefault(
725 *context_, options_trianglestrip, porter_duff_constants[3]);
726 pipelines_->destination_over_blend.CreateDefault(
727 *context_, options_trianglestrip, porter_duff_constants[4]);
728 pipelines_->source_in_blend.CreateDefault(*context_, options_trianglestrip,
729 porter_duff_constants[5]);
730 pipelines_->destination_in_blend.CreateDefault(
731 *context_, options_trianglestrip, porter_duff_constants[6]);
732 pipelines_->source_out_blend.CreateDefault(*context_, options_trianglestrip,
733 porter_duff_constants[7]);
734 pipelines_->destination_out_blend.CreateDefault(
735 *context_, options_trianglestrip, porter_duff_constants[8]);
736 pipelines_->source_a_top_blend.CreateDefault(
737 *context_, options_trianglestrip, porter_duff_constants[9]);
738 pipelines_->destination_a_top_blend.CreateDefault(
739 *context_, options_trianglestrip, porter_duff_constants[10]);
740 pipelines_->xor_blend.CreateDefault(*context_, options_trianglestrip,
741 porter_duff_constants[11]);
742 pipelines_->plus_blend.CreateDefault(*context_, options_trianglestrip,
743 porter_duff_constants[12]);
744 pipelines_->modulate_blend.CreateDefault(*context_, options_trianglestrip,
745 porter_duff_constants[13]);
746 pipelines_->screen_blend.CreateDefault(*context_, options_trianglestrip,
747 porter_duff_constants[14]);
748 }
749
750 if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
751 pipelines_->framebuffer_blend_color.CreateDefault(
752 *context_, options_trianglestrip,
753 {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
754 pipelines_->framebuffer_blend_colorburn.CreateDefault(
755 *context_, options_trianglestrip,
756 {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
757 pipelines_->framebuffer_blend_colordodge.CreateDefault(
758 *context_, options_trianglestrip,
759 {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
760 pipelines_->framebuffer_blend_darken.CreateDefault(
761 *context_, options_trianglestrip,
762 {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
763 pipelines_->framebuffer_blend_difference.CreateDefault(
764 *context_, options_trianglestrip,
765 {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
766 pipelines_->framebuffer_blend_exclusion.CreateDefault(
767 *context_, options_trianglestrip,
768 {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
769 pipelines_->framebuffer_blend_hardlight.CreateDefault(
770 *context_, options_trianglestrip,
771 {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
772 pipelines_->framebuffer_blend_hue.CreateDefault(
773 *context_, options_trianglestrip,
774 {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
775 pipelines_->framebuffer_blend_lighten.CreateDefault(
776 *context_, options_trianglestrip,
777 {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
778 pipelines_->framebuffer_blend_luminosity.CreateDefault(
779 *context_, options_trianglestrip,
780 {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
781 pipelines_->framebuffer_blend_multiply.CreateDefault(
782 *context_, options_trianglestrip,
783 {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
784 pipelines_->framebuffer_blend_overlay.CreateDefault(
785 *context_, options_trianglestrip,
786 {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
787 pipelines_->framebuffer_blend_saturation.CreateDefault(
788 *context_, options_trianglestrip,
789 {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
790 pipelines_->framebuffer_blend_screen.CreateDefault(
791 *context_, options_trianglestrip,
792 {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
793 pipelines_->framebuffer_blend_softlight.CreateDefault(
794 *context_, options_trianglestrip,
795 {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
796 } else {
797 pipelines_->blend_color.CreateDefault(
798 *context_, options_trianglestrip,
799 {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
800 pipelines_->blend_colorburn.CreateDefault(
801 *context_, options_trianglestrip,
802 {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
803 pipelines_->blend_colordodge.CreateDefault(
804 *context_, options_trianglestrip,
805 {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
806 pipelines_->blend_darken.CreateDefault(
807 *context_, options_trianglestrip,
808 {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
809 pipelines_->blend_difference.CreateDefault(
810 *context_, options_trianglestrip,
811 {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
812 pipelines_->blend_exclusion.CreateDefault(
813 *context_, options_trianglestrip,
814 {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
815 pipelines_->blend_hardlight.CreateDefault(
816 *context_, options_trianglestrip,
817 {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
818 pipelines_->blend_hue.CreateDefault(
819 *context_, options_trianglestrip,
820 {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
821 pipelines_->blend_lighten.CreateDefault(
822 *context_, options_trianglestrip,
823 {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
824 pipelines_->blend_luminosity.CreateDefault(
825 *context_, options_trianglestrip,
826 {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
827 pipelines_->blend_multiply.CreateDefault(
828 *context_, options_trianglestrip,
829 {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
830 pipelines_->blend_overlay.CreateDefault(
831 *context_, options_trianglestrip,
832 {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
833 pipelines_->blend_saturation.CreateDefault(
834 *context_, options_trianglestrip,
835 {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
836 pipelines_->blend_screen.CreateDefault(
837 *context_, options_trianglestrip,
838 {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
839 pipelines_->blend_softlight.CreateDefault(
840 *context_, options_trianglestrip,
841 {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
842 }
843
844 pipelines_->morphology_filter.CreateDefault(*context_, options_trianglestrip,
845 {supports_decal});
846 pipelines_->linear_to_srgb_filter.CreateDefault(*context_,
847 options_trianglestrip);
848 pipelines_->srgb_to_linear_filter.CreateDefault(*context_,
849 options_trianglestrip);
850 pipelines_->yuv_to_rgb_filter.CreateDefault(*context_, options_trianglestrip);
851
852 #if defined(IMPELLER_ENABLE_OPENGLES)
853 if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
854 #if !defined(FML_OS_MACOSX)
855 // GLES only shader that is unsupported on macOS.
856 pipelines_->tiled_texture_external.CreateDefault(*context_, options);
857 pipelines_->tiled_texture_uv_external.CreateDefault(*context_, options);
858 #endif // !defined(FML_OS_MACOSX)
859 pipelines_->texture_downsample_gles.CreateDefault(*context_,
860 options_trianglestrip);
861 }
862 #endif // IMPELLER_ENABLE_OPENGLES
863
864 is_valid_ = true;
865 InitializeCommonlyUsedShadersIfNeeded();
866 }
867
868 ContentContext::~ContentContext() = default;
869
870 bool ContentContext::IsValid() const {
871 return is_valid_;
872 }
873
874 std::shared_ptr<Texture> ContentContext::GetEmptyTexture() const {
875 return empty_texture_;
876 }
877
878 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
879 std::string_view label,
880 ISize texture_size,
881 const std::shared_ptr<CommandBuffer>& command_buffer,
882 const SubpassCallback& subpass_callback,
883 bool msaa_enabled,
884 bool depth_stencil_enabled,
885 int32_t mip_count) const {
886 const std::shared_ptr<Context>& context = GetContext();
887 RenderTarget subpass_target;
888
889 std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
890 depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
891 : std::optional<RenderTarget::AttachmentConfig>();
892
893 if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
894 subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
895 *context, texture_size,
896 /*mip_count=*/mip_count, label,
897 RenderTarget::kDefaultColorAttachmentConfigMSAA, depth_stencil_config);
898 } else {
899 subpass_target = GetRenderTargetCache()->CreateOffscreen(
900 *context, texture_size,
901 /*mip_count=*/mip_count, label,
902 RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
903 }
904 return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
905 }
906
907 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
908 std::string_view label,
909 const RenderTarget& subpass_target,
910 const std::shared_ptr<CommandBuffer>& command_buffer,
911 const SubpassCallback& subpass_callback) const {
912 const std::shared_ptr<Context>& context = GetContext();
913
914 auto subpass_texture = subpass_target.GetRenderTargetTexture();
915 if (!subpass_texture) {
916 return fml::Status(fml::StatusCode::kUnknown, "");
917 }
918
919 auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
920 if (!sub_renderpass) {
921 return fml::Status(fml::StatusCode::kUnknown, "");
922 }
923 sub_renderpass->SetLabel(label);
924
925 if (!subpass_callback(*this, *sub_renderpass)) {
926 return fml::Status(fml::StatusCode::kUnknown, "");
927 }
928
929 if (!sub_renderpass->EncodeCommands()) {
930 return fml::Status(fml::StatusCode::kUnknown, "");
931 }
932
933 const std::shared_ptr<Texture>& target_texture =
934 subpass_target.GetRenderTargetTexture();
935 if (target_texture->GetMipCount() > 1) {
936 fml::Status mipmap_status =
937 AddMipmapGeneration(command_buffer, context, target_texture);
938 if (!mipmap_status.ok()) {
939 return mipmap_status;
940 }
941 }
942
943 return subpass_target;
944 }
945
946 Tessellator& ContentContext::GetTessellator() const {
947 return *tessellator_;
948 }
949
950 std::shared_ptr<Context> ContentContext::GetContext() const {
951 return context_;
952 }
953
954 const Capabilities& ContentContext::GetDeviceCapabilities() const {
955 return *context_->GetCapabilities();
956 }
957
958 PipelineRef ContentContext::GetCachedRuntimeEffectPipeline(
959 const std::string& unique_entrypoint_name,
960 const ContentContextOptions& options,
961 const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
962 create_callback) const {
963 RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
964 auto it = runtime_effect_pipelines_.find(key);
965 if (it == runtime_effect_pipelines_.end()) {
966 it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
967 }
968 return raw_ptr(it->second);
969 }
970
971 void ContentContext::ClearCachedRuntimeEffectPipeline(
972 const std::string& unique_entrypoint_name) const {
973 #ifdef IMPELLER_DEBUG
974 // destroying in-use pipleines is a validation error.
975 const auto& idle_waiter = GetContext()->GetIdleWaiter();
976 if (idle_waiter) {
977 idle_waiter->WaitIdle();
978 }
979 #endif // IMPELLER_DEBUG
980 for (auto it = runtime_effect_pipelines_.begin();
981 it != runtime_effect_pipelines_.end();) {
982 if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
983 it = runtime_effect_pipelines_.erase(it);
984 } else {
985 it++;
986 }
987 }
988 }
989
990 void ContentContext::ResetTransientsBuffers() {
991 data_host_buffer_->Reset();
992
993 // We should only reset the indexes host buffer if it is actually different
994 // from the data host buffer. Otherwise we'll end up resetting the same host
995 // buffer twice.
996 if (data_host_buffer_ != indexes_host_buffer_) {
997 indexes_host_buffer_->Reset();
998 }
999 }
1000
1001 void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
1002 if (GetContext()->GetFlags().lazy_shader_mode) {
1003 return;
1004 }
1005 GetContext()->InitializeCommonlyUsedShadersIfNeeded();
1006 }
1007
1008 PipelineRef ContentContext::GetFastGradientPipeline(
1009 ContentContextOptions opts) const {
1010 return GetPipeline(this, pipelines_->fast_gradient, opts);
1011 }
1012
1013 PipelineRef ContentContext::GetLinearGradientFillPipeline(
1014 ContentContextOptions opts) const {
1015 return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1016 }
1017
1018 PipelineRef ContentContext::GetLinearGradientUniformFillPipeline(
1019 ContentContextOptions opts) const {
1020 return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1021 }
1022
1023 PipelineRef ContentContext::GetRadialGradientUniformFillPipeline(
1024 ContentContextOptions opts) const {
1025 return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
1026 }
1027
1028 PipelineRef ContentContext::GetSweepGradientUniformFillPipeline(
1029 ContentContextOptions opts) const {
1030 return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1031 }
1032
1033 PipelineRef ContentContext::GetLinearGradientSSBOFillPipeline(
1034 ContentContextOptions opts) const {
1035 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1036 return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1037 }
1038
1039 PipelineRef ContentContext::GetRadialGradientSSBOFillPipeline(
1040 ContentContextOptions opts) const {
1041 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1042 return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1043 }
1044
1045 PipelineRef ContentContext::GetConicalGradientUniformFillPipeline(
1046 ContentContextOptions opts,
1047 ConicalKind kind) const {
1048 switch (kind) {
1049 case ConicalKind::kConical:
1050 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1051 case ConicalKind::kRadial:
1052 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1053 opts);
1054 case ConicalKind::kStrip:
1055 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1056 opts);
1057 case ConicalKind::kStripAndRadial:
1058 return GetPipeline(
1059 this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1060 opts);
1061 }
1062 }
1063
1064 PipelineRef ContentContext::GetConicalGradientSSBOFillPipeline(
1065 ContentContextOptions opts,
1066 ConicalKind kind) const {
1067 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1068 switch (kind) {
1069 case ConicalKind::kConical:
1070 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1071 case ConicalKind::kRadial:
1072 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1073 opts);
1074 case ConicalKind::kStrip:
1075 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1076 opts);
1077 case ConicalKind::kStripAndRadial:
1078 return GetPipeline(
1079 this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1080 }
1081 }
1082
1083 PipelineRef ContentContext::GetSweepGradientSSBOFillPipeline(
1084 ContentContextOptions opts) const {
1085 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1086 return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1087 }
1088
1089 PipelineRef ContentContext::GetRadialGradientFillPipeline(
1090 ContentContextOptions opts) const {
1091 return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1092 }
1093
1094 PipelineRef ContentContext::GetConicalGradientFillPipeline(
1095 ContentContextOptions opts,
1096 ConicalKind kind) const {
1097 switch (kind) {
1098 case ConicalKind::kConical:
1099 return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1100 case ConicalKind::kRadial:
1101 return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1102 case ConicalKind::kStrip:
1103 return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1104 case ConicalKind::kStripAndRadial:
1105 return GetPipeline(
1106 this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1107 }
1108 }
1109
1110 PipelineRef ContentContext::GetRRectBlurPipeline(
1111 ContentContextOptions opts) const {
1112 return GetPipeline(this, pipelines_->rrect_blur, opts);
1113 }
1114
1115 PipelineRef ContentContext::GetRSuperellipseBlurPipeline(
1116 ContentContextOptions opts) const {
1117 return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1118 }
1119
1120 PipelineRef ContentContext::GetSweepGradientFillPipeline(
1121 ContentContextOptions opts) const {
1122 return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1123 }
1124
1125 PipelineRef ContentContext::GetSolidFillPipeline(
1126 ContentContextOptions opts) const {
1127 return GetPipeline(this, pipelines_->solid_fill, opts);
1128 }
1129
1130 PipelineRef ContentContext::GetTexturePipeline(
1131 ContentContextOptions opts) const {
1132 return GetPipeline(this, pipelines_->texture, opts);
1133 }
1134
1135 PipelineRef ContentContext::GetTextureStrictSrcPipeline(
1136 ContentContextOptions opts) const {
1137 return GetPipeline(this, pipelines_->texture_strict_src, opts);
1138 }
1139
1140 PipelineRef ContentContext::GetTiledTexturePipeline(
1141 ContentContextOptions opts) const {
1142 return GetPipeline(this, pipelines_->tiled_texture, opts);
1143 }
1144
1145 PipelineRef ContentContext::GetGaussianBlurPipeline(
1146 ContentContextOptions opts) const {
1147 return GetPipeline(this, pipelines_->gaussian_blur, opts);
1148 }
1149
1150 PipelineRef ContentContext::GetBorderMaskBlurPipeline(
1151 ContentContextOptions opts) const {
1152 return GetPipeline(this, pipelines_->border_mask_blur, opts);
1153 }
1154
1155 PipelineRef ContentContext::GetMorphologyFilterPipeline(
1156 ContentContextOptions opts) const {
1157 return GetPipeline(this, pipelines_->morphology_filter, opts);
1158 }
1159
1160 PipelineRef ContentContext::GetColorMatrixColorFilterPipeline(
1161 ContentContextOptions opts) const {
1162 return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1163 }
1164
1165 PipelineRef ContentContext::GetLinearToSrgbFilterPipeline(
1166 ContentContextOptions opts) const {
1167 return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1168 }
1169
1170 PipelineRef ContentContext::GetSrgbToLinearFilterPipeline(
1171 ContentContextOptions opts) const {
1172 return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1173 }
1174
1175 PipelineRef ContentContext::GetClipPipeline(ContentContextOptions opts) const {
1176 return GetPipeline(this, pipelines_->clip, opts);
1177 }
1178
1179 PipelineRef ContentContext::GetGlyphAtlasPipeline(
1180 ContentContextOptions opts) const {
1181 return GetPipeline(this, pipelines_->glyph_atlas, opts);
1182 }
1183
1184 PipelineRef ContentContext::GetYUVToRGBFilterPipeline(
1185 ContentContextOptions opts) const {
1186 return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1187 }
1188
1189 PipelineRef ContentContext::GetPorterDuffPipeline(
1190 BlendMode mode,
1191 ContentContextOptions opts) const {
1192 switch (mode) {
1193 case BlendMode::kClear:
1194 return GetClearBlendPipeline(opts);
1195 case BlendMode::kSrc:
1196 return GetSourceBlendPipeline(opts);
1197 case BlendMode::kDst:
1198 return GetDestinationBlendPipeline(opts);
1199 case BlendMode::kSrcOver:
1200 return GetSourceOverBlendPipeline(opts);
1201 case BlendMode::kDstOver:
1202 return GetDestinationOverBlendPipeline(opts);
1203 case BlendMode::kSrcIn:
1204 return GetSourceInBlendPipeline(opts);
1205 case BlendMode::kDstIn:
1206 return GetDestinationInBlendPipeline(opts);
1207 case BlendMode::kSrcOut:
1208 return GetSourceOutBlendPipeline(opts);
1209 case BlendMode::kDstOut:
1210 return GetDestinationOutBlendPipeline(opts);
1211 case BlendMode::kSrcATop:
1212 return GetSourceATopBlendPipeline(opts);
1213 case BlendMode::kDstATop:
1214 return GetDestinationATopBlendPipeline(opts);
1215 case BlendMode::kXor:
1216 return GetXorBlendPipeline(opts);
1217 case BlendMode::kPlus:
1218 return GetPlusBlendPipeline(opts);
1219 case BlendMode::kModulate:
1220 return GetModulateBlendPipeline(opts);
1221 case BlendMode::kScreen:
1222 return GetScreenBlendPipeline(opts);
1223 case BlendMode::kOverlay:
1224 case BlendMode::kDarken:
1225 case BlendMode::kLighten:
1226 case BlendMode::kColorDodge:
1227 case BlendMode::kColorBurn:
1228 case BlendMode::kHardLight:
1229 case BlendMode::kSoftLight:
1230 case BlendMode::kDifference:
1231 case BlendMode::kExclusion:
1232 case BlendMode::kMultiply:
1233 case BlendMode::kHue:
1234 case BlendMode::kSaturation:
1235 case BlendMode::kColor:
1236 case BlendMode::kLuminosity:
1237 VALIDATION_LOG << "Invalid porter duff blend mode "
1238 << BlendModeToString(mode);
1239 return GetClearBlendPipeline(opts);
1240 break;
1241 }
1242 }
1243
1244 PipelineRef ContentContext::GetClearBlendPipeline(
1245 ContentContextOptions opts) const {
1246 return GetPipeline(this, pipelines_->clear_blend, opts);
1247 }
1248
1249 PipelineRef ContentContext::GetSourceBlendPipeline(
1250 ContentContextOptions opts) const {
1251 return GetPipeline(this, pipelines_->source_blend, opts);
1252 }
1253
1254 PipelineRef ContentContext::GetDestinationBlendPipeline(
1255 ContentContextOptions opts) const {
1256 return GetPipeline(this, pipelines_->destination_blend, opts);
1257 }
1258
1259 PipelineRef ContentContext::GetSourceOverBlendPipeline(
1260 ContentContextOptions opts) const {
1261 return GetPipeline(this, pipelines_->source_over_blend, opts);
1262 }
1263
1264 PipelineRef ContentContext::GetDestinationOverBlendPipeline(
1265 ContentContextOptions opts) const {
1266 return GetPipeline(this, pipelines_->destination_over_blend, opts);
1267 }
1268
1269 PipelineRef ContentContext::GetSourceInBlendPipeline(
1270 ContentContextOptions opts) const {
1271 return GetPipeline(this, pipelines_->source_in_blend, opts);
1272 }
1273
1274 PipelineRef ContentContext::GetDestinationInBlendPipeline(
1275 ContentContextOptions opts) const {
1276 return GetPipeline(this, pipelines_->destination_in_blend, opts);
1277 }
1278
1279 PipelineRef ContentContext::GetSourceOutBlendPipeline(
1280 ContentContextOptions opts) const {
1281 return GetPipeline(this, pipelines_->source_out_blend, opts);
1282 }
1283
1284 PipelineRef ContentContext::GetDestinationOutBlendPipeline(
1285 ContentContextOptions opts) const {
1286 return GetPipeline(this, pipelines_->destination_out_blend, opts);
1287 }
1288
1289 PipelineRef ContentContext::GetSourceATopBlendPipeline(
1290 ContentContextOptions opts) const {
1291 return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1292 }
1293
1294 PipelineRef ContentContext::GetDestinationATopBlendPipeline(
1295 ContentContextOptions opts) const {
1296 return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1297 }
1298
1299 PipelineRef ContentContext::GetXorBlendPipeline(
1300 ContentContextOptions opts) const {
1301 return GetPipeline(this, pipelines_->xor_blend, opts);
1302 }
1303
1304 PipelineRef ContentContext::GetPlusBlendPipeline(
1305 ContentContextOptions opts) const {
1306 return GetPipeline(this, pipelines_->plus_blend, opts);
1307 }
1308
1309 PipelineRef ContentContext::GetModulateBlendPipeline(
1310 ContentContextOptions opts) const {
1311 return GetPipeline(this, pipelines_->modulate_blend, opts);
1312 }
1313
1314 PipelineRef ContentContext::GetScreenBlendPipeline(
1315 ContentContextOptions opts) const {
1316 return GetPipeline(this, pipelines_->screen_blend, opts);
1317 }
1318
1319 PipelineRef ContentContext::GetBlendColorPipeline(
1320 ContentContextOptions opts) const {
1321 return GetPipeline(this, pipelines_->blend_color, opts);
1322 }
1323
1324 PipelineRef ContentContext::GetBlendColorBurnPipeline(
1325 ContentContextOptions opts) const {
1326 return GetPipeline(this, pipelines_->blend_colorburn, opts);
1327 }
1328
1329 PipelineRef ContentContext::GetBlendColorDodgePipeline(
1330 ContentContextOptions opts) const {
1331 return GetPipeline(this, pipelines_->blend_colordodge, opts);
1332 }
1333
1334 PipelineRef ContentContext::GetBlendDarkenPipeline(
1335 ContentContextOptions opts) const {
1336 return GetPipeline(this, pipelines_->blend_darken, opts);
1337 }
1338
1339 PipelineRef ContentContext::GetBlendDifferencePipeline(
1340 ContentContextOptions opts) const {
1341 return GetPipeline(this, pipelines_->blend_difference, opts);
1342 }
1343
1344 PipelineRef ContentContext::GetBlendExclusionPipeline(
1345 ContentContextOptions opts) const {
1346 return GetPipeline(this, pipelines_->blend_exclusion, opts);
1347 }
1348
1349 PipelineRef ContentContext::GetBlendHardLightPipeline(
1350 ContentContextOptions opts) const {
1351 return GetPipeline(this, pipelines_->blend_hardlight, opts);
1352 }
1353
1354 PipelineRef ContentContext::GetBlendHuePipeline(
1355 ContentContextOptions opts) const {
1356 return GetPipeline(this, pipelines_->blend_hue, opts);
1357 }
1358
1359 PipelineRef ContentContext::GetBlendLightenPipeline(
1360 ContentContextOptions opts) const {
1361 return GetPipeline(this, pipelines_->blend_lighten, opts);
1362 }
1363
1364 PipelineRef ContentContext::GetBlendLuminosityPipeline(
1365 ContentContextOptions opts) const {
1366 return GetPipeline(this, pipelines_->blend_luminosity, opts);
1367 }
1368
1369 PipelineRef ContentContext::GetBlendMultiplyPipeline(
1370 ContentContextOptions opts) const {
1371 return GetPipeline(this, pipelines_->blend_multiply, opts);
1372 }
1373
1374 PipelineRef ContentContext::GetBlendOverlayPipeline(
1375 ContentContextOptions opts) const {
1376 return GetPipeline(this, pipelines_->blend_overlay, opts);
1377 }
1378
1379 PipelineRef ContentContext::GetBlendSaturationPipeline(
1380 ContentContextOptions opts) const {
1381 return GetPipeline(this, pipelines_->blend_saturation, opts);
1382 }
1383
1384 PipelineRef ContentContext::GetBlendScreenPipeline(
1385 ContentContextOptions opts) const {
1386 return GetPipeline(this, pipelines_->blend_screen, opts);
1387 }
1388
1389 PipelineRef ContentContext::GetBlendSoftLightPipeline(
1390 ContentContextOptions opts) const {
1391 return GetPipeline(this, pipelines_->blend_softlight, opts);
1392 }
1393
1394 PipelineRef ContentContext::GetDownsamplePipeline(
1395 ContentContextOptions opts) const {
1396 return GetPipeline(this, pipelines_->texture_downsample, opts);
1397 }
1398
1399 PipelineRef ContentContext::GetFramebufferBlendColorPipeline(
1400 ContentContextOptions opts) const {
1401 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1402 return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1403 }
1404
1405 PipelineRef ContentContext::GetFramebufferBlendColorBurnPipeline(
1406 ContentContextOptions opts) const {
1407 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1408 return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1409 }
1410
1411 PipelineRef ContentContext::GetFramebufferBlendColorDodgePipeline(
1412 ContentContextOptions opts) const {
1413 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1414 return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1415 }
1416
1417 PipelineRef ContentContext::GetFramebufferBlendDarkenPipeline(
1418 ContentContextOptions opts) const {
1419 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1420 return GetPipeline(this, pipelines_->framebuffer_blend_darken, opts);
1421 }
1422
1423 PipelineRef ContentContext::GetFramebufferBlendDifferencePipeline(
1424 ContentContextOptions opts) const {
1425 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1426 return GetPipeline(this, pipelines_->framebuffer_blend_difference, opts);
1427 }
1428
1429 PipelineRef ContentContext::GetFramebufferBlendExclusionPipeline(
1430 ContentContextOptions opts) const {
1431 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1432 return GetPipeline(this, pipelines_->framebuffer_blend_exclusion, opts);
1433 }
1434
1435 PipelineRef ContentContext::GetFramebufferBlendHardLightPipeline(
1436 ContentContextOptions opts) const {
1437 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1438 return GetPipeline(this, pipelines_->framebuffer_blend_hardlight, opts);
1439 }
1440
1441 PipelineRef ContentContext::GetFramebufferBlendHuePipeline(
1442 ContentContextOptions opts) const {
1443 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1444 return GetPipeline(this, pipelines_->framebuffer_blend_hue, opts);
1445 }
1446
1447 PipelineRef ContentContext::GetFramebufferBlendLightenPipeline(
1448 ContentContextOptions opts) const {
1449 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1450 return GetPipeline(this, pipelines_->framebuffer_blend_lighten, opts);
1451 }
1452
1453 PipelineRef ContentContext::GetFramebufferBlendLuminosityPipeline(
1454 ContentContextOptions opts) const {
1455 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1456 return GetPipeline(this, pipelines_->framebuffer_blend_luminosity, opts);
1457 }
1458
1459 PipelineRef ContentContext::GetFramebufferBlendMultiplyPipeline(
1460 ContentContextOptions opts) const {
1461 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1462 return GetPipeline(this, pipelines_->framebuffer_blend_multiply, opts);
1463 }
1464
1465 PipelineRef ContentContext::GetFramebufferBlendOverlayPipeline(
1466 ContentContextOptions opts) const {
1467 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1468 return GetPipeline(this, pipelines_->framebuffer_blend_overlay, opts);
1469 }
1470
1471 PipelineRef ContentContext::GetFramebufferBlendSaturationPipeline(
1472 ContentContextOptions opts) const {
1473 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1474 return GetPipeline(this, pipelines_->framebuffer_blend_saturation, opts);
1475 }
1476
1477 PipelineRef ContentContext::GetFramebufferBlendScreenPipeline(
1478 ContentContextOptions opts) const {
1479 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1480 return GetPipeline(this, pipelines_->framebuffer_blend_screen, opts);
1481 }
1482
1483 PipelineRef ContentContext::GetFramebufferBlendSoftLightPipeline(
1484 ContentContextOptions opts) const {
1485 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1486 return GetPipeline(this, pipelines_->framebuffer_blend_softlight, opts);
1487 }
1488
1489 PipelineRef ContentContext::GetDrawVerticesUberPipeline(
1490 BlendMode blend_mode,
1491 ContentContextOptions opts) const {
1492 if (blend_mode <= BlendMode::kHardLight) {
1493 return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1494 } else {
1495 return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1496 }
1497 }
1498
1499 PipelineRef ContentContext::GetLinePipeline(ContentContextOptions opts) const {
1500 return GetPipeline(this, pipelines_->line, opts);
1501 }
1502
1503 #ifdef IMPELLER_ENABLE_OPENGLES
1504 PipelineRef ContentContext::GetDownsampleTextureGlesPipeline(
1505 ContentContextOptions opts) const {
1506 return GetPipeline(this, pipelines_->texture_downsample_gles, opts);
1507 }
1508
1509 PipelineRef ContentContext::GetTiledTextureExternalPipeline(
1510 ContentContextOptions opts) const {
1511 FML_DCHECK(GetContext()->GetBackendType() == Context::BackendType::kOpenGLES);
1512 return GetPipeline(this, pipelines_->tiled_texture_external, opts);
1513 }
1514
1515 PipelineRef ContentContext::GetTiledTextureUvExternalPipeline(
1516 ContentContextOptions opts) const {
1517 FML_DCHECK(GetContext()->GetBackendType() == Context::BackendType::kOpenGLES);
1518 return GetPipeline(this, pipelines_->tiled_texture_uv_external, opts);
1519 }
1520 #endif // IMPELLER_ENABLE_OPENGLES
1521
1522 } // namespace impeller
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:154
impeller::Capabilities
Definition: capabilities.h:14
impeller::ContentContext::GetBlendLuminosityPipeline
PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1364
impeller::ContentContext::~ContentContext
~ContentContext()
impeller::ContentContext::GetTiledTexturePipeline
PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1140
impeller::ContentContext::GetFramebufferBlendColorPipeline
PipelineRef GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1399
impeller::ContentContext::GetDownsamplePipeline
PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1394
impeller::ContentContext::GetSourceInBlendPipeline
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1269
impeller::ContentContext::ClearCachedRuntimeEffectPipeline
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
Definition: content_context.cc:971
impeller::ContentContext::GetLinearGradientFillPipeline
PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1013
impeller::ContentContext::GetFramebufferBlendOverlayPipeline
PipelineRef GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1465
impeller::ContentContext::GetBlendColorDodgePipeline
PipelineRef GetBlendColorDodgePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1329
impeller::ContentContext::GetFramebufferBlendColorBurnPipeline
PipelineRef GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1405
impeller::ContentContext::GetPorterDuffPipeline
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
Definition: content_context.cc:1189
impeller::ContentContext::GetEmptyTexture
std::shared_ptr< Texture > GetEmptyTexture() const
Definition: content_context.cc:874
impeller::ContentContext::GetSourceOutBlendPipeline
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1279
impeller::ContentContext::GetScreenBlendPipeline
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1314
impeller::ContentContext::GetBlendColorPipeline
PipelineRef GetBlendColorPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1319
impeller::ContentContext::GetLinePipeline
PipelineRef GetLinePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1499
impeller::ContentContext::GetFramebufferBlendLuminosityPipeline
PipelineRef GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1453
impeller::ContentContext::GetPlusBlendPipeline
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1304
impeller::ContentContext::GetFastGradientPipeline
PipelineRef GetFastGradientPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1008
impeller::ContentContext::ContentContext
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
Definition: content_context.cc:545
impeller::ContentContext::ResetTransientsBuffers
void ResetTransientsBuffers()
Resets the transients buffers held onto by the content context.
Definition: content_context.cc:990
impeller::ContentContext::GetSolidFillPipeline
PipelineRef GetSolidFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1125
impeller::ContentContext::MakeSubpass
fml::StatusOr< RenderTarget > MakeSubpass(std::string_view label, ISize texture_size, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback, bool msaa_enabled=true, bool depth_stencil_enabled=false, int32_t mip_count=1) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
Definition: content_context.cc:878
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:954
impeller::ContentContext::GetModulateBlendPipeline
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1309
impeller::ContentContext::GetFramebufferBlendHardLightPipeline
PipelineRef GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1435
impeller::ContentContext::GetFramebufferBlendColorDodgePipeline
PipelineRef GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1411
impeller::ContentContext::GetSweepGradientUniformFillPipeline
PipelineRef GetSweepGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1028
impeller::ContentContext::GetBlendSoftLightPipeline
PipelineRef GetBlendSoftLightPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1389
impeller::ContentContext::GetDestinationATopBlendPipeline
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1294
impeller::ContentContext::GetTextureStrictSrcPipeline
PipelineRef GetTextureStrictSrcPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1135
impeller::ContentContext::GetCachedRuntimeEffectPipeline
PipelineRef GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
Definition: content_context.cc:958
impeller::ContentContext::GetRadialGradientSSBOFillPipeline
PipelineRef GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1039
impeller::ContentContext::GetBlendColorBurnPipeline
PipelineRef GetBlendColorBurnPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1324
impeller::ContentContext::GetSweepGradientSSBOFillPipeline
PipelineRef GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1083
impeller::ContentContext::GetLinearGradientUniformFillPipeline
PipelineRef GetLinearGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1018
impeller::ContentContext::GetFramebufferBlendScreenPipeline
PipelineRef GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1477
impeller::ContentContext::GetLinearGradientSSBOFillPipeline
PipelineRef GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1033
impeller::ContentContext::GetRadialGradientFillPipeline
PipelineRef GetRadialGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1089
impeller::ContentContext::GetTexturePipeline
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1130
impeller::ContentContext::GetBlendHardLightPipeline
PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1349
impeller::ContentContext::GetClearBlendPipeline
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1244
impeller::ContentContext::GetConicalGradientUniformFillPipeline
PipelineRef GetConicalGradientUniformFillPipeline(ContentContextOptions opts, ConicalKind kind) const
Definition: content_context.cc:1045
impeller::ContentContext::GetRadialGradientUniformFillPipeline
PipelineRef GetRadialGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1023
impeller::ContentContext::GetSweepGradientFillPipeline
PipelineRef GetSweepGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1120
impeller::ContentContext::GetFramebufferBlendExclusionPipeline
PipelineRef GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1429
impeller::ContentContext::GetFramebufferBlendDarkenPipeline
PipelineRef GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1417
impeller::ContentContext::GetBlendSaturationPipeline
PipelineRef GetBlendSaturationPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1379
impeller::ContentContext::GetFramebufferBlendSoftLightPipeline
PipelineRef GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1483
impeller::ContentContext::GetFramebufferBlendLightenPipeline
PipelineRef GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1447
impeller::ContentContext::GetMorphologyFilterPipeline
PipelineRef GetMorphologyFilterPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1155
impeller::ContentContext::GetFramebufferBlendSaturationPipeline
PipelineRef GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1471
impeller::ContentContext::GetBlendDifferencePipeline
PipelineRef GetBlendDifferencePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1339
impeller::ContentContext::GetGaussianBlurPipeline
PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1145
impeller::ContentContext::GetBlendHuePipeline
PipelineRef GetBlendHuePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1354
impeller::ContentContext::GetSrgbToLinearFilterPipeline
PipelineRef GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1170
impeller::ContentContext::GetDestinationOutBlendPipeline
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1284
impeller::ContentContext::GetYUVToRGBFilterPipeline
PipelineRef GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1184
impeller::ContentContext::GetFramebufferBlendDifferencePipeline
PipelineRef GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1423
impeller::ContentContext::GetFramebufferBlendHuePipeline
PipelineRef GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
Definition: content_context.cc:1441
impeller::ContentContext::GetSourceATopBlendPipeline
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1289
impeller::ContentContext::GetTransientsDataBuffer
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
Definition: content_context.h:310
impeller::ContentContext::GetXorBlendPipeline
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1299
impeller::ContentContext::GetGlyphAtlasPipeline
PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1179
impeller::ContentContext::GetClipPipeline
PipelineRef GetClipPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1175
impeller::ContentContext::GetRenderTargetCache
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
Definition: content_context.h:269
impeller::ContentContext::IsValid
bool IsValid() const
Definition: content_context.cc:870
impeller::ContentContext::GetRRectBlurPipeline
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1110
impeller::ContentContext::GetBlendScreenPipeline
PipelineRef GetBlendScreenPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1384
impeller::ContentContext::SubpassCallback
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
Definition: content_context.h:245
impeller::ContentContext::GetBlendDarkenPipeline
PipelineRef GetBlendDarkenPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1334
impeller::ContentContext::GetSourceBlendPipeline
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1249
impeller::ContentContext::GetLinearToSrgbFilterPipeline
PipelineRef GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1165
impeller::ContentContext::GetBlendOverlayPipeline
PipelineRef GetBlendOverlayPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1374
impeller::ContentContext::GetDestinationBlendPipeline
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1254
impeller::ContentContext::GetDestinationOverBlendPipeline
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1264
impeller::ContentContext::GetFramebufferBlendMultiplyPipeline
PipelineRef GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1459
impeller::ContentContext::GetConicalGradientSSBOFillPipeline
PipelineRef GetConicalGradientSSBOFillPipeline(ContentContextOptions opts, ConicalKind kind) const
Definition: content_context.cc:1064
impeller::ContentContext::GetTessellator
Tessellator & GetTessellator() const
Definition: content_context.cc:946
impeller::ContentContext::GetBlendLightenPipeline
PipelineRef GetBlendLightenPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1359
impeller::ContentContext::GetBlendMultiplyPipeline
PipelineRef GetBlendMultiplyPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1369
impeller::ContentContext::GetSourceOverBlendPipeline
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1259
impeller::ContentContext::GetBlendExclusionPipeline
PipelineRef GetBlendExclusionPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1344
impeller::ContentContext::GetColorMatrixColorFilterPipeline
PipelineRef GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1160
impeller::ContentContext::GetConicalGradientFillPipeline
PipelineRef GetConicalGradientFillPipeline(ContentContextOptions opts, ConicalKind kind) const
Definition: content_context.cc:1094
impeller::ContentContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: content_context.cc:950
impeller::ContentContext::GetDestinationInBlendPipeline
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1274
impeller::ContentContext::GetRSuperellipseBlurPipeline
PipelineRef GetRSuperellipseBlurPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1115
impeller::ContentContext::GetBorderMaskBlurPipeline
PipelineRef GetBorderMaskBlurPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1150
impeller::ContentContext::GetDrawVerticesUberPipeline
PipelineRef GetDrawVerticesUberPipeline(BlendMode blend_mode, ContentContextOptions opts) const
Definition: content_context.cc:1489
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:65
impeller::Context::GetCapabilities
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::Entity::kLastPipelineBlendMode
static constexpr BlendMode kLastPipelineBlendMode
Definition: entity.h:28
impeller::HostBuffer
Definition: host_buffer.h:26
impeller::HostBuffer::Emplace
BufferView Emplace(const BufferType &buffer, size_t alignment=0)
Emplace non-uniform data (like contiguous vertices) onto the host buffer.
Definition: host_buffer.h:92
impeller::HostBuffer::Create
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator, const std::shared_ptr< const IdleWaiter > &idle_waiter, size_t minimum_uniform_alignment)
Definition: host_buffer.cc:21
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:16
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:24
impeller::PipelineDescriptor::SetDepthStencilAttachmentDescriptor
PipelineDescriptor & SetDepthStencilAttachmentDescriptor(std::optional< DepthAttachmentDescriptor > desc)
Definition: pipeline_descriptor.cc:151
impeller::PipelineDescriptor::ClearStencilAttachments
void ClearStencilAttachments()
Definition: pipeline_descriptor.cc:170
impeller::PipelineDescriptor::SetPolygonMode
void SetPolygonMode(PolygonMode mode)
Definition: pipeline_descriptor.cc:276
impeller::PipelineDescriptor::GetDepthStencilAttachmentDescriptor
std::optional< DepthAttachmentDescriptor > GetDepthStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:207
impeller::PipelineDescriptor::SetStencilAttachmentDescriptors
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)
Definition: pipeline_descriptor.cc:157
impeller::PipelineDescriptor::GetColorAttachmentDescriptor
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const
Definition: pipeline_descriptor.cc:124
impeller::PipelineDescriptor::SetColorAttachmentDescriptor
PipelineDescriptor & SetColorAttachmentDescriptor(size_t index, ColorAttachmentDescriptor desc)
Definition: pipeline_descriptor.cc:110
impeller::PipelineDescriptor::SetSampleCount
PipelineDescriptor & SetSampleCount(SampleCount samples)
Definition: pipeline_descriptor.cc:76
impeller::PipelineDescriptor::SetPrimitiveType
void SetPrimitiveType(PrimitiveType type)
Definition: pipeline_descriptor.cc:268
impeller::PipelineDescriptor::ClearDepthAttachment
void ClearDepthAttachment()
Definition: pipeline_descriptor.cc:176
impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:202
impeller::Pipeline< PipelineDescriptor >
impeller::RenderTargetCache
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame...
Definition: render_target_cache.h:18
impeller::RenderTarget
Definition: render_target.h:38
impeller::RenderTarget::GetRenderTargetTexture
std::shared_ptr< Texture > GetRenderTargetTexture() const
Definition: render_target.cc:176
impeller::RenderTarget::kDefaultColorAttachmentConfig
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
Definition: render_target.h:55
impeller::RenderTarget::kDefaultColorAttachmentConfigMSAA
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
Definition: render_target.h:61
impeller::RenderTarget::kDefaultStencilAttachmentConfig
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
Definition: render_target.h:68
impeller::Tessellator
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition: tessellator.h:37
impeller::TextShadowCache
A cache for blurred text that re-uses these across frames.
Definition: text_shadow_cache.h:31
impeller::raw_ptr< Pipeline< PipelineDescriptor > >
command_buffer.h
desc_
std::optional< PipelineDescriptor > desc_
Definition: content_context.cc:76
pipelines_
std::vector< std::pair< uint64_t, std::unique_ptr< GenericRenderPipelineHandle > > > pipelines_
Definition: content_context.cc:79
default_options_
std::optional< ContentContextOptions > default_options_
Definition: content_context.cc:77
content_context.h
formats.h
x
int32_t x
Definition: dl_golden_unittests.cc:458
entity.h
framebuffer_blend_contents.h
impeller::interop::Create
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:161
impeller
Definition: allocation.cc:12
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
impeller::BlendFactor::kOne
@ kOne
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::BlendFactor::kZero
@ kZero
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::ConicalKind
ConicalKind
Definition: content_context.h:128
impeller::kStripAndRadial
@ kStripAndRadial
Definition: content_context.h:132
impeller::kStrip
@ kStrip
Definition: content_context.h:131
impeller::kConical
@ kConical
Definition: content_context.h:129
impeller::kRadial
@ kRadial
Definition: content_context.h:130
impeller::CreateDefaultPipeline
static std::unique_ptr< PipelineT > CreateDefaultPipeline(const Context &context)
Definition: content_context.cc:529
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::PipelineRef
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:88
impeller::BlendModeToString
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
impeller::AddMipmapGeneration
fml::Status AddMipmapGeneration(const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
Adds a blit command to the render pass.
Definition: texture_util.cc:37
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::BlendMode
BlendMode
Definition: color.h:58
impeller::BlendMode::kSrcOut
@ kSrcOut
impeller::BlendMode::kExclusion
@ kExclusion
impeller::BlendMode::kSaturation
@ kSaturation
impeller::BlendMode::kColorBurn
@ kColorBurn
impeller::BlendMode::kPlus
@ kPlus
impeller::BlendMode::kLighten
@ kLighten
impeller::BlendMode::kHue
@ kHue
impeller::BlendMode::kDst
@ kDst
impeller::BlendMode::kDstIn
@ kDstIn
impeller::BlendMode::kModulate
@ kModulate
impeller::BlendMode::kMultiply
@ kMultiply
impeller::BlendMode::kColorDodge
@ kColorDodge
impeller::BlendMode::kScreen
@ kScreen
impeller::BlendMode::kSrcOver
@ kSrcOver
impeller::BlendMode::kXor
@ kXor
impeller::BlendMode::kSrc
@ kSrc
impeller::BlendMode::kLuminosity
@ kLuminosity
impeller::BlendMode::kSoftLight
@ kSoftLight
impeller::BlendMode::kDifference
@ kDifference
impeller::BlendMode::kOverlay
@ kOverlay
impeller::BlendMode::kSrcATop
@ kSrcATop
impeller::BlendMode::kDstATop
@ kDstATop
impeller::BlendMode::kDstOver
@ kDstOver
impeller::BlendMode::kColor
@ kColor
impeller::BlendMode::kHardLight
@ kHardLight
impeller::BlendMode::kDstOut
@ kDstOut
impeller::BlendMode::kDarken
@ kDarken
impeller::BlendMode::kSrcIn
@ kSrcIn
impeller::BlendMode::kClear
@ kClear
impeller::GetPorterDuffSpecConstants
std::array< std::vector< Scalar >, 15 > GetPorterDuffSpecConstants(bool supports_decal)
Definition: content_context.cc:506
impeller::PolygonMode::kFill
@ kFill
impeller::ColorWriteMaskBits::kAll
@ kAll
impeller::ColorWriteMaskBits::kNone
@ kNone
impeller::BlendOperation::kAdd
@ kAdd
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::SampleCount::kCount4
@ kCount4
impeller::SampleCount::kCount1
@ kCount1
impeller::BlendSelectValues::kExclusion
@ kExclusion
impeller::BlendSelectValues::kSaturation
@ kSaturation
impeller::BlendSelectValues::kColorBurn
@ kColorBurn
impeller::BlendSelectValues::kLighten
@ kLighten
impeller::BlendSelectValues::kHue
@ kHue
impeller::BlendSelectValues::kMultiply
@ kMultiply
impeller::BlendSelectValues::kColorDodge
@ kColorDodge
impeller::BlendSelectValues::kScreen
@ kScreen
impeller::BlendSelectValues::kLuminosity
@ kLuminosity
impeller::BlendSelectValues::kSoftLight
@ kSoftLight
impeller::BlendSelectValues::kDifference
@ kDifference
impeller::BlendSelectValues::kOverlay
@ kOverlay
impeller::BlendSelectValues::kColor
@ kColor
impeller::BlendSelectValues::kHardLight
@ kHardLight
impeller::BlendSelectValues::kDarken
@ kDarken
std
Definition: comparable.h:95
pipeline_descriptor.h
pipeline_library.h
pipelines.h
render_target.h
render_target_cache.h
impeller::BufferView
Definition: buffer_view.h:19
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:518
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:520
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:523
impeller::ColorAttachmentDescriptor::format
PixelFormat format
Definition: formats.h:519
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:524
impeller::ColorAttachmentDescriptor::write_mask
ColorWriteMask write_mask
Definition: formats.h:530
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:526
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:527
impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:522
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:528
impeller::Color::ToR8G8B8A8
std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:246
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:270
impeller::ContentContext::Pipelines
Definition: content_context.cc:214
impeller::ContentContext::Pipelines::solid_fill
Variants< SolidFillPipeline > solid_fill
Definition: content_context.cc:290
impeller::ContentContext::Pipelines::destination_blend
Variants< PorterDuffBlendPipeline > destination_blend
Definition: content_context.cc:272
impeller::ContentContext::Pipelines::sweep_gradient_ssbo_fill
Variants< SweepGradientSSBOFillPipeline > sweep_gradient_ssbo_fill
Definition: content_context.cc:293
impeller::ContentContext::Pipelines::blend_screen
Variants< BlendScreenPipeline > blend_screen
Definition: content_context.cc:229
impeller::ContentContext::Pipelines::modulate_blend
Variants< PorterDuffBlendPipeline > modulate_blend
Definition: content_context.cc:276
impeller::ContentContext::Pipelines::framebuffer_blend_overlay
Variants< FramebufferBlendOverlayPipeline > framebuffer_blend_overlay
Definition: content_context.cc:258
impeller::ContentContext::Pipelines::blend_saturation
Variants< BlendSaturationPipeline > blend_saturation
Definition: content_context.cc:228
impeller::ContentContext::Pipelines::tiled_texture
Variants< TiledTexturePipeline > tiled_texture
Definition: content_context.cc:298
impeller::ContentContext::Pipelines::destination_in_blend
Variants< PorterDuffBlendPipeline > destination_in_blend
Definition: content_context.cc:273
impeller::ContentContext::Pipelines::blend_softlight
Variants< BlendSoftLightPipeline > blend_softlight
Definition: content_context.cc:230
impeller::ContentContext::Pipelines::blend_colordodge
Variants< BlendColorDodgePipeline > blend_colordodge
Definition: content_context.cc:217
impeller::ContentContext::Pipelines::blend_multiply
Variants< BlendMultiplyPipeline > blend_multiply
Definition: content_context.cc:226
impeller::ContentContext::Pipelines::blend_color
Variants< BlendColorPipeline > blend_color
Definition: content_context.cc:218
impeller::ContentContext::Pipelines::blend_difference
Variants< BlendDifferencePipeline > blend_difference
Definition: content_context.cc:220
impeller::ContentContext::Pipelines::blend_overlay
Variants< BlendOverlayPipeline > blend_overlay
Definition: content_context.cc:227
impeller::ContentContext::Pipelines::conical_gradient_fill_strip
Variants< ConicalGradientFillStripPipeline > conical_gradient_fill_strip
Definition: content_context.cc:236
impeller::ContentContext::Pipelines::framebuffer_blend_exclusion
Variants< FramebufferBlendExclusionPipeline > framebuffer_blend_exclusion
Definition: content_context.cc:252
impeller::ContentContext::Pipelines::morphology_filter
Variants< MorphologyFilterPipeline > morphology_filter
Definition: content_context.cc:269
impeller::ContentContext::Pipelines::screen_blend
Variants< PorterDuffBlendPipeline > screen_blend
Definition: content_context.cc:278
impeller::ContentContext::Pipelines::framebuffer_blend_saturation
Variants< FramebufferBlendSaturationPipeline > framebuffer_blend_saturation
Definition: content_context.cc:259
impeller::ContentContext::Pipelines::source_over_blend
Variants< PorterDuffBlendPipeline > source_over_blend
Definition: content_context.cc:283
impeller::ContentContext::Pipelines::linear_gradient_fill
Variants< LinearGradientFillPipeline > linear_gradient_fill
Definition: content_context.cc:265
impeller::ContentContext::Pipelines::plus_blend
Variants< PorterDuffBlendPipeline > plus_blend
Definition: content_context.cc:277
impeller::ContentContext::Pipelines::vertices_uber_2_
Variants< VerticesUber2Shader > vertices_uber_2_
Definition: content_context.cc:300
impeller::ContentContext::Pipelines::framebuffer_blend_hardlight
Variants< FramebufferBlendHardLightPipeline > framebuffer_blend_hardlight
Definition: content_context.cc:253
impeller::ContentContext::Pipelines::radial_gradient_ssbo_fill
Variants< RadialGradientSSBOFillPipeline > radial_gradient_ssbo_fill
Definition: content_context.cc:286
impeller::ContentContext::Pipelines::line
Variants< LinePipeline > line
Definition: content_context.cc:264
impeller::ContentContext::Pipelines::clear_blend
Variants< PorterDuffBlendPipeline > clear_blend
Definition: content_context.cc:270
impeller::ContentContext::Pipelines::conical_gradient_uniform_fill
Variants< ConicalGradientUniformFillConicalPipeline > conical_gradient_uniform_fill
Definition: content_context.cc:242
impeller::ContentContext::Pipelines::framebuffer_blend_multiply
Variants< FramebufferBlendMultiplyPipeline > framebuffer_blend_multiply
Definition: content_context.cc:257
impeller::ContentContext::Pipelines::conical_gradient_ssbo_fill
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill
Definition: content_context.cc:238
impeller::ContentContext::Pipelines::texture_downsample
Variants< TextureDownsamplePipeline > texture_downsample
Definition: content_context.cc:295
impeller::ContentContext::Pipelines::framebuffer_blend_luminosity
Variants< FramebufferBlendLuminosityPipeline > framebuffer_blend_luminosity
Definition: content_context.cc:256
impeller::ContentContext::Pipelines::framebuffer_blend_softlight
Variants< FramebufferBlendSoftLightPipeline > framebuffer_blend_softlight
Definition: content_context.cc:261
impeller::ContentContext::Pipelines::sweep_gradient_uniform_fill
Variants< SweepGradientUniformFillPipeline > sweep_gradient_uniform_fill
Definition: content_context.cc:294
impeller::ContentContext::Pipelines::blend_colorburn
Variants< BlendColorBurnPipeline > blend_colorburn
Definition: content_context.cc:216
impeller::ContentContext::Pipelines::conical_gradient_uniform_fill_strip_and_radial
Variants< ConicalGradientUniformFillStripRadialPipeline > conical_gradient_uniform_fill_strip_and_radial
Definition: content_context.cc:245
impeller::ContentContext::Pipelines::source_in_blend
Variants< PorterDuffBlendPipeline > source_in_blend
Definition: content_context.cc:281
impeller::ContentContext::Pipelines::conical_gradient_fill
Variants< ConicalGradientFillConicalPipeline > conical_gradient_fill
Definition: content_context.cc:234
impeller::ContentContext::Pipelines::sweep_gradient_fill
Variants< SweepGradientFillPipeline > sweep_gradient_fill
Definition: content_context.cc:292
impeller::ContentContext::Pipelines::framebuffer_blend_lighten
Variants< FramebufferBlendLightenPipeline > framebuffer_blend_lighten
Definition: content_context.cc:255
impeller::ContentContext::Pipelines::source_a_top_blend
Variants< PorterDuffBlendPipeline > source_a_top_blend
Definition: content_context.cc:279
impeller::ContentContext::Pipelines::destination_a_top_blend
Variants< PorterDuffBlendPipeline > destination_a_top_blend
Definition: content_context.cc:271
impeller::ContentContext::Pipelines::radial_gradient_uniform_fill
Variants< RadialGradientUniformFillPipeline > radial_gradient_uniform_fill
Definition: content_context.cc:287
impeller::ContentContext::Pipelines::blend_lighten
Variants< BlendLightenPipeline > blend_lighten
Definition: content_context.cc:224
impeller::ContentContext::Pipelines::linear_gradient_uniform_fill
Variants< LinearGradientUniformFillPipeline > linear_gradient_uniform_fill
Definition: content_context.cc:267
impeller::ContentContext::Pipelines::framebuffer_blend_colorburn
Variants< FramebufferBlendColorBurnPipeline > framebuffer_blend_colorburn
Definition: content_context.cc:247
impeller::ContentContext::Pipelines::conical_gradient_fill_radial
Variants< ConicalGradientFillRadialPipeline > conical_gradient_fill_radial
Definition: content_context.cc:235
impeller::ContentContext::Pipelines::clip
Variants< ClipPipeline > clip
Definition: content_context.cc:232
impeller::ContentContext::Pipelines::destination_over_blend
Variants< PorterDuffBlendPipeline > destination_over_blend
Definition: content_context.cc:275
impeller::ContentContext::Pipelines::blend_exclusion
Variants< BlendExclusionPipeline > blend_exclusion
Definition: content_context.cc:221
impeller::ContentContext::Pipelines::rsuperellipse_blur
Variants< RSuperellipseBlurPipeline > rsuperellipse_blur
Definition: content_context.cc:289
impeller::ContentContext::Pipelines::srgb_to_linear_filter
Variants< SrgbToLinearFilterPipeline > srgb_to_linear_filter
Definition: content_context.cc:291
impeller::ContentContext::Pipelines::color_matrix_color_filter
Variants< ColorMatrixColorFilterPipeline > color_matrix_color_filter
Definition: content_context.cc:233
impeller::ContentContext::Pipelines::linear_to_srgb_filter
Variants< LinearToSrgbFilterPipeline > linear_to_srgb_filter
Definition: content_context.cc:268
impeller::ContentContext::Pipelines::conical_gradient_uniform_fill_radial
Variants< ConicalGradientUniformFillRadialPipeline > conical_gradient_uniform_fill_radial
Definition: content_context.cc:243
impeller::ContentContext::Pipelines::conical_gradient_ssbo_fill_strip
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill_strip
Definition: content_context.cc:241
impeller::ContentContext::Pipelines::rrect_blur
Variants< RRectBlurPipeline > rrect_blur
Definition: content_context.cc:288
impeller::ContentContext::Pipelines::blend_darken
Variants< BlendDarkenPipeline > blend_darken
Definition: content_context.cc:219
impeller::ContentContext::Pipelines::texture
Variants< TexturePipeline > texture
Definition: content_context.cc:296
impeller::ContentContext::Pipelines::source_out_blend
Variants< PorterDuffBlendPipeline > source_out_blend
Definition: content_context.cc:282
impeller::ContentContext::Pipelines::framebuffer_blend_hue
Variants< FramebufferBlendHuePipeline > framebuffer_blend_hue
Definition: content_context.cc:254
impeller::ContentContext::Pipelines::texture_strict_src
Variants< TextureStrictSrcPipeline > texture_strict_src
Definition: content_context.cc:297
impeller::ContentContext::Pipelines::framebuffer_blend_color
Variants< FramebufferBlendColorPipeline > framebuffer_blend_color
Definition: content_context.cc:249
impeller::ContentContext::Pipelines::blend_hue
Variants< BlendHuePipeline > blend_hue
Definition: content_context.cc:223
impeller::ContentContext::Pipelines::framebuffer_blend_darken
Variants< FramebufferBlendDarkenPipeline > framebuffer_blend_darken
Definition: content_context.cc:250
impeller::ContentContext::Pipelines::fast_gradient
Variants< FastGradientPipeline > fast_gradient
Definition: content_context.cc:246
impeller::ContentContext::Pipelines::conical_gradient_uniform_fill_strip
Variants< ConicalGradientUniformFillStripPipeline > conical_gradient_uniform_fill_strip
Definition: content_context.cc:244
impeller::ContentContext::Pipelines::xor_blend
Variants< PorterDuffBlendPipeline > xor_blend
Definition: content_context.cc:284
impeller::ContentContext::Pipelines::gaussian_blur
Variants< GaussianBlurPipeline > gaussian_blur
Definition: content_context.cc:262
impeller::ContentContext::Pipelines::linear_gradient_ssbo_fill
Variants< LinearGradientSSBOFillPipeline > linear_gradient_ssbo_fill
Definition: content_context.cc:266
impeller::ContentContext::Pipelines::conical_gradient_ssbo_fill_strip_and_radial
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill_strip_and_radial
Definition: content_context.cc:240
impeller::ContentContext::Pipelines::glyph_atlas
Variants< GlyphAtlasPipeline > glyph_atlas
Definition: content_context.cc:263
impeller::ContentContext::Pipelines::source_blend
Variants< PorterDuffBlendPipeline > source_blend
Definition: content_context.cc:280
impeller::ContentContext::Pipelines::blend_luminosity
Variants< BlendLuminosityPipeline > blend_luminosity
Definition: content_context.cc:225
impeller::ContentContext::Pipelines::border_mask_blur
Variants< BorderMaskBlurPipeline > border_mask_blur
Definition: content_context.cc:231
impeller::ContentContext::Pipelines::framebuffer_blend_screen
Variants< FramebufferBlendScreenPipeline > framebuffer_blend_screen
Definition: content_context.cc:260
impeller::ContentContext::Pipelines::framebuffer_blend_difference
Variants< FramebufferBlendDifferencePipeline > framebuffer_blend_difference
Definition: content_context.cc:251
impeller::ContentContext::Pipelines::yuv_to_rgb_filter
Variants< YUVToRGBFilterPipeline > yuv_to_rgb_filter
Definition: content_context.cc:301
impeller::ContentContext::Pipelines::radial_gradient_fill
Variants< RadialGradientFillPipeline > radial_gradient_fill
Definition: content_context.cc:285
impeller::ContentContext::Pipelines::conical_gradient_ssbo_fill_radial
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill_radial
Definition: content_context.cc:239
impeller::ContentContext::Pipelines::conical_gradient_fill_strip_and_radial
Variants< ConicalGradientFillStripRadialPipeline > conical_gradient_fill_strip_and_radial
Definition: content_context.cc:237
impeller::ContentContext::Pipelines::blend_hardlight
Variants< BlendHardLightPipeline > blend_hardlight
Definition: content_context.cc:222
impeller::ContentContext::Pipelines::framebuffer_blend_colordodge
Variants< FramebufferBlendColorDodgePipeline > framebuffer_blend_colordodge
Definition: content_context.cc:248
impeller::ContentContext::Pipelines::destination_out_blend
Variants< PorterDuffBlendPipeline > destination_out_blend
Definition: content_context.cc:274
impeller::ContentContext::Pipelines::vertices_uber_1_
Variants< VerticesUber1Shader > vertices_uber_1_
Definition: content_context.cc:299
impeller::ContentContextOptions
Definition: content_context.h:40
impeller::ContentContextOptions::primitive_type
PrimitiveType primitive_type
Definition: content_context.h:97
impeller::ContentContextOptions::has_depth_stencil_attachments
bool has_depth_stencil_attachments
Definition: content_context.h:99
impeller::ContentContextOptions::stencil_mode
StencilMode stencil_mode
Definition: content_context.h:96
impeller::ContentContextOptions::depth_write_enabled
bool depth_write_enabled
Definition: content_context.h:100
impeller::ContentContextOptions::ApplyToPipelineDescriptor
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
Definition: content_context.cc:311
impeller::ContentContextOptions::blend_mode
BlendMode blend_mode
Definition: content_context.h:94
impeller::ContentContextOptions::color_attachment_pixel_format
PixelFormat color_attachment_pixel_format
Definition: content_context.h:98
impeller::ContentContextOptions::StencilMode::kOverdrawPreventionRestore
@ kOverdrawPreventionRestore
impeller::ContentContextOptions::StencilMode::kStencilEvenOddFill
@ kStencilEvenOddFill
impeller::ContentContextOptions::StencilMode::kOverdrawPreventionIncrement
@ kOverdrawPreventionIncrement
impeller::ContentContextOptions::StencilMode::kCoverCompareInverted
@ kCoverCompareInverted
impeller::ContentContextOptions::StencilMode::kStencilNonZeroFill
@ kStencilNonZeroFill
impeller::ContentContextOptions::StencilMode::kIgnore
@ kIgnore
impeller::ContentContextOptions::StencilMode::kCoverCompare
@ kCoverCompare
impeller::ContentContextOptions::sample_count
SampleCount sample_count
Definition: content_context.h:93
impeller::ContentContextOptions::is_for_rrect_blur_clear
bool is_for_rrect_blur_clear
Definition: content_context.h:101
impeller::ContentContextOptions::depth_compare
CompareFunction depth_compare
Definition: content_context.h:95
impeller::DepthAttachmentDescriptor
Definition: formats.h:590
impeller::DepthAttachmentDescriptor::depth_compare
CompareFunction depth_compare
Definition: formats.h:594
impeller::DepthAttachmentDescriptor::depth_write_enabled
bool depth_write_enabled
Definition: formats.h:598
impeller::PipelineBuilder::MakeDefaultPipelineDescriptor
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
Definition: pipeline_builder.h:50
impeller::StencilAttachmentDescriptor
Definition: formats.h:610
impeller::StencilAttachmentDescriptor::stencil_failure
StencilOperation stencil_failure
Definition: formats.h:620
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:616
impeller::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:629
impeller::TSize
Definition: size.h:25
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:42
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:39
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41
tessellator.h
text_shadow_cache.h
texture_descriptor.h
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:68
texture_util.h
typographer_context.h
validation.h
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91