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 
6 
7 #include <format>
8 #include <memory>
9 #include <utility>
10 
11 #include "fml/trace_event.h"
13 #include "impeller/core/formats.h"
18 #include "impeller/entity/entity.h"
28 
29 namespace impeller {
30 
31 namespace {
32 
33 /// A generic version of `Variants` which mostly exists to reduce code size.
34 class GenericVariants {
35  public:
36  void Set(const ContentContextOptions& options,
37  std::unique_ptr<GenericRenderPipelineHandle> pipeline) {
38  uint64_t p_key = options.ToKey();
39  for (const auto& [key, pipeline] : pipelines_) {
40  if (key == p_key) {
41  return;
42  }
43  }
44  pipelines_.push_back(std::make_pair(p_key, std::move(pipeline)));
45  }
46 
47  void SetDefault(const ContentContextOptions& options,
48  std::unique_ptr<GenericRenderPipelineHandle> pipeline) {
49  default_options_ = options;
50  if (pipeline) {
51  Set(options, std::move(pipeline));
52  }
53  }
54 
55  GenericRenderPipelineHandle* Get(const ContentContextOptions& options) const {
56  uint64_t p_key = options.ToKey();
57  for (const auto& [key, pipeline] : pipelines_) {
58  if (key == p_key) {
59  return pipeline.get();
60  }
61  }
62  return nullptr;
63  }
64 
65  void SetDefaultDescriptor(std::optional<PipelineDescriptor> desc) {
66  desc_ = std::move(desc);
67  }
68 
69  size_t GetPipelineCount() const { return pipelines_.size(); }
70 
71  bool IsDefault(const ContentContextOptions& opts) {
72  return default_options_.has_value() &&
73  opts.ToKey() == default_options_.value().ToKey();
74  }
75 
76  protected:
77  std::optional<PipelineDescriptor> desc_;
78  std::optional<ContentContextOptions> default_options_;
79  std::vector<std::pair<uint64_t, std::unique_ptr<GenericRenderPipelineHandle>>>
81 };
82 
83 /// Holds multiple Pipelines associated with the same PipelineHandle types.
84 ///
85 /// For example, it may have multiple
86 /// RenderPipelineHandle<SolidFillVertexShader, SolidFillFragmentShader>
87 /// instances for different blend modes. From them you can access the
88 /// Pipeline.
89 ///
90 /// See also:
91 /// - impeller::ContentContextOptions - options from which variants are
92 /// created.
93 /// - impeller::Pipeline::CreateVariant
94 /// - impeller::RenderPipelineHandle<> - The type of objects this typically
95 /// contains.
96 template <class PipelineHandleT>
97 class Variants : public GenericVariants {
98  static_assert(
99  ShaderStageCompatibilityChecker<
100  typename PipelineHandleT::VertexShader,
101  typename PipelineHandleT::FragmentShader>::Check(),
102  "The output slots for the fragment shader don't have matches in the "
103  "vertex shader's output slots. This will result in a linker error.");
104 
105  public:
106  Variants() = default;
107 
108  void Set(const ContentContextOptions& options,
109  std::unique_ptr<PipelineHandleT> pipeline) {
110  GenericVariants::Set(options, std::move(pipeline));
111  }
112 
113  void SetDefault(const ContentContextOptions& options,
114  std::unique_ptr<PipelineHandleT> pipeline) {
115  GenericVariants::SetDefault(options, std::move(pipeline));
116  }
117 
118  void CreateDefault(const Context& context,
119  const ContentContextOptions& options,
120  const std::vector<Scalar>& constants = {}) {
121  std::optional<PipelineDescriptor> desc =
122  PipelineHandleT::Builder::MakeDefaultPipelineDescriptor(context,
123  constants);
124  if (!desc.has_value()) {
125  VALIDATION_LOG << "Failed to create default pipeline.";
126  return;
127  }
128  context.GetPipelineLibrary()->LogPipelineCreation(*desc);
129  options.ApplyToPipelineDescriptor(*desc);
130  desc_ = desc;
131  if (context.GetFlags().lazy_shader_mode) {
132  SetDefault(options, nullptr);
133  } else {
134  SetDefault(options, std::make_unique<PipelineHandleT>(context, desc_,
135  /*async=*/true));
136  }
137  }
138 
139  PipelineHandleT* Get(const ContentContextOptions& options) const {
140  return static_cast<PipelineHandleT*>(GenericVariants::Get(options));
141  }
142 
143  PipelineHandleT* GetDefault(const Context& context) {
144  if (!default_options_.has_value()) {
145  return nullptr;
146  }
147  PipelineHandleT* result = Get(default_options_.value());
148  if (result != nullptr) {
149  return result;
150  }
151  SetDefault(default_options_.value(), std::make_unique<PipelineHandleT>(
152  context, desc_, /*async=*/false));
153  // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
154  return Get(default_options_.value());
155  }
156 
157  private:
158  Variants(const Variants&) = delete;
159 
160  Variants& operator=(const Variants&) = delete;
161 };
162 
163 template <class RenderPipelineHandleT>
164 RenderPipelineHandleT* CreateIfNeeded(
165  const ContentContext* context,
166  Variants<RenderPipelineHandleT>& container,
167  ContentContextOptions opts) {
168  if (!context->IsValid()) {
169  return nullptr;
170  }
171 
172  if (RenderPipelineHandleT* found = container.Get(opts)) {
173  return found;
174  }
175 
176  RenderPipelineHandleT* default_handle =
177  container.GetDefault(*context->GetContext());
178  if (container.IsDefault(opts)) {
179  return default_handle;
180  }
181 
182  // The default must always be initialized in the constructor.
183  FML_CHECK(default_handle != nullptr);
184 
185  const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline =
186  default_handle->WaitAndGet();
187  if (!pipeline) {
188  return nullptr;
189  }
190 
191  auto variant_future = pipeline->CreateVariant(
192  /*async=*/false, [&opts, variants_count = container.GetPipelineCount()](
193  PipelineDescriptor& desc) {
194  opts.ApplyToPipelineDescriptor(desc);
195  desc.SetLabel(std::format("{} V#{}", desc.GetLabel(), variants_count));
196  });
197  std::unique_ptr<RenderPipelineHandleT> variant =
198  std::make_unique<RenderPipelineHandleT>(std::move(variant_future));
199  container.Set(opts, std::move(variant));
200  return container.Get(opts);
201 }
202 
203 template <class TypedPipeline>
204 PipelineRef GetPipeline(const ContentContext* context,
205  Variants<TypedPipeline>& container,
206  ContentContextOptions opts) {
207  TypedPipeline* pipeline = CreateIfNeeded(context, container, opts);
208  if (!pipeline) {
209  return raw_ptr<Pipeline<PipelineDescriptor>>();
210  }
211  return raw_ptr(pipeline->WaitAndGet());
212 }
213 
214 } // namespace
215 
217  // clang-format off
218  Variants<BlendColorBurnPipeline> blend_colorburn;
219  Variants<BlendColorDodgePipeline> blend_colordodge;
220  Variants<BlendColorPipeline> blend_color;
221  Variants<BlendDarkenPipeline> blend_darken;
222  Variants<BlendDifferencePipeline> blend_difference;
223  Variants<BlendExclusionPipeline> blend_exclusion;
224  Variants<BlendHardLightPipeline> blend_hardlight;
225  Variants<BlendHuePipeline> blend_hue;
226  Variants<BlendLightenPipeline> blend_lighten;
227  Variants<BlendLuminosityPipeline> blend_luminosity;
228  Variants<BlendMultiplyPipeline> blend_multiply;
229  Variants<BlendOverlayPipeline> blend_overlay;
230  Variants<BlendSaturationPipeline> blend_saturation;
231  Variants<BlendScreenPipeline> blend_screen;
232  Variants<BlendSoftLightPipeline> blend_softlight;
233  Variants<BorderMaskBlurPipeline> border_mask_blur;
234  Variants<CirclePipeline> circle;
235  Variants<ClipPipeline> clip;
236  Variants<ColorMatrixColorFilterPipeline> color_matrix_color_filter;
237  Variants<ConicalGradientFillConicalPipeline> conical_gradient_fill;
238  Variants<ConicalGradientFillRadialPipeline> conical_gradient_fill_radial;
239  Variants<ConicalGradientFillStripPipeline> conical_gradient_fill_strip;
240  Variants<ConicalGradientFillStripRadialPipeline> conical_gradient_fill_strip_and_radial;
241  Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill;
242  Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill_radial;
243  Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill_strip_and_radial;
244  Variants<ConicalGradientSSBOFillPipeline> conical_gradient_ssbo_fill_strip;
245  Variants<ConicalGradientUniformFillConicalPipeline> conical_gradient_uniform_fill;
246  Variants<ConicalGradientUniformFillRadialPipeline> conical_gradient_uniform_fill_radial;
247  Variants<ConicalGradientUniformFillStripPipeline> conical_gradient_uniform_fill_strip;
248  Variants<ConicalGradientUniformFillStripRadialPipeline> conical_gradient_uniform_fill_strip_and_radial;
249  Variants<FastGradientPipeline> fast_gradient;
250  Variants<FramebufferBlendColorBurnPipeline> framebuffer_blend_colorburn;
251  Variants<FramebufferBlendColorDodgePipeline> framebuffer_blend_colordodge;
252  Variants<FramebufferBlendColorPipeline> framebuffer_blend_color;
253  Variants<FramebufferBlendDarkenPipeline> framebuffer_blend_darken;
254  Variants<FramebufferBlendDifferencePipeline> framebuffer_blend_difference;
255  Variants<FramebufferBlendExclusionPipeline> framebuffer_blend_exclusion;
256  Variants<FramebufferBlendHardLightPipeline> framebuffer_blend_hardlight;
257  Variants<FramebufferBlendHuePipeline> framebuffer_blend_hue;
258  Variants<FramebufferBlendLightenPipeline> framebuffer_blend_lighten;
259  Variants<FramebufferBlendLuminosityPipeline> framebuffer_blend_luminosity;
260  Variants<FramebufferBlendMultiplyPipeline> framebuffer_blend_multiply;
261  Variants<FramebufferBlendOverlayPipeline> framebuffer_blend_overlay;
262  Variants<FramebufferBlendSaturationPipeline> framebuffer_blend_saturation;
263  Variants<FramebufferBlendScreenPipeline> framebuffer_blend_screen;
264  Variants<FramebufferBlendSoftLightPipeline> framebuffer_blend_softlight;
265  Variants<GaussianBlurPipeline> gaussian_blur;
266  Variants<GlyphAtlasPipeline> glyph_atlas;
267  Variants<LinePipeline> line;
268  Variants<LinearGradientFillPipeline> linear_gradient_fill;
269  Variants<LinearGradientSSBOFillPipeline> linear_gradient_ssbo_fill;
270  Variants<LinearGradientUniformFillPipeline> linear_gradient_uniform_fill;
271  Variants<LinearToSrgbFilterPipeline> linear_to_srgb_filter;
272  Variants<MorphologyFilterPipeline> morphology_filter;
273  Variants<PorterDuffBlendPipeline> clear_blend;
274  Variants<PorterDuffBlendPipeline> destination_a_top_blend;
275  Variants<PorterDuffBlendPipeline> destination_blend;
276  Variants<PorterDuffBlendPipeline> destination_in_blend;
277  Variants<PorterDuffBlendPipeline> destination_out_blend;
278  Variants<PorterDuffBlendPipeline> destination_over_blend;
279  Variants<PorterDuffBlendPipeline> modulate_blend;
280  Variants<PorterDuffBlendPipeline> plus_blend;
281  Variants<PorterDuffBlendPipeline> screen_blend;
282  Variants<PorterDuffBlendPipeline> source_a_top_blend;
283  Variants<PorterDuffBlendPipeline> source_blend;
284  Variants<PorterDuffBlendPipeline> source_in_blend;
285  Variants<PorterDuffBlendPipeline> source_out_blend;
286  Variants<PorterDuffBlendPipeline> source_over_blend;
287  Variants<PorterDuffBlendPipeline> xor_blend;
288  Variants<RadialGradientFillPipeline> radial_gradient_fill;
289  Variants<RadialGradientSSBOFillPipeline> radial_gradient_ssbo_fill;
290  Variants<RadialGradientUniformFillPipeline> radial_gradient_uniform_fill;
291  Variants<RRectBlurPipeline> rrect_blur;
292  Variants<RSuperellipseBlurPipeline> rsuperellipse_blur;
293  Variants<ShadowVerticesShader> shadow_vertices_;
294  Variants<SolidFillPipeline> solid_fill;
295  Variants<SrgbToLinearFilterPipeline> srgb_to_linear_filter;
296  Variants<SweepGradientFillPipeline> sweep_gradient_fill;
297  Variants<SweepGradientSSBOFillPipeline> sweep_gradient_ssbo_fill;
298  Variants<SweepGradientUniformFillPipeline> sweep_gradient_uniform_fill;
299  Variants<TextureDownsamplePipeline> texture_downsample;
300  Variants<TextureDownsampleBoundedPipeline> texture_downsample_bounded;
301  Variants<TexturePipeline> texture;
302  Variants<TextureStrictSrcPipeline> texture_strict_src;
303  Variants<TiledTexturePipeline> tiled_texture;
304  Variants<VerticesUber1Shader> vertices_uber_1_;
305  Variants<VerticesUber2Shader> vertices_uber_2_;
306  Variants<YUVToRGBFilterPipeline> yuv_to_rgb_filter;
307 
308 // Web doesn't support external texture OpenGL extensions
309 #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_EMSCRIPTEN)
310  Variants<TiledTextureExternalPipeline> tiled_texture_external;
311  Variants<TiledTextureUvExternalPipeline> tiled_texture_uv_external;
312 #endif
313 
314 #if defined(IMPELLER_ENABLE_OPENGLES)
315  Variants<TextureDownsampleGlesPipeline> texture_downsample_gles;
316 #endif // IMPELLER_ENABLE_OPENGLES
317  // clang-format on
318 };
319 
321  PipelineDescriptor& desc) const {
322  auto pipeline_blend = blend_mode;
324  VALIDATION_LOG << "Cannot use blend mode " << static_cast<int>(blend_mode)
325  << " as a pipeline blend.";
326  pipeline_blend = BlendMode::kSrcOver;
327  }
328 
330 
336 
337  switch (pipeline_blend) {
338  case BlendMode::kClear:
346  } else {
351  }
352  break;
353  case BlendMode::kSrc:
354  color0.blending_enabled = false;
359  break;
360  case BlendMode::kDst:
366  break;
367  case BlendMode::kSrcOver:
372  break;
373  case BlendMode::kDstOver:
378  break;
379  case BlendMode::kSrcIn:
384  break;
385  case BlendMode::kDstIn:
390  break;
391  case BlendMode::kSrcOut:
396  break;
397  case BlendMode::kDstOut:
402  break;
403  case BlendMode::kSrcATop:
408  break;
409  case BlendMode::kDstATop:
414  break;
415  case BlendMode::kXor:
420  break;
421  case BlendMode::kPlus:
426  break;
432  break;
433  default:
434  FML_UNREACHABLE();
435  }
436  desc.SetColorAttachmentDescriptor(0u, color0);
437 
439  desc.ClearDepthAttachment();
441  }
442 
443  auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
444  auto maybe_depth = desc.GetDepthStencilAttachmentDescriptor();
445  FML_DCHECK(has_depth_stencil_attachments == maybe_depth.has_value())
446  << "Depth attachment doesn't match expected pipeline state. "
447  "has_depth_stencil_attachments="
449  FML_DCHECK(has_depth_stencil_attachments == maybe_stencil.has_value())
450  << "Stencil attachment doesn't match expected pipeline state. "
451  "has_depth_stencil_attachments="
453  if (maybe_stencil.has_value()) {
454  StencilAttachmentDescriptor front_stencil = maybe_stencil.value();
455  StencilAttachmentDescriptor back_stencil = front_stencil;
456 
457  switch (stencil_mode) {
461  desc.SetStencilAttachmentDescriptors(front_stencil);
462  break;
464  // The stencil ref should be 0 on commands that use this mode.
469  desc.SetStencilAttachmentDescriptors(front_stencil, back_stencil);
470  break;
472  // The stencil ref should be 0 on commands that use this mode.
476  desc.SetStencilAttachmentDescriptors(front_stencil);
477  break;
479  // The stencil ref should be 0 on commands that use this mode.
482  desc.SetStencilAttachmentDescriptors(front_stencil);
483  break;
485  // The stencil ref should be 0 on commands that use this mode.
487  front_stencil.depth_stencil_pass =
489  desc.SetStencilAttachmentDescriptors(front_stencil);
490  break;
492  // The stencil ref should be 0 on commands that use this mode.
495  desc.SetStencilAttachmentDescriptors(front_stencil);
496  break;
497  }
498  }
499  if (maybe_depth.has_value()) {
500  DepthAttachmentDescriptor depth = maybe_depth.value();
504  }
505 
508 }
509 
510 std::array<std::vector<Scalar>, 15> GetPorterDuffSpecConstants(
511  bool supports_decal) {
512  Scalar x = supports_decal ? 1 : 0;
513  return {{
514  {x, 0, 0, 0, 0, 0}, // Clear
515  {x, 1, 0, 0, 0, 0}, // Source
516  {x, 0, 0, 1, 0, 0}, // Destination
517  {x, 1, 0, 1, -1, 0}, // SourceOver
518  {x, 1, -1, 1, 0, 0}, // DestinationOver
519  {x, 0, 1, 0, 0, 0}, // SourceIn
520  {x, 0, 0, 0, 1, 0}, // DestinationIn
521  {x, 1, -1, 0, 0, 0}, // SourceOut
522  {x, 0, 0, 1, -1, 0}, // DestinationOut
523  {x, 0, 1, 1, -1, 0}, // SourceATop
524  {x, 1, -1, 0, 1, 0}, // DestinationATop
525  {x, 1, -1, 1, -1, 0}, // Xor
526  {x, 1, 0, 1, 0, 0}, // Plus
527  {x, 0, 0, 0, 0, 1}, // Modulate
528  {x, 0, 0, 1, 0, -1}, // Screen
529  }};
530 }
531 
532 template <typename PipelineT>
533 static std::unique_ptr<PipelineT> CreateDefaultPipeline(
534  const Context& context) {
535  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
536  if (!desc.has_value()) {
537  return nullptr;
538  }
539  // Apply default ContentContextOptions to the descriptor.
540  const auto default_color_format =
541  context.GetCapabilities()->GetDefaultColorFormat();
543  .primitive_type = PrimitiveType::kTriangleStrip,
544  .color_attachment_pixel_format = default_color_format}
545  .ApplyToPipelineDescriptor(*desc);
546  return std::make_unique<PipelineT>(context, desc);
547 }
548 
550  std::shared_ptr<Context> context,
551  std::shared_ptr<TypographerContext> typographer_context,
552  std::shared_ptr<RenderTargetAllocator> render_target_allocator)
553  : context_(std::move(context)),
554  lazy_glyph_atlas_(
555  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
556  pipelines_(new Pipelines()),
557  tessellator_(std::make_shared<Tessellator>(
558  context_->GetCapabilities()->Supports32BitPrimitiveIndices())),
559  render_target_cache_(render_target_allocator == nullptr
560  ? std::make_shared<RenderTargetCache>(
561  context_->GetResourceAllocator())
562  : std::move(render_target_allocator)),
563  data_host_buffer_(HostBuffer::Create(
564  context_->GetResourceAllocator(),
565  context_->GetIdleWaiter(),
566  context_->GetCapabilities()->GetMinimumUniformAlignment())),
567  text_shadow_cache_(std::make_unique<TextShadowCache>()) {
568  if (!context_ || !context_->IsValid()) {
569  return;
570  }
571 
572  // On most backends, indexes and other data can be allocated into the same
573  // buffers. However, some backends (namely WebGL) require indexes used in
574  // indexed draws to be allocated separately from other data. For those
575  // backends, we allocate a separate host buffer just for indexes.
576  indexes_host_buffer_ =
577  context_->GetCapabilities()->NeedsPartitionedHostBuffer()
579  context_->GetResourceAllocator(), context_->GetIdleWaiter(),
580  context_->GetCapabilities()->GetMinimumUniformAlignment())
581  : data_host_buffer_;
582  {
583  TextureDescriptor desc;
586  desc.size = ISize{1, 1};
587  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
588 
589  std::array<uint8_t, 4> data = Color::BlackTransparent().ToR8G8B8A8();
590  std::shared_ptr<CommandBuffer> cmd_buffer =
591  GetContext()->CreateCommandBuffer();
592  std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
593  HostBuffer& data_host_buffer = GetTransientsDataBuffer();
594  BufferView buffer_view = data_host_buffer.Emplace(data);
595  blit_pass->AddCopy(buffer_view, empty_texture_);
596 
597  if (!blit_pass->EncodeCommands() || !GetContext()
598  ->GetCommandQueue()
599  ->Submit({std::move(cmd_buffer)})
600  .ok()) {
601  VALIDATION_LOG << "Failed to create empty texture.";
602  }
603  }
604 
605  auto options = ContentContextOptions{
607  .color_attachment_pixel_format =
608  context_->GetCapabilities()->GetDefaultColorFormat()};
609  auto options_trianglestrip = ContentContextOptions{
611  .primitive_type = PrimitiveType::kTriangleStrip,
612  .color_attachment_pixel_format =
613  context_->GetCapabilities()->GetDefaultColorFormat()};
614  auto options_no_msaa_no_depth_stencil = ContentContextOptions{
616  .primitive_type = PrimitiveType::kTriangleStrip,
617  .color_attachment_pixel_format =
618  context_->GetCapabilities()->GetDefaultColorFormat(),
619  .has_depth_stencil_attachments = false};
620  const auto supports_decal = static_cast<Scalar>(
621  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
622 
623  // Futures for the following pipelines may block in case the first frame is
624  // rendered without the pipelines being ready. Put pipelines that are more
625  // likely to be used first.
626  {
627  pipelines_->glyph_atlas.CreateDefault(
628  *context_, options,
629  {static_cast<Scalar>(
630  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
632  pipelines_->solid_fill.CreateDefault(*context_, options);
633  pipelines_->texture.CreateDefault(*context_, options);
634  pipelines_->fast_gradient.CreateDefault(*context_, options);
635  pipelines_->line.CreateDefault(*context_, options);
636  pipelines_->circle.CreateDefault(*context_, options);
637 
638  if (context_->GetCapabilities()->SupportsSSBO()) {
639  pipelines_->linear_gradient_ssbo_fill.CreateDefault(*context_, options);
640  pipelines_->radial_gradient_ssbo_fill.CreateDefault(*context_, options);
641  pipelines_->conical_gradient_ssbo_fill.CreateDefault(*context_, options,
642  {3.0});
643  pipelines_->conical_gradient_ssbo_fill_radial.CreateDefault(
644  *context_, options, {1.0});
645  pipelines_->conical_gradient_ssbo_fill_strip.CreateDefault(
646  *context_, options, {2.0});
647  pipelines_->conical_gradient_ssbo_fill_strip_and_radial.CreateDefault(
648  *context_, options, {0.0});
649  pipelines_->sweep_gradient_ssbo_fill.CreateDefault(*context_, options);
650  } else {
651  pipelines_->linear_gradient_uniform_fill.CreateDefault(*context_,
652  options);
653  pipelines_->radial_gradient_uniform_fill.CreateDefault(*context_,
654  options);
655  pipelines_->conical_gradient_uniform_fill.CreateDefault(*context_,
656  options);
657  pipelines_->conical_gradient_uniform_fill_radial.CreateDefault(*context_,
658  options);
659  pipelines_->conical_gradient_uniform_fill_strip.CreateDefault(*context_,
660  options);
661  pipelines_->conical_gradient_uniform_fill_strip_and_radial.CreateDefault(
662  *context_, options);
663  pipelines_->sweep_gradient_uniform_fill.CreateDefault(*context_, options);
664 
665  pipelines_->linear_gradient_fill.CreateDefault(*context_, options);
666  pipelines_->radial_gradient_fill.CreateDefault(*context_, options);
667  pipelines_->conical_gradient_fill.CreateDefault(*context_, options);
668  pipelines_->conical_gradient_fill_radial.CreateDefault(*context_,
669  options);
670  pipelines_->conical_gradient_fill_strip.CreateDefault(*context_, options);
671  pipelines_->conical_gradient_fill_strip_and_radial.CreateDefault(
672  *context_, options);
673  pipelines_->sweep_gradient_fill.CreateDefault(*context_, options);
674  }
675 
676  /// Setup default clip pipeline.
677  auto clip_pipeline_descriptor =
679  if (!clip_pipeline_descriptor.has_value()) {
680  return;
681  }
684  .color_attachment_pixel_format =
685  context_->GetCapabilities()->GetDefaultColorFormat()}
686  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
687  // Disable write to all color attachments.
688  auto clip_color_attachments =
689  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
690  for (auto& color_attachment : clip_color_attachments) {
691  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
692  }
693  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
694  std::move(clip_color_attachments));
695  if (GetContext()->GetFlags().lazy_shader_mode) {
696  pipelines_->clip.SetDefaultDescriptor(clip_pipeline_descriptor);
697  pipelines_->clip.SetDefault(options, nullptr);
698  } else {
699  pipelines_->clip.SetDefault(
700  options,
701  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
702  }
703  pipelines_->texture_downsample.CreateDefault(
704  *context_, options_no_msaa_no_depth_stencil);
705  pipelines_->texture_downsample_bounded.CreateDefault(
706  *context_, options_no_msaa_no_depth_stencil);
707  pipelines_->rrect_blur.CreateDefault(*context_, options_trianglestrip);
708  pipelines_->rsuperellipse_blur.CreateDefault(*context_,
709  options_trianglestrip);
710  pipelines_->texture_strict_src.CreateDefault(*context_, options);
711  pipelines_->tiled_texture.CreateDefault(*context_, options,
712  {supports_decal});
713  pipelines_->gaussian_blur.CreateDefault(
714  *context_, options_no_msaa_no_depth_stencil, {supports_decal});
715  pipelines_->border_mask_blur.CreateDefault(*context_,
716  options_trianglestrip);
717  pipelines_->color_matrix_color_filter.CreateDefault(*context_,
718  options_trianglestrip);
719  pipelines_->shadow_vertices_.CreateDefault(*context_, options);
720  pipelines_->vertices_uber_1_.CreateDefault(*context_, options,
721  {supports_decal});
722  pipelines_->vertices_uber_2_.CreateDefault(*context_, options,
723  {supports_decal});
724 
725  const std::array<std::vector<Scalar>, 15> porter_duff_constants =
726  GetPorterDuffSpecConstants(supports_decal);
727  pipelines_->clear_blend.CreateDefault(*context_, options_trianglestrip,
728  porter_duff_constants[0]);
729  pipelines_->source_blend.CreateDefault(*context_, options_trianglestrip,
730  porter_duff_constants[1]);
731  pipelines_->destination_blend.CreateDefault(
732  *context_, options_trianglestrip, porter_duff_constants[2]);
733  pipelines_->source_over_blend.CreateDefault(
734  *context_, options_trianglestrip, porter_duff_constants[3]);
735  pipelines_->destination_over_blend.CreateDefault(
736  *context_, options_trianglestrip, porter_duff_constants[4]);
737  pipelines_->source_in_blend.CreateDefault(*context_, options_trianglestrip,
738  porter_duff_constants[5]);
739  pipelines_->destination_in_blend.CreateDefault(
740  *context_, options_trianglestrip, porter_duff_constants[6]);
741  pipelines_->source_out_blend.CreateDefault(*context_, options_trianglestrip,
742  porter_duff_constants[7]);
743  pipelines_->destination_out_blend.CreateDefault(
744  *context_, options_trianglestrip, porter_duff_constants[8]);
745  pipelines_->source_a_top_blend.CreateDefault(
746  *context_, options_trianglestrip, porter_duff_constants[9]);
747  pipelines_->destination_a_top_blend.CreateDefault(
748  *context_, options_trianglestrip, porter_duff_constants[10]);
749  pipelines_->xor_blend.CreateDefault(*context_, options_trianglestrip,
750  porter_duff_constants[11]);
751  pipelines_->plus_blend.CreateDefault(*context_, options_trianglestrip,
752  porter_duff_constants[12]);
753  pipelines_->modulate_blend.CreateDefault(*context_, options_trianglestrip,
754  porter_duff_constants[13]);
755  pipelines_->screen_blend.CreateDefault(*context_, options_trianglestrip,
756  porter_duff_constants[14]);
757  }
758 
759  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
760  pipelines_->framebuffer_blend_color.CreateDefault(
761  *context_, options_trianglestrip,
762  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
763  pipelines_->framebuffer_blend_colorburn.CreateDefault(
764  *context_, options_trianglestrip,
765  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
766  pipelines_->framebuffer_blend_colordodge.CreateDefault(
767  *context_, options_trianglestrip,
768  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
769  pipelines_->framebuffer_blend_darken.CreateDefault(
770  *context_, options_trianglestrip,
771  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
772  pipelines_->framebuffer_blend_difference.CreateDefault(
773  *context_, options_trianglestrip,
774  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
775  pipelines_->framebuffer_blend_exclusion.CreateDefault(
776  *context_, options_trianglestrip,
777  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
778  pipelines_->framebuffer_blend_hardlight.CreateDefault(
779  *context_, options_trianglestrip,
780  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
781  pipelines_->framebuffer_blend_hue.CreateDefault(
782  *context_, options_trianglestrip,
783  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
784  pipelines_->framebuffer_blend_lighten.CreateDefault(
785  *context_, options_trianglestrip,
786  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
787  pipelines_->framebuffer_blend_luminosity.CreateDefault(
788  *context_, options_trianglestrip,
789  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
790  pipelines_->framebuffer_blend_multiply.CreateDefault(
791  *context_, options_trianglestrip,
792  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
793  pipelines_->framebuffer_blend_overlay.CreateDefault(
794  *context_, options_trianglestrip,
795  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
796  pipelines_->framebuffer_blend_saturation.CreateDefault(
797  *context_, options_trianglestrip,
798  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
799  pipelines_->framebuffer_blend_screen.CreateDefault(
800  *context_, options_trianglestrip,
801  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
802  pipelines_->framebuffer_blend_softlight.CreateDefault(
803  *context_, options_trianglestrip,
804  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
805  } else {
806  pipelines_->blend_color.CreateDefault(
807  *context_, options_trianglestrip,
808  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
809  pipelines_->blend_colorburn.CreateDefault(
810  *context_, options_trianglestrip,
811  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
812  pipelines_->blend_colordodge.CreateDefault(
813  *context_, options_trianglestrip,
814  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
815  pipelines_->blend_darken.CreateDefault(
816  *context_, options_trianglestrip,
817  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
818  pipelines_->blend_difference.CreateDefault(
819  *context_, options_trianglestrip,
820  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
821  pipelines_->blend_exclusion.CreateDefault(
822  *context_, options_trianglestrip,
823  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
824  pipelines_->blend_hardlight.CreateDefault(
825  *context_, options_trianglestrip,
826  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
827  pipelines_->blend_hue.CreateDefault(
828  *context_, options_trianglestrip,
829  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
830  pipelines_->blend_lighten.CreateDefault(
831  *context_, options_trianglestrip,
832  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
833  pipelines_->blend_luminosity.CreateDefault(
834  *context_, options_trianglestrip,
835  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
836  pipelines_->blend_multiply.CreateDefault(
837  *context_, options_trianglestrip,
838  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
839  pipelines_->blend_overlay.CreateDefault(
840  *context_, options_trianglestrip,
841  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
842  pipelines_->blend_saturation.CreateDefault(
843  *context_, options_trianglestrip,
844  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
845  pipelines_->blend_screen.CreateDefault(
846  *context_, options_trianglestrip,
847  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
848  pipelines_->blend_softlight.CreateDefault(
849  *context_, options_trianglestrip,
850  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
851  }
852 
853  pipelines_->morphology_filter.CreateDefault(*context_, options_trianglestrip,
854  {supports_decal});
855  pipelines_->linear_to_srgb_filter.CreateDefault(*context_,
856  options_trianglestrip);
857  pipelines_->srgb_to_linear_filter.CreateDefault(*context_,
858  options_trianglestrip);
859  pipelines_->yuv_to_rgb_filter.CreateDefault(*context_, options_trianglestrip);
860 
861  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
862 #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX) && \
863  !defined(FML_OS_EMSCRIPTEN)
864  // GLES only shader that is unsupported on macOS and web.
865  pipelines_->tiled_texture_external.CreateDefault(*context_, options);
866  pipelines_->tiled_texture_uv_external.CreateDefault(*context_, options);
867 #endif // !defined(FML_OS_MACOSX)
868 
869 #if defined(IMPELLER_ENABLE_OPENGLES)
870  pipelines_->texture_downsample_gles.CreateDefault(*context_,
871  options_trianglestrip);
872 #endif // IMPELLER_ENABLE_OPENGLES
873  }
874 
875  is_valid_ = true;
876  InitializeCommonlyUsedShadersIfNeeded();
877 }
878 
880 
882  return is_valid_;
883 }
884 
885 std::shared_ptr<Texture> ContentContext::GetEmptyTexture() const {
886  return empty_texture_;
887 }
888 
889 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
890  std::string_view label,
891  ISize texture_size,
892  const std::shared_ptr<CommandBuffer>& command_buffer,
893  const SubpassCallback& subpass_callback,
894  bool msaa_enabled,
895  bool depth_stencil_enabled,
896  int32_t mip_count) const {
897  const std::shared_ptr<Context>& context = GetContext();
898  RenderTarget subpass_target;
899 
900  std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
901  depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
902  : std::optional<RenderTarget::AttachmentConfig>();
903 
904  if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
905  subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
906  /*context=*/*context,
907  /*size=*/texture_size,
908  /*mip_count=*/mip_count,
909  /*label=*/label,
910  /*color_attachment_config=*/
912  /*stencil_attachment_config=*/depth_stencil_config,
913  /*existing_color_msaa_texture=*/nullptr,
914  /*existing_color_resolve_texture=*/nullptr,
915  /*existing_depth_stencil_texture=*/nullptr,
916  /*target_pixel_format=*/std::nullopt);
917  } else {
918  subpass_target = GetRenderTargetCache()->CreateOffscreen(
919  *context, texture_size,
920  /*mip_count=*/mip_count, label,
921  RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
922  }
923  return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
924 }
925 
926 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
927  std::string_view label,
928  const RenderTarget& subpass_target,
929  const std::shared_ptr<CommandBuffer>& command_buffer,
930  const SubpassCallback& subpass_callback) const {
931  const std::shared_ptr<Context>& context = GetContext();
932 
933  auto subpass_texture = subpass_target.GetRenderTargetTexture();
934  if (!subpass_texture) {
935  return fml::Status(fml::StatusCode::kUnknown, "");
936  }
937 
938  auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
939  if (!sub_renderpass) {
940  return fml::Status(fml::StatusCode::kUnknown, "");
941  }
942  sub_renderpass->SetLabel(label);
943 
944  if (!subpass_callback(*this, *sub_renderpass)) {
945  return fml::Status(fml::StatusCode::kUnknown, "");
946  }
947 
948  if (!sub_renderpass->EncodeCommands()) {
949  return fml::Status(fml::StatusCode::kUnknown, "");
950  }
951 
952  const std::shared_ptr<Texture>& target_texture =
953  subpass_target.GetRenderTargetTexture();
954  if (target_texture->GetMipCount() > 1) {
955  fml::Status mipmap_status =
956  AddMipmapGeneration(command_buffer, context, target_texture);
957  if (!mipmap_status.ok()) {
958  return mipmap_status;
959  }
960  }
961 
962  return subpass_target;
963 }
964 
966  return *tessellator_;
967 }
968 
969 std::shared_ptr<Context> ContentContext::GetContext() const {
970  return context_;
971 }
972 
974  return *context_->GetCapabilities();
975 }
976 
978  const std::string& unique_entrypoint_name,
979  const ContentContextOptions& options,
980  const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
981  create_callback) const {
982  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
983  auto it = runtime_effect_pipelines_.find(key);
984  if (it == runtime_effect_pipelines_.end()) {
985  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
986  }
987  return raw_ptr(it->second);
988 }
989 
991  const std::string& unique_entrypoint_name) const {
992 #ifdef IMPELLER_DEBUG
993  // destroying in-use pipleines is a validation error.
994  const auto& idle_waiter = GetContext()->GetIdleWaiter();
995  if (idle_waiter) {
996  idle_waiter->WaitIdle();
997  }
998 #endif // IMPELLER_DEBUG
999  for (auto it = runtime_effect_pipelines_.begin();
1000  it != runtime_effect_pipelines_.end();) {
1001  if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
1002  it = runtime_effect_pipelines_.erase(it);
1003  } else {
1004  it++;
1005  }
1006  }
1007 }
1008 
1010  data_host_buffer_->Reset();
1011 
1012  // We should only reset the indexes host buffer if it is actually different
1013  // from the data host buffer. Otherwise we'll end up resetting the same host
1014  // buffer twice.
1015  if (data_host_buffer_ != indexes_host_buffer_) {
1016  indexes_host_buffer_->Reset();
1017  }
1018 }
1019 
1020 void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
1021  if (GetContext()->GetFlags().lazy_shader_mode) {
1022  return;
1023  }
1024  GetContext()->InitializeCommonlyUsedShadersIfNeeded();
1025 }
1026 
1028  ContentContextOptions opts) const {
1029  return GetPipeline(this, pipelines_->fast_gradient, opts);
1030 }
1031 
1033  ContentContextOptions opts) const {
1034  return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1035 }
1036 
1038  ContentContextOptions opts) const {
1039  return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1040 }
1041 
1043  ContentContextOptions opts) const {
1044  return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
1045 }
1046 
1048  ContentContextOptions opts) const {
1049  return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1050 }
1051 
1053  ContentContextOptions opts) const {
1054  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1055  return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1056 }
1057 
1059  ContentContextOptions opts) const {
1060  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1061  return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1062 }
1063 
1065  ContentContextOptions opts,
1066  ConicalKind kind) const {
1067  switch (kind) {
1068  case ConicalKind::kConical:
1069  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1070  case ConicalKind::kRadial:
1071  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1072  opts);
1073  case ConicalKind::kStrip:
1074  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1075  opts);
1077  return GetPipeline(
1078  this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1079  opts);
1080  }
1081 }
1082 
1084  ContentContextOptions opts,
1085  ConicalKind kind) const {
1086  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1087  switch (kind) {
1088  case ConicalKind::kConical:
1089  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1090  case ConicalKind::kRadial:
1091  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1092  opts);
1093  case ConicalKind::kStrip:
1094  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1095  opts);
1097  return GetPipeline(
1098  this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1099  }
1100 }
1101 
1103  ContentContextOptions opts) const {
1104  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1105  return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1106 }
1107 
1109  ContentContextOptions opts) const {
1110  return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1111 }
1112 
1114  ContentContextOptions opts,
1115  ConicalKind kind) const {
1116  switch (kind) {
1117  case ConicalKind::kConical:
1118  return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1119  case ConicalKind::kRadial:
1120  return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1121  case ConicalKind::kStrip:
1122  return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1124  return GetPipeline(
1125  this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1126  }
1127 }
1128 
1130  ContentContextOptions opts) const {
1131  return GetPipeline(this, pipelines_->rrect_blur, opts);
1132 }
1133 
1135  ContentContextOptions opts) const {
1136  return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1137 }
1138 
1140  ContentContextOptions opts) const {
1141  return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1142 }
1143 
1145  ContentContextOptions opts) const {
1146  return GetPipeline(this, pipelines_->solid_fill, opts);
1147 }
1148 
1150  ContentContextOptions opts) const {
1151  return GetPipeline(this, pipelines_->texture, opts);
1152 }
1153 
1155  ContentContextOptions opts) const {
1156  return GetPipeline(this, pipelines_->texture_strict_src, opts);
1157 }
1158 
1160  ContentContextOptions opts) const {
1161  return GetPipeline(this, pipelines_->tiled_texture, opts);
1162 }
1163 
1165  ContentContextOptions opts) const {
1166  return GetPipeline(this, pipelines_->gaussian_blur, opts);
1167 }
1168 
1170  ContentContextOptions opts) const {
1171  return GetPipeline(this, pipelines_->border_mask_blur, opts);
1172 }
1173 
1175  ContentContextOptions opts) const {
1176  return GetPipeline(this, pipelines_->morphology_filter, opts);
1177 }
1178 
1180  ContentContextOptions opts) const {
1181  return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1182 }
1183 
1185  ContentContextOptions opts) const {
1186  return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1187 }
1188 
1190  ContentContextOptions opts) const {
1191  return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1192 }
1193 
1195  return GetPipeline(this, pipelines_->clip, opts);
1196 }
1197 
1199  ContentContextOptions opts) const {
1200  return GetPipeline(this, pipelines_->glyph_atlas, opts);
1201 }
1202 
1204  ContentContextOptions opts) const {
1205  return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1206 }
1207 
1209  BlendMode mode,
1210  ContentContextOptions opts) const {
1211  switch (mode) {
1212  case BlendMode::kClear:
1213  return GetClearBlendPipeline(opts);
1214  case BlendMode::kSrc:
1215  return GetSourceBlendPipeline(opts);
1216  case BlendMode::kDst:
1217  return GetDestinationBlendPipeline(opts);
1218  case BlendMode::kSrcOver:
1219  return GetSourceOverBlendPipeline(opts);
1220  case BlendMode::kDstOver:
1221  return GetDestinationOverBlendPipeline(opts);
1222  case BlendMode::kSrcIn:
1223  return GetSourceInBlendPipeline(opts);
1224  case BlendMode::kDstIn:
1225  return GetDestinationInBlendPipeline(opts);
1226  case BlendMode::kSrcOut:
1227  return GetSourceOutBlendPipeline(opts);
1228  case BlendMode::kDstOut:
1229  return GetDestinationOutBlendPipeline(opts);
1230  case BlendMode::kSrcATop:
1231  return GetSourceATopBlendPipeline(opts);
1232  case BlendMode::kDstATop:
1233  return GetDestinationATopBlendPipeline(opts);
1234  case BlendMode::kXor:
1235  return GetXorBlendPipeline(opts);
1236  case BlendMode::kPlus:
1237  return GetPlusBlendPipeline(opts);
1238  case BlendMode::kModulate:
1239  return GetModulateBlendPipeline(opts);
1240  case BlendMode::kScreen:
1241  return GetScreenBlendPipeline(opts);
1242  case BlendMode::kOverlay:
1243  case BlendMode::kDarken:
1244  case BlendMode::kLighten:
1246  case BlendMode::kColorBurn:
1247  case BlendMode::kHardLight:
1248  case BlendMode::kSoftLight:
1250  case BlendMode::kExclusion:
1251  case BlendMode::kMultiply:
1252  case BlendMode::kHue:
1254  case BlendMode::kColor:
1256  VALIDATION_LOG << "Invalid porter duff blend mode "
1257  << BlendModeToString(mode);
1258  return GetClearBlendPipeline(opts);
1259  break;
1260  }
1261 }
1262 
1264  ContentContextOptions opts) const {
1265  return GetPipeline(this, pipelines_->clear_blend, opts);
1266 }
1267 
1269  ContentContextOptions opts) const {
1270  return GetPipeline(this, pipelines_->source_blend, opts);
1271 }
1272 
1274  ContentContextOptions opts) const {
1275  return GetPipeline(this, pipelines_->destination_blend, opts);
1276 }
1277 
1279  ContentContextOptions opts) const {
1280  return GetPipeline(this, pipelines_->source_over_blend, opts);
1281 }
1282 
1284  ContentContextOptions opts) const {
1285  return GetPipeline(this, pipelines_->destination_over_blend, opts);
1286 }
1287 
1289  ContentContextOptions opts) const {
1290  return GetPipeline(this, pipelines_->source_in_blend, opts);
1291 }
1292 
1294  ContentContextOptions opts) const {
1295  return GetPipeline(this, pipelines_->destination_in_blend, opts);
1296 }
1297 
1299  ContentContextOptions opts) const {
1300  return GetPipeline(this, pipelines_->source_out_blend, opts);
1301 }
1302 
1304  ContentContextOptions opts) const {
1305  return GetPipeline(this, pipelines_->destination_out_blend, opts);
1306 }
1307 
1309  ContentContextOptions opts) const {
1310  return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1311 }
1312 
1314  ContentContextOptions opts) const {
1315  return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1316 }
1317 
1319  ContentContextOptions opts) const {
1320  return GetPipeline(this, pipelines_->xor_blend, opts);
1321 }
1322 
1324  ContentContextOptions opts) const {
1325  return GetPipeline(this, pipelines_->plus_blend, opts);
1326 }
1327 
1329  ContentContextOptions opts) const {
1330  return GetPipeline(this, pipelines_->modulate_blend, opts);
1331 }
1332 
1334  ContentContextOptions opts) const {
1335  return GetPipeline(this, pipelines_->screen_blend, opts);
1336 }
1337 
1339  ContentContextOptions opts) const {
1340  return GetPipeline(this, pipelines_->blend_color, opts);
1341 }
1342 
1344  ContentContextOptions opts) const {
1345  return GetPipeline(this, pipelines_->blend_colorburn, opts);
1346 }
1347 
1349  ContentContextOptions opts) const {
1350  return GetPipeline(this, pipelines_->blend_colordodge, opts);
1351 }
1352 
1354  ContentContextOptions opts) const {
1355  return GetPipeline(this, pipelines_->blend_darken, opts);
1356 }
1357 
1359  ContentContextOptions opts) const {
1360  return GetPipeline(this, pipelines_->blend_difference, opts);
1361 }
1362 
1364  ContentContextOptions opts) const {
1365  return GetPipeline(this, pipelines_->blend_exclusion, opts);
1366 }
1367 
1369  ContentContextOptions opts) const {
1370  return GetPipeline(this, pipelines_->blend_hardlight, opts);
1371 }
1372 
1374  ContentContextOptions opts) const {
1375  return GetPipeline(this, pipelines_->blend_hue, opts);
1376 }
1377 
1379  ContentContextOptions opts) const {
1380  return GetPipeline(this, pipelines_->blend_lighten, opts);
1381 }
1382 
1384  ContentContextOptions opts) const {
1385  return GetPipeline(this, pipelines_->blend_luminosity, opts);
1386 }
1387 
1389  ContentContextOptions opts) const {
1390  return GetPipeline(this, pipelines_->blend_multiply, opts);
1391 }
1392 
1394  ContentContextOptions opts) const {
1395  return GetPipeline(this, pipelines_->blend_overlay, opts);
1396 }
1397 
1399  ContentContextOptions opts) const {
1400  return GetPipeline(this, pipelines_->blend_saturation, opts);
1401 }
1402 
1404  ContentContextOptions opts) const {
1405  return GetPipeline(this, pipelines_->blend_screen, opts);
1406 }
1407 
1409  ContentContextOptions opts) const {
1410  return GetPipeline(this, pipelines_->blend_softlight, opts);
1411 }
1412 
1414  ContentContextOptions opts) const {
1415  return GetPipeline(this, pipelines_->texture_downsample, opts);
1416 }
1417 
1419  ContentContextOptions opts) const {
1420  return GetPipeline(this, pipelines_->texture_downsample_bounded, opts);
1421 }
1422 
1424  ContentContextOptions opts) const {
1425  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1426  return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1427 }
1428 
1430  ContentContextOptions opts) const {
1431  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1432  return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1433 }
1434 
1436  ContentContextOptions opts) const {
1437  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1438  return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1439 }
1440 
1442  ContentContextOptions opts) const {
1443  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1444  return GetPipeline(this, pipelines_->framebuffer_blend_darken, opts);
1445 }
1446 
1448  ContentContextOptions opts) const {
1449  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1450  return GetPipeline(this, pipelines_->framebuffer_blend_difference, opts);
1451 }
1452 
1454  ContentContextOptions opts) const {
1455  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1456  return GetPipeline(this, pipelines_->framebuffer_blend_exclusion, opts);
1457 }
1458 
1460  ContentContextOptions opts) const {
1461  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1462  return GetPipeline(this, pipelines_->framebuffer_blend_hardlight, opts);
1463 }
1464 
1466  ContentContextOptions opts) const {
1467  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1468  return GetPipeline(this, pipelines_->framebuffer_blend_hue, opts);
1469 }
1470 
1472  ContentContextOptions opts) const {
1473  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1474  return GetPipeline(this, pipelines_->framebuffer_blend_lighten, opts);
1475 }
1476 
1478  ContentContextOptions opts) const {
1479  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1480  return GetPipeline(this, pipelines_->framebuffer_blend_luminosity, opts);
1481 }
1482 
1484  ContentContextOptions opts) const {
1485  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1486  return GetPipeline(this, pipelines_->framebuffer_blend_multiply, opts);
1487 }
1488 
1490  ContentContextOptions opts) const {
1491  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1492  return GetPipeline(this, pipelines_->framebuffer_blend_overlay, opts);
1493 }
1494 
1496  ContentContextOptions opts) const {
1497  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1498  return GetPipeline(this, pipelines_->framebuffer_blend_saturation, opts);
1499 }
1500 
1502  ContentContextOptions opts) const {
1503  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1504  return GetPipeline(this, pipelines_->framebuffer_blend_screen, opts);
1505 }
1506 
1508  ContentContextOptions opts) const {
1509  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1510  return GetPipeline(this, pipelines_->framebuffer_blend_softlight, opts);
1511 }
1512 
1514  ContentContextOptions opts) const {
1515  return GetPipeline(this, pipelines_->shadow_vertices_, opts);
1516 }
1517 
1519  BlendMode blend_mode,
1520  ContentContextOptions opts) const {
1521  if (blend_mode <= BlendMode::kHardLight) {
1522  return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1523  } else {
1524  return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1525  }
1526 }
1527 
1529  ContentContextOptions opts) const {
1530  return GetPipeline(this, pipelines_->circle, opts);
1531 }
1532 
1534  return GetPipeline(this, pipelines_->line, opts);
1535 }
1536 
1537 #ifdef IMPELLER_ENABLE_OPENGLES
1538 
1539 #if !defined(FML_OS_EMSCRIPTEN)
1540 PipelineRef ContentContext::GetTiledTextureUvExternalPipeline(
1541  ContentContextOptions opts) const {
1542  FML_DCHECK(GetContext()->GetBackendType() == Context::BackendType::kOpenGLES);
1543  return GetPipeline(this, pipelines_->tiled_texture_uv_external, opts);
1544 }
1545 
1546 PipelineRef ContentContext::GetTiledTextureExternalPipeline(
1547  ContentContextOptions opts) const {
1548  FML_DCHECK(GetContext()->GetBackendType() == Context::BackendType::kOpenGLES);
1549  return GetPipeline(this, pipelines_->tiled_texture_external, opts);
1550 }
1551 #endif
1552 
1553 PipelineRef ContentContext::GetDownsampleTextureGlesPipeline(
1554  ContentContextOptions opts) const {
1555  return GetPipeline(this, pipelines_->texture_downsample_gles, opts);
1556 }
1557 
1558 #endif // IMPELLER_ENABLE_OPENGLES
1559 
1560 } // namespace impeller
BufferView buffer_view
PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const
PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorDodgePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
std::shared_ptr< Texture > GetEmptyTexture() const
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetLinePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
PipelineRef GetDownsampleBoundedPipeline(ContentContextOptions opts) const
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFastGradientPipeline(ContentContextOptions opts) const
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
void ResetTransientsBuffers()
Resets the transients buffers held onto by the content context.
PipelineRef GetSolidFillPipeline(ContentContextOptions opts) const
fml::StatusOr< RenderTarget > MakeSubpass(std::string_view label, ISize texture_size, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback, bool msaa_enabled=true, bool depth_stencil_enabled=false, int32_t mip_count=1) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
const Capabilities & GetDeviceCapabilities() const
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetBlendSoftLightPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetTextureStrictSrcPipeline(ContentContextOptions opts) const
PipelineRef GetDrawShadowVerticesPipeline(ContentContextOptions opts) const
PipelineRef GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
PipelineRef GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorBurnPipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetLinearGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
PipelineRef GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetRadialGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
PipelineRef GetCirclePipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientUniformFillPipeline(ContentContextOptions opts, ConicalKind kind) const
PipelineRef GetRadialGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
PipelineRef GetBlendSaturationPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
PipelineRef GetMorphologyFilterPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
PipelineRef GetBlendDifferencePipeline(ContentContextOptions opts) const
PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBlendHuePipeline(ContentContextOptions opts) const
PipelineRef GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const
PipelineRef GetClipPipeline(ContentContextOptions opts) const
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBlendScreenPipeline(ContentContextOptions opts) const
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
PipelineRef GetBlendDarkenPipeline(ContentContextOptions opts) const
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
PipelineRef GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
PipelineRef GetBlendOverlayPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientSSBOFillPipeline(ContentContextOptions opts, ConicalKind kind) const
Tessellator & GetTessellator() const
PipelineRef GetBlendLightenPipeline(ContentContextOptions opts) const
PipelineRef GetBlendMultiplyPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBlendExclusionPipeline(ContentContextOptions opts) const
PipelineRef GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientFillPipeline(ContentContextOptions opts, ConicalKind kind) const
std::shared_ptr< Context > GetContext() const
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
PipelineRef GetRSuperellipseBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBorderMaskBlurPipeline(ContentContextOptions opts) const
PipelineRef GetDrawVerticesUberPipeline(BlendMode blend_mode, ContentContextOptions opts) const
To do anything rendering related with Impeller, you need a context.
Definition: context.h:65
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
static constexpr BlendMode kLastPipelineBlendMode
Definition: entity.h:28
BufferView Emplace(const BufferType &buffer, size_t alignment=0)
Emplace non-uniform data (like contiguous vertices) onto the host buffer.
Definition: host_buffer.h:92
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator, const std::shared_ptr< const IdleWaiter > &idle_waiter, size_t minimum_uniform_alignment)
Definition: host_buffer.cc:21
PipelineDescriptor & SetDepthStencilAttachmentDescriptor(std::optional< DepthAttachmentDescriptor > desc)
void SetPolygonMode(PolygonMode mode)
std::optional< DepthAttachmentDescriptor > GetDepthStencilAttachmentDescriptor() const
PipelineDescriptor & SetStencilAttachmentDescriptors(std::optional< StencilAttachmentDescriptor > front_and_back)
const ColorAttachmentDescriptor * GetColorAttachmentDescriptor(size_t index) const
PipelineDescriptor & SetColorAttachmentDescriptor(size_t index, ColorAttachmentDescriptor desc)
PipelineDescriptor & SetSampleCount(SampleCount samples)
void SetPrimitiveType(PrimitiveType type)
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame...
std::shared_ptr< Texture > GetRenderTargetTexture() const
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
Definition: render_target.h:55
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
Definition: render_target.h:61
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
Definition: render_target.h:68
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition: tessellator.h:37
A cache for blurred text that re-uses these across frames.
std::optional< PipelineDescriptor > desc_
std::vector< std::pair< uint64_t, std::unique_ptr< GenericRenderPipelineHandle > > > pipelines_
std::optional< ContentContextOptions > default_options_
int32_t x
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:161
float Scalar
Definition: scalar.h:19
static std::unique_ptr< PipelineT > CreateDefaultPipeline(const Context &context)
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:88
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47
@ kEqual
Comparison test passes if new_value == current_value.
@ kAlways
Comparison test passes always passes.
@ kNotEqual
Comparison test passes if new_value != current_value.
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_util.cc:37
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
@ kSetToReferenceValue
Reset the stencil value to the reference value.
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
@ kKeep
Don't modify the current stencil value.
BlendMode
Definition: color.h:58
std::array< std::vector< Scalar >, 15 > GetPorterDuffSpecConstants(bool supports_decal)
Definition: comparable.h:95
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:522
std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:246
static constexpr Color BlackTransparent()
Definition: color.h:270
Variants< SolidFillPipeline > solid_fill
Variants< PorterDuffBlendPipeline > destination_blend
Variants< SweepGradientSSBOFillPipeline > sweep_gradient_ssbo_fill
Variants< BlendScreenPipeline > blend_screen
Variants< PorterDuffBlendPipeline > modulate_blend
Variants< FramebufferBlendOverlayPipeline > framebuffer_blend_overlay
Variants< BlendSaturationPipeline > blend_saturation
Variants< TiledTexturePipeline > tiled_texture
Variants< PorterDuffBlendPipeline > destination_in_blend
Variants< BlendSoftLightPipeline > blend_softlight
Variants< BlendColorDodgePipeline > blend_colordodge
Variants< BlendMultiplyPipeline > blend_multiply
Variants< BlendColorPipeline > blend_color
Variants< BlendDifferencePipeline > blend_difference
Variants< BlendOverlayPipeline > blend_overlay
Variants< ConicalGradientFillStripPipeline > conical_gradient_fill_strip
Variants< FramebufferBlendExclusionPipeline > framebuffer_blend_exclusion
Variants< MorphologyFilterPipeline > morphology_filter
Variants< PorterDuffBlendPipeline > screen_blend
Variants< FramebufferBlendSaturationPipeline > framebuffer_blend_saturation
Variants< PorterDuffBlendPipeline > source_over_blend
Variants< LinearGradientFillPipeline > linear_gradient_fill
Variants< PorterDuffBlendPipeline > plus_blend
Variants< VerticesUber2Shader > vertices_uber_2_
Variants< FramebufferBlendHardLightPipeline > framebuffer_blend_hardlight
Variants< RadialGradientSSBOFillPipeline > radial_gradient_ssbo_fill
Variants< PorterDuffBlendPipeline > clear_blend
Variants< ConicalGradientUniformFillConicalPipeline > conical_gradient_uniform_fill
Variants< FramebufferBlendMultiplyPipeline > framebuffer_blend_multiply
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill
Variants< TextureDownsamplePipeline > texture_downsample
Variants< TextureDownsampleBoundedPipeline > texture_downsample_bounded
Variants< FramebufferBlendLuminosityPipeline > framebuffer_blend_luminosity
Variants< FramebufferBlendSoftLightPipeline > framebuffer_blend_softlight
Variants< SweepGradientUniformFillPipeline > sweep_gradient_uniform_fill
Variants< BlendColorBurnPipeline > blend_colorburn
Variants< ConicalGradientUniformFillStripRadialPipeline > conical_gradient_uniform_fill_strip_and_radial
Variants< PorterDuffBlendPipeline > source_in_blend
Variants< ConicalGradientFillConicalPipeline > conical_gradient_fill
Variants< ShadowVerticesShader > shadow_vertices_
Variants< CirclePipeline > circle
Variants< SweepGradientFillPipeline > sweep_gradient_fill
Variants< FramebufferBlendLightenPipeline > framebuffer_blend_lighten
Variants< PorterDuffBlendPipeline > source_a_top_blend
Variants< PorterDuffBlendPipeline > destination_a_top_blend
Variants< RadialGradientUniformFillPipeline > radial_gradient_uniform_fill
Variants< BlendLightenPipeline > blend_lighten
Variants< LinearGradientUniformFillPipeline > linear_gradient_uniform_fill
Variants< FramebufferBlendColorBurnPipeline > framebuffer_blend_colorburn
Variants< ConicalGradientFillRadialPipeline > conical_gradient_fill_radial
Variants< PorterDuffBlendPipeline > destination_over_blend
Variants< BlendExclusionPipeline > blend_exclusion
Variants< RSuperellipseBlurPipeline > rsuperellipse_blur
Variants< SrgbToLinearFilterPipeline > srgb_to_linear_filter
Variants< ColorMatrixColorFilterPipeline > color_matrix_color_filter
Variants< LinearToSrgbFilterPipeline > linear_to_srgb_filter
Variants< ConicalGradientUniformFillRadialPipeline > conical_gradient_uniform_fill_radial
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill_strip
Variants< RRectBlurPipeline > rrect_blur
Variants< BlendDarkenPipeline > blend_darken
Variants< TexturePipeline > texture
Variants< PorterDuffBlendPipeline > source_out_blend
Variants< FramebufferBlendHuePipeline > framebuffer_blend_hue
Variants< TextureStrictSrcPipeline > texture_strict_src
Variants< FramebufferBlendColorPipeline > framebuffer_blend_color
Variants< BlendHuePipeline > blend_hue
Variants< FramebufferBlendDarkenPipeline > framebuffer_blend_darken
Variants< FastGradientPipeline > fast_gradient
Variants< ConicalGradientUniformFillStripPipeline > conical_gradient_uniform_fill_strip
Variants< PorterDuffBlendPipeline > xor_blend
Variants< GaussianBlurPipeline > gaussian_blur
Variants< LinearGradientSSBOFillPipeline > linear_gradient_ssbo_fill
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill_strip_and_radial
Variants< GlyphAtlasPipeline > glyph_atlas
Variants< PorterDuffBlendPipeline > source_blend
Variants< BlendLuminosityPipeline > blend_luminosity
Variants< BorderMaskBlurPipeline > border_mask_blur
Variants< FramebufferBlendScreenPipeline > framebuffer_blend_screen
Variants< FramebufferBlendDifferencePipeline > framebuffer_blend_difference
Variants< YUVToRGBFilterPipeline > yuv_to_rgb_filter
Variants< RadialGradientFillPipeline > radial_gradient_fill
Variants< ConicalGradientSSBOFillPipeline > conical_gradient_ssbo_fill_radial
Variants< ConicalGradientFillStripRadialPipeline > conical_gradient_fill_strip_and_radial
Variants< BlendHardLightPipeline > blend_hardlight
Variants< FramebufferBlendColorDodgePipeline > framebuffer_blend_colordodge
Variants< PorterDuffBlendPipeline > destination_out_blend
Variants< VerticesUber1Shader > vertices_uber_1_
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
@ kIgnore
Turn the stencil test off. Used when drawing without stencil-then-cover.
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
StencilOperation depth_stencil_pass
Definition: formats.h:633
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:69
#define VALIDATION_LOG
Definition: validation.h:91