Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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/build_config.h"
14#include "flutter/fml/logging.h"
15#include "flutter/fml/status_or.h"
26
27#ifdef IMPELLER_DEBUG
28#include "impeller/entity/checkerboard.frag.h"
29#include "impeller/entity/checkerboard.vert.h"
30#endif // IMPELLER_DEBUG
31
32#include "impeller/entity/border_mask_blur.frag.h"
33#include "impeller/entity/clip.frag.h"
34#include "impeller/entity/clip.vert.h"
35#include "impeller/entity/color_matrix_color_filter.frag.h"
36#include "impeller/entity/conical_gradient_fill.frag.h"
37#include "impeller/entity/filter_position.vert.h"
38#include "impeller/entity/filter_position_uv.vert.h"
39#include "impeller/entity/gaussian.frag.h"
40#include "impeller/entity/glyph_atlas.frag.h"
41#include "impeller/entity/glyph_atlas.vert.h"
42#include "impeller/entity/gradient_fill.vert.h"
43#include "impeller/entity/linear_gradient_fill.frag.h"
44#include "impeller/entity/linear_to_srgb_filter.frag.h"
45#include "impeller/entity/morphology_filter.frag.h"
46#include "impeller/entity/porter_duff_blend.frag.h"
47#include "impeller/entity/porter_duff_blend.vert.h"
48#include "impeller/entity/radial_gradient_fill.frag.h"
49#include "impeller/entity/rrect_blur.frag.h"
50#include "impeller/entity/rrect_blur.vert.h"
51#include "impeller/entity/solid_fill.frag.h"
52#include "impeller/entity/solid_fill.vert.h"
53#include "impeller/entity/srgb_to_linear_filter.frag.h"
54#include "impeller/entity/sweep_gradient_fill.frag.h"
55#include "impeller/entity/texture_fill.frag.h"
56#include "impeller/entity/texture_fill.vert.h"
57#include "impeller/entity/texture_fill_strict_src.frag.h"
58#include "impeller/entity/texture_uv_fill.vert.h"
59#include "impeller/entity/tiled_texture_fill.frag.h"
60#include "impeller/entity/yuv_to_rgb_filter.frag.h"
61
63
64#include "impeller/entity/conical_gradient_ssbo_fill.frag.h"
65#include "impeller/entity/linear_gradient_ssbo_fill.frag.h"
66#include "impeller/entity/radial_gradient_ssbo_fill.frag.h"
67#include "impeller/entity/sweep_gradient_ssbo_fill.frag.h"
68
69#include "impeller/entity/advanced_blend.frag.h"
70#include "impeller/entity/advanced_blend.vert.h"
71
72#include "impeller/entity/framebuffer_blend.frag.h"
73#include "impeller/entity/framebuffer_blend.vert.h"
74
75#include "impeller/entity/vertices_uber.frag.h"
76
77#ifdef IMPELLER_ENABLE_OPENGLES
78#include "impeller/entity/tiled_texture_fill_external.frag.h"
79#endif // IMPELLER_ENABLE_OPENGLES
80
81#if IMPELLER_ENABLE_3D
82#include "impeller/scene/scene_context.h" // nogncheck
83#endif
84
85namespace impeller {
86
87#ifdef IMPELLER_DEBUG
88using CheckerboardPipeline =
89 RenderPipelineHandle<CheckerboardVertexShader, CheckerboardFragmentShader>;
90#endif // IMPELLER_DEBUG
91
93 RenderPipelineHandle<GradientFillVertexShader,
94 LinearGradientFillFragmentShader>;
98 RenderPipelineHandle<GradientFillVertexShader,
99 RadialGradientFillFragmentShader>;
101 RenderPipelineHandle<GradientFillVertexShader,
102 ConicalGradientFillFragmentShader>;
104 RenderPipelineHandle<GradientFillVertexShader,
105 SweepGradientFillFragmentShader>;
107 RenderPipelineHandle<GradientFillVertexShader,
108 LinearGradientSsboFillFragmentShader>;
110 RenderPipelineHandle<GradientFillVertexShader,
111 ConicalGradientSsboFillFragmentShader>;
113 RenderPipelineHandle<GradientFillVertexShader,
114 RadialGradientSsboFillFragmentShader>;
116 RenderPipelineHandle<GradientFillVertexShader,
117 SweepGradientSsboFillFragmentShader>;
123 RenderPipelineHandle<TextureFillVertexShader,
124 TextureFillStrictSrcFragmentShader>;
126 RenderPipelineHandle<TextureUvFillVertexShader,
127 TiledTextureFillFragmentShader>;
131 RenderPipelineHandle<FilterPositionUvVertexShader,
132 BorderMaskBlurFragmentShader>;
134 RenderPipelineHandle<FilterPositionUvVertexShader,
135 MorphologyFilterFragmentShader>;
137 RenderPipelineHandle<FilterPositionVertexShader,
138 ColorMatrixColorFilterFragmentShader>;
140 RenderPipelineHandle<FilterPositionVertexShader,
141 LinearToSrgbFilterFragmentShader>;
143 RenderPipelineHandle<FilterPositionVertexShader,
144 SrgbToLinearFilterFragmentShader>;
146 RenderPipelineHandle<FilterPositionVertexShader,
147 YuvToRgbFilterFragmentShader>;
148
151
153 RenderPipelineHandle<PorterDuffBlendVertexShader,
154 PorterDuffBlendFragmentShader>;
156
157// Advanced blends
158using BlendColorPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
159 AdvancedBlendFragmentShader>;
161 RenderPipelineHandle<AdvancedBlendVertexShader,
162 AdvancedBlendFragmentShader>;
164 RenderPipelineHandle<AdvancedBlendVertexShader,
165 AdvancedBlendFragmentShader>;
166using BlendDarkenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
167 AdvancedBlendFragmentShader>;
169 RenderPipelineHandle<AdvancedBlendVertexShader,
170 AdvancedBlendFragmentShader>;
172 RenderPipelineHandle<AdvancedBlendVertexShader,
173 AdvancedBlendFragmentShader>;
175 RenderPipelineHandle<AdvancedBlendVertexShader,
176 AdvancedBlendFragmentShader>;
177using BlendHuePipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
178 AdvancedBlendFragmentShader>;
179using BlendLightenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
180 AdvancedBlendFragmentShader>;
182 RenderPipelineHandle<AdvancedBlendVertexShader,
183 AdvancedBlendFragmentShader>;
184using BlendMultiplyPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
185 AdvancedBlendFragmentShader>;
186using BlendOverlayPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
187 AdvancedBlendFragmentShader>;
189 RenderPipelineHandle<AdvancedBlendVertexShader,
190 AdvancedBlendFragmentShader>;
191using BlendScreenPipeline = RenderPipelineHandle<AdvancedBlendVertexShader,
192 AdvancedBlendFragmentShader>;
194 RenderPipelineHandle<AdvancedBlendVertexShader,
195 AdvancedBlendFragmentShader>;
196// Framebuffer Advanced Blends
198 RenderPipelineHandle<FramebufferBlendVertexShader,
199 FramebufferBlendFragmentShader>;
201 RenderPipelineHandle<FramebufferBlendVertexShader,
202 FramebufferBlendFragmentShader>;
204 RenderPipelineHandle<FramebufferBlendVertexShader,
205 FramebufferBlendFragmentShader>;
207 RenderPipelineHandle<FramebufferBlendVertexShader,
208 FramebufferBlendFragmentShader>;
210 RenderPipelineHandle<FramebufferBlendVertexShader,
211 FramebufferBlendFragmentShader>;
213 RenderPipelineHandle<FramebufferBlendVertexShader,
214 FramebufferBlendFragmentShader>;
216 RenderPipelineHandle<FramebufferBlendVertexShader,
217 FramebufferBlendFragmentShader>;
219 RenderPipelineHandle<FramebufferBlendVertexShader,
220 FramebufferBlendFragmentShader>;
222 RenderPipelineHandle<FramebufferBlendVertexShader,
223 FramebufferBlendFragmentShader>;
225 RenderPipelineHandle<FramebufferBlendVertexShader,
226 FramebufferBlendFragmentShader>;
228 RenderPipelineHandle<FramebufferBlendVertexShader,
229 FramebufferBlendFragmentShader>;
231 RenderPipelineHandle<FramebufferBlendVertexShader,
232 FramebufferBlendFragmentShader>;
234 RenderPipelineHandle<FramebufferBlendVertexShader,
235 FramebufferBlendFragmentShader>;
237 RenderPipelineHandle<FramebufferBlendVertexShader,
238 FramebufferBlendFragmentShader>;
240 RenderPipelineHandle<FramebufferBlendVertexShader,
241 FramebufferBlendFragmentShader>;
242
243/// Draw Vertices/Atlas Uber Shader
244using VerticesUberShader = RenderPipelineHandle<PorterDuffBlendVertexShader,
245 VerticesUberFragmentShader>;
246
247#ifdef IMPELLER_ENABLE_OPENGLES
248using TiledTextureExternalPipeline =
249 RenderPipelineHandle<TextureUvFillVertexShader,
250 TiledTextureFillExternalFragmentShader>;
251#endif // IMPELLER_ENABLE_OPENGLES
252
253/// Pipeline state configuration.
254///
255/// Each unique combination of these options requires a different pipeline state
256/// object to be built. This struct is used as a key for the per-pipeline
257/// variant cache.
258///
259/// When adding fields to this key, reliant features should take care to limit
260/// the combinatorical explosion of variations. A sufficiently complicated
261/// Flutter application may easily require building hundreds of PSOs in total,
262/// but they shouldn't require e.g. 10s of thousands.
264 enum class StencilMode : uint8_t {
265 /// Turn the stencil test off. Used when drawing without stencil-then-cover
266 /// or overdraw prevention.
267 kIgnore,
268
269 // Operations used for stencil-then-cover.
270
271 /// Draw the stencil for the NonZero fill path rule.
272 ///
273 /// The stencil ref should always be 0 on commands using this mode.
275 /// Draw the stencil for the EvenOdd fill path rule.
276 ///
277 /// The stencil ref should always be 0 on commands using this mode.
279 /// Used for draw calls which fill in the stenciled area. Intended to be
280 /// used after `kStencilNonZeroFill` or `kStencilEvenOddFill` is used to set
281 /// up the stencil buffer. Also cleans up the stencil buffer by resetting
282 /// everything to zero.
283 ///
284 /// The stencil ref should always be 0 on commands using this mode.
286 /// The opposite of `kCoverCompare`. Used for draw calls which fill in the
287 /// non-stenciled area (intersection clips). Intended to be used after
288 /// `kStencilNonZeroFill` or `kStencilEvenOddFill` is used to set up the
289 /// stencil buffer. Also cleans up the stencil buffer by resetting
290 /// everything to zero.
291 ///
292 /// The stencil ref should always be 0 on commands using this mode.
294
295 // Operations used for the "overdraw prevention" mechanism. This is used for
296 // drawing strokes.
297
298 /// For each fragment, increment the stencil value if it's currently zero.
299 /// Discard fragments when the value is non-zero. This prevents
300 /// self-overlapping strokes from drawing over themselves.
301 ///
302 /// Note that this is done for rendering correctness, not performance. If a
303 /// stroke is drawn with a backdrop-reliant blend and self-intersects, then
304 /// the intersected geometry will render incorrectly when overdrawn because
305 /// we don't adjust the geometry prevent self-intersection.
306 ///
307 /// The stencil ref should always be 0 on commands using this mode.
309 /// Reset the stencil to a new maximum value specified by the ref (currently
310 /// always 0).
311 ///
312 /// The stencil ref should always be 0 on commands using this mode.
314 };
315
324 bool wireframe = false;
326
327 struct Hash {
328 constexpr uint64_t operator()(const ContentContextOptions& o) const {
329 static_assert(sizeof(o.sample_count) == 1);
330 static_assert(sizeof(o.blend_mode) == 1);
331 static_assert(sizeof(o.sample_count) == 1);
332 static_assert(sizeof(o.depth_compare) == 1);
333 static_assert(sizeof(o.stencil_mode) == 1);
334 static_assert(sizeof(o.primitive_type) == 1);
335 static_assert(sizeof(o.color_attachment_pixel_format) == 1);
336
337 return (o.is_for_rrect_blur_clear ? 1llu : 0llu) << 0 |
338 (o.wireframe ? 1llu : 0llu) << 1 |
339 (o.has_depth_stencil_attachments ? 1llu : 0llu) << 2 |
340 (o.depth_write_enabled ? 1llu : 0llu) << 3 |
341 // enums
342 static_cast<uint64_t>(o.color_attachment_pixel_format) << 8 |
343 static_cast<uint64_t>(o.primitive_type) << 16 |
344 static_cast<uint64_t>(o.stencil_mode) << 24 |
345 static_cast<uint64_t>(o.depth_compare) << 32 |
346 static_cast<uint64_t>(o.blend_mode) << 40 |
347 static_cast<uint64_t>(o.sample_count) << 48;
348 }
349 };
350
351 struct Equal {
352 constexpr bool operator()(const ContentContextOptions& lhs,
353 const ContentContextOptions& rhs) const {
354 return lhs.sample_count == rhs.sample_count &&
355 lhs.blend_mode == rhs.blend_mode &&
357 lhs.depth_compare == rhs.depth_compare &&
358 lhs.stencil_mode == rhs.stencil_mode &&
359 lhs.primitive_type == rhs.primitive_type &&
364 lhs.wireframe == rhs.wireframe &&
366 }
367 };
368
370};
371
372class Tessellator;
373class RenderTargetCache;
374
376 public:
377 explicit ContentContext(
378 std::shared_ptr<Context> context,
379 std::shared_ptr<TypographerContext> typographer_context,
380 std::shared_ptr<RenderTargetAllocator> render_target_allocator = nullptr);
381
383
384 bool IsValid() const;
385
386#if IMPELLER_ENABLE_3D
387 std::shared_ptr<scene::SceneContext> GetSceneContext() const;
388#endif // IMPELLER_ENABLE_3D
389
390 std::shared_ptr<Tessellator> GetTessellator() const;
391
392#ifdef IMPELLER_DEBUG
393 std::shared_ptr<Pipeline<PipelineDescriptor>> GetCheckerboardPipeline(
394 ContentContextOptions opts) const {
395 return GetPipeline(checkerboard_pipelines_, opts);
396 }
397#endif // IMPELLER_DEBUG
398
399 std::shared_ptr<Pipeline<PipelineDescriptor>> GetLinearGradientFillPipeline(
400 ContentContextOptions opts) const {
401 return GetPipeline(linear_gradient_fill_pipelines_, opts);
402 }
403
404 std::shared_ptr<Pipeline<PipelineDescriptor>>
406 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
407 return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
408 }
409
410 std::shared_ptr<Pipeline<PipelineDescriptor>>
412 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
413 return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
414 }
415
416 std::shared_ptr<Pipeline<PipelineDescriptor>>
418 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
419 return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
420 }
421
422 std::shared_ptr<Pipeline<PipelineDescriptor>>
424 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
425 return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
426 }
427
428 std::shared_ptr<Pipeline<PipelineDescriptor>> GetRadialGradientFillPipeline(
429 ContentContextOptions opts) const {
430 return GetPipeline(radial_gradient_fill_pipelines_, opts);
431 }
432
433 std::shared_ptr<Pipeline<PipelineDescriptor>> GetConicalGradientFillPipeline(
434 ContentContextOptions opts) const {
435 return GetPipeline(conical_gradient_fill_pipelines_, opts);
436 }
437
438 std::shared_ptr<Pipeline<PipelineDescriptor>> GetRRectBlurPipeline(
439 ContentContextOptions opts) const {
440 return GetPipeline(rrect_blur_pipelines_, opts);
441 }
442
443 std::shared_ptr<Pipeline<PipelineDescriptor>> GetSweepGradientFillPipeline(
444 ContentContextOptions opts) const {
445 return GetPipeline(sweep_gradient_fill_pipelines_, opts);
446 }
447
448 std::shared_ptr<Pipeline<PipelineDescriptor>> GetSolidFillPipeline(
449 ContentContextOptions opts) const {
450 return GetPipeline(solid_fill_pipelines_, opts);
451 }
452
453 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTexturePipeline(
454 ContentContextOptions opts) const {
455 return GetPipeline(texture_pipelines_, opts);
456 }
457
458 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTextureStrictSrcPipeline(
459 ContentContextOptions opts) const {
460 return GetPipeline(texture_strict_src_pipelines_, opts);
461 }
462
463#ifdef IMPELLER_ENABLE_OPENGLES
464 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTiledTextureExternalPipeline(
465 ContentContextOptions opts) const {
466 FML_DCHECK(GetContext()->GetBackendType() ==
468 return GetPipeline(tiled_texture_external_pipelines_, opts);
469 }
470#endif // IMPELLER_ENABLE_OPENGLES
471
472 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTiledTexturePipeline(
473 ContentContextOptions opts) const {
474 return GetPipeline(tiled_texture_pipelines_, opts);
475 }
476
477 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGaussianBlurPipeline(
478 ContentContextOptions opts) const {
479 return GetPipeline(gaussian_blur_pipelines_, opts);
480 }
481
482 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBorderMaskBlurPipeline(
483 ContentContextOptions opts) const {
484 return GetPipeline(border_mask_blur_pipelines_, opts);
485 }
486
487 std::shared_ptr<Pipeline<PipelineDescriptor>> GetMorphologyFilterPipeline(
488 ContentContextOptions opts) const {
489 return GetPipeline(morphology_filter_pipelines_, opts);
490 }
491
492 std::shared_ptr<Pipeline<PipelineDescriptor>>
494 return GetPipeline(color_matrix_color_filter_pipelines_, opts);
495 }
496
497 std::shared_ptr<Pipeline<PipelineDescriptor>> GetLinearToSrgbFilterPipeline(
498 ContentContextOptions opts) const {
499 return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
500 }
501
502 std::shared_ptr<Pipeline<PipelineDescriptor>> GetSrgbToLinearFilterPipeline(
503 ContentContextOptions opts) const {
504 return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
505 }
506
507 std::shared_ptr<Pipeline<PipelineDescriptor>> GetClipPipeline(
508 ContentContextOptions opts) const {
509 return GetPipeline(clip_pipelines_, opts);
510 }
511
512 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGlyphAtlasPipeline(
513 ContentContextOptions opts) const {
514 return GetPipeline(glyph_atlas_pipelines_, opts);
515 }
516
517 std::shared_ptr<Pipeline<PipelineDescriptor>> GetYUVToRGBFilterPipeline(
518 ContentContextOptions opts) const {
519 return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
520 }
521
522 std::shared_ptr<Pipeline<PipelineDescriptor>> GetPorterDuffBlendPipeline(
523 ContentContextOptions opts) const {
524 return GetPipeline(porter_duff_blend_pipelines_, opts);
525 }
526
527 // Advanced blends.
528
529 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendColorPipeline(
530 ContentContextOptions opts) const {
531 return GetPipeline(blend_color_pipelines_, opts);
532 }
533
534 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendColorBurnPipeline(
535 ContentContextOptions opts) const {
536 return GetPipeline(blend_colorburn_pipelines_, opts);
537 }
538
539 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendColorDodgePipeline(
540 ContentContextOptions opts) const {
541 return GetPipeline(blend_colordodge_pipelines_, opts);
542 }
543
544 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendDarkenPipeline(
545 ContentContextOptions opts) const {
546 return GetPipeline(blend_darken_pipelines_, opts);
547 }
548
549 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendDifferencePipeline(
550 ContentContextOptions opts) const {
551 return GetPipeline(blend_difference_pipelines_, opts);
552 }
553
554 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendExclusionPipeline(
555 ContentContextOptions opts) const {
556 return GetPipeline(blend_exclusion_pipelines_, opts);
557 }
558
559 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendHardLightPipeline(
560 ContentContextOptions opts) const {
561 return GetPipeline(blend_hardlight_pipelines_, opts);
562 }
563
564 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendHuePipeline(
565 ContentContextOptions opts) const {
566 return GetPipeline(blend_hue_pipelines_, opts);
567 }
568
569 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendLightenPipeline(
570 ContentContextOptions opts) const {
571 return GetPipeline(blend_lighten_pipelines_, opts);
572 }
573
574 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendLuminosityPipeline(
575 ContentContextOptions opts) const {
576 return GetPipeline(blend_luminosity_pipelines_, opts);
577 }
578
579 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendMultiplyPipeline(
580 ContentContextOptions opts) const {
581 return GetPipeline(blend_multiply_pipelines_, opts);
582 }
583
584 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendOverlayPipeline(
585 ContentContextOptions opts) const {
586 return GetPipeline(blend_overlay_pipelines_, opts);
587 }
588
589 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendSaturationPipeline(
590 ContentContextOptions opts) const {
591 return GetPipeline(blend_saturation_pipelines_, opts);
592 }
593
594 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendScreenPipeline(
595 ContentContextOptions opts) const {
596 return GetPipeline(blend_screen_pipelines_, opts);
597 }
598
599 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendSoftLightPipeline(
600 ContentContextOptions opts) const {
601 return GetPipeline(blend_softlight_pipelines_, opts);
602 }
603
604 // Framebuffer Advanced Blends
605 std::shared_ptr<Pipeline<PipelineDescriptor>>
607 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
608 return GetPipeline(framebuffer_blend_color_pipelines_, opts);
609 }
610
611 std::shared_ptr<Pipeline<PipelineDescriptor>>
613 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
614 return GetPipeline(framebuffer_blend_colorburn_pipelines_, opts);
615 }
616
617 std::shared_ptr<Pipeline<PipelineDescriptor>>
619 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
620 return GetPipeline(framebuffer_blend_colordodge_pipelines_, opts);
621 }
622
623 std::shared_ptr<Pipeline<PipelineDescriptor>>
625 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
626 return GetPipeline(framebuffer_blend_darken_pipelines_, opts);
627 }
628
629 std::shared_ptr<Pipeline<PipelineDescriptor>>
631 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
632 return GetPipeline(framebuffer_blend_difference_pipelines_, opts);
633 }
634
635 std::shared_ptr<Pipeline<PipelineDescriptor>>
637 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
638 return GetPipeline(framebuffer_blend_exclusion_pipelines_, opts);
639 }
640
641 std::shared_ptr<Pipeline<PipelineDescriptor>>
643 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
644 return GetPipeline(framebuffer_blend_hardlight_pipelines_, opts);
645 }
646
647 std::shared_ptr<Pipeline<PipelineDescriptor>> GetFramebufferBlendHuePipeline(
648 ContentContextOptions opts) const {
649 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
650 return GetPipeline(framebuffer_blend_hue_pipelines_, opts);
651 }
652
653 std::shared_ptr<Pipeline<PipelineDescriptor>>
655 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
656 return GetPipeline(framebuffer_blend_lighten_pipelines_, opts);
657 }
658
659 std::shared_ptr<Pipeline<PipelineDescriptor>>
661 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
662 return GetPipeline(framebuffer_blend_luminosity_pipelines_, opts);
663 }
664
665 std::shared_ptr<Pipeline<PipelineDescriptor>>
667 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
668 return GetPipeline(framebuffer_blend_multiply_pipelines_, opts);
669 }
670
671 std::shared_ptr<Pipeline<PipelineDescriptor>>
673 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
674 return GetPipeline(framebuffer_blend_overlay_pipelines_, opts);
675 }
676
677 std::shared_ptr<Pipeline<PipelineDescriptor>>
679 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
680 return GetPipeline(framebuffer_blend_saturation_pipelines_, opts);
681 }
682
683 std::shared_ptr<Pipeline<PipelineDescriptor>>
685 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
686 return GetPipeline(framebuffer_blend_screen_pipelines_, opts);
687 }
688
689 std::shared_ptr<Pipeline<PipelineDescriptor>>
691 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
692 return GetPipeline(framebuffer_blend_softlight_pipelines_, opts);
693 }
694
695 std::shared_ptr<Pipeline<PipelineDescriptor>> GetDrawVerticesUberShader(
696 ContentContextOptions opts) const {
697 return GetPipeline(vertices_uber_shader_, opts);
698 }
699
700 // An empty 1x1 texture for binding drawVertices/drawAtlas or other cases
701 // that don't always have a texture (due to blending).
702 std::shared_ptr<Texture> GetEmptyTexture() const;
703
704 std::shared_ptr<Context> GetContext() const;
705
706 const Capabilities& GetDeviceCapabilities() const;
707
708 void SetWireframe(bool wireframe);
709
711 std::function<bool(const ContentContext&, RenderPass&)>;
712
713 /// @brief Creates a new texture of size `texture_size` and calls
714 /// `subpass_callback` with a `RenderPass` for drawing to the texture.
716 std::string_view label,
717 ISize texture_size,
718 const std::shared_ptr<CommandBuffer>& command_buffer,
719 const SubpassCallback& subpass_callback,
720 bool msaa_enabled = true,
721 bool depth_stencil_enabled = false,
722 int32_t mip_count = 1) const;
723
724 /// Makes a subpass that will render to `subpass_target`.
726 std::string_view label,
727 const RenderTarget& subpass_target,
728 const std::shared_ptr<CommandBuffer>& command_buffer,
729 const SubpassCallback& subpass_callback) const;
730
731 const std::shared_ptr<LazyGlyphAtlas>& GetLazyGlyphAtlas() const {
732 return lazy_glyph_atlas_;
733 }
734
735 const std::shared_ptr<RenderTargetAllocator>& GetRenderTargetCache() const {
736 return render_target_cache_;
737 }
738
739 /// RuntimeEffect pipelines must be obtained via this method to avoid
740 /// re-creating them every frame.
741 ///
742 /// The unique_entrypoint_name comes from RuntimeEffect::GetEntrypoint.
743 /// Impellerc generates a unique entrypoint name for runtime effect shaders
744 /// based on the input file name and shader stage.
745 ///
746 /// The create_callback is synchronously invoked exactly once if a cached
747 /// pipeline is not found.
748 std::shared_ptr<Pipeline<PipelineDescriptor>> GetCachedRuntimeEffectPipeline(
749 const std::string& unique_entrypoint_name,
751 const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
752 create_callback) const;
753
754 /// Used by hot reload/hot restart to clear a cached pipeline from
755 /// GetCachedRuntimeEffectPipeline.
757 const std::string& unique_entrypoint_name) const;
758
759 /// @brief Retrieve the currnent host buffer for transient storage.
760 ///
761 /// This is only safe to use from the raster threads. Other threads should
762 /// allocate their own device buffers.
763 HostBuffer& GetTransientsBuffer() const { return *host_buffer_; }
764
765 private:
766 std::shared_ptr<Context> context_;
767 std::shared_ptr<LazyGlyphAtlas> lazy_glyph_atlas_;
768
769 /// Run backend specific additional setup and create common shader variants.
770 ///
771 /// This bootstrap is intended to improve the performance of several
772 /// first frame benchmarks that are tracked in the flutter device lab.
773 /// The workload includes initializing commonly used but not default
774 /// shader variants, as well as forcing driver initialization.
775 void InitializeCommonlyUsedShadersIfNeeded() const;
776
777 struct RuntimeEffectPipelineKey {
778 std::string unique_entrypoint_name;
779 ContentContextOptions options;
780
781 struct Hash {
782 std::size_t operator()(const RuntimeEffectPipelineKey& key) const {
783 return fml::HashCombine(key.unique_entrypoint_name,
785 }
786 };
787
788 struct Equal {
789 constexpr bool operator()(const RuntimeEffectPipelineKey& lhs,
790 const RuntimeEffectPipelineKey& rhs) const {
791 return lhs.unique_entrypoint_name == rhs.unique_entrypoint_name &&
792 ContentContextOptions::Equal{}(lhs.options, rhs.options);
793 }
794 };
795 };
796
797 mutable std::unordered_map<RuntimeEffectPipelineKey,
798 std::shared_ptr<Pipeline<PipelineDescriptor>>,
799 RuntimeEffectPipelineKey::Hash,
800 RuntimeEffectPipelineKey::Equal>
801 runtime_effect_pipelines_;
802
803 /// Holds multiple Pipelines associated with the same PipelineHandle types.
804 ///
805 /// For example, it may have multiple
806 /// RenderPipelineHandle<SolidFillVertexShader, SolidFillFragmentShader>
807 /// instances for different blend modes. From them you can access the
808 /// Pipeline.
809 ///
810 /// See also:
811 /// - impeller::ContentContextOptions - options from which variants are
812 /// created.
813 /// - impeller::Pipeline::CreateVariant
814 /// - impeller::RenderPipelineHandle<> - The type of objects this typically
815 /// contains.
816 template <class PipelineHandleT>
817 class Variants {
818 public:
819 Variants() = default;
820
821 void Set(const ContentContextOptions& options,
822 std::unique_ptr<PipelineHandleT> pipeline) {
823 pipelines_[options] = std::move(pipeline);
824 }
825
826 void SetDefault(const ContentContextOptions& options,
827 std::unique_ptr<PipelineHandleT> pipeline) {
828 default_options_ = options;
829 Set(options, std::move(pipeline));
830 }
831
832 void CreateDefault(const Context& context,
833 const ContentContextOptions& options,
834 const std::initializer_list<Scalar>& constants = {}) {
835 auto desc = PipelineHandleT::Builder::MakeDefaultPipelineDescriptor(
836 context, constants);
837 if (!desc.has_value()) {
838 VALIDATION_LOG << "Failed to create default pipeline.";
839 return;
840 }
841 options.ApplyToPipelineDescriptor(*desc);
842 SetDefault(options, std::make_unique<PipelineHandleT>(context, desc));
843 }
844
845 PipelineHandleT* Get(const ContentContextOptions& options) const {
846 if (auto found = pipelines_.find(options); found != pipelines_.end()) {
847 return found->second.get();
848 }
849 return nullptr;
850 }
851
852 PipelineHandleT* GetDefault() const {
853 if (!default_options_.has_value()) {
854 return nullptr;
855 }
856 return Get(default_options_.value());
857 }
858
859 size_t GetPipelineCount() const { return pipelines_.size(); }
860
861 private:
862 std::optional<ContentContextOptions> default_options_;
863 std::unordered_map<ContentContextOptions,
864 std::unique_ptr<PipelineHandleT>,
865 ContentContextOptions::Hash,
866 ContentContextOptions::Equal>
867 pipelines_;
868
869 Variants(const Variants&) = delete;
870
871 Variants& operator=(const Variants&) = delete;
872 };
873
874 // These are mutable because while the prototypes are created eagerly, any
875 // variants requested from that are lazily created and cached in the variants
876 // map.
877
878#ifdef IMPELLER_DEBUG
879 mutable Variants<CheckerboardPipeline> checkerboard_pipelines_;
880#endif // IMPELLER_DEBUG
881
882 mutable Variants<SolidFillPipeline> solid_fill_pipelines_;
883 mutable Variants<LinearGradientFillPipeline> linear_gradient_fill_pipelines_;
884 mutable Variants<RadialGradientFillPipeline> radial_gradient_fill_pipelines_;
885 mutable Variants<ConicalGradientFillPipeline>
886 conical_gradient_fill_pipelines_;
887 mutable Variants<SweepGradientFillPipeline> sweep_gradient_fill_pipelines_;
888 mutable Variants<LinearGradientSSBOFillPipeline>
889 linear_gradient_ssbo_fill_pipelines_;
890 mutable Variants<RadialGradientSSBOFillPipeline>
891 radial_gradient_ssbo_fill_pipelines_;
892 mutable Variants<ConicalGradientSSBOFillPipeline>
893 conical_gradient_ssbo_fill_pipelines_;
894 mutable Variants<SweepGradientSSBOFillPipeline>
895 sweep_gradient_ssbo_fill_pipelines_;
896 mutable Variants<RRectBlurPipeline> rrect_blur_pipelines_;
897 mutable Variants<TexturePipeline> texture_pipelines_;
898 mutable Variants<TextureStrictSrcPipeline> texture_strict_src_pipelines_;
899#ifdef IMPELLER_ENABLE_OPENGLES
900 mutable Variants<TiledTextureExternalPipeline>
901 tiled_texture_external_pipelines_;
902#endif // IMPELLER_ENABLE_OPENGLES
903 mutable Variants<TiledTexturePipeline> tiled_texture_pipelines_;
904 mutable Variants<GaussianBlurPipeline> gaussian_blur_pipelines_;
905 mutable Variants<BorderMaskBlurPipeline> border_mask_blur_pipelines_;
906 mutable Variants<MorphologyFilterPipeline> morphology_filter_pipelines_;
907 mutable Variants<ColorMatrixColorFilterPipeline>
908 color_matrix_color_filter_pipelines_;
909 mutable Variants<LinearToSrgbFilterPipeline> linear_to_srgb_filter_pipelines_;
910 mutable Variants<SrgbToLinearFilterPipeline> srgb_to_linear_filter_pipelines_;
911 mutable Variants<ClipPipeline> clip_pipelines_;
912 mutable Variants<GlyphAtlasPipeline> glyph_atlas_pipelines_;
913 mutable Variants<YUVToRGBFilterPipeline> yuv_to_rgb_filter_pipelines_;
914 mutable Variants<PorterDuffBlendPipeline> porter_duff_blend_pipelines_;
915 // Advanced blends.
916 mutable Variants<BlendColorPipeline> blend_color_pipelines_;
917 mutable Variants<BlendColorBurnPipeline> blend_colorburn_pipelines_;
918 mutable Variants<BlendColorDodgePipeline> blend_colordodge_pipelines_;
919 mutable Variants<BlendDarkenPipeline> blend_darken_pipelines_;
920 mutable Variants<BlendDifferencePipeline> blend_difference_pipelines_;
921 mutable Variants<BlendExclusionPipeline> blend_exclusion_pipelines_;
922 mutable Variants<BlendHardLightPipeline> blend_hardlight_pipelines_;
923 mutable Variants<BlendHuePipeline> blend_hue_pipelines_;
924 mutable Variants<BlendLightenPipeline> blend_lighten_pipelines_;
925 mutable Variants<BlendLuminosityPipeline> blend_luminosity_pipelines_;
926 mutable Variants<BlendMultiplyPipeline> blend_multiply_pipelines_;
927 mutable Variants<BlendOverlayPipeline> blend_overlay_pipelines_;
928 mutable Variants<BlendSaturationPipeline> blend_saturation_pipelines_;
929 mutable Variants<BlendScreenPipeline> blend_screen_pipelines_;
930 mutable Variants<BlendSoftLightPipeline> blend_softlight_pipelines_;
931 // Framebuffer Advanced blends.
932 mutable Variants<FramebufferBlendColorPipeline>
933 framebuffer_blend_color_pipelines_;
934 mutable Variants<FramebufferBlendColorBurnPipeline>
935 framebuffer_blend_colorburn_pipelines_;
936 mutable Variants<FramebufferBlendColorDodgePipeline>
937 framebuffer_blend_colordodge_pipelines_;
938 mutable Variants<FramebufferBlendDarkenPipeline>
939 framebuffer_blend_darken_pipelines_;
940 mutable Variants<FramebufferBlendDifferencePipeline>
941 framebuffer_blend_difference_pipelines_;
942 mutable Variants<FramebufferBlendExclusionPipeline>
943 framebuffer_blend_exclusion_pipelines_;
944 mutable Variants<FramebufferBlendHardLightPipeline>
945 framebuffer_blend_hardlight_pipelines_;
946 mutable Variants<FramebufferBlendHuePipeline>
947 framebuffer_blend_hue_pipelines_;
948 mutable Variants<FramebufferBlendLightenPipeline>
949 framebuffer_blend_lighten_pipelines_;
950 mutable Variants<FramebufferBlendLuminosityPipeline>
951 framebuffer_blend_luminosity_pipelines_;
952 mutable Variants<FramebufferBlendMultiplyPipeline>
953 framebuffer_blend_multiply_pipelines_;
954 mutable Variants<FramebufferBlendOverlayPipeline>
955 framebuffer_blend_overlay_pipelines_;
956 mutable Variants<FramebufferBlendSaturationPipeline>
957 framebuffer_blend_saturation_pipelines_;
958 mutable Variants<FramebufferBlendScreenPipeline>
959 framebuffer_blend_screen_pipelines_;
960 mutable Variants<FramebufferBlendSoftLightPipeline>
961 framebuffer_blend_softlight_pipelines_;
962 mutable Variants<VerticesUberShader> vertices_uber_shader_;
963
964 template <class TypedPipeline>
965 std::shared_ptr<Pipeline<PipelineDescriptor>> GetPipeline(
966 Variants<TypedPipeline>& container,
967 ContentContextOptions opts) const {
968 TypedPipeline* pipeline = CreateIfNeeded(container, opts);
969 if (!pipeline) {
970 return nullptr;
971 }
972 return pipeline->WaitAndGet();
973 }
974
975 template <class RenderPipelineHandleT>
976 RenderPipelineHandleT* CreateIfNeeded(
977 Variants<RenderPipelineHandleT>& container,
978 ContentContextOptions opts) const {
979 if (!IsValid()) {
980 return nullptr;
981 }
982
983 if (wireframe_) {
984 opts.wireframe = true;
985 }
986
987 if (RenderPipelineHandleT* found = container.Get(opts)) {
988 return found;
989 }
990
991 RenderPipelineHandleT* default_handle = container.GetDefault();
992
993 // The default must always be initialized in the constructor.
994 FML_CHECK(default_handle != nullptr);
995
996 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline =
997 default_handle->WaitAndGet();
998 if (!pipeline) {
999 return nullptr;
1000 }
1001
1002 auto variant_future = pipeline->CreateVariant(
1003 [&opts, variants_count =
1004 container.GetPipelineCount()](PipelineDescriptor& desc) {
1005 opts.ApplyToPipelineDescriptor(desc);
1006 desc.SetLabel(
1007 SPrintF("%s V#%zu", desc.GetLabel().c_str(), variants_count));
1008 });
1009 std::unique_ptr<RenderPipelineHandleT> variant =
1010 std::make_unique<RenderPipelineHandleT>(std::move(variant_future));
1011 container.Set(opts, std::move(variant));
1012 return container.Get(opts);
1013 }
1014
1015 bool is_valid_ = false;
1016 std::shared_ptr<Tessellator> tessellator_;
1017#if IMPELLER_ENABLE_3D
1018 std::shared_ptr<scene::SceneContext> scene_context_;
1019#endif // IMPELLER_ENABLE_3D
1020 std::shared_ptr<RenderTargetAllocator> render_target_cache_;
1021 std::shared_ptr<HostBuffer> host_buffer_;
1022 std::shared_ptr<Texture> empty_texture_;
1023 bool wireframe_ = false;
1024
1025 ContentContext(const ContentContext&) = delete;
1026
1027 ContentContext& operator=(const ContentContext&) = delete;
1028};
1029
1030} // namespace impeller
1031
1032#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
const char * options
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetConicalGradientSSBOFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRadialGradientFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendSoftLightPipeline(ContentContextOptions opts) const
std::shared_ptr< Tessellator > GetTessellator() const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
std::shared_ptr< Texture > GetEmptyTexture() const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendScreenPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendSaturationPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBorderMaskBlurPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTiledTexturePipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSweepGradientFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendDarkenPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendOverlayPipeline(ContentContextOptions opts) const
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() 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
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTexturePipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendLuminosityPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGaussianBlurPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendHuePipeline(ContentContextOptions opts) const
void SetWireframe(bool wireframe)
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGlyphAtlasPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor > >()> &create_callback) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetDrawVerticesUberShader(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorBurnPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorDodgePipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendExclusionPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSolidFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetConicalGradientFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendDifferencePipeline(ContentContextOptions opts) const
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendHardLightPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRRectBlurPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetClipPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearGradientFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetMorphologyFilterPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetPorterDuffBlendPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendMultiplyPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTextureStrictSrcPipeline(ContentContextOptions opts) const
std::shared_ptr< Context > GetContext() const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendLightenPipeline(ContentContextOptions opts) const
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition pipeline.h:49
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:33
#define FML_CHECK(condition)
Definition logging.h:85
#define FML_DCHECK(condition)
Definition logging.h:103
const GrXPFactory * Get(SkBlendMode mode)
constexpr std::size_t HashCombine()
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition formats.h:353
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition formats.h:100
CompareFunction
Definition formats.h:534
@ kAlways
Comparison test passes always passes.
BlendMode
Definition color.h:59
constexpr bool operator()(const ContentContextOptions &lhs, const ContentContextOptions &rhs) const
constexpr uint64_t operator()(const ContentContextOptions &o) const
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
constexpr bool operator()(const RuntimeEffectPipelineKey &lhs, const RuntimeEffectPipelineKey &rhs) const
std::size_t operator()(const RuntimeEffectPipelineKey &key) const
#define VALIDATION_LOG
Definition validation.h:73