| Flutter Impeller |

content_context.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
7
8 #include <initializer_list>
9 #include <memory>
10 #include <optional>
11 #include <unordered_map>
12
13 #include "flutter/fml/logging.h"
14 #include "flutter/fml/status_or.h"
15 #include "impeller/base/validation.h"
16 #include "impeller/core/formats.h"
17 #include "impeller/core/host_buffer.h"
18 #include "impeller/geometry/color.h"
19 #include "impeller/renderer/capabilities.h"
20 #include "impeller/renderer/command_buffer.h"
21 #include "impeller/renderer/pipeline.h"
22 #include "impeller/renderer/pipeline_descriptor.h"
23 #include "impeller/renderer/render_target.h"
24 #include "impeller/typographer/lazy_glyph_atlas.h"
25 #include "impeller/typographer/typographer_context.h"
26
27 #include "impeller/entity/border_mask_blur.frag.h"
28 #include "impeller/entity/clip.frag.h"
29 #include "impeller/entity/clip.vert.h"
30 #include "impeller/entity/color_matrix_color_filter.frag.h"
31 #include "impeller/entity/conical_gradient_fill.frag.h"
32 #include "impeller/entity/fast_gradient.frag.h"
33 #include "impeller/entity/fast_gradient.vert.h"
34 #include "impeller/entity/filter_position.vert.h"
35 #include "impeller/entity/filter_position_uv.vert.h"
36 #include "impeller/entity/gaussian.frag.h"
37 #include "impeller/entity/glyph_atlas.frag.h"
38 #include "impeller/entity/glyph_atlas.vert.h"
39 #include "impeller/entity/gradient_fill.vert.h"
40 #include "impeller/entity/linear_gradient_fill.frag.h"
41 #include "impeller/entity/linear_to_srgb_filter.frag.h"
42 #include "impeller/entity/morphology_filter.frag.h"
43 #include "impeller/entity/porter_duff_blend.frag.h"
44 #include "impeller/entity/porter_duff_blend.vert.h"
45 #include "impeller/entity/radial_gradient_fill.frag.h"
46 #include "impeller/entity/rrect_blur.frag.h"
47 #include "impeller/entity/rrect_blur.vert.h"
48 #include "impeller/entity/solid_fill.frag.h"
49 #include "impeller/entity/solid_fill.vert.h"
50 #include "impeller/entity/srgb_to_linear_filter.frag.h"
51 #include "impeller/entity/sweep_gradient_fill.frag.h"
52 #include "impeller/entity/texture_downsample.frag.h"
53 #include "impeller/entity/texture_fill.frag.h"
54 #include "impeller/entity/texture_fill.vert.h"
55 #include "impeller/entity/texture_fill_strict_src.frag.h"
56 #include "impeller/entity/texture_uv_fill.vert.h"
57 #include "impeller/entity/tiled_texture_fill.frag.h"
58 #include "impeller/entity/yuv_to_rgb_filter.frag.h"
59
60 #include "impeller/entity/conical_gradient_uniform_fill.frag.h"
61 #include "impeller/entity/linear_gradient_uniform_fill.frag.h"
62 #include "impeller/entity/radial_gradient_uniform_fill.frag.h"
63 #include "impeller/entity/sweep_gradient_uniform_fill.frag.h"
64
65 #include "impeller/entity/conical_gradient_ssbo_fill.frag.h"
66 #include "impeller/entity/linear_gradient_ssbo_fill.frag.h"
67 #include "impeller/entity/radial_gradient_ssbo_fill.frag.h"
68 #include "impeller/entity/sweep_gradient_ssbo_fill.frag.h"
69
70 #include "impeller/entity/advanced_blend.frag.h"
71 #include "impeller/entity/advanced_blend.vert.h"
72
73 #include "impeller/entity/framebuffer_blend.frag.h"
74 #include "impeller/entity/framebuffer_blend.vert.h"
75
76 #include "impeller/entity/vertices_uber.frag.h"
77
78 #ifdef IMPELLER_ENABLE_OPENGLES
79 #include "impeller/entity/texture_downsample_gles.frag.h"
80 #include "impeller/entity/tiled_texture_fill_external.frag.h"
81 #endif // IMPELLER_ENABLE_OPENGLES
82
83 namespace impeller {
84
85 using FastGradientPipeline =
86 RenderPipelineHandle<FastGradientVertexShader, FastGradientFragmentShader>;
87 using LinearGradientFillPipeline =
88 RenderPipelineHandle<GradientFillVertexShader,
89 LinearGradientFillFragmentShader>;
90 using SolidFillPipeline =
91 RenderPipelineHandle<SolidFillVertexShader, SolidFillFragmentShader>;
92 using RadialGradientFillPipeline =
93 RenderPipelineHandle<GradientFillVertexShader,
94 RadialGradientFillFragmentShader>;
95 using ConicalGradientFillPipeline =
96 RenderPipelineHandle<GradientFillVertexShader,
97 ConicalGradientFillFragmentShader>;
98 using SweepGradientFillPipeline =
99 RenderPipelineHandle<GradientFillVertexShader,
100 SweepGradientFillFragmentShader>;
101 using LinearGradientUniformFillPipeline =
102 RenderPipelineHandle<GradientFillVertexShader,
103 LinearGradientUniformFillFragmentShader>;
104 using ConicalGradientUniformFillPipeline =
105 RenderPipelineHandle<GradientFillVertexShader,
106 ConicalGradientUniformFillFragmentShader>;
107 using RadialGradientUniformFillPipeline =
108 RenderPipelineHandle<GradientFillVertexShader,
109 RadialGradientUniformFillFragmentShader>;
110 using SweepGradientUniformFillPipeline =
111 RenderPipelineHandle<GradientFillVertexShader,
112 SweepGradientUniformFillFragmentShader>;
113 using LinearGradientSSBOFillPipeline =
114 RenderPipelineHandle<GradientFillVertexShader,
115 LinearGradientSsboFillFragmentShader>;
116 using ConicalGradientSSBOFillPipeline =
117 RenderPipelineHandle<GradientFillVertexShader,
118 ConicalGradientSsboFillFragmentShader>;
119 using RadialGradientSSBOFillPipeline =
120 RenderPipelineHandle<GradientFillVertexShader,
121 RadialGradientSsboFillFragmentShader>;
122 using SweepGradientSSBOFillPipeline =
123 RenderPipelineHandle<GradientFillVertexShader,
124 SweepGradientSsboFillFragmentShader>;
125 using RRectBlurPipeline =
126 RenderPipelineHandle<RrectBlurVertexShader, RrectBlurFragmentShader>;
127 using TexturePipeline =
128 RenderPipelineHandle<TextureFillVertexShader, TextureFillFragmentShader>;
129 using TextureDownsamplePipeline =
130 RenderPipelineHandle<TextureFillVertexShader,
131 TextureDownsampleFragmentShader>;
132 using TextureStrictSrcPipeline =
133 RenderPipelineHandle<TextureFillVertexShader,
134 TextureFillStrictSrcFragmentShader>;
135 using TiledTexturePipeline =
136 RenderPipelineHandle<TextureUvFillVertexShader,
137 TiledTextureFillFragmentShader>;
138 using GaussianBlurPipeline =
139 RenderPipelineHandle<FilterPositionUvVertexShader, GaussianFragmentShader>;
140 using BorderMaskBlurPipeline =
141 RenderPipelineHandle<FilterPositionUvVertexShader,
142 BorderMaskBlurFragmentShader>;
143 using MorphologyFilterPipeline =
144 RenderPipelineHandle<FilterPositionUvVertexShader,
145 MorphologyFilterFragmentShader>;
146 using ColorMatrixColorFilterPipeline =
147 RenderPipelineHandle<FilterPositionVertexShader,
148 ColorMatrixColorFilterFragmentShader>;
149 using LinearToSrgbFilterPipeline =
150 RenderPipelineHandle<FilterPositionVertexShader,
151 LinearToSrgbFilterFragmentShader>;
152 using SrgbToLinearFilterPipeline =
153 RenderPipelineHandle<FilterPositionVertexShader,
154 SrgbToLinearFilterFragmentShader>;
155 using YUVToRGBFilterPipeline =
156 RenderPipelineHandle<FilterPositionVertexShader,
157 YuvToRgbFilterFragmentShader>;
158
159 using GlyphAtlasPipeline =
160 RenderPipelineHandle<GlyphAtlasVertexShader, GlyphAtlasFragmentShader>;
161
162 using PorterDuffBlendPipeline =
163 RenderPipelineHandle<PorterDuffBlendVertexShader,
164 PorterDuffBlendFragmentShader>;
165 using ClipPipeline = RenderPipelineHandle<ClipVertexShader, ClipFragmentShader>;
166
167 // Advanced blends
168 using BlendColorPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
169 AdvancedBlendFragmentShader>;
170 using BlendColorBurnPipeline =
171 RenderPipelineHandle<AdvancedBlendVertexShader,
172 AdvancedBlendFragmentShader>;
173 using BlendColorDodgePipeline =
174 RenderPipelineHandle<AdvancedBlendVertexShader,
175 AdvancedBlendFragmentShader>;
176 using BlendDarkenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
177 AdvancedBlendFragmentShader>;
178 using BlendDifferencePipeline =
179 RenderPipelineHandle<AdvancedBlendVertexShader,
180 AdvancedBlendFragmentShader>;
181 using BlendExclusionPipeline =
182 RenderPipelineHandle<AdvancedBlendVertexShader,
183 AdvancedBlendFragmentShader>;
184 using BlendHardLightPipeline =
185 RenderPipelineHandle<AdvancedBlendVertexShader,
186 AdvancedBlendFragmentShader>;
187 using BlendHuePipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
188 AdvancedBlendFragmentShader>;
189 using BlendLightenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
190 AdvancedBlendFragmentShader>;
191 using BlendLuminosityPipeline =
192 RenderPipelineHandle<AdvancedBlendVertexShader,
193 AdvancedBlendFragmentShader>;
194 using BlendMultiplyPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
195 AdvancedBlendFragmentShader>;
196 using BlendOverlayPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
197 AdvancedBlendFragmentShader>;
198 using BlendSaturationPipeline =
199 RenderPipelineHandle<AdvancedBlendVertexShader,
200 AdvancedBlendFragmentShader>;
201 using BlendScreenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
202 AdvancedBlendFragmentShader>;
203 using BlendSoftLightPipeline =
204 RenderPipelineHandle<AdvancedBlendVertexShader,
205 AdvancedBlendFragmentShader>;
206 // Framebuffer Advanced Blends
207 using FramebufferBlendColorPipeline =
208 RenderPipelineHandle<FramebufferBlendVertexShader,
209 FramebufferBlendFragmentShader>;
210 using FramebufferBlendColorBurnPipeline =
211 RenderPipelineHandle<FramebufferBlendVertexShader,
212 FramebufferBlendFragmentShader>;
213 using FramebufferBlendColorDodgePipeline =
214 RenderPipelineHandle<FramebufferBlendVertexShader,
215 FramebufferBlendFragmentShader>;
216 using FramebufferBlendDarkenPipeline =
217 RenderPipelineHandle<FramebufferBlendVertexShader,
218 FramebufferBlendFragmentShader>;
219 using FramebufferBlendDifferencePipeline =
220 RenderPipelineHandle<FramebufferBlendVertexShader,
221 FramebufferBlendFragmentShader>;
222 using FramebufferBlendExclusionPipeline =
223 RenderPipelineHandle<FramebufferBlendVertexShader,
224 FramebufferBlendFragmentShader>;
225 using FramebufferBlendHardLightPipeline =
226 RenderPipelineHandle<FramebufferBlendVertexShader,
227 FramebufferBlendFragmentShader>;
228 using FramebufferBlendHuePipeline =
229 RenderPipelineHandle<FramebufferBlendVertexShader,
230 FramebufferBlendFragmentShader>;
231 using FramebufferBlendLightenPipeline =
232 RenderPipelineHandle<FramebufferBlendVertexShader,
233 FramebufferBlendFragmentShader>;
234 using FramebufferBlendLuminosityPipeline =
235 RenderPipelineHandle<FramebufferBlendVertexShader,
236 FramebufferBlendFragmentShader>;
237 using FramebufferBlendMultiplyPipeline =
238 RenderPipelineHandle<FramebufferBlendVertexShader,
239 FramebufferBlendFragmentShader>;
240 using FramebufferBlendOverlayPipeline =
241 RenderPipelineHandle<FramebufferBlendVertexShader,
242 FramebufferBlendFragmentShader>;
243 using FramebufferBlendSaturationPipeline =
244 RenderPipelineHandle<FramebufferBlendVertexShader,
245 FramebufferBlendFragmentShader>;
246 using FramebufferBlendScreenPipeline =
247 RenderPipelineHandle<FramebufferBlendVertexShader,
248 FramebufferBlendFragmentShader>;
249 using FramebufferBlendSoftLightPipeline =
250 RenderPipelineHandle<FramebufferBlendVertexShader,
251 FramebufferBlendFragmentShader>;
252
253 /// Draw Vertices/Atlas Uber Shader
254 using VerticesUberShader = RenderPipelineHandle<PorterDuffBlendVertexShader,
255 VerticesUberFragmentShader>;
256
257 #ifdef IMPELLER_ENABLE_OPENGLES
258 using TiledTextureExternalPipeline =
259 RenderPipelineHandle<TextureFillVertexShader,
260 TiledTextureFillExternalFragmentShader>;
261 using TiledTextureUvExternalPipeline =
262 RenderPipelineHandle<TextureUvFillVertexShader,
263 TiledTextureFillExternalFragmentShader>;
264 using TextureDownsampleGlesPipeline =
265 RenderPipelineHandle<TextureFillVertexShader,
266 TextureDownsampleGlesFragmentShader>;
267 #endif // IMPELLER_ENABLE_OPENGLES
268
269 /// Pipeline state configuration.
270 ///
271 /// Each unique combination of these options requires a different pipeline state
272 /// object to be built. This struct is used as a key for the per-pipeline
273 /// variant cache.
274 ///
275 /// When adding fields to this key, reliant features should take care to limit
276 /// the combinatorical explosion of variations. A sufficiently complicated
277 /// Flutter application may easily require building hundreds of PSOs in total,
278 /// but they shouldn't require e.g. 10s of thousands.
279 struct ContentContextOptions {
280 enum class StencilMode : uint8_t {
281 /// Turn the stencil test off. Used when drawing without stencil-then-cover
282 /// or overdraw prevention.
283 kIgnore,
284
285 // Operations used for stencil-then-cover.
286
287 /// Draw the stencil for the NonZero fill path rule.
288 ///
289 /// The stencil ref should always be 0 on commands using this mode.
290 kStencilNonZeroFill,
291 /// Draw the stencil for the EvenOdd fill path rule.
292 ///
293 /// The stencil ref should always be 0 on commands using this mode.
294 kStencilEvenOddFill,
295 /// Used for draw calls which fill in the stenciled area. Intended to be
296 /// used after `kStencilNonZeroFill` or `kStencilEvenOddFill` is used to set
297 /// up the stencil buffer. Also cleans up the stencil buffer by resetting
298 /// everything to zero.
299 ///
300 /// The stencil ref should always be 0 on commands using this mode.
301 kCoverCompare,
302 /// The opposite of `kCoverCompare`. Used for draw calls which fill in the
303 /// non-stenciled area (intersection clips). Intended to be used after
304 /// `kStencilNonZeroFill` or `kStencilEvenOddFill` is used to set up the
305 /// stencil buffer. Also cleans up the stencil buffer by resetting
306 /// everything to zero.
307 ///
308 /// The stencil ref should always be 0 on commands using this mode.
309 kCoverCompareInverted,
310
311 // Operations used for the "overdraw prevention" mechanism. This is used for
312 // drawing strokes.
313
314 /// For each fragment, increment the stencil value if it's currently zero.
315 /// Discard fragments when the value is non-zero. This prevents
316 /// self-overlapping strokes from drawing over themselves.
317 ///
318 /// Note that this is done for rendering correctness, not performance. If a
319 /// stroke is drawn with a backdrop-reliant blend and self-intersects, then
320 /// the intersected geometry will render incorrectly when overdrawn because
321 /// we don't adjust the geometry prevent self-intersection.
322 ///
323 /// The stencil ref should always be 0 on commands using this mode.
324 kOverdrawPreventionIncrement,
325 /// Reset the stencil to a new maximum value specified by the ref (currently
326 /// always 0).
327 ///
328 /// The stencil ref should always be 0 on commands using this mode.
329 kOverdrawPreventionRestore,
330 };
331
332 SampleCount sample_count = SampleCount::kCount1;
333 BlendMode blend_mode = BlendMode::kSourceOver;
334 CompareFunction depth_compare = CompareFunction::kAlways;
335 StencilMode stencil_mode = ContentContextOptions::StencilMode::kIgnore;
336 PrimitiveType primitive_type = PrimitiveType::kTriangle;
337 PixelFormat color_attachment_pixel_format = PixelFormat::kUnknown;
338 bool has_depth_stencil_attachments = true;
339 bool depth_write_enabled = false;
340 bool wireframe = false;
341 bool is_for_rrect_blur_clear = false;
342
343 constexpr uint64_t ToKey() const {
344 static_assert(sizeof(sample_count) == 1);
345 static_assert(sizeof(blend_mode) == 1);
346 static_assert(sizeof(sample_count) == 1);
347 static_assert(sizeof(depth_compare) == 1);
348 static_assert(sizeof(stencil_mode) == 1);
349 static_assert(sizeof(primitive_type) == 1);
350 static_assert(sizeof(color_attachment_pixel_format) == 1);
351
352 return (is_for_rrect_blur_clear ? 1llu : 0llu) << 0 |
353 (wireframe ? 1llu : 0llu) << 1 |
354 (has_depth_stencil_attachments ? 1llu : 0llu) << 2 |
355 (depth_write_enabled ? 1llu : 0llu) << 3 |
356 // enums
357 static_cast<uint64_t>(color_attachment_pixel_format) << 8 |
358 static_cast<uint64_t>(primitive_type) << 16 |
359 static_cast<uint64_t>(stencil_mode) << 24 |
360 static_cast<uint64_t>(depth_compare) << 32 |
361 static_cast<uint64_t>(blend_mode) << 40 |
362 static_cast<uint64_t>(sample_count) << 48;
363 }
364
365 void ApplyToPipelineDescriptor(PipelineDescriptor& desc) const;
366 };
367
368 class Tessellator;
369 class RenderTargetCache;
370
371 class ContentContext {
372 public:
373 explicit ContentContext(
374 std::shared_ptr<Context> context,
375 std::shared_ptr<TypographerContext> typographer_context,
376 std::shared_ptr<RenderTargetAllocator> render_target_allocator = nullptr);
377
378 ~ContentContext();
379
380 bool IsValid() const;
381
382 Tessellator& GetTessellator() const;
383
384 PipelineRef GetFastGradientPipeline(ContentContextOptions opts) const {
385 return GetPipeline(fast_gradient_pipelines_, opts);
386 }
387
388 PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const {
389 return GetPipeline(linear_gradient_fill_pipelines_, opts);
390 }
391
392 PipelineRef GetLinearGradientUniformFillPipeline(
393 ContentContextOptions opts) const {
394 return GetPipeline(linear_gradient_uniform_fill_pipelines_, opts);
395 }
396
397 PipelineRef GetRadialGradientUniformFillPipeline(
398 ContentContextOptions opts) const {
399 return GetPipeline(radial_gradient_uniform_fill_pipelines_, opts);
400 }
401
402 PipelineRef GetConicalGradientUniformFillPipeline(
403 ContentContextOptions opts) const {
404 return GetPipeline(conical_gradient_uniform_fill_pipelines_, opts);
405 }
406
407 PipelineRef GetSweepGradientUniformFillPipeline(
408 ContentContextOptions opts) const {
409 return GetPipeline(sweep_gradient_uniform_fill_pipelines_, opts);
410 }
411
412 PipelineRef GetLinearGradientSSBOFillPipeline(
413 ContentContextOptions opts) const {
414 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
415 return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
416 }
417
418 PipelineRef GetRadialGradientSSBOFillPipeline(
419 ContentContextOptions opts) const {
420 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
421 return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
422 }
423
424 PipelineRef GetConicalGradientSSBOFillPipeline(
425 ContentContextOptions opts) const {
426 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
427 return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
428 }
429
430 PipelineRef GetSweepGradientSSBOFillPipeline(
431 ContentContextOptions opts) const {
432 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
433 return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
434 }
435
436 PipelineRef GetRadialGradientFillPipeline(ContentContextOptions opts) const {
437 return GetPipeline(radial_gradient_fill_pipelines_, opts);
438 }
439
440 PipelineRef GetConicalGradientFillPipeline(ContentContextOptions opts) const {
441 return GetPipeline(conical_gradient_fill_pipelines_, opts);
442 }
443
444 PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const {
445 return GetPipeline(rrect_blur_pipelines_, opts);
446 }
447
448 PipelineRef GetSweepGradientFillPipeline(ContentContextOptions opts) const {
449 return GetPipeline(sweep_gradient_fill_pipelines_, opts);
450 }
451
452 PipelineRef GetSolidFillPipeline(ContentContextOptions opts) const {
453 return GetPipeline(solid_fill_pipelines_, opts);
454 }
455
456 PipelineRef GetTexturePipeline(ContentContextOptions opts) const {
457 return GetPipeline(texture_pipelines_, opts);
458 }
459
460 PipelineRef GetTextureStrictSrcPipeline(ContentContextOptions opts) const {
461 return GetPipeline(texture_strict_src_pipelines_, opts);
462 }
463
464 #ifdef IMPELLER_ENABLE_OPENGLES
465 PipelineRef GetDownsampleTextureGlesPipeline(
466 ContentContextOptions opts) const {
467 return GetPipeline(texture_downsample_gles_pipelines_, opts);
468 }
469
470 PipelineRef GetTiledTextureExternalPipeline(
471 ContentContextOptions opts) const {
472 FML_DCHECK(GetContext()->GetBackendType() ==
473 Context::BackendType::kOpenGLES);
474 return GetPipeline(tiled_texture_external_pipelines_, opts);
475 }
476
477 PipelineRef GetTiledTextureUvExternalPipeline(
478 ContentContextOptions opts) const {
479 FML_DCHECK(GetContext()->GetBackendType() ==
480 Context::BackendType::kOpenGLES);
481 return GetPipeline(tiled_texture_uv_external_pipelines_, opts);
482 }
483 #endif // IMPELLER_ENABLE_OPENGLES
484
485 PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const {
486 return GetPipeline(tiled_texture_pipelines_, opts);
487 }
488
489 PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const {
490 return GetPipeline(gaussian_blur_pipelines_, opts);
491 }
492
493 PipelineRef GetBorderMaskBlurPipeline(ContentContextOptions opts) const {
494 return GetPipeline(border_mask_blur_pipelines_, opts);
495 }
496
497 PipelineRef GetMorphologyFilterPipeline(ContentContextOptions opts) const {
498 return GetPipeline(morphology_filter_pipelines_, opts);
499 }
500
501 PipelineRef GetColorMatrixColorFilterPipeline(
502 ContentContextOptions opts) const {
503 return GetPipeline(color_matrix_color_filter_pipelines_, opts);
504 }
505
506 PipelineRef GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const {
507 return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
508 }
509
510 PipelineRef GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const {
511 return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
512 }
513
514 PipelineRef GetClipPipeline(ContentContextOptions opts) const {
515 return GetPipeline(clip_pipelines_, opts);
516 }
517
518 PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const {
519 return GetPipeline(glyph_atlas_pipelines_, opts);
520 }
521
522 PipelineRef GetYUVToRGBFilterPipeline(ContentContextOptions opts) const {
523 return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
524 }
525
526 // Porter-Duff combined blends.
527 PipelineRef GetPorterDuffPipeline(BlendMode mode,
528 ContentContextOptions opts) const {
529 switch (mode) {
530 case BlendMode::kClear:
531 return GetClearBlendPipeline(opts);
532 case BlendMode::kSource:
533 return GetSourceBlendPipeline(opts);
534 case BlendMode::kDestination:
535 return GetDestinationBlendPipeline(opts);
536 case BlendMode::kSourceOver:
537 return GetSourceOverBlendPipeline(opts);
538 case BlendMode::kDestinationOver:
539 return GetDestinationOverBlendPipeline(opts);
540 case BlendMode::kSourceIn:
541 return GetSourceInBlendPipeline(opts);
542 case BlendMode::kDestinationIn:
543 return GetDestinationInBlendPipeline(opts);
544 case BlendMode::kSourceOut:
545 return GetSourceOutBlendPipeline(opts);
546 case BlendMode::kDestinationOut:
547 return GetDestinationOutBlendPipeline(opts);
548 case BlendMode::kSourceATop:
549 return GetSourceATopBlendPipeline(opts);
550 case BlendMode::kDestinationATop:
551 return GetDestinationATopBlendPipeline(opts);
552 case BlendMode::kXor:
553 return GetXorBlendPipeline(opts);
554 case BlendMode::kPlus:
555 return GetPlusBlendPipeline(opts);
556 case BlendMode::kModulate:
557 return GetModulateBlendPipeline(opts);
558 case BlendMode::kScreen:
559 return GetScreenBlendPipeline(opts);
560 case BlendMode::kOverlay:
561 case BlendMode::kDarken:
562 case BlendMode::kLighten:
563 case BlendMode::kColorDodge:
564 case BlendMode::kColorBurn:
565 case BlendMode::kHardLight:
566 case BlendMode::kSoftLight:
567 case BlendMode::kDifference:
568 case BlendMode::kExclusion:
569 case BlendMode::kMultiply:
570 case BlendMode::kHue:
571 case BlendMode::kSaturation:
572 case BlendMode::kColor:
573 case BlendMode::kLuminosity:
574 VALIDATION_LOG << "Invalid porter duff blend mode "
575 << BlendModeToString(mode);
576 return GetClearBlendPipeline(opts);
577 break;
578 }
579 }
580
581 PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const {
582 return GetPipeline(clear_blend_pipelines_, opts);
583 }
584
585 PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const {
586 return GetPipeline(source_blend_pipelines_, opts);
587 }
588
589 PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const {
590 return GetPipeline(destination_blend_pipelines_, opts);
591 }
592
593 PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const {
594 return GetPipeline(source_over_blend_pipelines_, opts);
595 }
596
597 PipelineRef GetDestinationOverBlendPipeline(
598 ContentContextOptions opts) const {
599 return GetPipeline(destination_over_blend_pipelines_, opts);
600 }
601
602 PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const {
603 return GetPipeline(source_in_blend_pipelines_, opts);
604 }
605
606 PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const {
607 return GetPipeline(destination_in_blend_pipelines_, opts);
608 }
609
610 PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const {
611 return GetPipeline(source_out_blend_pipelines_, opts);
612 }
613
614 PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const {
615 return GetPipeline(destination_out_blend_pipelines_, opts);
616 }
617
618 PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const {
619 return GetPipeline(source_a_top_blend_pipelines_, opts);
620 }
621
622 PipelineRef GetDestinationATopBlendPipeline(
623 ContentContextOptions opts) const {
624 return GetPipeline(destination_a_top_blend_pipelines_, opts);
625 }
626
627 PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const {
628 return GetPipeline(xor_blend_pipelines_, opts);
629 }
630
631 PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const {
632 return GetPipeline(plus_blend_pipelines_, opts);
633 }
634
635 PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const {
636 return GetPipeline(modulate_blend_pipelines_, opts);
637 }
638
639 PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const {
640 return GetPipeline(screen_blend_pipelines_, opts);
641 }
642
643 // Advanced blends.
644
645 PipelineRef GetBlendColorPipeline(ContentContextOptions opts) const {
646 return GetPipeline(blend_color_pipelines_, opts);
647 }
648
649 PipelineRef GetBlendColorBurnPipeline(ContentContextOptions opts) const {
650 return GetPipeline(blend_colorburn_pipelines_, opts);
651 }
652
653 PipelineRef GetBlendColorDodgePipeline(ContentContextOptions opts) const {
654 return GetPipeline(blend_colordodge_pipelines_, opts);
655 }
656
657 PipelineRef GetBlendDarkenPipeline(ContentContextOptions opts) const {
658 return GetPipeline(blend_darken_pipelines_, opts);
659 }
660
661 PipelineRef GetBlendDifferencePipeline(ContentContextOptions opts) const {
662 return GetPipeline(blend_difference_pipelines_, opts);
663 }
664
665 PipelineRef GetBlendExclusionPipeline(ContentContextOptions opts) const {
666 return GetPipeline(blend_exclusion_pipelines_, opts);
667 }
668
669 PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const {
670 return GetPipeline(blend_hardlight_pipelines_, opts);
671 }
672
673 PipelineRef GetBlendHuePipeline(ContentContextOptions opts) const {
674 return GetPipeline(blend_hue_pipelines_, opts);
675 }
676
677 PipelineRef GetBlendLightenPipeline(ContentContextOptions opts) const {
678 return GetPipeline(blend_lighten_pipelines_, opts);
679 }
680
681 PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const {
682 return GetPipeline(blend_luminosity_pipelines_, opts);
683 }
684
685 PipelineRef GetBlendMultiplyPipeline(ContentContextOptions opts) const {
686 return GetPipeline(blend_multiply_pipelines_, opts);
687 }
688
689 PipelineRef GetBlendOverlayPipeline(ContentContextOptions opts) const {
690 return GetPipeline(blend_overlay_pipelines_, opts);
691 }
692
693 PipelineRef GetBlendSaturationPipeline(ContentContextOptions opts) const {
694 return GetPipeline(blend_saturation_pipelines_, opts);
695 }
696
697 PipelineRef GetBlendScreenPipeline(ContentContextOptions opts) const {
698 return GetPipeline(blend_screen_pipelines_, opts);
699 }
700
701 PipelineRef GetBlendSoftLightPipeline(ContentContextOptions opts) const {
702 return GetPipeline(blend_softlight_pipelines_, opts);
703 }
704
705 PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const {
706 return GetPipeline(texture_downsample_pipelines_, opts);
707 }
708
709 // Framebuffer Advanced Blends
710 PipelineRef GetFramebufferBlendColorPipeline(
711 ContentContextOptions opts) const {
712 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
713 return GetPipeline(framebuffer_blend_color_pipelines_, opts);
714 }
715
716 PipelineRef GetFramebufferBlendColorBurnPipeline(
717 ContentContextOptions opts) const {
718 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
719 return GetPipeline(framebuffer_blend_colorburn_pipelines_, opts);
720 }
721
722 PipelineRef GetFramebufferBlendColorDodgePipeline(
723 ContentContextOptions opts) const {
724 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
725 return GetPipeline(framebuffer_blend_colordodge_pipelines_, opts);
726 }
727
728 PipelineRef GetFramebufferBlendDarkenPipeline(
729 ContentContextOptions opts) const {
730 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
731 return GetPipeline(framebuffer_blend_darken_pipelines_, opts);
732 }
733
734 PipelineRef GetFramebufferBlendDifferencePipeline(
735 ContentContextOptions opts) const {
736 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
737 return GetPipeline(framebuffer_blend_difference_pipelines_, opts);
738 }
739
740 PipelineRef GetFramebufferBlendExclusionPipeline(
741 ContentContextOptions opts) const {
742 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
743 return GetPipeline(framebuffer_blend_exclusion_pipelines_, opts);
744 }
745
746 PipelineRef GetFramebufferBlendHardLightPipeline(
747 ContentContextOptions opts) const {
748 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
749 return GetPipeline(framebuffer_blend_hardlight_pipelines_, opts);
750 }
751
752 PipelineRef GetFramebufferBlendHuePipeline(ContentContextOptions opts) const {
753 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
754 return GetPipeline(framebuffer_blend_hue_pipelines_, opts);
755 }
756
757 PipelineRef GetFramebufferBlendLightenPipeline(
758 ContentContextOptions opts) const {
759 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
760 return GetPipeline(framebuffer_blend_lighten_pipelines_, opts);
761 }
762
763 PipelineRef GetFramebufferBlendLuminosityPipeline(
764 ContentContextOptions opts) const {
765 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
766 return GetPipeline(framebuffer_blend_luminosity_pipelines_, opts);
767 }
768
769 PipelineRef GetFramebufferBlendMultiplyPipeline(
770 ContentContextOptions opts) const {
771 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
772 return GetPipeline(framebuffer_blend_multiply_pipelines_, opts);
773 }
774
775 PipelineRef GetFramebufferBlendOverlayPipeline(
776 ContentContextOptions opts) const {
777 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
778 return GetPipeline(framebuffer_blend_overlay_pipelines_, opts);
779 }
780
781 PipelineRef GetFramebufferBlendSaturationPipeline(
782 ContentContextOptions opts) const {
783 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
784 return GetPipeline(framebuffer_blend_saturation_pipelines_, opts);
785 }
786
787 PipelineRef GetFramebufferBlendScreenPipeline(
788 ContentContextOptions opts) const {
789 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
790 return GetPipeline(framebuffer_blend_screen_pipelines_, opts);
791 }
792
793 PipelineRef GetFramebufferBlendSoftLightPipeline(
794 ContentContextOptions opts) const {
795 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
796 return GetPipeline(framebuffer_blend_softlight_pipelines_, opts);
797 }
798
799 PipelineRef GetDrawVerticesUberShader(ContentContextOptions opts) const {
800 return GetPipeline(vertices_uber_shader_, opts);
801 }
802
803 // An empty 1x1 texture for binding drawVertices/drawAtlas or other cases
804 // that don't always have a texture (due to blending).
805 std::shared_ptr<Texture> GetEmptyTexture() const;
806
807 std::shared_ptr<Context> GetContext() const;
808
809 const Capabilities& GetDeviceCapabilities() const;
810
811 void SetWireframe(bool wireframe);
812
813 using SubpassCallback =
814 std::function<bool(const ContentContext&, RenderPass&)>;
815
816 /// @brief Creates a new texture of size `texture_size` and calls
817 /// `subpass_callback` with a `RenderPass` for drawing to the texture.
818 fml::StatusOr<RenderTarget> MakeSubpass(
819 std::string_view label,
820 ISize texture_size,
821 const std::shared_ptr<CommandBuffer>& command_buffer,
822 const SubpassCallback& subpass_callback,
823 bool msaa_enabled = true,
824 bool depth_stencil_enabled = false,
825 int32_t mip_count = 1) const;
826
827 /// Makes a subpass that will render to `subpass_target`.
828 fml::StatusOr<RenderTarget> MakeSubpass(
829 std::string_view label,
830 const RenderTarget& subpass_target,
831 const std::shared_ptr<CommandBuffer>& command_buffer,
832 const SubpassCallback& subpass_callback) const;
833
834 const std::shared_ptr<LazyGlyphAtlas>& GetLazyGlyphAtlas() const {
835 return lazy_glyph_atlas_;
836 }
837
838 const std::shared_ptr<RenderTargetAllocator>& GetRenderTargetCache() const {
839 return render_target_cache_;
840 }
841
842 /// RuntimeEffect pipelines must be obtained via this method to avoid
843 /// re-creating them every frame.
844 ///
845 /// The unique_entrypoint_name comes from RuntimeEffect::GetEntrypoint.
846 /// Impellerc generates a unique entrypoint name for runtime effect shaders
847 /// based on the input file name and shader stage.
848 ///
849 /// The create_callback is synchronously invoked exactly once if a cached
850 /// pipeline is not found.
851 PipelineRef GetCachedRuntimeEffectPipeline(
852 const std::string& unique_entrypoint_name,
853 const ContentContextOptions& options,
854 const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
855 create_callback) const;
856
857 /// Used by hot reload/hot restart to clear a cached pipeline from
858 /// GetCachedRuntimeEffectPipeline.
859 void ClearCachedRuntimeEffectPipeline(
860 const std::string& unique_entrypoint_name) const;
861
862 /// @brief Retrieve the currnent host buffer for transient storage.
863 ///
864 /// This is only safe to use from the raster threads. Other threads should
865 /// allocate their own device buffers.
866 HostBuffer& GetTransientsBuffer() const { return *host_buffer_; }
867
868 private:
869 std::shared_ptr<Context> context_;
870 std::shared_ptr<LazyGlyphAtlas> lazy_glyph_atlas_;
871
872 /// Run backend specific additional setup and create common shader variants.
873 ///
874 /// This bootstrap is intended to improve the performance of several
875 /// first frame benchmarks that are tracked in the flutter device lab.
876 /// The workload includes initializing commonly used but not default
877 /// shader variants, as well as forcing driver initialization.
878 void InitializeCommonlyUsedShadersIfNeeded() const;
879
880 struct RuntimeEffectPipelineKey {
881 std::string unique_entrypoint_name;
882 ContentContextOptions options;
883
884 struct Hash {
885 std::size_t operator()(const RuntimeEffectPipelineKey& key) const {
886 return fml::HashCombine(key.unique_entrypoint_name,
887 key.options.ToKey());
888 }
889 };
890
891 struct Equal {
892 constexpr bool operator()(const RuntimeEffectPipelineKey& lhs,
893 const RuntimeEffectPipelineKey& rhs) const {
894 return lhs.unique_entrypoint_name == rhs.unique_entrypoint_name &&
895 lhs.options.ToKey() == rhs.options.ToKey();
896 }
897 };
898 };
899
900 mutable std::unordered_map<RuntimeEffectPipelineKey,
901 std::shared_ptr<Pipeline<PipelineDescriptor>>,
902 RuntimeEffectPipelineKey::Hash,
903 RuntimeEffectPipelineKey::Equal>
904 runtime_effect_pipelines_;
905
906 /// Holds multiple Pipelines associated with the same PipelineHandle types.
907 ///
908 /// For example, it may have multiple
909 /// RenderPipelineHandle<SolidFillVertexShader, SolidFillFragmentShader>
910 /// instances for different blend modes. From them you can access the
911 /// Pipeline.
912 ///
913 /// See also:
914 /// - impeller::ContentContextOptions - options from which variants are
915 /// created.
916 /// - impeller::Pipeline::CreateVariant
917 /// - impeller::RenderPipelineHandle<> - The type of objects this typically
918 /// contains.
919 template <class PipelineHandleT>
920 class Variants {
921 public:
922 Variants() = default;
923
924 void Set(const ContentContextOptions& options,
925 std::unique_ptr<PipelineHandleT> pipeline) {
926 uint64_t p_key = options.ToKey();
927 for (const auto& [key, pipeline] : pipelines_) {
928 if (key == p_key) {
929 return;
930 }
931 }
932 pipelines_.push_back(std::make_pair(p_key, std::move(pipeline)));
933 }
934
935 void SetDefault(const ContentContextOptions& options,
936 std::unique_ptr<PipelineHandleT> pipeline) {
937 default_options_ = options;
938 Set(options, std::move(pipeline));
939 }
940
941 void CreateDefault(const Context& context,
942 const ContentContextOptions& options,
943 const std::vector<Scalar>& constants = {}) {
944 auto desc = PipelineHandleT::Builder::MakeDefaultPipelineDescriptor(
945 context, constants);
946 if (!desc.has_value()) {
947 VALIDATION_LOG << "Failed to create default pipeline.";
948 return;
949 }
950 options.ApplyToPipelineDescriptor(*desc);
951 SetDefault(options, std::make_unique<PipelineHandleT>(context, desc));
952 }
953
954 PipelineHandleT* Get(const ContentContextOptions& options) const {
955 uint64_t p_key = options.ToKey();
956 for (const auto& [key, pipeline] : pipelines_) {
957 if (key == p_key) {
958 return pipeline.get();
959 }
960 }
961 return nullptr;
962 }
963
964 PipelineHandleT* GetDefault() const {
965 if (!default_options_.has_value()) {
966 return nullptr;
967 }
968 return Get(default_options_.value());
969 }
970
971 size_t GetPipelineCount() const { return pipelines_.size(); }
972
973 private:
974 std::optional<ContentContextOptions> default_options_;
975 std::vector<std::pair<uint64_t, std::unique_ptr<PipelineHandleT>>>
976 pipelines_;
977
978 Variants(const Variants&) = delete;
979
980 Variants& operator=(const Variants&) = delete;
981 };
982
983 // These are mutable because while the prototypes are created eagerly, any
984 // variants requested from that are lazily created and cached in the variants
985 // map.
986
987 mutable Variants<SolidFillPipeline> solid_fill_pipelines_;
988 mutable Variants<FastGradientPipeline> fast_gradient_pipelines_;
989 mutable Variants<LinearGradientFillPipeline> linear_gradient_fill_pipelines_;
990 mutable Variants<RadialGradientFillPipeline> radial_gradient_fill_pipelines_;
991 mutable Variants<ConicalGradientFillPipeline>
992 conical_gradient_fill_pipelines_;
993 mutable Variants<SweepGradientFillPipeline> sweep_gradient_fill_pipelines_;
994 mutable Variants<LinearGradientUniformFillPipeline>
995 linear_gradient_uniform_fill_pipelines_;
996 mutable Variants<RadialGradientUniformFillPipeline>
997 radial_gradient_uniform_fill_pipelines_;
998 mutable Variants<ConicalGradientUniformFillPipeline>
999 conical_gradient_uniform_fill_pipelines_;
1000 mutable Variants<SweepGradientUniformFillPipeline>
1001 sweep_gradient_uniform_fill_pipelines_;
1002 mutable Variants<LinearGradientSSBOFillPipeline>
1003 linear_gradient_ssbo_fill_pipelines_;
1004 mutable Variants<RadialGradientSSBOFillPipeline>
1005 radial_gradient_ssbo_fill_pipelines_;
1006 mutable Variants<ConicalGradientSSBOFillPipeline>
1007 conical_gradient_ssbo_fill_pipelines_;
1008 mutable Variants<SweepGradientSSBOFillPipeline>
1009 sweep_gradient_ssbo_fill_pipelines_;
1010 mutable Variants<RRectBlurPipeline> rrect_blur_pipelines_;
1011 mutable Variants<TexturePipeline> texture_pipelines_;
1012 mutable Variants<TextureDownsamplePipeline> texture_downsample_pipelines_;
1013 mutable Variants<TextureStrictSrcPipeline> texture_strict_src_pipelines_;
1014 #ifdef IMPELLER_ENABLE_OPENGLES
1015 mutable Variants<TiledTextureExternalPipeline>
1016 tiled_texture_external_pipelines_;
1017 mutable Variants<TextureDownsampleGlesPipeline>
1018 texture_downsample_gles_pipelines_;
1019 mutable Variants<TiledTextureUvExternalPipeline>
1020 tiled_texture_uv_external_pipelines_;
1021 #endif // IMPELLER_ENABLE_OPENGLES
1022 mutable Variants<TiledTexturePipeline> tiled_texture_pipelines_;
1023 mutable Variants<GaussianBlurPipeline> gaussian_blur_pipelines_;
1024 mutable Variants<BorderMaskBlurPipeline> border_mask_blur_pipelines_;
1025 mutable Variants<MorphologyFilterPipeline> morphology_filter_pipelines_;
1026 mutable Variants<ColorMatrixColorFilterPipeline>
1027 color_matrix_color_filter_pipelines_;
1028 mutable Variants<LinearToSrgbFilterPipeline> linear_to_srgb_filter_pipelines_;
1029 mutable Variants<SrgbToLinearFilterPipeline> srgb_to_linear_filter_pipelines_;
1030 mutable Variants<ClipPipeline> clip_pipelines_;
1031 mutable Variants<GlyphAtlasPipeline> glyph_atlas_pipelines_;
1032 mutable Variants<YUVToRGBFilterPipeline> yuv_to_rgb_filter_pipelines_;
1033
1034 // Porter Duff Blends.
1035 mutable Variants<PorterDuffBlendPipeline> clear_blend_pipelines_;
1036 mutable Variants<PorterDuffBlendPipeline> source_blend_pipelines_;
1037 mutable Variants<PorterDuffBlendPipeline> destination_blend_pipelines_;
1038 mutable Variants<PorterDuffBlendPipeline> source_over_blend_pipelines_;
1039 mutable Variants<PorterDuffBlendPipeline> destination_over_blend_pipelines_;
1040 mutable Variants<PorterDuffBlendPipeline> source_in_blend_pipelines_;
1041 mutable Variants<PorterDuffBlendPipeline> destination_in_blend_pipelines_;
1042 mutable Variants<PorterDuffBlendPipeline> source_out_blend_pipelines_;
1043 mutable Variants<PorterDuffBlendPipeline> destination_out_blend_pipelines_;
1044 mutable Variants<PorterDuffBlendPipeline> source_a_top_blend_pipelines_;
1045 mutable Variants<PorterDuffBlendPipeline> destination_a_top_blend_pipelines_;
1046 mutable Variants<PorterDuffBlendPipeline> xor_blend_pipelines_;
1047 mutable Variants<PorterDuffBlendPipeline> plus_blend_pipelines_;
1048 mutable Variants<PorterDuffBlendPipeline> modulate_blend_pipelines_;
1049 mutable Variants<PorterDuffBlendPipeline> screen_blend_pipelines_;
1050
1051 // Advanced blends.
1052 mutable Variants<BlendColorPipeline> blend_color_pipelines_;
1053 mutable Variants<BlendColorBurnPipeline> blend_colorburn_pipelines_;
1054 mutable Variants<BlendColorDodgePipeline> blend_colordodge_pipelines_;
1055 mutable Variants<BlendDarkenPipeline> blend_darken_pipelines_;
1056 mutable Variants<BlendDifferencePipeline> blend_difference_pipelines_;
1057 mutable Variants<BlendExclusionPipeline> blend_exclusion_pipelines_;
1058 mutable Variants<BlendHardLightPipeline> blend_hardlight_pipelines_;
1059 mutable Variants<BlendHuePipeline> blend_hue_pipelines_;
1060 mutable Variants<BlendLightenPipeline> blend_lighten_pipelines_;
1061 mutable Variants<BlendLuminosityPipeline> blend_luminosity_pipelines_;
1062 mutable Variants<BlendMultiplyPipeline> blend_multiply_pipelines_;
1063 mutable Variants<BlendOverlayPipeline> blend_overlay_pipelines_;
1064 mutable Variants<BlendSaturationPipeline> blend_saturation_pipelines_;
1065 mutable Variants<BlendScreenPipeline> blend_screen_pipelines_;
1066 mutable Variants<BlendSoftLightPipeline> blend_softlight_pipelines_;
1067 // Framebuffer Advanced blends.
1068 mutable Variants<FramebufferBlendColorPipeline>
1069 framebuffer_blend_color_pipelines_;
1070 mutable Variants<FramebufferBlendColorBurnPipeline>
1071 framebuffer_blend_colorburn_pipelines_;
1072 mutable Variants<FramebufferBlendColorDodgePipeline>
1073 framebuffer_blend_colordodge_pipelines_;
1074 mutable Variants<FramebufferBlendDarkenPipeline>
1075 framebuffer_blend_darken_pipelines_;
1076 mutable Variants<FramebufferBlendDifferencePipeline>
1077 framebuffer_blend_difference_pipelines_;
1078 mutable Variants<FramebufferBlendExclusionPipeline>
1079 framebuffer_blend_exclusion_pipelines_;
1080 mutable Variants<FramebufferBlendHardLightPipeline>
1081 framebuffer_blend_hardlight_pipelines_;
1082 mutable Variants<FramebufferBlendHuePipeline>
1083 framebuffer_blend_hue_pipelines_;
1084 mutable Variants<FramebufferBlendLightenPipeline>
1085 framebuffer_blend_lighten_pipelines_;
1086 mutable Variants<FramebufferBlendLuminosityPipeline>
1087 framebuffer_blend_luminosity_pipelines_;
1088 mutable Variants<FramebufferBlendMultiplyPipeline>
1089 framebuffer_blend_multiply_pipelines_;
1090 mutable Variants<FramebufferBlendOverlayPipeline>
1091 framebuffer_blend_overlay_pipelines_;
1092 mutable Variants<FramebufferBlendSaturationPipeline>
1093 framebuffer_blend_saturation_pipelines_;
1094 mutable Variants<FramebufferBlendScreenPipeline>
1095 framebuffer_blend_screen_pipelines_;
1096 mutable Variants<FramebufferBlendSoftLightPipeline>
1097 framebuffer_blend_softlight_pipelines_;
1098 mutable Variants<VerticesUberShader> vertices_uber_shader_;
1099
1100 template <class TypedPipeline>
1101 PipelineRef GetPipeline(Variants<TypedPipeline>& container,
1102 ContentContextOptions opts) const {
1103 TypedPipeline* pipeline = CreateIfNeeded(container, opts);
1104 if (!pipeline) {
1105 return raw_ptr<Pipeline<PipelineDescriptor>>();
1106 }
1107 return raw_ptr(pipeline->WaitAndGet());
1108 }
1109
1110 template <class RenderPipelineHandleT>
1111 RenderPipelineHandleT* CreateIfNeeded(
1112 Variants<RenderPipelineHandleT>& container,
1113 ContentContextOptions opts) const {
1114 if (!IsValid()) {
1115 return nullptr;
1116 }
1117
1118 if (wireframe_) {
1119 opts.wireframe = true;
1120 }
1121
1122 if (RenderPipelineHandleT* found = container.Get(opts)) {
1123 return found;
1124 }
1125
1126 RenderPipelineHandleT* default_handle = container.GetDefault();
1127
1128 // The default must always be initialized in the constructor.
1129 FML_CHECK(default_handle != nullptr);
1130
1131 const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline =
1132 default_handle->WaitAndGet();
1133 if (!pipeline) {
1134 return nullptr;
1135 }
1136
1137 auto variant_future = pipeline->CreateVariant(
1138 /*async=*/false, [&opts, variants_count = container.GetPipelineCount()](
1139 PipelineDescriptor& desc) {
1140 opts.ApplyToPipelineDescriptor(desc);
1141 desc.SetLabel(
1142 SPrintF("%s V#%zu", desc.GetLabel().data(), variants_count));
1143 });
1144 std::unique_ptr<RenderPipelineHandleT> variant =
1145 std::make_unique<RenderPipelineHandleT>(std::move(variant_future));
1146 container.Set(opts, std::move(variant));
1147 return container.Get(opts);
1148 }
1149
1150 bool is_valid_ = false;
1151 std::shared_ptr<Tessellator> tessellator_;
1152 std::shared_ptr<RenderTargetAllocator> render_target_cache_;
1153 std::shared_ptr<HostBuffer> host_buffer_;
1154 std::shared_ptr<Texture> empty_texture_;
1155 bool wireframe_ = false;
1156
1157 ContentContext(const ContentContext&) = delete;
1158
1159 ContentContext& operator=(const ContentContext&) = delete;
1160 };
1161
1162 } // namespace impeller
1163
1164 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:24
impeller::Pipeline< PipelineDescriptor >
impeller::ContentContextOptions::StencilMode::kIgnore
@ kIgnore
impeller::ContentContext::GetFramebufferBlendSoftLightPipeline
PipelineRef GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:793
impeller::PipelineRef
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:86
impeller::ContentContext::ClearCachedRuntimeEffectPipeline
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
Definition: content_context.cc:638
lazy_glyph_atlas.h
host_buffer.h
pipeline.h
impeller::BlendModeToString
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47
impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::ContentContext::GetTextureStrictSrcPipeline
PipelineRef GetTextureStrictSrcPipeline(ContentContextOptions opts) const
Definition: content_context.h:460
impeller::ContentContext::GetDestinationBlendPipeline
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:589
impeller::ContentContext::GetLinearGradientSSBOFillPipeline
PipelineRef GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:412
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:262
impeller::ContentContext::GetLazyGlyphAtlas
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() const
Definition: content_context.h:834
impeller::ContentContext::RuntimeEffectPipelineKey::Equal
Definition: content_context.h:891
impeller::ContentContext::GetFramebufferBlendHardLightPipeline
PipelineRef GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:746
impeller::ContentContext::GetFramebufferBlendOverlayPipeline
PipelineRef GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
Definition: content_context.h:775
impeller::ContentContext::GetFramebufferBlendSaturationPipeline
PipelineRef GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
Definition: content_context.h:781
impeller::ContentContext::GetDownsamplePipeline
PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const
Definition: content_context.h:705
impeller::ContentContext::GetFramebufferBlendColorDodgePipeline
PipelineRef GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
Definition: content_context.h:722
impeller::ContentContext::GetXorBlendPipeline
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:627
impeller::ContentContextOptions::StencilMode::kOverdrawPreventionIncrement
@ kOverdrawPreventionIncrement
impeller::Tessellator
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition: tessellator.h:34
impeller::BlendMode
BlendMode
Definition: color.h:58
impeller::ContentContext::GetLinearGradientFillPipeline
PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:388
impeller::HostBuffer
Definition: host_buffer.h:28
impeller::BlendMode::kLuminosity
@ kLuminosity
impeller::ContentContext::GetSweepGradientUniformFillPipeline
PipelineRef GetSweepGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:407
impeller::BlendMode::kSource
@ kSource
impeller::ContentContext::GetSourceOverBlendPipeline
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:593
impeller::BlendMode::kColorDodge
@ kColorDodge
impeller::ContentContext::GetColorMatrixColorFilterPipeline
PipelineRef GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:501
impeller::ContentContext::GetFramebufferBlendHuePipeline
PipelineRef GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
Definition: content_context.h:752
impeller::BlendMode::kDestination
@ kDestination
impeller::ContentContext::GetDestinationATopBlendPipeline
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:622
impeller::ContentContext::GetDestinationOverBlendPipeline
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:597
impeller::BlendMode::kDarken
@ kDarken
impeller::ContentContext::GetBlendDarkenPipeline
PipelineRef GetBlendDarkenPipeline(ContentContextOptions opts) const
Definition: content_context.h:657
impeller::ContentContext::GetBlendHuePipeline
PipelineRef GetBlendHuePipeline(ContentContextOptions opts) const
Definition: content_context.h:673
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:625
impeller::BlendMode::kColor
@ kColor
formats.h
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::ContentContextOptions::has_depth_stencil_attachments
bool has_depth_stencil_attachments
Definition: content_context.h:338
impeller::BlendMode::kPlus
@ kPlus
impeller::ContentContextOptions::blend_mode
BlendMode blend_mode
Definition: content_context.h:333
impeller::BlendMode::kOverlay
@ kOverlay
typographer_context.h
impeller::ContentContext::GetRadialGradientFillPipeline
PipelineRef GetRadialGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:436
impeller::ContentContextOptions::ApplyToPipelineDescriptor
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
Definition: content_context.cc:27
impeller::ContentContext::GetBlendMultiplyPipeline
PipelineRef GetBlendMultiplyPipeline(ContentContextOptions opts) const
Definition: content_context.h:685
impeller::RenderPipelineHandle
Definition: pipeline.h:106
impeller::ContentContextOptions::StencilMode::kStencilEvenOddFill
@ kStencilEvenOddFill
impeller::ContentContext::GetClipPipeline
PipelineRef GetClipPipeline(ContentContextOptions opts) const
Definition: content_context.h:514
validation.h
impeller::ContentContext::GetTessellator
Tessellator & GetTessellator() const
Definition: content_context.cc:609
impeller::ContentContext::GetFramebufferBlendDifferencePipeline
PipelineRef GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
Definition: content_context.h:734
impeller::ContentContext::GetBlendOverlayPipeline
PipelineRef GetBlendOverlayPipeline(ContentContextOptions opts) const
Definition: content_context.h:689
impeller::ContentContext::GetBlendLuminosityPipeline
PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const
Definition: content_context.h:681
impeller::ContentContext::GetEmptyTexture
std::shared_ptr< Texture > GetEmptyTexture() const
Definition: content_context.cc:537
impeller::ContentContext::GetGaussianBlurPipeline
PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const
Definition: content_context.h:489
impeller::ContentContext::GetSweepGradientSSBOFillPipeline
PipelineRef GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:430
impeller::ContentContext::GetBlendHardLightPipeline
PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:669
impeller::ContentContext::GetFramebufferBlendLuminosityPipeline
PipelineRef GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
Definition: content_context.h:763
impeller::BlendMode::kModulate
@ kModulate
impeller::ContentContextOptions::wireframe
bool wireframe
Definition: content_context.h:340
impeller::ContentContext::GetFramebufferBlendColorBurnPipeline
PipelineRef GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
Definition: content_context.h:716
impeller::ContentContext::GetFramebufferBlendDarkenPipeline
PipelineRef GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
Definition: content_context.h:728
impeller::BlendMode::kSourceOut
@ kSourceOut
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
impeller::BlendMode::kSaturation
@ kSaturation
impeller::BlendMode::kDifference
@ kDifference
impeller::ContentContext::GetMorphologyFilterPipeline
PipelineRef GetMorphologyFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:497
impeller::ContentContextOptions::StencilMode
StencilMode
Definition: content_context.h:280
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::FastGradientPipeline
RenderPipelineHandle< FastGradientVertexShader, FastGradientFragmentShader > FastGradientPipeline
Definition: content_context.h:86
impeller::Capabilities
Definition: capabilities.h:14
impeller::ContentContext::GetBlendDifferencePipeline
PipelineRef GetBlendDifferencePipeline(ContentContextOptions opts) const
Definition: content_context.h:661
impeller::BlendMode::kLighten
@ kLighten
impeller::ContentContext::GetRadialGradientSSBOFillPipeline
PipelineRef GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:418
impeller::TSize
Definition: size.h:25
impeller::CompareFunction
CompareFunction
Definition: formats.h:552
impeller::PrimitiveType
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
impeller::BlendMode::kSoftLight
@ kSoftLight
impeller::ContentContext::GetPorterDuffPipeline
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
Definition: content_context.h:527
impeller::ContentContextOptions::color_attachment_pixel_format
PixelFormat color_attachment_pixel_format
Definition: content_context.h:337
impeller::ContentContext::~ContentContext
~ContentContext()
impeller::ContentContext::GetBlendSoftLightPipeline
PipelineRef GetBlendSoftLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:701
impeller::BlendMode::kColorBurn
@ kColorBurn
impeller::BlendMode::kHardLight
@ kHardLight
impeller::ContentContext::GetFramebufferBlendMultiplyPipeline
PipelineRef GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
Definition: content_context.h:769
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::ContentContext::GetSweepGradientFillPipeline
PipelineRef GetSweepGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:448
impeller::ContentContext::GetPlusBlendPipeline
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:631
impeller::ContentContext::RuntimeEffectPipelineKey::Hash
Definition: content_context.h:884
impeller::ContentContext::GetTexturePipeline
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
Definition: content_context.h:456
impeller::ContentContext::GetTiledTexturePipeline
PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const
Definition: content_context.h:485
impeller::ContentContext::GetGlyphAtlasPipeline
PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const
Definition: content_context.h:518
impeller::ContentContext::GetRadialGradientUniformFillPipeline
PipelineRef GetRadialGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:397
impeller::BlendMode::kClear
@ kClear
impeller::ContentContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: content_context.cc:613
impeller::ContentContextOptions::StencilMode::kStencilNonZeroFill
@ kStencilNonZeroFill
impeller::ContentContext::GetScreenBlendPipeline
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:639
impeller::ContentContext::GetModulateBlendPipeline
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:635
impeller::ContentContext::GetBorderMaskBlurPipeline
PipelineRef GetBorderMaskBlurPipeline(ContentContextOptions opts) const
Definition: content_context.h:493
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:541
impeller::ContentContextOptions::ToKey
constexpr uint64_t ToKey() const
Definition: content_context.h:343
impeller::ContentContext::GetLinearToSrgbFilterPipeline
PipelineRef GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:506
impeller::ContentContext::GetBlendExclusionPipeline
PipelineRef GetBlendExclusionPipeline(ContentContextOptions opts) const
Definition: content_context.h:665
impeller::ContentContext::GetBlendColorDodgePipeline
PipelineRef GetBlendColorDodgePipeline(ContentContextOptions opts) const
Definition: content_context.h:653
capabilities.h
impeller::ContentContext::RuntimeEffectPipelineKey::Hash::operator()
std::size_t operator()(const RuntimeEffectPipelineKey &key) const
Definition: content_context.h:885
impeller::RenderTarget
Definition: render_target.h:38
impeller::ContentContext::GetFastGradientPipeline
PipelineRef GetFastGradientPipeline(ContentContextOptions opts) const
Definition: content_context.h:384
impeller::ContentContext::GetDestinationInBlendPipeline
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:606
impeller::ContentContext::GetFramebufferBlendExclusionPipeline
PipelineRef GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
Definition: content_context.h:740
impeller::ContentContext::GetBlendLightenPipeline
PipelineRef GetBlendLightenPipeline(ContentContextOptions opts) const
Definition: content_context.h:677
impeller::ContentContextOptions::is_for_rrect_blur_clear
bool is_for_rrect_blur_clear
Definition: content_context.h:341
impeller::ContentContextOptions::stencil_mode
StencilMode stencil_mode
Definition: content_context.h:335
impeller::ContentContextOptions::depth_write_enabled
bool depth_write_enabled
Definition: content_context.h:339
impeller::ContentContext::GetLinearGradientUniformFillPipeline
PipelineRef GetLinearGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:392
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::ContentContext::GetConicalGradientUniformFillPipeline
PipelineRef GetConicalGradientUniformFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:402
impeller::ContentContext::GetDrawVerticesUberShader
PipelineRef GetDrawVerticesUberShader(ContentContextOptions opts) const
Definition: content_context.h:799
impeller::ContentContextOptions::primitive_type
PrimitiveType primitive_type
Definition: content_context.h:336
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::ContentContext::SubpassCallback
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
Definition: content_context.h:814
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::ContentContext::GetFramebufferBlendScreenPipeline
PipelineRef GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
Definition: content_context.h:787
impeller::BlendMode::kDestinationIn
@ kDestinationIn
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
command_buffer.h
impeller::ContentContext::GetBlendSaturationPipeline
PipelineRef GetBlendSaturationPipeline(ContentContextOptions opts) const
Definition: content_context.h:693
impeller::BlendMode::kExclusion
@ kExclusion
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::ContentContext::GetRenderTargetCache
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
Definition: content_context.h:838
impeller::ContentContextOptions::depth_compare
CompareFunction depth_compare
Definition: content_context.h:334
impeller::ContentContext::GetSrgbToLinearFilterPipeline
PipelineRef GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:510
impeller::ContentContext::GetBlendScreenPipeline
PipelineRef GetBlendScreenPipeline(ContentContextOptions opts) const
Definition: content_context.h:697
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:617
impeller::ContentContext::GetConicalGradientFillPipeline
PipelineRef GetConicalGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:440
impeller::raw_ptr< Pipeline< PipelineDescriptor > >
impeller::ContentContext::GetFramebufferBlendColorPipeline
PipelineRef GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
Definition: content_context.h:710
impeller::ContentContextOptions::sample_count
SampleCount sample_count
Definition: content_context.h:332
impeller::ContentContext::GetSourceInBlendPipeline
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:602
impeller::ContentContext::GetSourceATopBlendPipeline
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:618
impeller::SampleCount
SampleCount
Definition: formats.h:295
impeller::ContentContext::GetFramebufferBlendLightenPipeline
PipelineRef GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
Definition: content_context.h:757
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::BlendMode::kScreen
@ kScreen
impeller::ContentContext::SetWireframe
void SetWireframe(bool wireframe)
Definition: content_context.cc:621
color.h
impeller::SampleCount::kCount1
@ kCount1
impeller::ContentContext::GetBlendColorPipeline
PipelineRef GetBlendColorPipeline(ContentContextOptions opts) const
Definition: content_context.h:645
impeller::BlendMode::kHue
@ kHue
impeller::ContentContextOptions::StencilMode::kOverdrawPreventionRestore
@ kOverdrawPreventionRestore
impeller::ContentContext::RuntimeEffectPipelineKey::Equal::operator()
constexpr bool operator()(const RuntimeEffectPipelineKey &lhs, const RuntimeEffectPipelineKey &rhs) const
Definition: content_context.h:892
impeller::ContentContextOptions::StencilMode::kCoverCompareInverted
@ kCoverCompareInverted
pipeline_descriptor.h
impeller::ContentContextOptions::StencilMode::kCoverCompare
@ kCoverCompare
impeller::ContentContext::GetDestinationOutBlendPipeline
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:614
render_target.h
impeller::BlendMode::kXor
@ kXor
impeller::ContentContext::GetBlendColorBurnPipeline
PipelineRef GetBlendColorBurnPipeline(ContentContextOptions opts) const
Definition: content_context.h:649
impeller::ContentContext::GetClearBlendPipeline
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:581
impeller::ContentContext::GetConicalGradientSSBOFillPipeline
PipelineRef GetConicalGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:424
impeller::ContentContextOptions
Definition: content_context.h:279
impeller::ContentContext::GetYUVToRGBFilterPipeline
PipelineRef GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:522
impeller::ContentContext::GetSourceBlendPipeline
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:585
impeller
Definition: allocation.cc:12
impeller::ContentContext::IsValid
bool IsValid() const
Definition: content_context.cc:533
impeller::ContentContext::GetRRectBlurPipeline
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
Definition: content_context.h:444
impeller::BlendMode::kSourceATop
@ kSourceATop
impeller::BlendMode::kMultiply
@ kMultiply
impeller::ContentContext
Definition: content_context.h:371
impeller::ContentContext::GetSolidFillPipeline
PipelineRef GetSolidFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:452
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::ContentContext::GetTransientsBuffer
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
Definition: content_context.h:866
impeller::ContentContext::GetSourceOutBlendPipeline
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:610