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