| 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/build_config.h"
14 #include "flutter/fml/logging.h"
15 #include "flutter/fml/status_or.h"
16 #include "impeller/base/validation.h"
17 #include "impeller/core/formats.h"
18 #include "impeller/entity/entity.h"
19 #include "impeller/renderer/capabilities.h"
20 #include "impeller/renderer/pipeline.h"
21 #include "impeller/renderer/pipeline_descriptor.h"
22 #include "impeller/renderer/render_target.h"
23 #include "impeller/typographer/typographer_context.h"
24
25 #ifdef IMPELLER_DEBUG
26 #include "impeller/entity/checkerboard.frag.h"
27 #include "impeller/entity/checkerboard.vert.h"
28 #endif // IMPELLER_DEBUG
29
30 #include "impeller/entity/blend.frag.h"
31 #include "impeller/entity/blend.vert.h"
32 #include "impeller/entity/border_mask_blur.frag.h"
33 #include "impeller/entity/border_mask_blur.vert.h"
34 #include "impeller/entity/clip.frag.h"
35 #include "impeller/entity/clip.vert.h"
36 #include "impeller/entity/color_matrix_color_filter.frag.h"
37 #include "impeller/entity/color_matrix_color_filter.vert.h"
38 #include "impeller/entity/conical_gradient_fill.frag.h"
39 #include "impeller/entity/glyph_atlas.frag.h"
40 #include "impeller/entity/glyph_atlas.vert.h"
41 #include "impeller/entity/glyph_atlas_color.frag.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/linear_to_srgb_filter.vert.h"
46 #include "impeller/entity/morphology_filter.frag.h"
47 #include "impeller/entity/morphology_filter.vert.h"
48 #include "impeller/entity/points.comp.h"
49 #include "impeller/entity/porter_duff_blend.frag.h"
50 #include "impeller/entity/porter_duff_blend.vert.h"
51 #include "impeller/entity/radial_gradient_fill.frag.h"
52 #include "impeller/entity/rrect_blur.frag.h"
53 #include "impeller/entity/rrect_blur.vert.h"
54 #include "impeller/entity/solid_fill.frag.h"
55 #include "impeller/entity/solid_fill.vert.h"
56 #include "impeller/entity/srgb_to_linear_filter.frag.h"
57 #include "impeller/entity/srgb_to_linear_filter.vert.h"
58 #include "impeller/entity/sweep_gradient_fill.frag.h"
59 #include "impeller/entity/texture_fill.frag.h"
60 #include "impeller/entity/texture_fill.vert.h"
61 #include "impeller/entity/tiled_texture_fill.frag.h"
62 #include "impeller/entity/uv.comp.h"
63 #include "impeller/entity/vertices.frag.h"
64 #include "impeller/entity/yuv_to_rgb_filter.frag.h"
65 #include "impeller/entity/yuv_to_rgb_filter.vert.h"
66
67 #include "impeller/entity/gaussian_blur.vert.h"
68 #include "impeller/entity/gaussian_blur_noalpha_decal.frag.h"
69 #include "impeller/entity/gaussian_blur_noalpha_nodecal.frag.h"
70 #include "impeller/entity/kernel_decal.frag.h"
71 #include "impeller/entity/kernel_nodecal.frag.h"
72
73 #include "impeller/entity/position_color.vert.h"
74
75 #include "impeller/typographer/glyph_atlas.h"
76
77 #include "impeller/entity/conical_gradient_ssbo_fill.frag.h"
78 #include "impeller/entity/linear_gradient_ssbo_fill.frag.h"
79 #include "impeller/entity/radial_gradient_ssbo_fill.frag.h"
80 #include "impeller/entity/sweep_gradient_ssbo_fill.frag.h"
81
82 #include "impeller/entity/advanced_blend.frag.h"
83 #include "impeller/entity/advanced_blend.vert.h"
84
85 #include "impeller/entity/framebuffer_blend.frag.h"
86 #include "impeller/entity/framebuffer_blend.vert.h"
87
88 #ifdef IMPELLER_ENABLE_OPENGLES
89 #include "impeller/entity/texture_fill_external.frag.h"
90 #include "impeller/entity/tiled_texture_fill_external.frag.h"
91 #endif // IMPELLER_ENABLE_OPENGLES
92
93 #if IMPELLER_ENABLE_3D
94 #include "impeller/scene/scene_context.h" // nogncheck
95 #endif
96
97 namespace impeller {
98
99 #ifdef IMPELLER_DEBUG
100 using CheckerboardPipeline =
101 RenderPipelineT<CheckerboardVertexShader, CheckerboardFragmentShader>;
102 #endif // IMPELLER_DEBUG
103
104 using LinearGradientFillPipeline =
105 RenderPipelineT<GradientFillVertexShader, LinearGradientFillFragmentShader>;
106 using SolidFillPipeline =
107 RenderPipelineT<SolidFillVertexShader, SolidFillFragmentShader>;
108 using RadialGradientFillPipeline =
109 RenderPipelineT<GradientFillVertexShader, RadialGradientFillFragmentShader>;
110 using ConicalGradientFillPipeline =
111 RenderPipelineT<GradientFillVertexShader,
112 ConicalGradientFillFragmentShader>;
113 using SweepGradientFillPipeline =
114 RenderPipelineT<GradientFillVertexShader, SweepGradientFillFragmentShader>;
115 using LinearGradientSSBOFillPipeline =
116 RenderPipelineT<GradientFillVertexShader,
117 LinearGradientSsboFillFragmentShader>;
118 using ConicalGradientSSBOFillPipeline =
119 RenderPipelineT<GradientFillVertexShader,
120 ConicalGradientSsboFillFragmentShader>;
121 using RadialGradientSSBOFillPipeline =
122 RenderPipelineT<GradientFillVertexShader,
123 RadialGradientSsboFillFragmentShader>;
124 using SweepGradientSSBOFillPipeline =
125 RenderPipelineT<GradientFillVertexShader,
126 SweepGradientSsboFillFragmentShader>;
127 using RRectBlurPipeline =
128 RenderPipelineT<RrectBlurVertexShader, RrectBlurFragmentShader>;
129 using BlendPipeline = RenderPipelineT<BlendVertexShader, BlendFragmentShader>;
130 using TexturePipeline =
131 RenderPipelineT<TextureFillVertexShader, TextureFillFragmentShader>;
132 using PositionUVPipeline =
133 RenderPipelineT<TextureFillVertexShader, TiledTextureFillFragmentShader>;
134 using TiledTexturePipeline =
135 RenderPipelineT<TextureFillVertexShader, TiledTextureFillFragmentShader>;
136 using GaussianBlurDecalPipeline =
137 RenderPipelineT<GaussianBlurVertexShader,
138 GaussianBlurNoalphaDecalFragmentShader>;
139 using GaussianBlurPipeline =
140 RenderPipelineT<GaussianBlurVertexShader,
141 GaussianBlurNoalphaNodecalFragmentShader>;
142 using KernelDecalPipeline =
143 RenderPipelineT<GaussianBlurVertexShader, KernelDecalFragmentShader>;
144 using KernelPipeline =
145 RenderPipelineT<GaussianBlurVertexShader, KernelNodecalFragmentShader>;
146 using BorderMaskBlurPipeline =
147 RenderPipelineT<BorderMaskBlurVertexShader, BorderMaskBlurFragmentShader>;
148 using MorphologyFilterPipeline =
149 RenderPipelineT<MorphologyFilterVertexShader,
150 MorphologyFilterFragmentShader>;
151 using ColorMatrixColorFilterPipeline =
152 RenderPipelineT<ColorMatrixColorFilterVertexShader,
153 ColorMatrixColorFilterFragmentShader>;
154 using LinearToSrgbFilterPipeline =
155 RenderPipelineT<LinearToSrgbFilterVertexShader,
156 LinearToSrgbFilterFragmentShader>;
157 using SrgbToLinearFilterPipeline =
158 RenderPipelineT<SrgbToLinearFilterVertexShader,
159 SrgbToLinearFilterFragmentShader>;
160 using GlyphAtlasPipeline =
161 RenderPipelineT<GlyphAtlasVertexShader, GlyphAtlasFragmentShader>;
162 using GlyphAtlasColorPipeline =
163 RenderPipelineT<GlyphAtlasVertexShader, GlyphAtlasColorFragmentShader>;
164 using PorterDuffBlendPipeline =
165 RenderPipelineT<PorterDuffBlendVertexShader, PorterDuffBlendFragmentShader>;
166 // Instead of requiring new shaders for clips, the solid fill stages are used
167 // to redirect writing to the stencil instead of color attachments.
168 using ClipPipeline = RenderPipelineT<ClipVertexShader, ClipFragmentShader>;
169
170 using GeometryColorPipeline =
171 RenderPipelineT<PositionColorVertexShader, VerticesFragmentShader>;
172 using YUVToRGBFilterPipeline =
173 RenderPipelineT<YuvToRgbFilterVertexShader, YuvToRgbFilterFragmentShader>;
174
175 // Advanced blends
176 using BlendColorPipeline =
177 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
178 using BlendColorBurnPipeline =
179 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
180 using BlendColorDodgePipeline =
181 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
182 using BlendDarkenPipeline =
183 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
184 using BlendDifferencePipeline =
185 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
186 using BlendExclusionPipeline =
187 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
188 using BlendHardLightPipeline =
189 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
190 using BlendHuePipeline =
191 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
192 using BlendLightenPipeline =
193 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
194 using BlendLuminosityPipeline =
195 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
196 using BlendMultiplyPipeline =
197 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
198 using BlendOverlayPipeline =
199 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
200 using BlendSaturationPipeline =
201 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
202 using BlendScreenPipeline =
203 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
204 using BlendSoftLightPipeline =
205 RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>;
206 // Framebuffer Advanced Blends
207 using FramebufferBlendColorPipeline =
208 RenderPipelineT<FramebufferBlendVertexShader,
209 FramebufferBlendFragmentShader>;
210 using FramebufferBlendColorBurnPipeline =
211 RenderPipelineT<FramebufferBlendVertexShader,
212 FramebufferBlendFragmentShader>;
213 using FramebufferBlendColorDodgePipeline =
214 RenderPipelineT<FramebufferBlendVertexShader,
215 FramebufferBlendFragmentShader>;
216 using FramebufferBlendDarkenPipeline =
217 RenderPipelineT<FramebufferBlendVertexShader,
218 FramebufferBlendFragmentShader>;
219 using FramebufferBlendDifferencePipeline =
220 RenderPipelineT<FramebufferBlendVertexShader,
221 FramebufferBlendFragmentShader>;
222 using FramebufferBlendExclusionPipeline =
223 RenderPipelineT<FramebufferBlendVertexShader,
224 FramebufferBlendFragmentShader>;
225 using FramebufferBlendHardLightPipeline =
226 RenderPipelineT<FramebufferBlendVertexShader,
227 FramebufferBlendFragmentShader>;
228 using FramebufferBlendHuePipeline =
229 RenderPipelineT<FramebufferBlendVertexShader,
230 FramebufferBlendFragmentShader>;
231 using FramebufferBlendLightenPipeline =
232 RenderPipelineT<FramebufferBlendVertexShader,
233 FramebufferBlendFragmentShader>;
234 using FramebufferBlendLuminosityPipeline =
235 RenderPipelineT<FramebufferBlendVertexShader,
236 FramebufferBlendFragmentShader>;
237 using FramebufferBlendMultiplyPipeline =
238 RenderPipelineT<FramebufferBlendVertexShader,
239 FramebufferBlendFragmentShader>;
240 using FramebufferBlendOverlayPipeline =
241 RenderPipelineT<FramebufferBlendVertexShader,
242 FramebufferBlendFragmentShader>;
243 using FramebufferBlendSaturationPipeline =
244 RenderPipelineT<FramebufferBlendVertexShader,
245 FramebufferBlendFragmentShader>;
246 using FramebufferBlendScreenPipeline =
247 RenderPipelineT<FramebufferBlendVertexShader,
248 FramebufferBlendFragmentShader>;
249 using FramebufferBlendSoftLightPipeline =
250 RenderPipelineT<FramebufferBlendVertexShader,
251 FramebufferBlendFragmentShader>;
252
253 /// Geometry Pipelines
254 using PointsComputeShaderPipeline = ComputePipelineBuilder<PointsComputeShader>;
255 using UvComputeShaderPipeline = ComputePipelineBuilder<UvComputeShader>;
256
257 #ifdef IMPELLER_ENABLE_OPENGLES
258 using TextureExternalPipeline =
259 RenderPipelineT<TextureFillVertexShader, TextureFillExternalFragmentShader>;
260
261 using TiledTextureExternalPipeline =
262 RenderPipelineT<TextureFillVertexShader,
263 TiledTextureFillExternalFragmentShader>;
264 #endif // IMPELLER_ENABLE_OPENGLES
265
266 /// Pipeline state configuration.
267 ///
268 /// Each unique combination of these options requires a different pipeline state
269 /// object to be built. This struct is used as a key for the per-pipeline
270 /// variant cache.
271 ///
272 /// When adding fields to this key, reliant features should take care to limit
273 /// the combinatorical explosion of variations. A sufficiently complicated
274 /// Flutter application may easily require building hundreds of PSOs in total,
275 /// but they shouldn't require e.g. 10s of thousands.
276 struct ContentContextOptions {
277 SampleCount sample_count = SampleCount::kCount1;
278 BlendMode blend_mode = BlendMode::kSourceOver;
279 CompareFunction stencil_compare = CompareFunction::kEqual;
280 StencilOperation stencil_operation = StencilOperation::kKeep;
281 PrimitiveType primitive_type = PrimitiveType::kTriangle;
282 PixelFormat color_attachment_pixel_format = PixelFormat::kUnknown;
283 bool has_stencil_attachment = true;
284 bool wireframe = false;
285 bool is_for_rrect_blur_clear = false;
286
287 struct Hash {
288 constexpr uint64_t operator()(const ContentContextOptions& o) const {
289 static_assert(sizeof(o.sample_count) == 1);
290 static_assert(sizeof(o.blend_mode) == 1);
291 static_assert(sizeof(o.sample_count) == 1);
292 static_assert(sizeof(o.stencil_compare) == 1);
293 static_assert(sizeof(o.stencil_operation) == 1);
294 static_assert(sizeof(o.primitive_type) == 1);
295 static_assert(sizeof(o.color_attachment_pixel_format) == 1);
296
297 return (o.is_for_rrect_blur_clear ? 1llu : 0llu) << 0 |
298 (o.wireframe ? 1llu : 0llu) << 1 |
299 (o.has_stencil_attachment ? 1llu : 0llu) << 2 |
300 // enums
301 static_cast<uint64_t>(o.color_attachment_pixel_format) << 16 |
302 static_cast<uint64_t>(o.primitive_type) << 24 |
303 static_cast<uint64_t>(o.stencil_operation) << 32 |
304 static_cast<uint64_t>(o.stencil_compare) << 40 |
305 static_cast<uint64_t>(o.blend_mode) << 48 |
306 static_cast<uint64_t>(o.sample_count) << 56;
307 }
308 };
309
310 struct Equal {
311 constexpr bool operator()(const ContentContextOptions& lhs,
312 const ContentContextOptions& rhs) const {
313 return lhs.sample_count == rhs.sample_count &&
314 lhs.blend_mode == rhs.blend_mode &&
315 lhs.stencil_compare == rhs.stencil_compare &&
316 lhs.stencil_operation == rhs.stencil_operation &&
317 lhs.primitive_type == rhs.primitive_type &&
318 lhs.color_attachment_pixel_format ==
319 rhs.color_attachment_pixel_format &&
320 lhs.has_stencil_attachment == rhs.has_stencil_attachment &&
321 lhs.wireframe == rhs.wireframe &&
322 lhs.is_for_rrect_blur_clear == rhs.is_for_rrect_blur_clear;
323 }
324 };
325
326 void ApplyToPipelineDescriptor(PipelineDescriptor& desc) const;
327 };
328
329 class Tessellator;
330 class RenderTargetCache;
331
332 class ContentContext {
333 public:
334 explicit ContentContext(
335 std::shared_ptr<Context> context,
336 std::shared_ptr<TypographerContext> typographer_context,
337 std::shared_ptr<RenderTargetAllocator> render_target_allocator = nullptr);
338
339 ~ContentContext();
340
341 bool IsValid() const;
342
343 #if IMPELLER_ENABLE_3D
344 std::shared_ptr<scene::SceneContext> GetSceneContext() const;
345 #endif // IMPELLER_ENABLE_3D
346
347 std::shared_ptr<Tessellator> GetTessellator() const;
348
349 #ifdef IMPELLER_DEBUG
350 std::shared_ptr<Pipeline<PipelineDescriptor>> GetCheckerboardPipeline(
351 ContentContextOptions opts) const {
352 return GetPipeline(checkerboard_pipelines_, opts);
353 }
354 #endif // IMPELLER_DEBUG
355
356 std::shared_ptr<Pipeline<PipelineDescriptor>> GetLinearGradientFillPipeline(
357 ContentContextOptions opts) const {
358 return GetPipeline(linear_gradient_fill_pipelines_, opts);
359 }
360
361 std::shared_ptr<Pipeline<PipelineDescriptor>>
362 GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const {
363 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
364 return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
365 }
366
367 std::shared_ptr<Pipeline<PipelineDescriptor>>
368 GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const {
369 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
370 return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
371 }
372
373 std::shared_ptr<Pipeline<PipelineDescriptor>>
374 GetConicalGradientSSBOFillPipeline(ContentContextOptions opts) const {
375 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
376 return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
377 }
378
379 std::shared_ptr<Pipeline<PipelineDescriptor>>
380 GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const {
381 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
382 return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
383 }
384
385 std::shared_ptr<Pipeline<PipelineDescriptor>> GetRadialGradientFillPipeline(
386 ContentContextOptions opts) const {
387 return GetPipeline(radial_gradient_fill_pipelines_, opts);
388 }
389
390 std::shared_ptr<Pipeline<PipelineDescriptor>> GetConicalGradientFillPipeline(
391 ContentContextOptions opts) const {
392 return GetPipeline(conical_gradient_fill_pipelines_, opts);
393 }
394
395 std::shared_ptr<Pipeline<PipelineDescriptor>> GetRRectBlurPipeline(
396 ContentContextOptions opts) const {
397 return GetPipeline(rrect_blur_pipelines_, opts);
398 }
399
400 std::shared_ptr<Pipeline<PipelineDescriptor>> GetSweepGradientFillPipeline(
401 ContentContextOptions opts) const {
402 return GetPipeline(sweep_gradient_fill_pipelines_, opts);
403 }
404
405 std::shared_ptr<Pipeline<PipelineDescriptor>> GetSolidFillPipeline(
406 ContentContextOptions opts) const {
407 return GetPipeline(solid_fill_pipelines_, opts);
408 }
409
410 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendPipeline(
411 ContentContextOptions opts) const {
412 return GetPipeline(texture_blend_pipelines_, opts);
413 }
414
415 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTexturePipeline(
416 ContentContextOptions opts) const {
417 return GetPipeline(texture_pipelines_, opts);
418 }
419
420 #ifdef IMPELLER_ENABLE_OPENGLES
421 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTextureExternalPipeline(
422 ContentContextOptions opts) const {
423 FML_DCHECK(GetContext()->GetBackendType() ==
424 Context::BackendType::kOpenGLES);
425 return GetPipeline(texture_external_pipelines_, opts);
426 }
427
428 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTiledTextureExternalPipeline(
429 ContentContextOptions opts) const {
430 FML_DCHECK(GetContext()->GetBackendType() ==
431 Context::BackendType::kOpenGLES);
432 return GetPipeline(tiled_texture_external_pipelines_, opts);
433 }
434 #endif // IMPELLER_ENABLE_OPENGLES
435
436 std::shared_ptr<Pipeline<PipelineDescriptor>> GetPositionUVPipeline(
437 ContentContextOptions opts) const {
438 return GetPipeline(position_uv_pipelines_, opts);
439 }
440
441 std::shared_ptr<Pipeline<PipelineDescriptor>> GetTiledTexturePipeline(
442 ContentContextOptions opts) const {
443 return GetPipeline(tiled_texture_pipelines_, opts);
444 }
445
446 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGaussianBlurDecalPipeline(
447 ContentContextOptions opts) const {
448 return GetPipeline(gaussian_blur_noalpha_decal_pipelines_, opts);
449 }
450
451 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGaussianBlurPipeline(
452 ContentContextOptions opts) const {
453 return GetPipeline(gaussian_blur_noalpha_nodecal_pipelines_, opts);
454 }
455
456 std::shared_ptr<Pipeline<PipelineDescriptor>> GetKernelDecalPipeline(
457 ContentContextOptions opts) const {
458 return GetPipeline(kernel_decal_pipelines_, opts);
459 }
460
461 std::shared_ptr<Pipeline<PipelineDescriptor>> GetKernelPipeline(
462 ContentContextOptions opts) const {
463 return GetPipeline(kernel_nodecal_pipelines_, opts);
464 }
465
466 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBorderMaskBlurPipeline(
467 ContentContextOptions opts) const {
468 return GetPipeline(border_mask_blur_pipelines_, opts);
469 }
470
471 std::shared_ptr<Pipeline<PipelineDescriptor>> GetMorphologyFilterPipeline(
472 ContentContextOptions opts) const {
473 return GetPipeline(morphology_filter_pipelines_, opts);
474 }
475
476 std::shared_ptr<Pipeline<PipelineDescriptor>>
477 GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const {
478 return GetPipeline(color_matrix_color_filter_pipelines_, opts);
479 }
480
481 std::shared_ptr<Pipeline<PipelineDescriptor>> GetLinearToSrgbFilterPipeline(
482 ContentContextOptions opts) const {
483 return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
484 }
485
486 std::shared_ptr<Pipeline<PipelineDescriptor>> GetSrgbToLinearFilterPipeline(
487 ContentContextOptions opts) const {
488 return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
489 }
490
491 std::shared_ptr<Pipeline<PipelineDescriptor>> GetClipPipeline(
492 ContentContextOptions opts) const {
493 return GetPipeline(clip_pipelines_, opts);
494 }
495
496 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGlyphAtlasPipeline(
497 ContentContextOptions opts) const {
498 return GetPipeline(glyph_atlas_pipelines_, opts);
499 }
500
501 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGlyphAtlasColorPipeline(
502 ContentContextOptions opts) const {
503 return GetPipeline(glyph_atlas_color_pipelines_, opts);
504 }
505
506 std::shared_ptr<Pipeline<PipelineDescriptor>> GetGeometryColorPipeline(
507 ContentContextOptions opts) const {
508 return GetPipeline(geometry_color_pipelines_, opts);
509 }
510
511 std::shared_ptr<Pipeline<PipelineDescriptor>> GetYUVToRGBFilterPipeline(
512 ContentContextOptions opts) const {
513 return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
514 }
515
516 std::shared_ptr<Pipeline<PipelineDescriptor>> GetPorterDuffBlendPipeline(
517 ContentContextOptions opts) const {
518 return GetPipeline(porter_duff_blend_pipelines_, opts);
519 }
520
521 // Advanced blends.
522
523 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendColorPipeline(
524 ContentContextOptions opts) const {
525 return GetPipeline(blend_color_pipelines_, opts);
526 }
527
528 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendColorBurnPipeline(
529 ContentContextOptions opts) const {
530 return GetPipeline(blend_colorburn_pipelines_, opts);
531 }
532
533 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendColorDodgePipeline(
534 ContentContextOptions opts) const {
535 return GetPipeline(blend_colordodge_pipelines_, opts);
536 }
537
538 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendDarkenPipeline(
539 ContentContextOptions opts) const {
540 return GetPipeline(blend_darken_pipelines_, opts);
541 }
542
543 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendDifferencePipeline(
544 ContentContextOptions opts) const {
545 return GetPipeline(blend_difference_pipelines_, opts);
546 }
547
548 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendExclusionPipeline(
549 ContentContextOptions opts) const {
550 return GetPipeline(blend_exclusion_pipelines_, opts);
551 }
552
553 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendHardLightPipeline(
554 ContentContextOptions opts) const {
555 return GetPipeline(blend_hardlight_pipelines_, opts);
556 }
557
558 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendHuePipeline(
559 ContentContextOptions opts) const {
560 return GetPipeline(blend_hue_pipelines_, opts);
561 }
562
563 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendLightenPipeline(
564 ContentContextOptions opts) const {
565 return GetPipeline(blend_lighten_pipelines_, opts);
566 }
567
568 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendLuminosityPipeline(
569 ContentContextOptions opts) const {
570 return GetPipeline(blend_luminosity_pipelines_, opts);
571 }
572
573 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendMultiplyPipeline(
574 ContentContextOptions opts) const {
575 return GetPipeline(blend_multiply_pipelines_, opts);
576 }
577
578 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendOverlayPipeline(
579 ContentContextOptions opts) const {
580 return GetPipeline(blend_overlay_pipelines_, opts);
581 }
582
583 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendSaturationPipeline(
584 ContentContextOptions opts) const {
585 return GetPipeline(blend_saturation_pipelines_, opts);
586 }
587
588 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendScreenPipeline(
589 ContentContextOptions opts) const {
590 return GetPipeline(blend_screen_pipelines_, opts);
591 }
592
593 std::shared_ptr<Pipeline<PipelineDescriptor>> GetBlendSoftLightPipeline(
594 ContentContextOptions opts) const {
595 return GetPipeline(blend_softlight_pipelines_, opts);
596 }
597
598 // Framebuffer Advanced Blends
599 std::shared_ptr<Pipeline<PipelineDescriptor>>
600 GetFramebufferBlendColorPipeline(ContentContextOptions opts) const {
601 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
602 return GetPipeline(framebuffer_blend_color_pipelines_, opts);
603 }
604
605 std::shared_ptr<Pipeline<PipelineDescriptor>>
606 GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const {
607 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
608 return GetPipeline(framebuffer_blend_colorburn_pipelines_, opts);
609 }
610
611 std::shared_ptr<Pipeline<PipelineDescriptor>>
612 GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const {
613 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
614 return GetPipeline(framebuffer_blend_colordodge_pipelines_, opts);
615 }
616
617 std::shared_ptr<Pipeline<PipelineDescriptor>>
618 GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const {
619 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
620 return GetPipeline(framebuffer_blend_darken_pipelines_, opts);
621 }
622
623 std::shared_ptr<Pipeline<PipelineDescriptor>>
624 GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const {
625 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
626 return GetPipeline(framebuffer_blend_difference_pipelines_, opts);
627 }
628
629 std::shared_ptr<Pipeline<PipelineDescriptor>>
630 GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const {
631 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
632 return GetPipeline(framebuffer_blend_exclusion_pipelines_, opts);
633 }
634
635 std::shared_ptr<Pipeline<PipelineDescriptor>>
636 GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const {
637 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
638 return GetPipeline(framebuffer_blend_hardlight_pipelines_, opts);
639 }
640
641 std::shared_ptr<Pipeline<PipelineDescriptor>> GetFramebufferBlendHuePipeline(
642 ContentContextOptions opts) const {
643 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
644 return GetPipeline(framebuffer_blend_hue_pipelines_, opts);
645 }
646
647 std::shared_ptr<Pipeline<PipelineDescriptor>>
648 GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const {
649 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
650 return GetPipeline(framebuffer_blend_lighten_pipelines_, opts);
651 }
652
653 std::shared_ptr<Pipeline<PipelineDescriptor>>
654 GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const {
655 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
656 return GetPipeline(framebuffer_blend_luminosity_pipelines_, opts);
657 }
658
659 std::shared_ptr<Pipeline<PipelineDescriptor>>
660 GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const {
661 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
662 return GetPipeline(framebuffer_blend_multiply_pipelines_, opts);
663 }
664
665 std::shared_ptr<Pipeline<PipelineDescriptor>>
666 GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const {
667 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
668 return GetPipeline(framebuffer_blend_overlay_pipelines_, opts);
669 }
670
671 std::shared_ptr<Pipeline<PipelineDescriptor>>
672 GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const {
673 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
674 return GetPipeline(framebuffer_blend_saturation_pipelines_, opts);
675 }
676
677 std::shared_ptr<Pipeline<PipelineDescriptor>>
678 GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const {
679 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
680 return GetPipeline(framebuffer_blend_screen_pipelines_, opts);
681 }
682
683 std::shared_ptr<Pipeline<PipelineDescriptor>>
684 GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const {
685 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
686 return GetPipeline(framebuffer_blend_softlight_pipelines_, opts);
687 }
688
689 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> GetPointComputePipeline()
690 const {
691 FML_DCHECK(GetDeviceCapabilities().SupportsCompute());
692 return point_field_compute_pipelines_;
693 }
694
695 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> GetUvComputePipeline()
696 const {
697 FML_DCHECK(GetDeviceCapabilities().SupportsCompute());
698 return uv_compute_pipelines_;
699 }
700
701 std::shared_ptr<Context> GetContext() const;
702
703 const Capabilities& GetDeviceCapabilities() const;
704
705 void SetWireframe(bool wireframe);
706
707 using SubpassCallback =
708 std::function<bool(const ContentContext&, RenderPass&)>;
709
710 /// @brief Creates a new texture of size `texture_size` and calls
711 /// `subpass_callback` with a `RenderPass` for drawing to the texture.
712 fml::StatusOr<RenderTarget> MakeSubpass(
713 const std::string& label,
714 ISize texture_size,
715 const SubpassCallback& subpass_callback,
716 bool msaa_enabled = true) const;
717
718 /// Makes a subpass that will render to `subpass_target`.
719 fml::StatusOr<RenderTarget> MakeSubpass(
720 const std::string& label,
721 const RenderTarget& subpass_target,
722 const SubpassCallback& subpass_callback) const;
723
724 std::shared_ptr<LazyGlyphAtlas> GetLazyGlyphAtlas() const {
725 return lazy_glyph_atlas_;
726 }
727
728 std::shared_ptr<RenderTargetAllocator> GetRenderTargetCache() const {
729 return render_target_cache_;
730 }
731
732 private:
733 std::shared_ptr<Context> context_;
734 std::shared_ptr<LazyGlyphAtlas> lazy_glyph_atlas_;
735
736 template <class PipelineT>
737 class Variants {
738 public:
739 Variants() = default;
740
741 void Set(const ContentContextOptions& options,
742 std::unique_ptr<PipelineT> pipeline) {
743 pipelines_[options] = std::move(pipeline);
744 }
745
746 void SetDefault(const ContentContextOptions& options,
747 std::unique_ptr<PipelineT> pipeline) {
748 default_options_ = options;
749 Set(options, std::move(pipeline));
750 }
751
752 void CreateDefault(const Context& context,
753 const ContentContextOptions& options,
754 const std::initializer_list<Scalar>& constants = {},
755 UseSubpassInput subpass_input = UseSubpassInput::kNo) {
756 auto desc =
757 PipelineT::Builder::MakeDefaultPipelineDescriptor(context, constants);
758 if (!desc.has_value()) {
759 VALIDATION_LOG << "Failed to create default pipeline.";
760 return;
761 }
762 desc->SetUseSubpassInput(subpass_input);
763 options.ApplyToPipelineDescriptor(*desc);
764 SetDefault(options, std::make_unique<PipelineT>(context, desc));
765 }
766
767 PipelineT* Get(const ContentContextOptions& options) const {
768 if (auto found = pipelines_.find(options); found != pipelines_.end()) {
769 return found->second.get();
770 }
771 return nullptr;
772 }
773
774 PipelineT* GetDefault() const {
775 if (!default_options_.has_value()) {
776 return nullptr;
777 }
778 return Get(default_options_.value());
779 }
780
781 size_t GetPipelineCount() const { return pipelines_.size(); }
782
783 private:
784 std::optional<ContentContextOptions> default_options_;
785 std::unordered_map<ContentContextOptions,
786 std::unique_ptr<PipelineT>,
787 ContentContextOptions::Hash,
788 ContentContextOptions::Equal>
789 pipelines_;
790
791 Variants(const Variants&) = delete;
792
793 Variants& operator=(const Variants&) = delete;
794 };
795
796 // These are mutable because while the prototypes are created eagerly, any
797 // variants requested from that are lazily created and cached in the variants
798 // map.
799
800 #ifdef IMPELLER_DEBUG
801 mutable Variants<CheckerboardPipeline> checkerboard_pipelines_;
802 #endif // IMPELLER_DEBUG
803
804 mutable Variants<SolidFillPipeline> solid_fill_pipelines_;
805 mutable Variants<LinearGradientFillPipeline> linear_gradient_fill_pipelines_;
806 mutable Variants<RadialGradientFillPipeline> radial_gradient_fill_pipelines_;
807 mutable Variants<ConicalGradientFillPipeline>
808 conical_gradient_fill_pipelines_;
809 mutable Variants<SweepGradientFillPipeline> sweep_gradient_fill_pipelines_;
810 mutable Variants<LinearGradientSSBOFillPipeline>
811 linear_gradient_ssbo_fill_pipelines_;
812 mutable Variants<RadialGradientSSBOFillPipeline>
813 radial_gradient_ssbo_fill_pipelines_;
814 mutable Variants<ConicalGradientSSBOFillPipeline>
815 conical_gradient_ssbo_fill_pipelines_;
816 mutable Variants<SweepGradientSSBOFillPipeline>
817 sweep_gradient_ssbo_fill_pipelines_;
818 mutable Variants<RRectBlurPipeline> rrect_blur_pipelines_;
819 mutable Variants<BlendPipeline> texture_blend_pipelines_;
820 mutable Variants<TexturePipeline> texture_pipelines_;
821 #ifdef IMPELLER_ENABLE_OPENGLES
822 mutable Variants<TextureExternalPipeline> texture_external_pipelines_;
823 mutable Variants<TiledTextureExternalPipeline>
824 tiled_texture_external_pipelines_;
825 #endif // IMPELLER_ENABLE_OPENGLES
826 mutable Variants<PositionUVPipeline> position_uv_pipelines_;
827 mutable Variants<TiledTexturePipeline> tiled_texture_pipelines_;
828 mutable Variants<GaussianBlurDecalPipeline>
829 gaussian_blur_noalpha_decal_pipelines_;
830 mutable Variants<GaussianBlurPipeline>
831 gaussian_blur_noalpha_nodecal_pipelines_;
832 mutable Variants<KernelDecalPipeline> kernel_decal_pipelines_;
833 mutable Variants<KernelPipeline> kernel_nodecal_pipelines_;
834 mutable Variants<BorderMaskBlurPipeline> border_mask_blur_pipelines_;
835 mutable Variants<MorphologyFilterPipeline> morphology_filter_pipelines_;
836 mutable Variants<ColorMatrixColorFilterPipeline>
837 color_matrix_color_filter_pipelines_;
838 mutable Variants<LinearToSrgbFilterPipeline> linear_to_srgb_filter_pipelines_;
839 mutable Variants<SrgbToLinearFilterPipeline> srgb_to_linear_filter_pipelines_;
840 mutable Variants<ClipPipeline> clip_pipelines_;
841 mutable Variants<GlyphAtlasPipeline> glyph_atlas_pipelines_;
842 mutable Variants<GlyphAtlasColorPipeline> glyph_atlas_color_pipelines_;
843 mutable Variants<GeometryColorPipeline> geometry_color_pipelines_;
844 mutable Variants<YUVToRGBFilterPipeline> yuv_to_rgb_filter_pipelines_;
845 mutable Variants<PorterDuffBlendPipeline> porter_duff_blend_pipelines_;
846 // Advanced blends.
847 mutable Variants<BlendColorPipeline> blend_color_pipelines_;
848 mutable Variants<BlendColorBurnPipeline> blend_colorburn_pipelines_;
849 mutable Variants<BlendColorDodgePipeline> blend_colordodge_pipelines_;
850 mutable Variants<BlendDarkenPipeline> blend_darken_pipelines_;
851 mutable Variants<BlendDifferencePipeline> blend_difference_pipelines_;
852 mutable Variants<BlendExclusionPipeline> blend_exclusion_pipelines_;
853 mutable Variants<BlendHardLightPipeline> blend_hardlight_pipelines_;
854 mutable Variants<BlendHuePipeline> blend_hue_pipelines_;
855 mutable Variants<BlendLightenPipeline> blend_lighten_pipelines_;
856 mutable Variants<BlendLuminosityPipeline> blend_luminosity_pipelines_;
857 mutable Variants<BlendMultiplyPipeline> blend_multiply_pipelines_;
858 mutable Variants<BlendOverlayPipeline> blend_overlay_pipelines_;
859 mutable Variants<BlendSaturationPipeline> blend_saturation_pipelines_;
860 mutable Variants<BlendScreenPipeline> blend_screen_pipelines_;
861 mutable Variants<BlendSoftLightPipeline> blend_softlight_pipelines_;
862 // Framebuffer Advanced blends.
863 mutable Variants<FramebufferBlendColorPipeline>
864 framebuffer_blend_color_pipelines_;
865 mutable Variants<FramebufferBlendColorBurnPipeline>
866 framebuffer_blend_colorburn_pipelines_;
867 mutable Variants<FramebufferBlendColorDodgePipeline>
868 framebuffer_blend_colordodge_pipelines_;
869 mutable Variants<FramebufferBlendDarkenPipeline>
870 framebuffer_blend_darken_pipelines_;
871 mutable Variants<FramebufferBlendDifferencePipeline>
872 framebuffer_blend_difference_pipelines_;
873 mutable Variants<FramebufferBlendExclusionPipeline>
874 framebuffer_blend_exclusion_pipelines_;
875 mutable Variants<FramebufferBlendHardLightPipeline>
876 framebuffer_blend_hardlight_pipelines_;
877 mutable Variants<FramebufferBlendHuePipeline>
878 framebuffer_blend_hue_pipelines_;
879 mutable Variants<FramebufferBlendLightenPipeline>
880 framebuffer_blend_lighten_pipelines_;
881 mutable Variants<FramebufferBlendLuminosityPipeline>
882 framebuffer_blend_luminosity_pipelines_;
883 mutable Variants<FramebufferBlendMultiplyPipeline>
884 framebuffer_blend_multiply_pipelines_;
885 mutable Variants<FramebufferBlendOverlayPipeline>
886 framebuffer_blend_overlay_pipelines_;
887 mutable Variants<FramebufferBlendSaturationPipeline>
888 framebuffer_blend_saturation_pipelines_;
889 mutable Variants<FramebufferBlendScreenPipeline>
890 framebuffer_blend_screen_pipelines_;
891 mutable Variants<FramebufferBlendSoftLightPipeline>
892 framebuffer_blend_softlight_pipelines_;
893 mutable std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
894 point_field_compute_pipelines_;
895 mutable std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
896 uv_compute_pipelines_;
897
898 template <class TypedPipeline>
899 std::shared_ptr<Pipeline<PipelineDescriptor>> GetPipeline(
900 Variants<TypedPipeline>& container,
901 ContentContextOptions opts) const {
902 if (!IsValid()) {
903 return nullptr;
904 }
905
906 if (wireframe_) {
907 opts.wireframe = true;
908 }
909
910 if (auto found = container.Get(opts)) {
911 return found->WaitAndGet();
912 }
913
914 auto prototype = container.GetDefault();
915
916 // The prototype must always be initialized in the constructor.
917 FML_CHECK(prototype != nullptr);
918
919 auto pipeline = prototype->WaitAndGet();
920 if (!pipeline) {
921 return nullptr;
922 }
923
924 auto variant_future = pipeline->CreateVariant(
925 [&opts, variants_count =
926 container.GetPipelineCount()](PipelineDescriptor& desc) {
927 opts.ApplyToPipelineDescriptor(desc);
928 desc.SetLabel(
929 SPrintF("%s V#%zu", desc.GetLabel().c_str(), variants_count));
930 });
931 auto variant = std::make_unique<TypedPipeline>(std::move(variant_future));
932 auto variant_pipeline = variant->WaitAndGet();
933 container.Set(opts, std::move(variant));
934 return variant_pipeline;
935 }
936
937 bool is_valid_ = false;
938 std::shared_ptr<Tessellator> tessellator_;
939 #if IMPELLER_ENABLE_3D
940 std::shared_ptr<scene::SceneContext> scene_context_;
941 #endif // IMPELLER_ENABLE_3D
942 std::shared_ptr<RenderTargetAllocator> render_target_cache_;
943 bool wireframe_ = false;
944
945 ContentContext(const ContentContext&) = delete;
946
947 ContentContext& operator=(const ContentContext&) = delete;
948 };
949
950 } // namespace impeller
951
952 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:29
impeller::ContentContext::GetTexturePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTexturePipeline(ContentContextOptions opts) const
Definition: content_context.h:415
impeller::LinearGradientFillPipeline
RenderPipelineT< GradientFillVertexShader, LinearGradientFillFragmentShader > LinearGradientFillPipeline
Definition: content_context.h:105
impeller::ContentContext::GetFramebufferBlendScreenPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
Definition: content_context.h:678
impeller::ContentContext::GetKernelDecalPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetKernelDecalPipeline(ContentContextOptions opts) const
Definition: content_context.h:456
pipeline.h
impeller::ContentContext::GetRadialGradientFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRadialGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:385
impeller::ContentContext::GetBorderMaskBlurPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBorderMaskBlurPipeline(ContentContextOptions opts) const
Definition: content_context.h:466
impeller::ContentContext::GetGlyphAtlasColorPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGlyphAtlasColorPipeline(ContentContextOptions opts) const
Definition: content_context.h:501
impeller::ContentContext::GetLinearGradientFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:356
scene_context.h
impeller::ContentContext::GetBlendPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:410
impeller::ContentContext::GetBlendColorDodgePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorDodgePipeline(ContentContextOptions opts) const
Definition: content_context.h:533
impeller::ContentContext::GetFramebufferBlendColorBurnPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
Definition: content_context.h:606
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:173
impeller::ContentContext::GetFramebufferBlendLightenPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
Definition: content_context.h:648
impeller::ContentContext::GetBlendHuePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendHuePipeline(ContentContextOptions opts) const
Definition: content_context.h:558
impeller::ContentContext::GetLazyGlyphAtlas
std::shared_ptr< LazyGlyphAtlas > GetLazyGlyphAtlas() const
Definition: content_context.h:724
entity.h
impeller::ContentContext::GetPointComputePipeline
std::shared_ptr< Pipeline< ComputePipelineDescriptor > > GetPointComputePipeline() const
Definition: content_context.h:689
impeller::ContentContext::GetGaussianBlurPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGaussianBlurPipeline(ContentContextOptions opts) const
Definition: content_context.h:451
impeller::ContentContext::GetFramebufferBlendExclusionPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
Definition: content_context.h:630
impeller::BlendMode
BlendMode
Definition: color.h:59
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::ContentContext::GetBlendColorPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorPipeline(ContentContextOptions opts) const
Definition: content_context.h:523
impeller::ContentContext::GetMorphologyFilterPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetMorphologyFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:471
impeller::ContentContext::MakeSubpass
fml::StatusOr< RenderTarget > MakeSubpass(const std::string &label, ISize texture_size, const SubpassCallback &subpass_callback, bool msaa_enabled=true) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
Definition: content_context.cc:410
formats.h
impeller::ContentContextOptions::Hash
Definition: content_context.h:287
impeller::ContentContext::GetGaussianBlurDecalPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGaussianBlurDecalPipeline(ContentContextOptions opts) const
Definition: content_context.h:446
impeller::ContentContext::GetFramebufferBlendColorDodgePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
Definition: content_context.h:612
impeller::ContentContext::GetBlendDarkenPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendDarkenPipeline(ContentContextOptions opts) const
Definition: content_context.h:538
impeller::ContentContext::GetClipPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetClipPipeline(ContentContextOptions opts) const
Definition: content_context.h:491
impeller::ContentContext::GetTiledTexturePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTiledTexturePipeline(ContentContextOptions opts) const
Definition: content_context.h:441
impeller::ContentContextOptions::blend_mode
BlendMode blend_mode
Definition: content_context.h:278
impeller::ContentContext::GetSweepGradientSSBOFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:380
impeller::UseSubpassInput
UseSubpassInput
Definition: pipeline_descriptor.h:24
typographer_context.h
impeller::ContentContext::GetFramebufferBlendOverlayPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
Definition: content_context.h:666
impeller::ContentContextOptions::ApplyToPipelineDescriptor
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
Definition: content_context.cc:23
impeller::ContentContext::GetSrgbToLinearFilterPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:486
impeller::ContentContext::GetKernelPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetKernelPipeline(ContentContextOptions opts) const
Definition: content_context.h:461
impeller::ContentContext::GetLinearToSrgbFilterPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:481
validation.h
impeller::ContentContext::GetBlendDifferencePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendDifferencePipeline(ContentContextOptions opts) const
Definition: content_context.h:543
impeller::ContentContext::GetConicalGradientFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetConicalGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:390
impeller::ContentContextOptions::Hash::operator()
constexpr uint64_t operator()(const ContentContextOptions &o) const
Definition: content_context.h:288
impeller::StencilOperation
StencilOperation
Definition: formats.h:548
impeller::ContentContextOptions::wireframe
bool wireframe
Definition: content_context.h:284
impeller::ContentContext::GetLinearGradientSSBOFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:362
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:94
impeller::ContentContextOptions::stencil_compare
CompareFunction stencil_compare
Definition: content_context.h:279
impeller::ContentContext::GetUvComputePipeline
std::shared_ptr< Pipeline< ComputePipelineDescriptor > > GetUvComputePipeline() const
Definition: content_context.h:695
impeller::ContentContext::GetFramebufferBlendHuePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
Definition: content_context.h:641
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::Capabilities
Definition: capabilities.h:15
impeller::TSize< int64_t >
impeller::CompareFunction
CompareFunction
Definition: formats.h:529
impeller::PrimitiveType
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:350
impeller::ContentContext::GetYUVToRGBFilterPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:511
impeller::ContentContext::GetFramebufferBlendDifferencePipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
Definition: content_context.h:624
impeller::ContentContextOptions::color_attachment_pixel_format
PixelFormat color_attachment_pixel_format
Definition: content_context.h:282
impeller::ContentContext::~ContentContext
~ContentContext()
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::ContentContext::GetBlendExclusionPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendExclusionPipeline(ContentContextOptions opts) const
Definition: content_context.h:548
impeller::ContentContext::GetConicalGradientSSBOFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetConicalGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:374
impeller::ContentContextOptions::Equal::operator()
constexpr bool operator()(const ContentContextOptions &lhs, const ContentContextOptions &rhs) const
Definition: content_context.h:311
impeller::ContentContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: content_context.cc:479
impeller::ContentContext::GetBlendColorBurnPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorBurnPipeline(ContentContextOptions opts) const
Definition: content_context.h:528
impeller::ContentContext::GetBlendScreenPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendScreenPipeline(ContentContextOptions opts) const
Definition: content_context.h:588
impeller::ContentContext::GetFramebufferBlendSaturationPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
Definition: content_context.h:672
impeller::ContentContext::GetRenderTargetCache
std::shared_ptr< RenderTargetAllocator > GetRenderTargetCache() const
Definition: content_context.h:728
impeller::ContentContext::GetBlendSoftLightPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendSoftLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:593
impeller::ContentContext::GetSolidFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSolidFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:405
impeller::ContentContext::GetFramebufferBlendDarkenPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
Definition: content_context.h:618
capabilities.h
impeller::RenderTarget
Definition: render_target.h:49
impeller::ContentContext::GetRRectBlurPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRRectBlurPipeline(ContentContextOptions opts) const
Definition: content_context.h:395
impeller::ContentContextOptions::has_stencil_attachment
bool has_stencil_attachment
Definition: content_context.h:283
impeller::ContentContextOptions::is_for_rrect_blur_clear
bool is_for_rrect_blur_clear
Definition: content_context.h:285
impeller::ContentContext::GetTessellator
std::shared_ptr< Tessellator > GetTessellator() const
Definition: content_context.cc:475
impeller::ContentContext::GetFramebufferBlendMultiplyPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
Definition: content_context.h:660
impeller::ContentContext::GetFramebufferBlendSoftLightPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:684
impeller::ContentContextOptions::primitive_type
PrimitiveType primitive_type
Definition: content_context.h:281
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::ContentContext::GetSweepGradientFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSweepGradientFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:400
impeller::ContentContext::SubpassCallback
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
Definition: content_context.h:708
impeller::ContentContext::GetBlendLightenPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendLightenPipeline(ContentContextOptions opts) const
Definition: content_context.h:563
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:29
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:67
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:483
impeller::ContentContext::GetFramebufferBlendColorPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
Definition: content_context.h:600
impeller::ContentContext::GetBlendMultiplyPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendMultiplyPipeline(ContentContextOptions opts) const
Definition: content_context.h:573
impeller::ContentContext::GetBlendLuminosityPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendLuminosityPipeline(ContentContextOptions opts) const
Definition: content_context.h:568
impeller::ContentContext::GetBlendOverlayPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendOverlayPipeline(ContentContextOptions opts) const
Definition: content_context.h:578
impeller::ContentContextOptions::sample_count
SampleCount sample_count
Definition: content_context.h:277
impeller::ContentContext::GetBlendSaturationPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendSaturationPipeline(ContentContextOptions opts) const
Definition: content_context.h:583
impeller::SampleCount
SampleCount
Definition: formats.h:290
impeller::ContentContext::GetRadialGradientSSBOFillPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
Definition: content_context.h:368
impeller::RenderPipelineT
Definition: pipeline.h:90
impeller::ContentContext::SetWireframe
void SetWireframe(bool wireframe)
Definition: content_context.cc:487
impeller::SampleCount::kCount1
@ kCount1
pipeline_descriptor.h
glyph_atlas.h
impeller::UseSubpassInput::kNo
@ kNo
render_target.h
impeller::ContentContext::GetPositionUVPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetPositionUVPipeline(ContentContextOptions opts) const
Definition: content_context.h:436
impeller::ContentContext::GetGlyphAtlasPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGlyphAtlasPipeline(ContentContextOptions opts) const
Definition: content_context.h:496
impeller::ContentContextOptions::Equal
Definition: content_context.h:310
impeller::ContentContextOptions
Definition: content_context.h:276
impeller::ContentContext::GetFramebufferBlendHardLightPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:636
impeller
Definition: aiks_context.cc:10
impeller::ContentContext::IsValid
bool IsValid() const
Definition: content_context.cc:406
impeller::ContentContext
Definition: content_context.h:332
impeller::ContentContext::GetFramebufferBlendLuminosityPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
Definition: content_context.h:654
impeller::ContentContext::GetGeometryColorPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGeometryColorPipeline(ContentContextOptions opts) const
Definition: content_context.h:506
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::ContentContextOptions::stencil_operation
StencilOperation stencil_operation
Definition: content_context.h:280
impeller::ContentContext::GetPorterDuffBlendPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetPorterDuffBlendPipeline(ContentContextOptions opts) const
Definition: content_context.h:516
impeller::ComputePipelineBuilder
An optional (but highly recommended) utility for creating pipelines from reflected shader information...
Definition: compute_pipeline_builder.h:25
impeller::ContentContext::GetBlendHardLightPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendHardLightPipeline(ContentContextOptions opts) const
Definition: content_context.h:553
impeller::GaussianBlurVertexShader
KernelPipeline::VertexShader GaussianBlurVertexShader
Definition: gaussian_blur_filter_contents.cc:18
impeller::ContentContext::GetColorMatrixColorFilterPipeline
std::shared_ptr< Pipeline< PipelineDescriptor > > GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
Definition: content_context.h:477