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 <memory>
8 #include <utility>
9 
10 #include "fml/trace_event.h"
12 #include "impeller/core/formats.h"
15 #include "impeller/entity/entity.h"
24 
25 namespace impeller {
26 
28  PipelineDescriptor& desc) const {
29  auto pipeline_blend = blend_mode;
31  VALIDATION_LOG << "Cannot use blend mode " << static_cast<int>(blend_mode)
32  << " as a pipeline blend.";
33  pipeline_blend = BlendMode::kSourceOver;
34  }
35 
37 
43 
44  switch (pipeline_blend) {
45  case BlendMode::kClear:
53  } else {
58  }
59  break;
60  case BlendMode::kSource:
61  color0.blending_enabled = false;
66  break;
73  break;
79  break;
85  break;
91  break;
97  break;
103  break;
109  break;
115  break;
121  break;
122  case BlendMode::kXor:
127  break;
128  case BlendMode::kPlus:
133  break;
139  break;
140  default:
141  FML_UNREACHABLE();
142  }
143  desc.SetColorAttachmentDescriptor(0u, color0);
144 
146  desc.ClearDepthAttachment();
148  }
149 
150  auto maybe_stencil = desc.GetFrontStencilAttachmentDescriptor();
151  auto maybe_depth = desc.GetDepthStencilAttachmentDescriptor();
152  FML_DCHECK(has_depth_stencil_attachments == maybe_depth.has_value())
153  << "Depth attachment doesn't match expected pipeline state. "
154  "has_depth_stencil_attachments="
156  FML_DCHECK(has_depth_stencil_attachments == maybe_stencil.has_value())
157  << "Stencil attachment doesn't match expected pipeline state. "
158  "has_depth_stencil_attachments="
160  if (maybe_stencil.has_value()) {
161  StencilAttachmentDescriptor front_stencil = maybe_stencil.value();
162  StencilAttachmentDescriptor back_stencil = front_stencil;
163 
164  switch (stencil_mode) {
168  desc.SetStencilAttachmentDescriptors(front_stencil);
169  break;
171  // The stencil ref should be 0 on commands that use this mode.
176  desc.SetStencilAttachmentDescriptors(front_stencil, back_stencil);
177  break;
179  // The stencil ref should be 0 on commands that use this mode.
183  desc.SetStencilAttachmentDescriptors(front_stencil);
184  break;
186  // The stencil ref should be 0 on commands that use this mode.
188  front_stencil.depth_stencil_pass =
190  desc.SetStencilAttachmentDescriptors(front_stencil);
191  break;
193  // The stencil ref should be 0 on commands that use this mode.
196  desc.SetStencilAttachmentDescriptors(front_stencil);
197  break;
201  desc.SetStencilAttachmentDescriptors(front_stencil);
202  break;
204  front_stencil.stencil_compare = CompareFunction::kLess;
205  front_stencil.depth_stencil_pass =
207  desc.SetStencilAttachmentDescriptors(front_stencil);
208  break;
209  }
210  }
211  if (maybe_depth.has_value()) {
212  DepthAttachmentDescriptor depth = maybe_depth.value();
216  }
217 
219 
221 }
222 
223 std::array<std::vector<Scalar>, 15> GetPorterDuffSpecConstants(
224  bool supports_decal) {
225  Scalar x = supports_decal ? 1 : 0;
226  return {{
227  {x, 0, 0, 0, 0, 0}, // Clear
228  {x, 1, 0, 0, 0, 0}, // Source
229  {x, 0, 0, 1, 0, 0}, // Destination
230  {x, 1, 0, 1, -1, 0}, // SourceOver
231  {x, 1, -1, 1, 0, 0}, // DestinationOver
232  {x, 0, 1, 0, 0, 0}, // SourceIn
233  {x, 0, 0, 0, 1, 0}, // DestinationIn
234  {x, 1, -1, 0, 0, 0}, // SourceOut
235  {x, 0, 0, 1, -1, 0}, // DestinationOut
236  {x, 0, 1, 1, -1, 0}, // SourceATop
237  {x, 1, -1, 0, 1, 0}, // DestinationATop
238  {x, 1, -1, 1, -1, 0}, // Xor
239  {x, 1, 0, 1, 0, 0}, // Plus
240  {x, 0, 0, 0, 0, 1}, // Modulate
241  {x, 0, 0, 1, 0, -1}, // Screen
242  }};
243 }
244 
245 template <typename PipelineT>
246 static std::unique_ptr<PipelineT> CreateDefaultPipeline(
247  const Context& context) {
248  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
249  if (!desc.has_value()) {
250  return nullptr;
251  }
252  // Apply default ContentContextOptions to the descriptor.
253  const auto default_color_format =
254  context.GetCapabilities()->GetDefaultColorFormat();
256  .primitive_type = PrimitiveType::kTriangleStrip,
257  .color_attachment_pixel_format = default_color_format}
258  .ApplyToPipelineDescriptor(*desc);
259  return std::make_unique<PipelineT>(context, desc);
260 }
261 
263  std::shared_ptr<Context> context,
264  std::shared_ptr<TypographerContext> typographer_context,
265  std::shared_ptr<RenderTargetAllocator> render_target_allocator)
266  : context_(std::move(context)),
267  lazy_glyph_atlas_(
268  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
269  tessellator_(std::make_shared<Tessellator>()),
270  render_target_cache_(render_target_allocator == nullptr
271  ? std::make_shared<RenderTargetCache>(
272  context_->GetResourceAllocator())
273  : std::move(render_target_allocator)),
274  host_buffer_(HostBuffer::Create(context_->GetResourceAllocator(),
275  context_->GetIdleWaiter())) {
276  if (!context_ || !context_->IsValid()) {
277  return;
278  }
279 
280  {
281  TextureDescriptor desc;
284  desc.size = ISize{1, 1};
285  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
287  auto cmd_buffer = GetContext()->CreateCommandBuffer();
288  auto blit_pass = cmd_buffer->CreateBlitPass();
289  auto& host_buffer = GetTransientsBuffer();
290  auto buffer_view = host_buffer.Emplace(data);
291  blit_pass->AddCopy(buffer_view, empty_texture_);
292 
293  if (!blit_pass->EncodeCommands() || !GetContext()
294  ->GetCommandQueue()
295  ->Submit({std::move(cmd_buffer)})
296  .ok()) {
297  VALIDATION_LOG << "Failed to create empty texture.";
298  }
299  }
300 
301  auto options = ContentContextOptions{
303  .color_attachment_pixel_format =
304  context_->GetCapabilities()->GetDefaultColorFormat()};
305  auto options_trianglestrip = ContentContextOptions{
307  .primitive_type = PrimitiveType::kTriangleStrip,
308  .color_attachment_pixel_format =
309  context_->GetCapabilities()->GetDefaultColorFormat()};
310  const auto supports_decal = static_cast<Scalar>(
311  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
312 
313  // Futures for the following pipelines may block in case the first frame is
314  // rendered without the pipelines being ready. Put pipelines that are more
315  // likely to be used first.
316  {
317  glyph_atlas_pipelines_.CreateDefault(
318  *context_, options,
319  {static_cast<Scalar>(
320  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
322  solid_fill_pipelines_.CreateDefault(*context_, options);
323  texture_pipelines_.CreateDefault(*context_, options);
324  fast_gradient_pipelines_.CreateDefault(*context_, options);
325 
326  if (context_->GetCapabilities()->SupportsSSBO()) {
327  linear_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
328  radial_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
329  conical_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
330  sweep_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
331  } else {
332  linear_gradient_uniform_fill_pipelines_.CreateDefault(*context_, options);
333  radial_gradient_uniform_fill_pipelines_.CreateDefault(*context_, options);
334  conical_gradient_uniform_fill_pipelines_.CreateDefault(*context_,
335  options);
336  sweep_gradient_uniform_fill_pipelines_.CreateDefault(*context_, options);
337 
338  linear_gradient_fill_pipelines_.CreateDefault(*context_, options);
339  radial_gradient_fill_pipelines_.CreateDefault(*context_, options);
340  conical_gradient_fill_pipelines_.CreateDefault(*context_, options);
341  sweep_gradient_fill_pipelines_.CreateDefault(*context_, options);
342  }
343 
344  /// Setup default clip pipeline.
345  auto clip_pipeline_descriptor =
347  if (!clip_pipeline_descriptor.has_value()) {
348  return;
349  }
352  .color_attachment_pixel_format =
353  context_->GetCapabilities()->GetDefaultColorFormat()}
354  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
355  // Disable write to all color attachments.
356  auto clip_color_attachments =
357  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
358  for (auto& color_attachment : clip_color_attachments) {
359  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
360  }
361  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
362  std::move(clip_color_attachments));
363  clip_pipelines_.SetDefault(
364  options,
365  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
366  texture_downsample_pipelines_.CreateDefault(*context_,
367  options_trianglestrip);
368  rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
369  texture_strict_src_pipelines_.CreateDefault(*context_, options);
370  tiled_texture_pipelines_.CreateDefault(*context_, options,
371  {supports_decal});
372  gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
373  {supports_decal});
374  border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
375  color_matrix_color_filter_pipelines_.CreateDefault(*context_,
376  options_trianglestrip);
377  vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
378 
379  const std::array<std::vector<Scalar>, 15> porter_duff_constants =
380  GetPorterDuffSpecConstants(supports_decal);
381  clear_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
382  porter_duff_constants[0]);
383  source_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
384  porter_duff_constants[1]);
385  destination_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
386  porter_duff_constants[2]);
387  source_over_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
388  porter_duff_constants[3]);
389  destination_over_blend_pipelines_.CreateDefault(
390  *context_, options_trianglestrip, porter_duff_constants[4]);
391  source_in_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
392  porter_duff_constants[5]);
393  destination_in_blend_pipelines_.CreateDefault(
394  *context_, options_trianglestrip, porter_duff_constants[6]);
395  source_out_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
396  porter_duff_constants[7]);
397  destination_out_blend_pipelines_.CreateDefault(
398  *context_, options_trianglestrip, porter_duff_constants[8]);
399  source_a_top_blend_pipelines_.CreateDefault(
400  *context_, options_trianglestrip, porter_duff_constants[9]);
401  destination_a_top_blend_pipelines_.CreateDefault(
402  *context_, options_trianglestrip, porter_duff_constants[10]);
403  xor_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
404  porter_duff_constants[11]);
405  plus_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
406  porter_duff_constants[12]);
407  modulate_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
408  porter_duff_constants[13]);
409  screen_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
410  porter_duff_constants[14]);
411  }
412 
413  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
414  framebuffer_blend_color_pipelines_.CreateDefault(
415  *context_, options_trianglestrip,
416  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
417  framebuffer_blend_colorburn_pipelines_.CreateDefault(
418  *context_, options_trianglestrip,
419  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
420  framebuffer_blend_colordodge_pipelines_.CreateDefault(
421  *context_, options_trianglestrip,
422  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
423  framebuffer_blend_darken_pipelines_.CreateDefault(
424  *context_, options_trianglestrip,
425  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
426  framebuffer_blend_difference_pipelines_.CreateDefault(
427  *context_, options_trianglestrip,
428  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
429  framebuffer_blend_exclusion_pipelines_.CreateDefault(
430  *context_, options_trianglestrip,
431  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
432  framebuffer_blend_hardlight_pipelines_.CreateDefault(
433  *context_, options_trianglestrip,
434  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
435  framebuffer_blend_hue_pipelines_.CreateDefault(
436  *context_, options_trianglestrip,
437  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
438  framebuffer_blend_lighten_pipelines_.CreateDefault(
439  *context_, options_trianglestrip,
440  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
441  framebuffer_blend_luminosity_pipelines_.CreateDefault(
442  *context_, options_trianglestrip,
443  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
444  framebuffer_blend_multiply_pipelines_.CreateDefault(
445  *context_, options_trianglestrip,
446  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
447  framebuffer_blend_overlay_pipelines_.CreateDefault(
448  *context_, options_trianglestrip,
449  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
450  framebuffer_blend_saturation_pipelines_.CreateDefault(
451  *context_, options_trianglestrip,
452  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
453  framebuffer_blend_screen_pipelines_.CreateDefault(
454  *context_, options_trianglestrip,
455  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
456  framebuffer_blend_softlight_pipelines_.CreateDefault(
457  *context_, options_trianglestrip,
458  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
459  } else {
460  blend_color_pipelines_.CreateDefault(
461  *context_, options_trianglestrip,
462  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
463  blend_colorburn_pipelines_.CreateDefault(
464  *context_, options_trianglestrip,
465  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
466  blend_colordodge_pipelines_.CreateDefault(
467  *context_, options_trianglestrip,
468  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
469  blend_darken_pipelines_.CreateDefault(
470  *context_, options_trianglestrip,
471  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
472  blend_difference_pipelines_.CreateDefault(
473  *context_, options_trianglestrip,
474  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
475  blend_exclusion_pipelines_.CreateDefault(
476  *context_, options_trianglestrip,
477  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
478  blend_hardlight_pipelines_.CreateDefault(
479  *context_, options_trianglestrip,
480  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
481  blend_hue_pipelines_.CreateDefault(
482  *context_, options_trianglestrip,
483  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
484  blend_lighten_pipelines_.CreateDefault(
485  *context_, options_trianglestrip,
486  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
487  blend_luminosity_pipelines_.CreateDefault(
488  *context_, options_trianglestrip,
489  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
490  blend_multiply_pipelines_.CreateDefault(
491  *context_, options_trianglestrip,
492  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
493  blend_overlay_pipelines_.CreateDefault(
494  *context_, options_trianglestrip,
495  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
496  blend_saturation_pipelines_.CreateDefault(
497  *context_, options_trianglestrip,
498  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
499  blend_screen_pipelines_.CreateDefault(
500  *context_, options_trianglestrip,
501  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
502  blend_softlight_pipelines_.CreateDefault(
503  *context_, options_trianglestrip,
504  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
505  }
506 
507  morphology_filter_pipelines_.CreateDefault(*context_, options_trianglestrip,
508  {supports_decal});
509  linear_to_srgb_filter_pipelines_.CreateDefault(*context_,
510  options_trianglestrip);
511  srgb_to_linear_filter_pipelines_.CreateDefault(*context_,
512  options_trianglestrip);
513  yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip);
514 
515 #if defined(IMPELLER_ENABLE_OPENGLES)
516  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
517 #if !defined(FML_OS_MACOSX)
518  // GLES only shader that is unsupported on macOS.
519  tiled_texture_external_pipelines_.CreateDefault(*context_, options);
520  tiled_texture_uv_external_pipelines_.CreateDefault(*context_, options);
521 #endif // !defined(FML_OS_MACOSX)
522  texture_downsample_gles_pipelines_.CreateDefault(*context_,
523  options_trianglestrip);
524  }
525 #endif // IMPELLER_ENABLE_OPENGLES
526 
527  is_valid_ = true;
528  InitializeCommonlyUsedShadersIfNeeded();
529 }
530 
532 
534  return is_valid_;
535 }
536 
537 std::shared_ptr<Texture> ContentContext::GetEmptyTexture() const {
538  return empty_texture_;
539 }
540 
541 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
542  std::string_view label,
543  ISize texture_size,
544  const std::shared_ptr<CommandBuffer>& command_buffer,
545  const SubpassCallback& subpass_callback,
546  bool msaa_enabled,
547  bool depth_stencil_enabled,
548  int32_t mip_count) const {
549  const std::shared_ptr<Context>& context = GetContext();
550  RenderTarget subpass_target;
551 
552  std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
553  depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
554  : std::optional<RenderTarget::AttachmentConfig>();
555 
556  if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
557  subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
558  *context, texture_size,
559  /*mip_count=*/mip_count, label,
561  } else {
562  subpass_target = GetRenderTargetCache()->CreateOffscreen(
563  *context, texture_size,
564  /*mip_count=*/mip_count, label,
565  RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
566  }
567  return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
568 }
569 
570 fml::StatusOr<RenderTarget> ContentContext::MakeSubpass(
571  std::string_view label,
572  const RenderTarget& subpass_target,
573  const std::shared_ptr<CommandBuffer>& command_buffer,
574  const SubpassCallback& subpass_callback) const {
575  const std::shared_ptr<Context>& context = GetContext();
576 
577  auto subpass_texture = subpass_target.GetRenderTargetTexture();
578  if (!subpass_texture) {
579  return fml::Status(fml::StatusCode::kUnknown, "");
580  }
581 
582  auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
583  if (!sub_renderpass) {
584  return fml::Status(fml::StatusCode::kUnknown, "");
585  }
586  sub_renderpass->SetLabel(label);
587 
588  if (!subpass_callback(*this, *sub_renderpass)) {
589  return fml::Status(fml::StatusCode::kUnknown, "");
590  }
591 
592  if (!sub_renderpass->EncodeCommands()) {
593  return fml::Status(fml::StatusCode::kUnknown, "");
594  }
595 
596  const std::shared_ptr<Texture>& target_texture =
597  subpass_target.GetRenderTargetTexture();
598  if (target_texture->GetMipCount() > 1) {
599  fml::Status mipmap_status =
600  AddMipmapGeneration(command_buffer, context, target_texture);
601  if (!mipmap_status.ok()) {
602  return mipmap_status;
603  }
604  }
605 
606  return subpass_target;
607 }
608 
610  return *tessellator_;
611 }
612 
613 std::shared_ptr<Context> ContentContext::GetContext() const {
614  return context_;
615 }
616 
618  return *context_->GetCapabilities();
619 }
620 
621 void ContentContext::SetWireframe(bool wireframe) {
622  wireframe_ = wireframe;
623 }
624 
626  const std::string& unique_entrypoint_name,
627  const ContentContextOptions& options,
628  const std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>()>&
629  create_callback) const {
630  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
631  auto it = runtime_effect_pipelines_.find(key);
632  if (it == runtime_effect_pipelines_.end()) {
633  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
634  }
635  return raw_ptr(it->second);
636 }
637 
639  const std::string& unique_entrypoint_name) const {
640  for (auto it = runtime_effect_pipelines_.begin();
641  it != runtime_effect_pipelines_.end();) {
642  if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
643  it = runtime_effect_pipelines_.erase(it);
644  } else {
645  it++;
646  }
647  }
648 }
649 
650 void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
651  TRACE_EVENT0("flutter", "InitializeCommonlyUsedShadersIfNeeded");
652  GetContext()->InitializeCommonlyUsedShadersIfNeeded();
653 }
654 
655 } // namespace impeller
BufferView buffer_view
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
std::shared_ptr< Texture > GetEmptyTexture() const
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
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 GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
void SetWireframe(bool wireframe)
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
Tessellator & GetTessellator() const
std::shared_ptr< Context > GetContext() const
To do anything rendering related with Impeller, you need a context.
Definition: context.h:46
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:22
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:34
int32_t x
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:160
float Scalar
Definition: scalar.h:18
static std::unique_ptr< PipelineT > CreateDefaultPipeline(const Context &context)
@ kEqual
Comparison test passes if new_value == current_value.
@ kAlways
Comparison test passes always passes.
@ kLess
Comparison test passes if new_value < current_value.
@ 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.
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
@ kSetToReferenceValue
Reset the stencil value to the reference value.
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
@ kKeep
Don't modify the current stencil value.
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:518
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:245
static constexpr Color BlackTransparent()
Definition: color.h:269
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
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:629
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:64
#define VALIDATION_LOG
Definition: validation.h:91