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  SetDefault(options, std::make_unique<PipelineHandleT>(context, desc_,
132  /*async=*/true));
133  }
134 
135  PipelineHandleT* Get(const ContentContextOptions& options) const {
136  return static_cast<PipelineHandleT*>(GenericVariants::Get(options));
137  }
138 
139  PipelineHandleT* GetDefault(const Context& context) {
140  if (!default_options_.has_value()) {
141  return nullptr;
142  }
143  PipelineHandleT* result = Get(default_options_.value());
144  if (result != nullptr) {
145  return result;
146  }
147  SetDefault(default_options_.value(), std::make_unique<PipelineHandleT>(
148  context, desc_, /*async=*/false));
149  // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
150  return Get(default_options_.value());
151  }
152 
153  private:
154  Variants(const Variants&) = delete;
155 
156  Variants& operator=(const Variants&) = delete;
157 };
158 
159 template <class RenderPipelineHandleT>
160 RenderPipelineHandleT* CreateIfNeeded(
161  const ContentContext* context,
162  Variants<RenderPipelineHandleT>& container,
163  ContentContextOptions opts,
164  PipelineCompileQueue* compile_queue) {
165  if (!context->IsValid()) {
166  return nullptr;
167  }
168 
169  if (RenderPipelineHandleT* found = container.Get(opts)) {
170  return found;
171  }
172 
173  RenderPipelineHandleT* default_handle =
174  container.GetDefault(*context->GetContext());
175  if (container.IsDefault(opts)) {
176  return default_handle;
177  }
178 
179  // The default must always be initialized in the constructor.
180  FML_CHECK(default_handle != nullptr);
181 
182  const std::shared_ptr<Pipeline<PipelineDescriptor>>& pipeline =
183  default_handle->WaitAndGet(compile_queue);
184  if (!pipeline) {
185  return nullptr;
186  }
187 
188  auto variant_future = pipeline->CreateVariant(
189  /*async=*/false, [&opts, variants_count = container.GetPipelineCount()](
190  PipelineDescriptor& desc) {
191  opts.ApplyToPipelineDescriptor(desc);
192  desc.SetLabel(std::format("{} V#{}", desc.GetLabel(), variants_count));
193  });
194  std::unique_ptr<RenderPipelineHandleT> variant =
195  std::make_unique<RenderPipelineHandleT>(std::move(variant_future));
196  container.Set(opts, std::move(variant));
197  return container.Get(opts);
198 }
199 
200 template <class TypedPipeline>
201 PipelineRef GetPipeline(const ContentContext* context,
202  Variants<TypedPipeline>& container,
203  ContentContextOptions opts) {
204  auto compile_queue =
205  context->GetContext()->GetPipelineLibrary()->GetPipelineCompileQueue();
206  TypedPipeline* pipeline =
207  CreateIfNeeded(context, container, opts, compile_queue);
208  if (!pipeline) {
209  return raw_ptr<Pipeline<PipelineDescriptor>>();
210  }
211  return raw_ptr(pipeline->WaitAndGet(compile_queue));
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<UberSDFPipeline> uber_sdf;
307  Variants<YUVToRGBFilterPipeline> yuv_to_rgb_filter;
308 
309 // Web doesn't support external texture OpenGL extensions
310 #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_EMSCRIPTEN)
311  Variants<TiledTextureExternalPipeline> tiled_texture_external;
312  Variants<TiledTextureUvExternalPipeline> tiled_texture_uv_external;
313 #endif
314 
315 #if defined(IMPELLER_ENABLE_OPENGLES)
316  Variants<TextureDownsampleGlesPipeline> texture_downsample_gles;
317 #endif // IMPELLER_ENABLE_OPENGLES
318  // clang-format on
319 };
320 
322  PipelineDescriptor& desc) const {
323  auto pipeline_blend = blend_mode;
325  VALIDATION_LOG << "Cannot use blend mode " << static_cast<int>(blend_mode)
326  << " as a pipeline blend.";
327  pipeline_blend = BlendMode::kSrcOver;
328  }
329 
331 
337 
338  switch (pipeline_blend) {
339  case BlendMode::kClear:
347  } else {
352  }
353  break;
354  case BlendMode::kSrc:
355  color0.blending_enabled = false;
360  break;
361  case BlendMode::kDst:
367  break;
368  case BlendMode::kSrcOver:
373  break;
374  case BlendMode::kDstOver:
379  break;
380  case BlendMode::kSrcIn:
385  break;
386  case BlendMode::kDstIn:
391  break;
392  case BlendMode::kSrcOut:
397  break;
398  case BlendMode::kDstOut:
403  break;
404  case BlendMode::kSrcATop:
409  break;
410  case BlendMode::kDstATop:
415  break;
416  case BlendMode::kXor:
421  break;
422  case BlendMode::kPlus:
427  break;
433  break;
434  default:
435  FML_UNREACHABLE();
436  }
437  desc.SetColorAttachmentDescriptor(0u, color0);
438 
440  desc.ClearDepthAttachment();
442  }
443 
444  auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
445  auto maybe_depth = desc.GetDepthStencilAttachmentDescriptor();
446  FML_DCHECK(has_depth_stencil_attachments == maybe_depth.has_value())
447  << "Depth attachment doesn't match expected pipeline state. "
448  "has_depth_stencil_attachments="
450  FML_DCHECK(has_depth_stencil_attachments == maybe_stencil.has_value())
451  << "Stencil attachment doesn't match expected pipeline state. "
452  "has_depth_stencil_attachments="
454  if (maybe_stencil.has_value()) {
455  StencilAttachmentDescriptor front_stencil = maybe_stencil.value();
456  StencilAttachmentDescriptor back_stencil = front_stencil;
457 
458  switch (stencil_mode) {
462  desc.SetStencilAttachmentDescriptors(front_stencil);
463  break;
465  // The stencil ref should be 0 on commands that use this mode.
470  desc.SetStencilAttachmentDescriptors(front_stencil, back_stencil);
471  break;
473  // The stencil ref should be 0 on commands that use this mode.
477  desc.SetStencilAttachmentDescriptors(front_stencil);
478  break;
480  // The stencil ref should be 0 on commands that use this mode.
483  desc.SetStencilAttachmentDescriptors(front_stencil);
484  break;
486  // The stencil ref should be 0 on commands that use this mode.
488  front_stencil.depth_stencil_pass =
490  desc.SetStencilAttachmentDescriptors(front_stencil);
491  break;
493  // The stencil ref should be 0 on commands that use this mode.
496  desc.SetStencilAttachmentDescriptors(front_stencil);
497  break;
498  }
499  }
500  if (maybe_depth.has_value()) {
501  DepthAttachmentDescriptor depth = maybe_depth.value();
505  }
506 
509 }
510 
511 std::array<std::vector<Scalar>, 15> GetPorterDuffSpecConstants(
512  bool supports_decal) {
513  Scalar x = supports_decal ? 1 : 0;
514  return {{
515  {x, 0, 0, 0, 0, 0}, // Clear
516  {x, 1, 0, 0, 0, 0}, // Source
517  {x, 0, 0, 1, 0, 0}, // Destination
518  {x, 1, 0, 1, -1, 0}, // SourceOver
519  {x, 1, -1, 1, 0, 0}, // DestinationOver
520  {x, 0, 1, 0, 0, 0}, // SourceIn
521  {x, 0, 0, 0, 1, 0}, // DestinationIn
522  {x, 1, -1, 0, 0, 0}, // SourceOut
523  {x, 0, 0, 1, -1, 0}, // DestinationOut
524  {x, 0, 1, 1, -1, 0}, // SourceATop
525  {x, 1, -1, 0, 1, 0}, // DestinationATop
526  {x, 1, -1, 1, -1, 0}, // Xor
527  {x, 1, 0, 1, 0, 0}, // Plus
528  {x, 0, 0, 0, 0, 1}, // Modulate
529  {x, 0, 0, 1, 0, -1}, // Screen
530  }};
531 }
532 
533 template <typename PipelineT>
534 static std::unique_ptr<PipelineT> CreateDefaultPipeline(
535  const Context& context) {
536  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
537  if (!desc.has_value()) {
538  return nullptr;
539  }
540  // Apply default ContentContextOptions to the descriptor.
541  const auto default_color_format =
542  context.GetCapabilities()->GetDefaultColorFormat();
544  .primitive_type = PrimitiveType::kTriangleStrip,
545  .color_attachment_pixel_format = default_color_format}
546  .ApplyToPipelineDescriptor(*desc);
547  return std::make_unique<PipelineT>(context, desc);
548 }
549 
551  std::shared_ptr<Context> context,
552  std::shared_ptr<TypographerContext> typographer_context,
553  std::shared_ptr<RenderTargetAllocator> render_target_allocator)
554  : context_(std::move(context)),
555  lazy_glyph_atlas_(
556  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
557  pipelines_(new Pipelines()),
558  tessellator_(std::make_shared<Tessellator>(
559  context_->GetCapabilities()->Supports32BitPrimitiveIndices())),
560  render_target_cache_(render_target_allocator == nullptr
561  ? std::make_shared<RenderTargetCache>(
562  context_->GetResourceAllocator())
563  : std::move(render_target_allocator)),
564  data_host_buffer_(HostBuffer::Create(
565  context_->GetResourceAllocator(),
566  context_->GetIdleWaiter(),
567  context_->GetCapabilities()->GetMinimumUniformAlignment())),
568  text_shadow_cache_(std::make_unique<TextShadowCache>()) {
569  if (!context_ || !context_->IsValid()) {
570  return;
571  }
572 
573  // On most backends, indexes and other data can be allocated into the same
574  // buffers. However, some backends (namely WebGL) require indexes used in
575  // indexed draws to be allocated separately from other data. For those
576  // backends, we allocate a separate host buffer just for indexes.
577  indexes_host_buffer_ =
578  context_->GetCapabilities()->NeedsPartitionedHostBuffer()
580  context_->GetResourceAllocator(), context_->GetIdleWaiter(),
581  context_->GetCapabilities()->GetMinimumUniformAlignment())
582  : data_host_buffer_;
583  {
584  TextureDescriptor desc;
587  desc.size = ISize{1, 1};
588  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
589 
590  std::array<uint8_t, 4> data = Color::BlackTransparent().ToR8G8B8A8();
591  std::shared_ptr<CommandBuffer> cmd_buffer =
592  GetContext()->CreateCommandBuffer();
593  std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
594  HostBuffer& data_host_buffer = GetTransientsDataBuffer();
595  BufferView buffer_view = data_host_buffer.Emplace(data);
596  blit_pass->AddCopy(buffer_view, empty_texture_);
597 
598  if (!blit_pass->EncodeCommands() || !GetContext()
599  ->GetCommandQueue()
600  ->Submit({std::move(cmd_buffer)})
601  .ok()) {
602  VALIDATION_LOG << "Failed to create empty texture.";
603  }
604  }
605 
606  auto options = ContentContextOptions{
608  .color_attachment_pixel_format =
609  context_->GetCapabilities()->GetDefaultColorFormat()};
610  auto options_trianglestrip = ContentContextOptions{
612  .primitive_type = PrimitiveType::kTriangleStrip,
613  .color_attachment_pixel_format =
614  context_->GetCapabilities()->GetDefaultColorFormat()};
615  auto options_no_msaa_no_depth_stencil = ContentContextOptions{
617  .primitive_type = PrimitiveType::kTriangleStrip,
618  .color_attachment_pixel_format =
619  context_->GetCapabilities()->GetDefaultColorFormat(),
620  .has_depth_stencil_attachments = false};
621  const auto supports_decal = static_cast<Scalar>(
622  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
623 
624  // Futures for the following pipelines may block in case the first frame is
625  // rendered without the pipelines being ready. Put pipelines that are more
626  // likely to be used first.
627  {
628  pipelines_->glyph_atlas.CreateDefault(
629  *context_, options,
630  {static_cast<Scalar>(
631  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
633  pipelines_->solid_fill.CreateDefault(*context_, options);
634  pipelines_->texture.CreateDefault(*context_, options);
635  pipelines_->fast_gradient.CreateDefault(*context_, options);
636  pipelines_->line.CreateDefault(*context_, options);
637  pipelines_->circle.CreateDefault(*context_, options);
638  if (context_->GetFlags().use_sdfs) {
639  pipelines_->uber_sdf.CreateDefault(*context_, options);
640  }
641 
642  if (context_->GetCapabilities()->SupportsSSBO()) {
643  pipelines_->linear_gradient_ssbo_fill.CreateDefault(*context_, options);
644  pipelines_->radial_gradient_ssbo_fill.CreateDefault(*context_, options);
645  pipelines_->conical_gradient_ssbo_fill.CreateDefault(*context_, options,
646  {3.0});
647  pipelines_->conical_gradient_ssbo_fill_radial.CreateDefault(
648  *context_, options, {1.0});
649  pipelines_->conical_gradient_ssbo_fill_strip.CreateDefault(
650  *context_, options, {2.0});
651  pipelines_->conical_gradient_ssbo_fill_strip_and_radial.CreateDefault(
652  *context_, options, {0.0});
653  pipelines_->sweep_gradient_ssbo_fill.CreateDefault(*context_, options);
654  } else {
655  pipelines_->linear_gradient_uniform_fill.CreateDefault(*context_,
656  options);
657  pipelines_->radial_gradient_uniform_fill.CreateDefault(*context_,
658  options);
659  pipelines_->conical_gradient_uniform_fill.CreateDefault(*context_,
660  options);
661  pipelines_->conical_gradient_uniform_fill_radial.CreateDefault(*context_,
662  options);
663  pipelines_->conical_gradient_uniform_fill_strip.CreateDefault(*context_,
664  options);
665  pipelines_->conical_gradient_uniform_fill_strip_and_radial.CreateDefault(
666  *context_, options);
667  pipelines_->sweep_gradient_uniform_fill.CreateDefault(*context_, options);
668 
669  pipelines_->linear_gradient_fill.CreateDefault(*context_, options);
670  pipelines_->radial_gradient_fill.CreateDefault(*context_, options);
671  pipelines_->conical_gradient_fill.CreateDefault(*context_, options);
672  pipelines_->conical_gradient_fill_radial.CreateDefault(*context_,
673  options);
674  pipelines_->conical_gradient_fill_strip.CreateDefault(*context_, options);
675  pipelines_->conical_gradient_fill_strip_and_radial.CreateDefault(
676  *context_, options);
677  pipelines_->sweep_gradient_fill.CreateDefault(*context_, options);
678  }
679 
680  /// Setup default clip pipeline.
681  auto clip_pipeline_descriptor =
683  if (!clip_pipeline_descriptor.has_value()) {
684  return;
685  }
688  .color_attachment_pixel_format =
689  context_->GetCapabilities()->GetDefaultColorFormat()}
690  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
691  // Disable write to all color attachments.
692  auto clip_color_attachments =
693  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
694  for (auto& color_attachment : clip_color_attachments) {
695  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
696  }
697  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
698  std::move(clip_color_attachments));
699  pipelines_->clip.SetDefault(
700  options,
701  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
702  pipelines_->texture_downsample.CreateDefault(
703  *context_, options_no_msaa_no_depth_stencil);
704  pipelines_->texture_downsample_bounded.CreateDefault(
705  *context_, options_no_msaa_no_depth_stencil);
706  pipelines_->rrect_blur.CreateDefault(*context_, options_trianglestrip);
707  pipelines_->rsuperellipse_blur.CreateDefault(*context_,
708  options_trianglestrip);
709  pipelines_->texture_strict_src.CreateDefault(*context_, options);
710  pipelines_->tiled_texture.CreateDefault(*context_, options,
711  {supports_decal});
712  pipelines_->gaussian_blur.CreateDefault(
713  *context_, options_no_msaa_no_depth_stencil, {supports_decal});
714  pipelines_->border_mask_blur.CreateDefault(*context_,
715  options_trianglestrip);
716  pipelines_->color_matrix_color_filter.CreateDefault(*context_,
717  options_trianglestrip);
718  pipelines_->shadow_vertices_.CreateDefault(*context_, options);
719  pipelines_->vertices_uber_1_.CreateDefault(*context_, options,
720  {supports_decal});
721  pipelines_->vertices_uber_2_.CreateDefault(*context_, options,
722  {supports_decal});
723 
724  const std::array<std::vector<Scalar>, 15> porter_duff_constants =
725  GetPorterDuffSpecConstants(supports_decal);
726  pipelines_->clear_blend.CreateDefault(*context_, options_trianglestrip,
727  porter_duff_constants[0]);
728  pipelines_->source_blend.CreateDefault(*context_, options_trianglestrip,
729  porter_duff_constants[1]);
730  pipelines_->destination_blend.CreateDefault(
731  *context_, options_trianglestrip, porter_duff_constants[2]);
732  pipelines_->source_over_blend.CreateDefault(
733  *context_, options_trianglestrip, porter_duff_constants[3]);
734  pipelines_->destination_over_blend.CreateDefault(
735  *context_, options_trianglestrip, porter_duff_constants[4]);
736  pipelines_->source_in_blend.CreateDefault(*context_, options_trianglestrip,
737  porter_duff_constants[5]);
738  pipelines_->destination_in_blend.CreateDefault(
739  *context_, options_trianglestrip, porter_duff_constants[6]);
740  pipelines_->source_out_blend.CreateDefault(*context_, options_trianglestrip,
741  porter_duff_constants[7]);
742  pipelines_->destination_out_blend.CreateDefault(
743  *context_, options_trianglestrip, porter_duff_constants[8]);
744  pipelines_->source_a_top_blend.CreateDefault(
745  *context_, options_trianglestrip, porter_duff_constants[9]);
746  pipelines_->destination_a_top_blend.CreateDefault(
747  *context_, options_trianglestrip, porter_duff_constants[10]);
748  pipelines_->xor_blend.CreateDefault(*context_, options_trianglestrip,
749  porter_duff_constants[11]);
750  pipelines_->plus_blend.CreateDefault(*context_, options_trianglestrip,
751  porter_duff_constants[12]);
752  pipelines_->modulate_blend.CreateDefault(*context_, options_trianglestrip,
753  porter_duff_constants[13]);
754  pipelines_->screen_blend.CreateDefault(*context_, options_trianglestrip,
755  porter_duff_constants[14]);
756  }
757 
758  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
759  pipelines_->framebuffer_blend_color.CreateDefault(
760  *context_, options_trianglestrip,
761  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
762  pipelines_->framebuffer_blend_colorburn.CreateDefault(
763  *context_, options_trianglestrip,
764  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
765  pipelines_->framebuffer_blend_colordodge.CreateDefault(
766  *context_, options_trianglestrip,
767  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
768  pipelines_->framebuffer_blend_darken.CreateDefault(
769  *context_, options_trianglestrip,
770  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
771  pipelines_->framebuffer_blend_difference.CreateDefault(
772  *context_, options_trianglestrip,
773  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
774  pipelines_->framebuffer_blend_exclusion.CreateDefault(
775  *context_, options_trianglestrip,
776  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
777  pipelines_->framebuffer_blend_hardlight.CreateDefault(
778  *context_, options_trianglestrip,
779  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
780  pipelines_->framebuffer_blend_hue.CreateDefault(
781  *context_, options_trianglestrip,
782  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
783  pipelines_->framebuffer_blend_lighten.CreateDefault(
784  *context_, options_trianglestrip,
785  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
786  pipelines_->framebuffer_blend_luminosity.CreateDefault(
787  *context_, options_trianglestrip,
788  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
789  pipelines_->framebuffer_blend_multiply.CreateDefault(
790  *context_, options_trianglestrip,
791  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
792  pipelines_->framebuffer_blend_overlay.CreateDefault(
793  *context_, options_trianglestrip,
794  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
795  pipelines_->framebuffer_blend_saturation.CreateDefault(
796  *context_, options_trianglestrip,
797  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
798  pipelines_->framebuffer_blend_screen.CreateDefault(
799  *context_, options_trianglestrip,
800  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
801  pipelines_->framebuffer_blend_softlight.CreateDefault(
802  *context_, options_trianglestrip,
803  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
804  } else {
805  pipelines_->blend_color.CreateDefault(
806  *context_, options_trianglestrip,
807  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
808  pipelines_->blend_colorburn.CreateDefault(
809  *context_, options_trianglestrip,
810  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
811  pipelines_->blend_colordodge.CreateDefault(
812  *context_, options_trianglestrip,
813  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
814  pipelines_->blend_darken.CreateDefault(
815  *context_, options_trianglestrip,
816  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
817  pipelines_->blend_difference.CreateDefault(
818  *context_, options_trianglestrip,
819  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
820  pipelines_->blend_exclusion.CreateDefault(
821  *context_, options_trianglestrip,
822  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
823  pipelines_->blend_hardlight.CreateDefault(
824  *context_, options_trianglestrip,
825  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
826  pipelines_->blend_hue.CreateDefault(
827  *context_, options_trianglestrip,
828  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
829  pipelines_->blend_lighten.CreateDefault(
830  *context_, options_trianglestrip,
831  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
832  pipelines_->blend_luminosity.CreateDefault(
833  *context_, options_trianglestrip,
834  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
835  pipelines_->blend_multiply.CreateDefault(
836  *context_, options_trianglestrip,
837  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
838  pipelines_->blend_overlay.CreateDefault(
839  *context_, options_trianglestrip,
840  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
841  pipelines_->blend_saturation.CreateDefault(
842  *context_, options_trianglestrip,
843  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
844  pipelines_->blend_screen.CreateDefault(
845  *context_, options_trianglestrip,
846  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
847  pipelines_->blend_softlight.CreateDefault(
848  *context_, options_trianglestrip,
849  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
850  }
851 
852  pipelines_->morphology_filter.CreateDefault(*context_, options_trianglestrip,
853  {supports_decal});
854  pipelines_->linear_to_srgb_filter.CreateDefault(*context_,
855  options_trianglestrip);
856  pipelines_->srgb_to_linear_filter.CreateDefault(*context_,
857  options_trianglestrip);
858  pipelines_->yuv_to_rgb_filter.CreateDefault(*context_, options_trianglestrip);
859 
860  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
861 #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX) && \
862  !defined(FML_OS_EMSCRIPTEN)
863  // GLES only shader that is unsupported on macOS and web.
864  pipelines_->tiled_texture_external.CreateDefault(*context_, options);
865  pipelines_->tiled_texture_uv_external.CreateDefault(*context_, options);
866 #endif // !defined(FML_OS_MACOSX)
867 
868 #if defined(IMPELLER_ENABLE_OPENGLES)
869  pipelines_->texture_downsample_gles.CreateDefault(*context_,
870  options_trianglestrip);
871 #endif // IMPELLER_ENABLE_OPENGLES
872  }
873 
874  is_valid_ = true;
875  InitializeCommonlyUsedShadersIfNeeded();
876 }
877 
879 
881  return is_valid_;
882 }
883 
884 std::shared_ptr<Texture> ContentContext::GetEmptyTexture() const {
885  return empty_texture_;
886 }
887 
888 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
889  std::string_view label,
890  ISize texture_size,
891  const std::shared_ptr<CommandBuffer>& command_buffer,
892  const SubpassCallback& subpass_callback,
893  bool msaa_enabled,
894  bool depth_stencil_enabled,
895  int32_t mip_count) const {
896  const std::shared_ptr<Context>& context = GetContext();
897  RenderTarget subpass_target;
898 
899  std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
900  depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
901  : std::optional<RenderTarget::AttachmentConfig>();
902 
903  if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
904  subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
905  /*context=*/*context,
906  /*size=*/texture_size,
907  /*mip_count=*/mip_count,
908  /*label=*/label,
909  /*color_attachment_config=*/
911  /*stencil_attachment_config=*/depth_stencil_config,
912  /*existing_color_msaa_texture=*/nullptr,
913  /*existing_color_resolve_texture=*/nullptr,
914  /*existing_depth_stencil_texture=*/nullptr,
915  /*target_pixel_format=*/std::nullopt);
916  } else {
917  subpass_target = GetRenderTargetCache()->CreateOffscreen(
918  *context, texture_size,
919  /*mip_count=*/mip_count, label,
920  RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
921  }
922  return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
923 }
924 
925 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
926  std::string_view label,
927  const RenderTarget& subpass_target,
928  const std::shared_ptr<CommandBuffer>& command_buffer,
929  const SubpassCallback& subpass_callback) const {
930  const std::shared_ptr<Context>& context = GetContext();
931 
932  auto subpass_texture = subpass_target.GetRenderTargetTexture();
933  if (!subpass_texture) {
934  return fml::Status(fml::StatusCode::kUnknown, "");
935  }
936 
937  auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
938  if (!sub_renderpass) {
939  return fml::Status(fml::StatusCode::kUnknown, "");
940  }
941  sub_renderpass->SetLabel(label);
942 
943  if (!subpass_callback(*this, *sub_renderpass)) {
944  return fml::Status(fml::StatusCode::kUnknown, "");
945  }
946 
947  if (!sub_renderpass->EncodeCommands()) {
948  return fml::Status(fml::StatusCode::kUnknown, "");
949  }
950 
951  const std::shared_ptr<Texture>& target_texture =
952  subpass_target.GetRenderTargetTexture();
953  if (target_texture->GetMipCount() > 1) {
954  fml::Status mipmap_status =
955  AddMipmapGeneration(command_buffer, context, target_texture);
956  if (!mipmap_status.ok()) {
957  return mipmap_status;
958  }
959  }
960 
961  return subpass_target;
962 }
963 
965  return *tessellator_;
966 }
967 
968 std::shared_ptr<Context> ContentContext::GetContext() const {
969  return context_;
970 }
971 
973  return *context_->GetCapabilities();
974 }
975 
977  const std::string& unique_entrypoint_name,
978  const ContentContextOptions& options,
979  const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
980  create_callback) const {
981  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
982  auto it = runtime_effect_pipelines_.find(key);
983  if (it == runtime_effect_pipelines_.end()) {
984  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
985  }
986  return raw_ptr(it->second);
987 }
988 
990  const std::string& unique_entrypoint_name) const {
991 #ifdef IMPELLER_DEBUG
992  // destroying in-use pipleines is a validation error.
993  const auto& idle_waiter = GetContext()->GetIdleWaiter();
994  if (idle_waiter) {
995  idle_waiter->WaitIdle();
996  }
997 #endif // IMPELLER_DEBUG
998  for (auto it = runtime_effect_pipelines_.begin();
999  it != runtime_effect_pipelines_.end();) {
1000  if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
1001  it = runtime_effect_pipelines_.erase(it);
1002  } else {
1003  it++;
1004  }
1005  }
1006 }
1007 
1009  data_host_buffer_->Reset();
1010 
1011  // We should only reset the indexes host buffer if it is actually different
1012  // from the data host buffer. Otherwise we'll end up resetting the same host
1013  // buffer twice.
1014  if (data_host_buffer_ != indexes_host_buffer_) {
1015  indexes_host_buffer_->Reset();
1016  }
1017 }
1018 
1019 void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
1020  GetContext()->InitializeCommonlyUsedShadersIfNeeded();
1021 }
1022 
1024  ContentContextOptions opts) const {
1025  return GetPipeline(this, pipelines_->fast_gradient, opts);
1026 }
1027 
1029  ContentContextOptions opts) const {
1030  return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1031 }
1032 
1034  ContentContextOptions opts) const {
1035  return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1036 }
1037 
1039  ContentContextOptions opts) const {
1040  return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
1041 }
1042 
1044  ContentContextOptions opts) const {
1045  return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1046 }
1047 
1049  ContentContextOptions opts) const {
1050  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1051  return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1052 }
1053 
1055  ContentContextOptions opts) const {
1056  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1057  return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1058 }
1059 
1061  ContentContextOptions opts,
1062  ConicalKind kind) const {
1063  switch (kind) {
1064  case ConicalKind::kConical:
1065  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1066  case ConicalKind::kRadial:
1067  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1068  opts);
1069  case ConicalKind::kStrip:
1070  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1071  opts);
1073  return GetPipeline(
1074  this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1075  opts);
1076  }
1077 }
1078 
1080  ContentContextOptions opts,
1081  ConicalKind kind) const {
1082  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1083  switch (kind) {
1084  case ConicalKind::kConical:
1085  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1086  case ConicalKind::kRadial:
1087  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1088  opts);
1089  case ConicalKind::kStrip:
1090  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1091  opts);
1093  return GetPipeline(
1094  this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1095  }
1096 }
1097 
1099  ContentContextOptions opts) const {
1100  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1101  return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1102 }
1103 
1105  ContentContextOptions opts) const {
1106  return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1107 }
1108 
1110  ContentContextOptions opts,
1111  ConicalKind kind) const {
1112  switch (kind) {
1113  case ConicalKind::kConical:
1114  return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1115  case ConicalKind::kRadial:
1116  return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1117  case ConicalKind::kStrip:
1118  return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1120  return GetPipeline(
1121  this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1122  }
1123 }
1124 
1126  ContentContextOptions opts) const {
1127  return GetPipeline(this, pipelines_->rrect_blur, opts);
1128 }
1129 
1131  ContentContextOptions opts) const {
1132  return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1133 }
1134 
1136  ContentContextOptions opts) const {
1137  return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1138 }
1139 
1141  ContentContextOptions opts) const {
1142  return GetPipeline(this, pipelines_->solid_fill, opts);
1143 }
1144 
1146  ContentContextOptions opts) const {
1147  return GetPipeline(this, pipelines_->texture, opts);
1148 }
1149 
1151  ContentContextOptions opts) const {
1152  return GetPipeline(this, pipelines_->texture_strict_src, opts);
1153 }
1154 
1156  ContentContextOptions opts) const {
1157  return GetPipeline(this, pipelines_->tiled_texture, opts);
1158 }
1159 
1161  ContentContextOptions opts) const {
1162  return GetPipeline(this, pipelines_->gaussian_blur, opts);
1163 }
1164 
1166  ContentContextOptions opts) const {
1167  return GetPipeline(this, pipelines_->border_mask_blur, opts);
1168 }
1169 
1171  ContentContextOptions opts) const {
1172  return GetPipeline(this, pipelines_->morphology_filter, opts);
1173 }
1174 
1176  ContentContextOptions opts) const {
1177  return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1178 }
1179 
1181  ContentContextOptions opts) const {
1182  return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1183 }
1184 
1186  ContentContextOptions opts) const {
1187  return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1188 }
1189 
1191  return GetPipeline(this, pipelines_->clip, opts);
1192 }
1193 
1195  ContentContextOptions opts) const {
1196  return GetPipeline(this, pipelines_->glyph_atlas, opts);
1197 }
1198 
1200  ContentContextOptions opts) const {
1201  return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1202 }
1203 
1205  ContentContextOptions opts) const {
1206  return GetPipeline(this, pipelines_->uber_sdf, opts);
1207 }
1208 
1210  BlendMode mode,
1211  ContentContextOptions opts) const {
1212  switch (mode) {
1213  case BlendMode::kClear:
1214  return GetClearBlendPipeline(opts);
1215  case BlendMode::kSrc:
1216  return GetSourceBlendPipeline(opts);
1217  case BlendMode::kDst:
1218  return GetDestinationBlendPipeline(opts);
1219  case BlendMode::kSrcOver:
1220  return GetSourceOverBlendPipeline(opts);
1221  case BlendMode::kDstOver:
1222  return GetDestinationOverBlendPipeline(opts);
1223  case BlendMode::kSrcIn:
1224  return GetSourceInBlendPipeline(opts);
1225  case BlendMode::kDstIn:
1226  return GetDestinationInBlendPipeline(opts);
1227  case BlendMode::kSrcOut:
1228  return GetSourceOutBlendPipeline(opts);
1229  case BlendMode::kDstOut:
1230  return GetDestinationOutBlendPipeline(opts);
1231  case BlendMode::kSrcATop:
1232  return GetSourceATopBlendPipeline(opts);
1233  case BlendMode::kDstATop:
1234  return GetDestinationATopBlendPipeline(opts);
1235  case BlendMode::kXor:
1236  return GetXorBlendPipeline(opts);
1237  case BlendMode::kPlus:
1238  return GetPlusBlendPipeline(opts);
1239  case BlendMode::kModulate:
1240  return GetModulateBlendPipeline(opts);
1241  case BlendMode::kScreen:
1242  return GetScreenBlendPipeline(opts);
1243  case BlendMode::kOverlay:
1244  case BlendMode::kDarken:
1245  case BlendMode::kLighten:
1247  case BlendMode::kColorBurn:
1248  case BlendMode::kHardLight:
1249  case BlendMode::kSoftLight:
1251  case BlendMode::kExclusion:
1252  case BlendMode::kMultiply:
1253  case BlendMode::kHue:
1255  case BlendMode::kColor:
1257  VALIDATION_LOG << "Invalid porter duff blend mode "
1258  << BlendModeToString(mode);
1259  return GetClearBlendPipeline(opts);
1260  break;
1261  }
1262 }
1263 
1265  ContentContextOptions opts) const {
1266  return GetPipeline(this, pipelines_->clear_blend, opts);
1267 }
1268 
1270  ContentContextOptions opts) const {
1271  return GetPipeline(this, pipelines_->source_blend, opts);
1272 }
1273 
1275  ContentContextOptions opts) const {
1276  return GetPipeline(this, pipelines_->destination_blend, opts);
1277 }
1278 
1280  ContentContextOptions opts) const {
1281  return GetPipeline(this, pipelines_->source_over_blend, opts);
1282 }
1283 
1285  ContentContextOptions opts) const {
1286  return GetPipeline(this, pipelines_->destination_over_blend, opts);
1287 }
1288 
1290  ContentContextOptions opts) const {
1291  return GetPipeline(this, pipelines_->source_in_blend, opts);
1292 }
1293 
1295  ContentContextOptions opts) const {
1296  return GetPipeline(this, pipelines_->destination_in_blend, opts);
1297 }
1298 
1300  ContentContextOptions opts) const {
1301  return GetPipeline(this, pipelines_->source_out_blend, opts);
1302 }
1303 
1305  ContentContextOptions opts) const {
1306  return GetPipeline(this, pipelines_->destination_out_blend, opts);
1307 }
1308 
1310  ContentContextOptions opts) const {
1311  return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1312 }
1313 
1315  ContentContextOptions opts) const {
1316  return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1317 }
1318 
1320  ContentContextOptions opts) const {
1321  return GetPipeline(this, pipelines_->xor_blend, opts);
1322 }
1323 
1325  ContentContextOptions opts) const {
1326  return GetPipeline(this, pipelines_->plus_blend, opts);
1327 }
1328 
1330  ContentContextOptions opts) const {
1331  return GetPipeline(this, pipelines_->modulate_blend, opts);
1332 }
1333 
1335  ContentContextOptions opts) const {
1336  return GetPipeline(this, pipelines_->screen_blend, opts);
1337 }
1338 
1340  ContentContextOptions opts) const {
1341  return GetPipeline(this, pipelines_->blend_color, opts);
1342 }
1343 
1345  ContentContextOptions opts) const {
1346  return GetPipeline(this, pipelines_->blend_colorburn, opts);
1347 }
1348 
1350  ContentContextOptions opts) const {
1351  return GetPipeline(this, pipelines_->blend_colordodge, opts);
1352 }
1353 
1355  ContentContextOptions opts) const {
1356  return GetPipeline(this, pipelines_->blend_darken, opts);
1357 }
1358 
1360  ContentContextOptions opts) const {
1361  return GetPipeline(this, pipelines_->blend_difference, opts);
1362 }
1363 
1365  ContentContextOptions opts) const {
1366  return GetPipeline(this, pipelines_->blend_exclusion, opts);
1367 }
1368 
1370  ContentContextOptions opts) const {
1371  return GetPipeline(this, pipelines_->blend_hardlight, opts);
1372 }
1373 
1375  ContentContextOptions opts) const {
1376  return GetPipeline(this, pipelines_->blend_hue, opts);
1377 }
1378 
1380  ContentContextOptions opts) const {
1381  return GetPipeline(this, pipelines_->blend_lighten, opts);
1382 }
1383 
1385  ContentContextOptions opts) const {
1386  return GetPipeline(this, pipelines_->blend_luminosity, opts);
1387 }
1388 
1390  ContentContextOptions opts) const {
1391  return GetPipeline(this, pipelines_->blend_multiply, opts);
1392 }
1393 
1395  ContentContextOptions opts) const {
1396  return GetPipeline(this, pipelines_->blend_overlay, opts);
1397 }
1398 
1400  ContentContextOptions opts) const {
1401  return GetPipeline(this, pipelines_->blend_saturation, opts);
1402 }
1403 
1405  ContentContextOptions opts) const {
1406  return GetPipeline(this, pipelines_->blend_screen, opts);
1407 }
1408 
1410  ContentContextOptions opts) const {
1411  return GetPipeline(this, pipelines_->blend_softlight, opts);
1412 }
1413 
1415  ContentContextOptions opts) const {
1416  return GetPipeline(this, pipelines_->texture_downsample, opts);
1417 }
1418 
1420  ContentContextOptions opts) const {
1421  return GetPipeline(this, pipelines_->texture_downsample_bounded, opts);
1422 }
1423 
1425  ContentContextOptions opts) const {
1426  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1427  return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1428 }
1429 
1431  ContentContextOptions opts) const {
1432  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1433  return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1434 }
1435 
1437  ContentContextOptions opts) const {
1438  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1439  return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1440 }
1441 
1443  ContentContextOptions opts) const {
1444  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1445  return GetPipeline(this, pipelines_->framebuffer_blend_darken, opts);
1446 }
1447 
1449  ContentContextOptions opts) const {
1450  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1451  return GetPipeline(this, pipelines_->framebuffer_blend_difference, opts);
1452 }
1453 
1455  ContentContextOptions opts) const {
1456  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1457  return GetPipeline(this, pipelines_->framebuffer_blend_exclusion, opts);
1458 }
1459 
1461  ContentContextOptions opts) const {
1462  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1463  return GetPipeline(this, pipelines_->framebuffer_blend_hardlight, opts);
1464 }
1465 
1467  ContentContextOptions opts) const {
1468  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1469  return GetPipeline(this, pipelines_->framebuffer_blend_hue, opts);
1470 }
1471 
1473  ContentContextOptions opts) const {
1474  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1475  return GetPipeline(this, pipelines_->framebuffer_blend_lighten, opts);
1476 }
1477 
1479  ContentContextOptions opts) const {
1480  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1481  return GetPipeline(this, pipelines_->framebuffer_blend_luminosity, opts);
1482 }
1483 
1485  ContentContextOptions opts) const {
1486  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1487  return GetPipeline(this, pipelines_->framebuffer_blend_multiply, opts);
1488 }
1489 
1491  ContentContextOptions opts) const {
1492  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1493  return GetPipeline(this, pipelines_->framebuffer_blend_overlay, opts);
1494 }
1495 
1497  ContentContextOptions opts) const {
1498  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1499  return GetPipeline(this, pipelines_->framebuffer_blend_saturation, opts);
1500 }
1501 
1503  ContentContextOptions opts) const {
1504  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1505  return GetPipeline(this, pipelines_->framebuffer_blend_screen, opts);
1506 }
1507 
1509  ContentContextOptions opts) const {
1510  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1511  return GetPipeline(this, pipelines_->framebuffer_blend_softlight, opts);
1512 }
1513 
1515  ContentContextOptions opts) const {
1516  return GetPipeline(this, pipelines_->shadow_vertices_, opts);
1517 }
1518 
1520  BlendMode blend_mode,
1521  ContentContextOptions opts) const {
1522  if (blend_mode <= BlendMode::kHardLight) {
1523  return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1524  } else {
1525  return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1526  }
1527 }
1528 
1530  ContentContextOptions opts) const {
1531  return GetPipeline(this, pipelines_->circle, opts);
1532 }
1533 
1535  return GetPipeline(this, pipelines_->line, opts);
1536 }
1537 
1538 #ifdef IMPELLER_ENABLE_OPENGLES
1539 
1540 #if !defined(FML_OS_EMSCRIPTEN)
1541 PipelineRef ContentContext::GetTiledTextureUvExternalPipeline(
1542  ContentContextOptions opts) const {
1543  FML_DCHECK(GetContext()->GetBackendType() == Context::BackendType::kOpenGLES);
1544  return GetPipeline(this, pipelines_->tiled_texture_uv_external, opts);
1545 }
1546 
1547 PipelineRef ContentContext::GetTiledTextureExternalPipeline(
1548  ContentContextOptions opts) const {
1549  FML_DCHECK(GetContext()->GetBackendType() == Context::BackendType::kOpenGLES);
1550  return GetPipeline(this, pipelines_->tiled_texture_external, opts);
1551 }
1552 #endif
1553 
1554 PipelineRef ContentContext::GetDownsampleTextureGlesPipeline(
1555  ContentContextOptions opts) const {
1556  return GetPipeline(this, pipelines_->texture_downsample_gles, opts);
1557 }
1558 
1559 #endif // IMPELLER_ENABLE_OPENGLES
1560 
1561 } // namespace impeller
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 GetUberSDFPipeline(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:89
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:93
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< UberSDFPipeline > uber_sdf
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...
#define VALIDATION_LOG
Definition: validation.h:91