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"
16 #include "impeller/core/formats.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 
88  RenderPipelineHandle<GradientFillVertexShader,
89  LinearGradientFillFragmentShader>;
93  RenderPipelineHandle<GradientFillVertexShader,
94  RadialGradientFillFragmentShader>;
96  RenderPipelineHandle<GradientFillVertexShader,
97  ConicalGradientFillFragmentShader>;
99  RenderPipelineHandle<GradientFillVertexShader,
100  SweepGradientFillFragmentShader>;
102  RenderPipelineHandle<GradientFillVertexShader,
103  LinearGradientUniformFillFragmentShader>;
105  RenderPipelineHandle<GradientFillVertexShader,
106  ConicalGradientUniformFillFragmentShader>;
108  RenderPipelineHandle<GradientFillVertexShader,
109  RadialGradientUniformFillFragmentShader>;
111  RenderPipelineHandle<GradientFillVertexShader,
112  SweepGradientUniformFillFragmentShader>;
114  RenderPipelineHandle<GradientFillVertexShader,
115  LinearGradientSsboFillFragmentShader>;
117  RenderPipelineHandle<GradientFillVertexShader,
118  ConicalGradientSsboFillFragmentShader>;
120  RenderPipelineHandle<GradientFillVertexShader,
121  RadialGradientSsboFillFragmentShader>;
123  RenderPipelineHandle<GradientFillVertexShader,
124  SweepGradientSsboFillFragmentShader>;
130  RenderPipelineHandle<TextureFillVertexShader,
131  TextureDownsampleFragmentShader>;
133  RenderPipelineHandle<TextureFillVertexShader,
134  TextureFillStrictSrcFragmentShader>;
136  RenderPipelineHandle<TextureUvFillVertexShader,
137  TiledTextureFillFragmentShader>;
141  RenderPipelineHandle<FilterPositionUvVertexShader,
142  BorderMaskBlurFragmentShader>;
144  RenderPipelineHandle<FilterPositionUvVertexShader,
145  MorphologyFilterFragmentShader>;
147  RenderPipelineHandle<FilterPositionVertexShader,
148  ColorMatrixColorFilterFragmentShader>;
150  RenderPipelineHandle<FilterPositionVertexShader,
151  LinearToSrgbFilterFragmentShader>;
153  RenderPipelineHandle<FilterPositionVertexShader,
154  SrgbToLinearFilterFragmentShader>;
156  RenderPipelineHandle<FilterPositionVertexShader,
157  YuvToRgbFilterFragmentShader>;
158 
161 
163  RenderPipelineHandle<PorterDuffBlendVertexShader,
164  PorterDuffBlendFragmentShader>;
166 
167 // Advanced blends
168 using BlendColorPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
169  AdvancedBlendFragmentShader>;
171  RenderPipelineHandle<AdvancedBlendVertexShader,
172  AdvancedBlendFragmentShader>;
174  RenderPipelineHandle<AdvancedBlendVertexShader,
175  AdvancedBlendFragmentShader>;
176 using BlendDarkenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
177  AdvancedBlendFragmentShader>;
179  RenderPipelineHandle<AdvancedBlendVertexShader,
180  AdvancedBlendFragmentShader>;
182  RenderPipelineHandle<AdvancedBlendVertexShader,
183  AdvancedBlendFragmentShader>;
185  RenderPipelineHandle<AdvancedBlendVertexShader,
186  AdvancedBlendFragmentShader>;
187 using BlendHuePipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
188  AdvancedBlendFragmentShader>;
189 using BlendLightenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
190  AdvancedBlendFragmentShader>;
192  RenderPipelineHandle<AdvancedBlendVertexShader,
193  AdvancedBlendFragmentShader>;
194 using BlendMultiplyPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
195  AdvancedBlendFragmentShader>;
196 using BlendOverlayPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
197  AdvancedBlendFragmentShader>;
199  RenderPipelineHandle<AdvancedBlendVertexShader,
200  AdvancedBlendFragmentShader>;
201 using BlendScreenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
202  AdvancedBlendFragmentShader>;
204  RenderPipelineHandle<AdvancedBlendVertexShader,
205  AdvancedBlendFragmentShader>;
206 // Framebuffer Advanced Blends
208  RenderPipelineHandle<FramebufferBlendVertexShader,
209  FramebufferBlendFragmentShader>;
211  RenderPipelineHandle<FramebufferBlendVertexShader,
212  FramebufferBlendFragmentShader>;
214  RenderPipelineHandle<FramebufferBlendVertexShader,
215  FramebufferBlendFragmentShader>;
217  RenderPipelineHandle<FramebufferBlendVertexShader,
218  FramebufferBlendFragmentShader>;
220  RenderPipelineHandle<FramebufferBlendVertexShader,
221  FramebufferBlendFragmentShader>;
223  RenderPipelineHandle<FramebufferBlendVertexShader,
224  FramebufferBlendFragmentShader>;
226  RenderPipelineHandle<FramebufferBlendVertexShader,
227  FramebufferBlendFragmentShader>;
229  RenderPipelineHandle<FramebufferBlendVertexShader,
230  FramebufferBlendFragmentShader>;
232  RenderPipelineHandle<FramebufferBlendVertexShader,
233  FramebufferBlendFragmentShader>;
235  RenderPipelineHandle<FramebufferBlendVertexShader,
236  FramebufferBlendFragmentShader>;
238  RenderPipelineHandle<FramebufferBlendVertexShader,
239  FramebufferBlendFragmentShader>;
241  RenderPipelineHandle<FramebufferBlendVertexShader,
242  FramebufferBlendFragmentShader>;
244  RenderPipelineHandle<FramebufferBlendVertexShader,
245  FramebufferBlendFragmentShader>;
247  RenderPipelineHandle<FramebufferBlendVertexShader,
248  FramebufferBlendFragmentShader>;
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.
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.
291  /// Draw the stencil for the EvenOdd fill path rule.
292  ///
293  /// The stencil ref should always be 0 on commands using this mode.
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.
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.
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.
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.
330  };
331 
339  bool depth_write_enabled = false;
340  bool wireframe = 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 
366 };
367 
368 class Tessellator;
369 class RenderTargetCache;
370 
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 
379 
380  bool IsValid() const;
381 
382  Tessellator& GetTessellator() const;
383 
385  return GetPipeline(fast_gradient_pipelines_, opts);
386  }
387 
389  return GetPipeline(linear_gradient_fill_pipelines_, opts);
390  }
391 
393  ContentContextOptions opts) const {
394  return GetPipeline(linear_gradient_uniform_fill_pipelines_, opts);
395  }
396 
398  ContentContextOptions opts) const {
399  return GetPipeline(radial_gradient_uniform_fill_pipelines_, opts);
400  }
401 
403  ContentContextOptions opts) const {
404  return GetPipeline(conical_gradient_uniform_fill_pipelines_, opts);
405  }
406 
408  ContentContextOptions opts) const {
409  return GetPipeline(sweep_gradient_uniform_fill_pipelines_, opts);
410  }
411 
413  ContentContextOptions opts) const {
414  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
415  return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
416  }
417 
419  ContentContextOptions opts) const {
420  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
421  return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
422  }
423 
425  ContentContextOptions opts) const {
426  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
427  return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
428  }
429 
431  ContentContextOptions opts) const {
432  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
433  return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
434  }
435 
437  return GetPipeline(radial_gradient_fill_pipelines_, opts);
438  }
439 
441  return GetPipeline(conical_gradient_fill_pipelines_, opts);
442  }
443 
445  return GetPipeline(rrect_blur_pipelines_, opts);
446  }
447 
449  return GetPipeline(sweep_gradient_fill_pipelines_, opts);
450  }
451 
453  return GetPipeline(solid_fill_pipelines_, opts);
454  }
455 
457  return GetPipeline(texture_pipelines_, opts);
458  }
459 
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() ==
474  return GetPipeline(tiled_texture_external_pipelines_, opts);
475  }
476 
477  PipelineRef GetTiledTextureUvExternalPipeline(
478  ContentContextOptions opts) const {
479  FML_DCHECK(GetContext()->GetBackendType() ==
481  return GetPipeline(tiled_texture_uv_external_pipelines_, opts);
482  }
483 #endif // IMPELLER_ENABLE_OPENGLES
484 
486  return GetPipeline(tiled_texture_pipelines_, opts);
487  }
488 
490  return GetPipeline(gaussian_blur_pipelines_, opts);
491  }
492 
494  return GetPipeline(border_mask_blur_pipelines_, opts);
495  }
496 
498  return GetPipeline(morphology_filter_pipelines_, opts);
499  }
500 
502  ContentContextOptions opts) const {
503  return GetPipeline(color_matrix_color_filter_pipelines_, opts);
504  }
505 
507  return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
508  }
509 
511  return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
512  }
513 
515  return GetPipeline(clip_pipelines_, opts);
516  }
517 
519  return GetPipeline(glyph_atlas_pipelines_, opts);
520  }
521 
523  return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
524  }
525 
526  // Porter-Duff combined blends.
528  ContentContextOptions opts) const {
529  switch (mode) {
530  case BlendMode::kClear:
531  return GetClearBlendPipeline(opts);
532  case BlendMode::kSource:
533  return GetSourceBlendPipeline(opts);
535  return GetDestinationBlendPipeline(opts);
537  return GetSourceOverBlendPipeline(opts);
539  return GetDestinationOverBlendPipeline(opts);
541  return GetSourceInBlendPipeline(opts);
543  return GetDestinationInBlendPipeline(opts);
545  return GetSourceOutBlendPipeline(opts);
547  return GetDestinationOutBlendPipeline(opts);
549  return GetSourceATopBlendPipeline(opts);
551  return GetDestinationATopBlendPipeline(opts);
552  case BlendMode::kXor:
553  return GetXorBlendPipeline(opts);
554  case BlendMode::kPlus:
555  return GetPlusBlendPipeline(opts);
557  return GetModulateBlendPipeline(opts);
558  case BlendMode::kScreen:
559  return GetScreenBlendPipeline(opts);
560  case BlendMode::kOverlay:
561  case BlendMode::kDarken:
562  case BlendMode::kLighten:
570  case BlendMode::kHue:
572  case BlendMode::kColor:
574  VALIDATION_LOG << "Invalid porter duff blend mode "
575  << BlendModeToString(mode);
576  return GetClearBlendPipeline(opts);
577  break;
578  }
579  }
580 
582  return GetPipeline(clear_blend_pipelines_, opts);
583  }
584 
586  return GetPipeline(source_blend_pipelines_, opts);
587  }
588 
590  return GetPipeline(destination_blend_pipelines_, opts);
591  }
592 
594  return GetPipeline(source_over_blend_pipelines_, opts);
595  }
596 
598  ContentContextOptions opts) const {
599  return GetPipeline(destination_over_blend_pipelines_, opts);
600  }
601 
603  return GetPipeline(source_in_blend_pipelines_, opts);
604  }
605 
607  return GetPipeline(destination_in_blend_pipelines_, opts);
608  }
609 
611  return GetPipeline(source_out_blend_pipelines_, opts);
612  }
613 
615  return GetPipeline(destination_out_blend_pipelines_, opts);
616  }
617 
619  return GetPipeline(source_a_top_blend_pipelines_, opts);
620  }
621 
623  ContentContextOptions opts) const {
624  return GetPipeline(destination_a_top_blend_pipelines_, opts);
625  }
626 
628  return GetPipeline(xor_blend_pipelines_, opts);
629  }
630 
632  return GetPipeline(plus_blend_pipelines_, opts);
633  }
634 
636  return GetPipeline(modulate_blend_pipelines_, opts);
637  }
638 
640  return GetPipeline(screen_blend_pipelines_, opts);
641  }
642 
643  // Advanced blends.
644 
646  return GetPipeline(blend_color_pipelines_, opts);
647  }
648 
650  return GetPipeline(blend_colorburn_pipelines_, opts);
651  }
652 
654  return GetPipeline(blend_colordodge_pipelines_, opts);
655  }
656 
658  return GetPipeline(blend_darken_pipelines_, opts);
659  }
660 
662  return GetPipeline(blend_difference_pipelines_, opts);
663  }
664 
666  return GetPipeline(blend_exclusion_pipelines_, opts);
667  }
668 
670  return GetPipeline(blend_hardlight_pipelines_, opts);
671  }
672 
674  return GetPipeline(blend_hue_pipelines_, opts);
675  }
676 
678  return GetPipeline(blend_lighten_pipelines_, opts);
679  }
680 
682  return GetPipeline(blend_luminosity_pipelines_, opts);
683  }
684 
686  return GetPipeline(blend_multiply_pipelines_, opts);
687  }
688 
690  return GetPipeline(blend_overlay_pipelines_, opts);
691  }
692 
694  return GetPipeline(blend_saturation_pipelines_, opts);
695  }
696 
698  return GetPipeline(blend_screen_pipelines_, opts);
699  }
700 
702  return GetPipeline(blend_softlight_pipelines_, opts);
703  }
704 
706  return GetPipeline(texture_downsample_pipelines_, opts);
707  }
708 
709  // Framebuffer Advanced Blends
711  ContentContextOptions opts) const {
712  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
713  return GetPipeline(framebuffer_blend_color_pipelines_, opts);
714  }
715 
717  ContentContextOptions opts) const {
718  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
719  return GetPipeline(framebuffer_blend_colorburn_pipelines_, opts);
720  }
721 
723  ContentContextOptions opts) const {
724  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
725  return GetPipeline(framebuffer_blend_colordodge_pipelines_, opts);
726  }
727 
729  ContentContextOptions opts) const {
730  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
731  return GetPipeline(framebuffer_blend_darken_pipelines_, opts);
732  }
733 
735  ContentContextOptions opts) const {
736  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
737  return GetPipeline(framebuffer_blend_difference_pipelines_, opts);
738  }
739 
741  ContentContextOptions opts) const {
742  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
743  return GetPipeline(framebuffer_blend_exclusion_pipelines_, opts);
744  }
745 
747  ContentContextOptions opts) const {
748  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
749  return GetPipeline(framebuffer_blend_hardlight_pipelines_, opts);
750  }
751 
753  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
754  return GetPipeline(framebuffer_blend_hue_pipelines_, opts);
755  }
756 
758  ContentContextOptions opts) const {
759  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
760  return GetPipeline(framebuffer_blend_lighten_pipelines_, opts);
761  }
762 
764  ContentContextOptions opts) const {
765  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
766  return GetPipeline(framebuffer_blend_luminosity_pipelines_, opts);
767  }
768 
770  ContentContextOptions opts) const {
771  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
772  return GetPipeline(framebuffer_blend_multiply_pipelines_, opts);
773  }
774 
776  ContentContextOptions opts) const {
777  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
778  return GetPipeline(framebuffer_blend_overlay_pipelines_, opts);
779  }
780 
782  ContentContextOptions opts) const {
783  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
784  return GetPipeline(framebuffer_blend_saturation_pipelines_, opts);
785  }
786 
788  ContentContextOptions opts) const {
789  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
790  return GetPipeline(framebuffer_blend_screen_pipelines_, opts);
791  }
792 
794  ContentContextOptions opts) const {
795  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
796  return GetPipeline(framebuffer_blend_softlight_pipelines_, opts);
797  }
798 
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 
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.
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.
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_
PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorDodgePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
std::shared_ptr< Texture > GetEmptyTexture() const
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFastGradientPipeline(ContentContextOptions opts) const
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() const
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
PipelineRef GetSolidFillPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientFillPipeline(ContentContextOptions opts) const
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...
const Capabilities & GetDeviceCapabilities() const
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetBlendSoftLightPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetTextureStrictSrcPipeline(ContentContextOptions opts) const
PipelineRef GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
PipelineRef GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorBurnPipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetLinearGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
PipelineRef GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetRadialGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetDrawVerticesUberShader(ContentContextOptions opts) const
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const
void SetWireframe(bool wireframe)
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
PipelineRef GetRadialGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
PipelineRef GetBlendSaturationPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
PipelineRef GetMorphologyFilterPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
PipelineRef GetBlendDifferencePipeline(ContentContextOptions opts) const
PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBlendHuePipeline(ContentContextOptions opts) const
PipelineRef GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const
PipelineRef GetClipPipeline(ContentContextOptions opts) const
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBlendScreenPipeline(ContentContextOptions opts) const
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
PipelineRef GetBlendDarkenPipeline(ContentContextOptions opts) const
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
PipelineRef GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
PipelineRef GetBlendOverlayPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
Tessellator & GetTessellator() const
PipelineRef GetBlendLightenPipeline(ContentContextOptions opts) const
PipelineRef GetBlendMultiplyPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBlendExclusionPipeline(ContentContextOptions opts) const
PipelineRef GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
std::shared_ptr< Context > GetContext() const
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBorderMaskBlurPipeline(ContentContextOptions opts) const
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition: tessellator.h:34
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:86
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
CompareFunction
Definition: formats.h:552
@ kAlways
Comparison test passes always passes.
BlendMode
Definition: color.h:58
SampleCount
Definition: formats.h:295
constexpr bool operator()(const RuntimeEffectPipelineKey &lhs, const RuntimeEffectPipelineKey &rhs) const
std::size_t operator()(const RuntimeEffectPipelineKey &key) const
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
constexpr uint64_t ToKey() const
#define VALIDATION_LOG
Definition: validation.h:91