| Flutter Impeller |

content_context.cc
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 #include "impeller/entity/contents/content_context.h"
6
7 #include <memory>
8 #include <utility>
9
10 #include "fml/trace_event.h"
11 #include "impeller/base/validation.h"
12 #include "impeller/core/formats.h"
13 #include "impeller/core/texture_descriptor.h"
14 #include "impeller/entity/contents/framebuffer_blend_contents.h"
15 #include "impeller/entity/entity.h"
16 #include "impeller/entity/render_target_cache.h"
17 #include "impeller/renderer/command_buffer.h"
18 #include "impeller/renderer/pipeline_descriptor.h"
19 #include "impeller/renderer/pipeline_library.h"
20 #include "impeller/renderer/render_target.h"
21 #include "impeller/renderer/texture_mipmap.h"
22 #include "impeller/tessellator/tessellator.h"
23 #include "impeller/typographer/typographer_context.h"
24
25 namespace impeller {
26
27 void ContentContextOptions::ApplyToPipelineDescriptor(
28 PipelineDescriptor& desc) const {
29 auto pipeline_blend = blend_mode;
30 if (blend_mode > Entity::kLastPipelineBlendMode) {
31 VALIDATION_LOG << "Cannot use blend mode " << static_cast<int>(blend_mode)
32 << " as a pipeline blend.";
33 pipeline_blend = BlendMode::kSourceOver;
34 }
35
36 desc.SetSampleCount(sample_count);
37
38 ColorAttachmentDescriptor color0 = *desc.GetColorAttachmentDescriptor(0u);
39 color0.format = color_attachment_pixel_format;
40 color0.alpha_blend_op = BlendOperation::kAdd;
41 color0.color_blend_op = BlendOperation::kAdd;
42 color0.write_mask = ColorWriteMaskBits::kAll;
43
44 switch (pipeline_blend) {
45 case BlendMode::kClear:
46 if (is_for_rrect_blur_clear) {
47 color0.alpha_blend_op = BlendOperation::kReverseSubtract;
48 color0.color_blend_op = BlendOperation::kReverseSubtract;
49 color0.dst_alpha_blend_factor = BlendFactor::kOne;
50 color0.dst_color_blend_factor = BlendFactor::kOne;
51 color0.src_alpha_blend_factor = BlendFactor::kDestinationColor;
52 color0.src_color_blend_factor = BlendFactor::kDestinationColor;
53 } else {
54 color0.dst_alpha_blend_factor = BlendFactor::kZero;
55 color0.dst_color_blend_factor = BlendFactor::kZero;
56 color0.src_alpha_blend_factor = BlendFactor::kZero;
57 color0.src_color_blend_factor = BlendFactor::kZero;
58 }
59 break;
60 case BlendMode::kSource:
61 color0.blending_enabled = false;
62 color0.dst_alpha_blend_factor = BlendFactor::kZero;
63 color0.dst_color_blend_factor = BlendFactor::kZero;
64 color0.src_alpha_blend_factor = BlendFactor::kOne;
65 color0.src_color_blend_factor = BlendFactor::kOne;
66 break;
67 case BlendMode::kDestination:
68 color0.dst_alpha_blend_factor = BlendFactor::kOne;
69 color0.dst_color_blend_factor = BlendFactor::kOne;
70 color0.src_alpha_blend_factor = BlendFactor::kZero;
71 color0.src_color_blend_factor = BlendFactor::kZero;
72 color0.write_mask = ColorWriteMaskBits::kNone;
73 break;
74 case BlendMode::kSourceOver:
75 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
76 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
77 color0.src_alpha_blend_factor = BlendFactor::kOne;
78 color0.src_color_blend_factor = BlendFactor::kOne;
79 break;
80 case BlendMode::kDestinationOver:
81 color0.dst_alpha_blend_factor = BlendFactor::kOne;
82 color0.dst_color_blend_factor = BlendFactor::kOne;
83 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
84 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
85 break;
86 case BlendMode::kSourceIn:
87 color0.dst_alpha_blend_factor = BlendFactor::kZero;
88 color0.dst_color_blend_factor = BlendFactor::kZero;
89 color0.src_alpha_blend_factor = BlendFactor::kDestinationAlpha;
90 color0.src_color_blend_factor = BlendFactor::kDestinationAlpha;
91 break;
92 case BlendMode::kDestinationIn:
93 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
94 color0.dst_color_blend_factor = BlendFactor::kSourceAlpha;
95 color0.src_alpha_blend_factor = BlendFactor::kZero;
96 color0.src_color_blend_factor = BlendFactor::kZero;
97 break;
98 case BlendMode::kSourceOut:
99 color0.dst_alpha_blend_factor = BlendFactor::kZero;
100 color0.dst_color_blend_factor = BlendFactor::kZero;
101 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
102 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
103 break;
104 case BlendMode::kDestinationOut:
105 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
106 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
107 color0.src_alpha_blend_factor = BlendFactor::kZero;
108 color0.src_color_blend_factor = BlendFactor::kZero;
109 break;
110 case BlendMode::kSourceATop:
111 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
112 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
113 color0.src_alpha_blend_factor = BlendFactor::kDestinationAlpha;
114 color0.src_color_blend_factor = BlendFactor::kDestinationAlpha;
115 break;
116 case BlendMode::kDestinationATop:
117 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
118 color0.dst_color_blend_factor = BlendFactor::kSourceAlpha;
119 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
120 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
121 break;
122 case BlendMode::kXor:
123 color0.dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
124 color0.dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
125 color0.src_alpha_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
126 color0.src_color_blend_factor = BlendFactor::kOneMinusDestinationAlpha;
127 break;
128 case BlendMode::kPlus:
129 color0.dst_alpha_blend_factor = BlendFactor::kOne;
130 color0.dst_color_blend_factor = BlendFactor::kOne;
131 color0.src_alpha_blend_factor = BlendFactor::kOne;
132 color0.src_color_blend_factor = BlendFactor::kOne;
133 break;
134 case BlendMode::kModulate:
135 color0.dst_alpha_blend_factor = BlendFactor::kSourceAlpha;
136 color0.dst_color_blend_factor = BlendFactor::kSourceColor;
137 color0.src_alpha_blend_factor = BlendFactor::kZero;
138 color0.src_color_blend_factor = BlendFactor::kZero;
139 break;
140 default:
141 FML_UNREACHABLE();
142 }
143 desc.SetColorAttachmentDescriptor(0u, color0);
144
145 if (!has_depth_stencil_attachments) {
146 desc.ClearDepthAttachment();
147 desc.ClearStencilAttachments();
148 }
149
150 auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
151 auto maybe_depth = desc.GetDepthStencilAttachmentDescriptor();
152 FML_DCHECK(has_depth_stencil_attachments == maybe_depth.has_value())
153 << "Depth attachment doesn't match expected pipeline state. "
154 "has_depth_stencil_attachments="
155 << has_depth_stencil_attachments;
156 FML_DCHECK(has_depth_stencil_attachments == maybe_stencil.has_value())
157 << "Stencil attachment doesn't match expected pipeline state. "
158 "has_depth_stencil_attachments="
159 << has_depth_stencil_attachments;
160 if (maybe_stencil.has_value()) {
161 StencilAttachmentDescriptor front_stencil = maybe_stencil.value();
162 StencilAttachmentDescriptor back_stencil = front_stencil;
163
164 switch (stencil_mode) {
165 case StencilMode::kIgnore:
166 front_stencil.stencil_compare = CompareFunction::kAlways;
167 front_stencil.depth_stencil_pass = StencilOperation::kKeep;
168 desc.SetStencilAttachmentDescriptors(front_stencil);
169 break;
170 case StencilMode::kStencilNonZeroFill:
171 // The stencil ref should be 0 on commands that use this mode.
172 front_stencil.stencil_compare = CompareFunction::kAlways;
173 front_stencil.depth_stencil_pass = StencilOperation::kIncrementWrap;
174 back_stencil.stencil_compare = CompareFunction::kAlways;
175 back_stencil.depth_stencil_pass = StencilOperation::kDecrementWrap;
176 desc.SetStencilAttachmentDescriptors(front_stencil, back_stencil);
177 break;
178 case StencilMode::kStencilEvenOddFill:
179 // The stencil ref should be 0 on commands that use this mode.
180 front_stencil.stencil_compare = CompareFunction::kEqual;
181 front_stencil.depth_stencil_pass = StencilOperation::kIncrementWrap;
182 front_stencil.stencil_failure = StencilOperation::kDecrementWrap;
183 desc.SetStencilAttachmentDescriptors(front_stencil);
184 break;
185 case StencilMode::kCoverCompare:
186 // The stencil ref should be 0 on commands that use this mode.
187 front_stencil.stencil_compare = CompareFunction::kNotEqual;
188 front_stencil.depth_stencil_pass =
189 StencilOperation::kSetToReferenceValue;
190 desc.SetStencilAttachmentDescriptors(front_stencil);
191 break;
192 case StencilMode::kCoverCompareInverted:
193 // The stencil ref should be 0 on commands that use this mode.
194 front_stencil.stencil_compare = CompareFunction::kEqual;
195 front_stencil.stencil_failure = StencilOperation::kSetToReferenceValue;
196 desc.SetStencilAttachmentDescriptors(front_stencil);
197 break;
198 case StencilMode::kOverdrawPreventionIncrement:
199 front_stencil.stencil_compare = CompareFunction::kEqual;
200 front_stencil.depth_stencil_pass = StencilOperation::kIncrementClamp;
201 desc.SetStencilAttachmentDescriptors(front_stencil);
202 break;
203 case StencilMode::kOverdrawPreventionRestore:
204 front_stencil.stencil_compare = CompareFunction::kLess;
205 front_stencil.depth_stencil_pass =
206 StencilOperation::kSetToReferenceValue;
207 desc.SetStencilAttachmentDescriptors(front_stencil);
208 break;
209 }
210 }
211 if (maybe_depth.has_value()) {
212 DepthAttachmentDescriptor depth = maybe_depth.value();
213 depth.depth_write_enabled = depth_write_enabled;
214 depth.depth_compare = depth_compare;
215 desc.SetDepthStencilAttachmentDescriptor(depth);
216 }
217
218 desc.SetPrimitiveType(primitive_type);
219
220 desc.SetPolygonMode(wireframe ? PolygonMode::kLine : PolygonMode::kFill);
221 }
222
223 std::array<std::vector<Scalar>, 15> GetPorterDuffSpecConstants(
224 bool supports_decal) {
225 Scalar x = supports_decal ? 1 : 0;
226 return {{
227 {x, 0, 0, 0, 0, 0}, // Clear
228 {x, 1, 0, 0, 0, 0}, // Source
229 {x, 0, 0, 1, 0, 0}, // Destination
230 {x, 1, 0, 1, -1, 0}, // SourceOver
231 {x, 1, -1, 1, 0, 0}, // DestinationOver
232 {x, 0, 1, 0, 0, 0}, // SourceIn
233 {x, 0, 0, 0, 1, 0}, // DestinationIn
234 {x, 1, -1, 0, 0, 0}, // SourceOut
235 {x, 0, 0, 1, -1, 0}, // DestinationOut
236 {x, 0, 1, 1, -1, 0}, // SourceATop
237 {x, 1, -1, 0, 1, 0}, // DestinationATop
238 {x, 1, -1, 1, -1, 0}, // Xor
239 {x, 1, 0, 1, 0, 0}, // Plus
240 {x, 0, 0, 0, 0, 1}, // Modulate
241 {x, 0, 0, 1, 0, -1}, // Screen
242 }};
243 }
244
245 template <typename PipelineT>
246 static std::unique_ptr<PipelineT> CreateDefaultPipeline(
247 const Context& context) {
248 auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
249 if (!desc.has_value()) {
250 return nullptr;
251 }
252 // Apply default ContentContextOptions to the descriptor.
253 const auto default_color_format =
254 context.GetCapabilities()->GetDefaultColorFormat();
255 ContentContextOptions{.sample_count = SampleCount::kCount4,
256 .primitive_type = PrimitiveType::kTriangleStrip,
257 .color_attachment_pixel_format = default_color_format}
258 .ApplyToPipelineDescriptor(*desc);
259 return std::make_unique<PipelineT>(context, desc);
260 }
261
262 ContentContext::ContentContext(
263 std::shared_ptr<Context> context,
264 std::shared_ptr<TypographerContext> typographer_context,
265 std::shared_ptr<RenderTargetAllocator> render_target_allocator)
266 : context_(std::move(context)),
267 lazy_glyph_atlas_(
268 std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
269 tessellator_(std::make_shared<Tessellator>()),
270 render_target_cache_(render_target_allocator == nullptr
271 ? std::make_shared<RenderTargetCache>(
272 context_->GetResourceAllocator())
273 : std::move(render_target_allocator)),
274 host_buffer_(HostBuffer::Create(context_->GetResourceAllocator(),
275 context_->GetIdleWaiter())) {
276 if (!context_ || !context_->IsValid()) {
277 return;
278 }
279
280 {
281 TextureDescriptor desc;
282 desc.storage_mode = StorageMode::kDevicePrivate;
283 desc.format = PixelFormat::kR8G8B8A8UNormInt;
284 desc.size = ISize{1, 1};
285 empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
286 auto data = Color::BlackTransparent().ToR8G8B8A8();
287 auto cmd_buffer = GetContext()->CreateCommandBuffer();
288 auto blit_pass = cmd_buffer->CreateBlitPass();
289 auto& host_buffer = GetTransientsBuffer();
290 auto buffer_view = host_buffer.Emplace(data);
291 blit_pass->AddCopy(buffer_view, empty_texture_);
292
293 if (!blit_pass->EncodeCommands() || !GetContext()
294 ->GetCommandQueue()
295 ->Submit({std::move(cmd_buffer)})
296 .ok()) {
297 VALIDATION_LOG << "Failed to create empty texture.";
298 }
299 }
300
301 auto options = ContentContextOptions{
302 .sample_count = SampleCount::kCount4,
303 .color_attachment_pixel_format =
304 context_->GetCapabilities()->GetDefaultColorFormat()};
305 auto options_trianglestrip = ContentContextOptions{
306 .sample_count = SampleCount::kCount4,
307 .primitive_type = PrimitiveType::kTriangleStrip,
308 .color_attachment_pixel_format =
309 context_->GetCapabilities()->GetDefaultColorFormat()};
310 const auto supports_decal = static_cast<Scalar>(
311 context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
312
313 // Futures for the following pipelines may block in case the first frame is
314 // rendered without the pipelines being ready. Put pipelines that are more
315 // likely to be used first.
316 {
317 glyph_atlas_pipelines_.CreateDefault(
318 *context_, options,
319 {static_cast<Scalar>(
320 GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
321 PixelFormat::kA8UNormInt)});
322 solid_fill_pipelines_.CreateDefault(*context_, options);
323 texture_pipelines_.CreateDefault(*context_, options);
324 fast_gradient_pipelines_.CreateDefault(*context_, options);
325
326 if (context_->GetCapabilities()->SupportsSSBO()) {
327 linear_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
328 radial_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
329 conical_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
330 sweep_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
331 } else {
332 linear_gradient_uniform_fill_pipelines_.CreateDefault(*context_, options);
333 radial_gradient_uniform_fill_pipelines_.CreateDefault(*context_, options);
334 conical_gradient_uniform_fill_pipelines_.CreateDefault(*context_,
335 options);
336 sweep_gradient_uniform_fill_pipelines_.CreateDefault(*context_, options);
337
338 linear_gradient_fill_pipelines_.CreateDefault(*context_, options);
339 radial_gradient_fill_pipelines_.CreateDefault(*context_, options);
340 conical_gradient_fill_pipelines_.CreateDefault(*context_, options);
341 sweep_gradient_fill_pipelines_.CreateDefault(*context_, options);
342 }
343
344 /// Setup default clip pipeline.
345 auto clip_pipeline_descriptor =
346 ClipPipeline::Builder::MakeDefaultPipelineDescriptor(*context_);
347 if (!clip_pipeline_descriptor.has_value()) {
348 return;
349 }
350 ContentContextOptions{
351 .sample_count = SampleCount::kCount4,
352 .color_attachment_pixel_format =
353 context_->GetCapabilities()->GetDefaultColorFormat()}
354 .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
355 // Disable write to all color attachments.
356 auto clip_color_attachments =
357 clip_pipeline_descriptor->GetColorAttachmentDescriptors();
358 for (auto& color_attachment : clip_color_attachments) {
359 color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
360 }
361 clip_pipeline_descriptor->SetColorAttachmentDescriptors(
362 std::move(clip_color_attachments));
363 clip_pipelines_.SetDefault(
364 options,
365 std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
366 texture_downsample_pipelines_.CreateDefault(*context_,
367 options_trianglestrip);
368 rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
369 texture_strict_src_pipelines_.CreateDefault(*context_, options);
370 tiled_texture_pipelines_.CreateDefault(*context_, options,
371 {supports_decal});
372 gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
373 {supports_decal});
374 border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
375 color_matrix_color_filter_pipelines_.CreateDefault(*context_,
376 options_trianglestrip);
377 vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
378
379 const std::array<std::vector<Scalar>, 15> porter_duff_constants =
380 GetPorterDuffSpecConstants(supports_decal);
381 clear_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
382 porter_duff_constants[0]);
383 source_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
384 porter_duff_constants[1]);
385 destination_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
386 porter_duff_constants[2]);
387 source_over_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
388 porter_duff_constants[3]);
389 destination_over_blend_pipelines_.CreateDefault(
390 *context_, options_trianglestrip, porter_duff_constants[4]);
391 source_in_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
392 porter_duff_constants[5]);
393 destination_in_blend_pipelines_.CreateDefault(
394 *context_, options_trianglestrip, porter_duff_constants[6]);
395 source_out_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
396 porter_duff_constants[7]);
397 destination_out_blend_pipelines_.CreateDefault(
398 *context_, options_trianglestrip, porter_duff_constants[8]);
399 source_a_top_blend_pipelines_.CreateDefault(
400 *context_, options_trianglestrip, porter_duff_constants[9]);
401 destination_a_top_blend_pipelines_.CreateDefault(
402 *context_, options_trianglestrip, porter_duff_constants[10]);
403 xor_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
404 porter_duff_constants[11]);
405 plus_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
406 porter_duff_constants[12]);
407 modulate_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
408 porter_duff_constants[13]);
409 screen_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
410 porter_duff_constants[14]);
411 }
412
413 if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
414 framebuffer_blend_color_pipelines_.CreateDefault(
415 *context_, options_trianglestrip,
416 {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
417 framebuffer_blend_colorburn_pipelines_.CreateDefault(
418 *context_, options_trianglestrip,
419 {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
420 framebuffer_blend_colordodge_pipelines_.CreateDefault(
421 *context_, options_trianglestrip,
422 {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
423 framebuffer_blend_darken_pipelines_.CreateDefault(
424 *context_, options_trianglestrip,
425 {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
426 framebuffer_blend_difference_pipelines_.CreateDefault(
427 *context_, options_trianglestrip,
428 {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
429 framebuffer_blend_exclusion_pipelines_.CreateDefault(
430 *context_, options_trianglestrip,
431 {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
432 framebuffer_blend_hardlight_pipelines_.CreateDefault(
433 *context_, options_trianglestrip,
434 {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
435 framebuffer_blend_hue_pipelines_.CreateDefault(
436 *context_, options_trianglestrip,
437 {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
438 framebuffer_blend_lighten_pipelines_.CreateDefault(
439 *context_, options_trianglestrip,
440 {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
441 framebuffer_blend_luminosity_pipelines_.CreateDefault(
442 *context_, options_trianglestrip,
443 {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
444 framebuffer_blend_multiply_pipelines_.CreateDefault(
445 *context_, options_trianglestrip,
446 {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
447 framebuffer_blend_overlay_pipelines_.CreateDefault(
448 *context_, options_trianglestrip,
449 {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
450 framebuffer_blend_saturation_pipelines_.CreateDefault(
451 *context_, options_trianglestrip,
452 {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
453 framebuffer_blend_screen_pipelines_.CreateDefault(
454 *context_, options_trianglestrip,
455 {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
456 framebuffer_blend_softlight_pipelines_.CreateDefault(
457 *context_, options_trianglestrip,
458 {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
459 } else {
460 blend_color_pipelines_.CreateDefault(
461 *context_, options_trianglestrip,
462 {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
463 blend_colorburn_pipelines_.CreateDefault(
464 *context_, options_trianglestrip,
465 {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
466 blend_colordodge_pipelines_.CreateDefault(
467 *context_, options_trianglestrip,
468 {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
469 blend_darken_pipelines_.CreateDefault(
470 *context_, options_trianglestrip,
471 {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
472 blend_difference_pipelines_.CreateDefault(
473 *context_, options_trianglestrip,
474 {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
475 blend_exclusion_pipelines_.CreateDefault(
476 *context_, options_trianglestrip,
477 {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
478 blend_hardlight_pipelines_.CreateDefault(
479 *context_, options_trianglestrip,
480 {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
481 blend_hue_pipelines_.CreateDefault(
482 *context_, options_trianglestrip,
483 {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
484 blend_lighten_pipelines_.CreateDefault(
485 *context_, options_trianglestrip,
486 {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
487 blend_luminosity_pipelines_.CreateDefault(
488 *context_, options_trianglestrip,
489 {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
490 blend_multiply_pipelines_.CreateDefault(
491 *context_, options_trianglestrip,
492 {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
493 blend_overlay_pipelines_.CreateDefault(
494 *context_, options_trianglestrip,
495 {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
496 blend_saturation_pipelines_.CreateDefault(
497 *context_, options_trianglestrip,
498 {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
499 blend_screen_pipelines_.CreateDefault(
500 *context_, options_trianglestrip,
501 {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
502 blend_softlight_pipelines_.CreateDefault(
503 *context_, options_trianglestrip,
504 {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
505 }
506
507 morphology_filter_pipelines_.CreateDefault(*context_, options_trianglestrip,
508 {supports_decal});
509 linear_to_srgb_filter_pipelines_.CreateDefault(*context_,
510 options_trianglestrip);
511 srgb_to_linear_filter_pipelines_.CreateDefault(*context_,
512 options_trianglestrip);
513 yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip);
514
515 #if defined(IMPELLER_ENABLE_OPENGLES)
516 if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
517 #if !defined(FML_OS_MACOSX)
518 // GLES only shader that is unsupported on macOS.
519 tiled_texture_external_pipelines_.CreateDefault(*context_, options);
520 tiled_texture_uv_external_pipelines_.CreateDefault(*context_, options);
521 #endif // !defined(FML_OS_MACOSX)
522 texture_downsample_gles_pipelines_.CreateDefault(*context_,
523 options_trianglestrip);
524 }
525 #endif // IMPELLER_ENABLE_OPENGLES
526
527 is_valid_ = true;
528 InitializeCommonlyUsedShadersIfNeeded();
529 }
530
531 ContentContext::~ContentContext() = default;
532
533 bool ContentContext::IsValid() const {
534 return is_valid_;
535 }
536
537 std::shared_ptr<Texture> ContentContext::GetEmptyTexture() const {
538 return empty_texture_;
539 }
540
541 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
542 std::string_view label,
543 ISize texture_size,
544 const std::shared_ptr<CommandBuffer>& command_buffer,
545 const SubpassCallback& subpass_callback,
546 bool msaa_enabled,
547 bool depth_stencil_enabled,
548 int32_t mip_count) const {
549 const std::shared_ptr<Context>& context = GetContext();
550 RenderTarget subpass_target;
551
552 std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
553 depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
554 : std::optional<RenderTarget::AttachmentConfig>();
555
556 if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
557 subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
558 *context, texture_size,
559 /*mip_count=*/mip_count, label,
560 RenderTarget::kDefaultColorAttachmentConfigMSAA, depth_stencil_config);
561 } else {
562 subpass_target = GetRenderTargetCache()->CreateOffscreen(
563 *context, texture_size,
564 /*mip_count=*/mip_count, label,
565 RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
566 }
567 return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
568 }
569
570 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
571 std::string_view label,
572 const RenderTarget& subpass_target,
573 const std::shared_ptr<CommandBuffer>& command_buffer,
574 const SubpassCallback& subpass_callback) const {
575 const std::shared_ptr<Context>& context = GetContext();
576
577 auto subpass_texture = subpass_target.GetRenderTargetTexture();
578 if (!subpass_texture) {
579 return fml::Status(fml::StatusCode::kUnknown, "");
580 }
581
582 auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
583 if (!sub_renderpass) {
584 return fml::Status(fml::StatusCode::kUnknown, "");
585 }
586 sub_renderpass->SetLabel(label);
587
588 if (!subpass_callback(*this, *sub_renderpass)) {
589 return fml::Status(fml::StatusCode::kUnknown, "");
590 }
591
592 if (!sub_renderpass->EncodeCommands()) {
593 return fml::Status(fml::StatusCode::kUnknown, "");
594 }
595
596 const std::shared_ptr<Texture>& target_texture =
597 subpass_target.GetRenderTargetTexture();
598 if (target_texture->GetMipCount() > 1) {
599 fml::Status mipmap_status =
600 AddMipmapGeneration(command_buffer, context, target_texture);
601 if (!mipmap_status.ok()) {
602 return mipmap_status;
603 }
604 }
605
606 return subpass_target;
607 }
608
609 Tessellator& ContentContext::GetTessellator() const {
610 return *tessellator_;
611 }
612
613 std::shared_ptr<Context> ContentContext::GetContext() const {
614 return context_;
615 }
616
617 const Capabilities& ContentContext::GetDeviceCapabilities() const {
618 return *context_->GetCapabilities();
619 }
620
621 void ContentContext::SetWireframe(bool wireframe) {
622 wireframe_ = wireframe;
623 }
624
625 PipelineRef ContentContext::GetCachedRuntimeEffectPipeline(
626 const std::string& unique_entrypoint_name,
627 const ContentContextOptions& options,
628 const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
629 create_callback) const {
630 RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
631 auto it = runtime_effect_pipelines_.find(key);
632 if (it == runtime_effect_pipelines_.end()) {
633 it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
634 }
635 return raw_ptr(it->second);
636 }
637
638 void ContentContext::ClearCachedRuntimeEffectPipeline(
639 const std::string& unique_entrypoint_name) const {
640 for (auto it = runtime_effect_pipelines_.begin();
641 it != runtime_effect_pipelines_.end();) {
642 if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
643 it = runtime_effect_pipelines_.erase(it);
644 } else {
645 it++;
646 }
647 }
648 }
649
650 void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
651 TRACE_EVENT0("flutter", "InitializeCommonlyUsedShadersIfNeeded");
652 GetContext()->InitializeCommonlyUsedShadersIfNeeded();
653 }
654
655 } // namespace impeller
impeller::PipelineDescriptor
Definition: pipeline_descriptor.h:24
impeller::Pipeline< PipelineDescriptor >
impeller::ContentContextOptions::StencilMode::kIgnore
@ kIgnore
impeller::BlendSelectValues::kSaturation
@ kSaturation
impeller::ContentContext::ClearCachedRuntimeEffectPipeline
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
Definition: content_context.cc:638
impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:522
impeller::PipelineDescriptor::SetPolygonMode
void SetPolygonMode(PolygonMode mode)
Definition: pipeline_descriptor.cc:276
impeller::Entity::kLastPipelineBlendMode
static constexpr BlendMode kLastPipelineBlendMode
Definition: entity.h:22
impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::BlendSelectValues::kColorBurn
@ kColorBurn
impeller::RenderTarget::kDefaultColorAttachmentConfig
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
Definition: render_target.h:55
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:616
impeller::ContentContext::ContentContext
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
Definition: content_context.cc:262
impeller::GetPorterDuffSpecConstants
std::array< std::vector< Scalar >, 15 > GetPorterDuffSpecConstants(bool supports_decal)
Definition: content_context.cc:223
impeller::BlendSelectValues::kMultiply
@ kMultiply
impeller::AddMipmapGeneration
fml::Status AddMipmapGeneration(const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
Adds a blit command to the render pass.
Definition: texture_mipmap.cc:11
impeller::ColorWriteMaskBits::kNone
@ kNone
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::PipelineDescriptor::SetStencilAttachmentDescriptors
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)
Definition: pipeline_descriptor.cc:157
entity.h
impeller::ContentContextOptions::StencilMode::kOverdrawPreventionIncrement
@ kOverdrawPreventionIncrement
impeller::PipelineDescriptor::SetColorAttachmentDescriptor
PipelineDescriptor & SetColorAttachmentDescriptor(size_t index, ColorAttachmentDescriptor desc)
Definition: pipeline_descriptor.cc:110
impeller::Tessellator
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition: tessellator.h:34
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::Context::GetCapabilities
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
impeller::HostBuffer
Definition: host_buffer.h:28
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:64
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41
impeller::PipelineDescriptor::GetColorAttachmentDescriptor
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const
Definition: pipeline_descriptor.cc:124
impeller::BlendMode::kSource
@ kSource
impeller::PipelineDescriptor::SetPrimitiveType
void SetPrimitiveType(PrimitiveType type)
Definition: pipeline_descriptor.cc:268
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::BlendMode::kDestination
@ kDestination
texture_descriptor.h
impeller::RenderTarget::kDefaultColorAttachmentConfigMSAA
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
Definition: render_target.h:61
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::ContentContext::GetCachedRuntimeEffectPipeline
PipelineRef GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
Definition: content_context.cc:625
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:527
formats.h
impeller::ContentContextOptions::has_depth_stencil_attachments
bool has_depth_stencil_attachments
Definition: content_context.h:338
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::BlendMode::kPlus
@ kPlus
impeller::BlendSelectValues::kSoftLight
@ kSoftLight
impeller::ContentContextOptions::blend_mode
BlendMode blend_mode
Definition: content_context.h:333
typographer_context.h
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:152
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::BlendSelectValues::kDifference
@ kDifference
impeller::ContentContextOptions::ApplyToPipelineDescriptor
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
Definition: content_context.cc:27
framebuffer_blend_contents.h
impeller::ContentContextOptions::StencilMode::kStencilEvenOddFill
@ kStencilEvenOddFill
x
int32_t x
Definition: dl_golden_unittests.cc:443
validation.h
impeller::ContentContext::GetTessellator
Tessellator & GetTessellator() const
Definition: content_context.cc:609
impeller::ContentContext::GetEmptyTexture
std::shared_ptr< Texture > GetEmptyTexture() const
Definition: content_context.cc:537
impeller::BlendMode::kModulate
@ kModulate
impeller::PolygonMode::kFill
@ kFill
impeller::ContentContextOptions::wireframe
bool wireframe
Definition: content_context.h:340
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::BlendMode::kSourceOut
@ kSourceOut
tessellator.h
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
impeller::BlendSelectValues::kDarken
@ kDarken
impeller::BlendSelectValues::kExclusion
@ kExclusion
impeller::BlendFactor::kZero
@ kZero
impeller::Capabilities
Definition: capabilities.h:14
impeller::ColorWriteMaskBits::kAll
@ kAll
impeller::TSize
Definition: size.h:25
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::DepthAttachmentDescriptor::depth_write_enabled
bool depth_write_enabled
Definition: formats.h:598
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::ContentContextOptions::color_attachment_pixel_format
PixelFormat color_attachment_pixel_format
Definition: content_context.h:337
impeller::ContentContext::~ContentContext
~ContentContext()
impeller::RenderTarget::GetRenderTargetTexture
std::shared_ptr< Texture > GetRenderTargetTexture() const
Definition: render_target.cc:176
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::BlendSelectValues::kColor
@ kColor
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::BlendMode::kClear
@ kClear
impeller::ContentContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: content_context.cc:613
impeller::BlendOperation::kAdd
@ kAdd
impeller::RenderTarget::kDefaultStencilAttachmentConfig
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
Definition: render_target.h:68
impeller::ContentContextOptions::StencilMode::kStencilNonZeroFill
@ kStencilNonZeroFill
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::ContentContext::MakeSubpass
fml::StatusOr< RenderTarget > MakeSubpass(std::string_view label, ISize texture_size, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback, bool msaa_enabled=true, bool depth_stencil_enabled=false, int32_t mip_count=1) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
Definition: content_context.cc:541
impeller::Color::ToR8G8B8A8
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:245
texture_mipmap.h
impeller::StencilAttachmentDescriptor::stencil_failure
StencilOperation stencil_failure
Definition: formats.h:620
impeller::ColorAttachmentDescriptor::format
PixelFormat format
Definition: formats.h:519
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:629
impeller::RenderTarget
Definition: render_target.h:38
impeller::BlendFactor::kOne
@ kOne
impeller::ContentContextOptions::is_for_rrect_blur_clear
bool is_for_rrect_blur_clear
Definition: content_context.h:341
impeller::ContentContextOptions::stencil_mode
StencilMode stencil_mode
Definition: content_context.h:335
impeller::ContentContextOptions::depth_write_enabled
bool depth_write_enabled
Definition: content_context.h:339
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::ContentContextOptions::primitive_type
PrimitiveType primitive_type
Definition: content_context.h:336
pipeline_library.h
impeller::ContentContext::SubpassCallback
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
Definition: content_context.h:814
impeller::PipelineDescriptor::SetSampleCount
PipelineDescriptor & SetSampleCount(SampleCount samples)
Definition: pipeline_descriptor.cc:76
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:526
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:42
impeller::BlendMode::kDestinationIn
@ kDestinationIn
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
command_buffer.h
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:524
content_context.h
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::ContentContext::GetRenderTargetCache
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
Definition: content_context.h:838
impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:202
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:528
impeller::ContentContextOptions::depth_compare
CompareFunction depth_compare
Definition: content_context.h:334
impeller::PipelineDescriptor::ClearDepthAttachment
void ClearDepthAttachment()
Definition: pipeline_descriptor.cc:176
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:617
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:46
std
Definition: comparable.h:95
impeller::raw_ptr< Pipeline< PipelineDescriptor > >
impeller::BlendSelectValues::kHardLight
@ kHardLight
impeller::ContentContextOptions::sample_count
SampleCount sample_count
Definition: content_context.h:332
impeller::BlendSelectValues::kScreen
@ kScreen
impeller::DepthAttachmentDescriptor
Definition: formats.h:590
impeller::RenderTargetCache
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame...
Definition: render_target_cache.h:17
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:269
impeller::StencilAttachmentDescriptor
Definition: formats.h:610
impeller::BlendSelectValues::kLighten
@ kLighten
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::PipelineDescriptor::GetDepthStencilAttachmentDescriptor
std::optional< DepthAttachmentDescriptor > GetDepthStencilAttachmentDescriptor() const
Definition: pipeline_descriptor.cc:207
impeller::ContentContext::SetWireframe
void SetWireframe(bool wireframe)
Definition: content_context.cc:621
impeller::BlendSelectValues::kHue
@ kHue
impeller::SampleCount::kCount4
@ kCount4
impeller::PolygonMode::kLine
@ kLine
impeller::BlendSelectValues::kLuminosity
@ kLuminosity
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:39
impeller::PipelineDescriptor::SetDepthStencilAttachmentDescriptor
PipelineDescriptor & SetDepthStencilAttachmentDescriptor(std::optional< DepthAttachmentDescriptor > desc)
Definition: pipeline_descriptor.cc:151
impeller::ContentContextOptions::StencilMode::kOverdrawPreventionRestore
@ kOverdrawPreventionRestore
impeller::ContentContextOptions::StencilMode::kCoverCompareInverted
@ kCoverCompareInverted
pipeline_descriptor.h
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
impeller::ContentContextOptions::StencilMode::kCoverCompare
@ kCoverCompare
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:523
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
render_target.h
impeller::BlendMode::kXor
@ kXor
impeller::PipelineBuilder::MakeDefaultPipelineDescriptor
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
Definition: pipeline_builder.h:49
render_target_cache.h
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::interop::Create
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:160
impeller::ContentContextOptions
Definition: content_context.h:279
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:15
impeller::PipelineDescriptor::ClearStencilAttachments
void ClearStencilAttachments()
Definition: pipeline_descriptor.cc:170
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller
Definition: allocation.cc:12
impeller::ContentContext::IsValid
bool IsValid() const
Definition: content_context.cc:533
impeller::BlendMode::kSourceATop
@ kSourceATop
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:520
impeller::BlendSelectValues::kColorDodge
@ kColorDodge
impeller::CreateDefaultPipeline
static std::unique_ptr< PipelineT > CreateDefaultPipeline(const Context &context)
Definition: content_context.cc:246
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::BlendSelectValues::kOverlay
@ kOverlay
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::ContentContext::GetTransientsBuffer
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
Definition: content_context.h:866
impeller::DepthAttachmentDescriptor::depth_compare
CompareFunction depth_compare
Definition: formats.h:594
impeller::ColorAttachmentDescriptor::write_mask
ColorWriteMask write_mask
Definition: formats.h:530
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:518