Flutter Impeller
impeller::ContentContext Class Reference

#include <content_context.h>

Public Types

using SubpassCallback = std::function< bool(const ContentContext &, RenderPass &)>
 

Public Member Functions

 ContentContext (std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
 
 ~ContentContext ()
 
bool IsValid () const
 
TessellatorGetTessellator () const
 
PipelineRef GetFastGradientPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetConicalGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetConicalGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetConicalGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRRectBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSolidFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetTexturePipeline (ContentContextOptions opts) const
 
PipelineRef GetTextureStrictSrcPipeline (ContentContextOptions opts) const
 
PipelineRef GetTiledTexturePipeline (ContentContextOptions opts) const
 
PipelineRef GetGaussianBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetBorderMaskBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetMorphologyFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetColorMatrixColorFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearToSrgbFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetSrgbToLinearFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetClipPipeline (ContentContextOptions opts) const
 
PipelineRef GetGlyphAtlasPipeline (ContentContextOptions opts) const
 
PipelineRef GetYUVToRGBFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetPorterDuffPipeline (BlendMode mode, ContentContextOptions opts) const
 
PipelineRef GetClearBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceOverBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationOverBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceInBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationInBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceOutBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationOutBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceATopBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationATopBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetXorBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetPlusBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetModulateBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetScreenBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendColorPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendColorBurnPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendColorDodgePipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendDarkenPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendDifferencePipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendExclusionPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendHardLightPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendHuePipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendLightenPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendLuminosityPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendMultiplyPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendOverlayPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendSaturationPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendScreenPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendSoftLightPipeline (ContentContextOptions opts) const
 
PipelineRef GetDownsamplePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorBurnPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorDodgePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendDarkenPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendDifferencePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendExclusionPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendHardLightPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendHuePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendLightenPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendLuminosityPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendMultiplyPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendOverlayPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendSaturationPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendScreenPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendSoftLightPipeline (ContentContextOptions opts) const
 
PipelineRef GetDrawVerticesUberShader (ContentContextOptions opts) const
 
std::shared_ptr< TextureGetEmptyTexture () const
 
std::shared_ptr< ContextGetContext () const
 
const CapabilitiesGetDeviceCapabilities () const
 
void SetWireframe (bool wireframe)
 
fml::StatusOr< RenderTargetMakeSubpass (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 to the texture. More...
 
fml::StatusOr< RenderTargetMakeSubpass (std::string_view label, const RenderTarget &subpass_target, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback) const
 Makes a subpass that will render to subpass_target. More...
 
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas () const
 
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache () const
 
PipelineRef GetCachedRuntimeEffectPipeline (const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
 
void ClearCachedRuntimeEffectPipeline (const std::string &unique_entrypoint_name) const
 
HostBufferGetTransientsBuffer () const
 Retrieve the currnent host buffer for transient storage. More...
 

Detailed Description

Definition at line 371 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

Definition at line 813 of file content_context.h.

Constructor & Destructor Documentation

◆ ContentContext()

impeller::ContentContext::ContentContext ( std::shared_ptr< Context context,
std::shared_ptr< TypographerContext typographer_context,
std::shared_ptr< RenderTargetAllocator render_target_allocator = nullptr 
)
explicit

Setup default clip pipeline.

Definition at line 262 of file content_context.cc.

266  : context_(std::move(context)),
267  lazy_glyph_atlas_(
268  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
269  tessellator_(std::make_shared<Tessellator>()),
270  render_target_cache_(render_target_allocator == nullptr
271  ? std::make_shared<RenderTargetCache>(
272  context_->GetResourceAllocator())
273  : std::move(render_target_allocator)),
274  host_buffer_(HostBuffer::Create(context_->GetResourceAllocator(),
275  context_->GetIdleWaiter())) {
276  if (!context_ || !context_->IsValid()) {
277  return;
278  }
279 
280  {
281  TextureDescriptor desc;
282  desc.storage_mode = StorageMode::kDevicePrivate;
283  desc.format = PixelFormat::kR8G8B8A8UNormInt;
284  desc.size = ISize{1, 1};
285  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
287  auto cmd_buffer = GetContext()->CreateCommandBuffer();
288  auto blit_pass = cmd_buffer->CreateBlitPass();
289  auto& host_buffer = GetTransientsBuffer();
290  auto buffer_view = host_buffer.Emplace(data);
291  blit_pass->AddCopy(buffer_view, empty_texture_);
292 
293  if (!blit_pass->EncodeCommands() || !GetContext()
294  ->GetCommandQueue()
295  ->Submit({std::move(cmd_buffer)})
296  .ok()) {
297  VALIDATION_LOG << "Failed to create empty texture.";
298  }
299  }
300 
301  auto options = ContentContextOptions{
302  .sample_count = SampleCount::kCount4,
303  .color_attachment_pixel_format =
304  context_->GetCapabilities()->GetDefaultColorFormat()};
305  auto options_trianglestrip = ContentContextOptions{
306  .sample_count = SampleCount::kCount4,
307  .primitive_type = PrimitiveType::kTriangleStrip,
308  .color_attachment_pixel_format =
309  context_->GetCapabilities()->GetDefaultColorFormat()};
310  const auto supports_decal = static_cast<Scalar>(
311  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
312 
313  // Futures for the following pipelines may block in case the first frame is
314  // rendered without the pipelines being ready. Put pipelines that are more
315  // likely to be used first.
316  {
317  glyph_atlas_pipelines_.CreateDefault(
318  *context_, options,
319  {static_cast<Scalar>(
320  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
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  }
350  ContentContextOptions{
351  .sample_count = SampleCount::kCount4,
352  .color_attachment_pixel_format =
353  context_->GetCapabilities()->GetDefaultColorFormat()}
354  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
355  // Disable write to all color attachments.
356  auto clip_color_attachments =
357  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
358  for (auto& color_attachment : clip_color_attachments) {
359  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
360  }
361  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
362  std::move(clip_color_attachments));
363  clip_pipelines_.SetDefault(
364  options,
365  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
366  texture_downsample_pipelines_.CreateDefault(*context_,
367  options_trianglestrip);
368  rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
369  texture_strict_src_pipelines_.CreateDefault(*context_, options);
370  tiled_texture_pipelines_.CreateDefault(*context_, options,
371  {supports_decal});
372  gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
373  {supports_decal});
374  border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
375  color_matrix_color_filter_pipelines_.CreateDefault(*context_,
376  options_trianglestrip);
377  vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
378 
379  const std::array<std::vector<Scalar>, 15> porter_duff_constants =
380  GetPorterDuffSpecConstants(supports_decal);
381  clear_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
382  porter_duff_constants[0]);
383  source_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
384  porter_duff_constants[1]);
385  destination_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
386  porter_duff_constants[2]);
387  source_over_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
388  porter_duff_constants[3]);
389  destination_over_blend_pipelines_.CreateDefault(
390  *context_, options_trianglestrip, porter_duff_constants[4]);
391  source_in_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
392  porter_duff_constants[5]);
393  destination_in_blend_pipelines_.CreateDefault(
394  *context_, options_trianglestrip, porter_duff_constants[6]);
395  source_out_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
396  porter_duff_constants[7]);
397  destination_out_blend_pipelines_.CreateDefault(
398  *context_, options_trianglestrip, porter_duff_constants[8]);
399  source_a_top_blend_pipelines_.CreateDefault(
400  *context_, options_trianglestrip, porter_duff_constants[9]);
401  destination_a_top_blend_pipelines_.CreateDefault(
402  *context_, options_trianglestrip, porter_duff_constants[10]);
403  xor_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
404  porter_duff_constants[11]);
405  plus_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
406  porter_duff_constants[12]);
407  modulate_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
408  porter_duff_constants[13]);
409  screen_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
410  porter_duff_constants[14]);
411  }
412 
413  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
414  framebuffer_blend_color_pipelines_.CreateDefault(
415  *context_, options_trianglestrip,
416  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
417  framebuffer_blend_colorburn_pipelines_.CreateDefault(
418  *context_, options_trianglestrip,
419  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
420  framebuffer_blend_colordodge_pipelines_.CreateDefault(
421  *context_, options_trianglestrip,
422  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
423  framebuffer_blend_darken_pipelines_.CreateDefault(
424  *context_, options_trianglestrip,
425  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
426  framebuffer_blend_difference_pipelines_.CreateDefault(
427  *context_, options_trianglestrip,
428  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
429  framebuffer_blend_exclusion_pipelines_.CreateDefault(
430  *context_, options_trianglestrip,
431  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
432  framebuffer_blend_hardlight_pipelines_.CreateDefault(
433  *context_, options_trianglestrip,
434  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
435  framebuffer_blend_hue_pipelines_.CreateDefault(
436  *context_, options_trianglestrip,
437  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
438  framebuffer_blend_lighten_pipelines_.CreateDefault(
439  *context_, options_trianglestrip,
440  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
441  framebuffer_blend_luminosity_pipelines_.CreateDefault(
442  *context_, options_trianglestrip,
443  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
444  framebuffer_blend_multiply_pipelines_.CreateDefault(
445  *context_, options_trianglestrip,
446  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
447  framebuffer_blend_overlay_pipelines_.CreateDefault(
448  *context_, options_trianglestrip,
449  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
450  framebuffer_blend_saturation_pipelines_.CreateDefault(
451  *context_, options_trianglestrip,
452  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
453  framebuffer_blend_screen_pipelines_.CreateDefault(
454  *context_, options_trianglestrip,
455  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
456  framebuffer_blend_softlight_pipelines_.CreateDefault(
457  *context_, options_trianglestrip,
458  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
459  } else {
460  blend_color_pipelines_.CreateDefault(
461  *context_, options_trianglestrip,
462  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
463  blend_colorburn_pipelines_.CreateDefault(
464  *context_, options_trianglestrip,
465  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
466  blend_colordodge_pipelines_.CreateDefault(
467  *context_, options_trianglestrip,
468  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
469  blend_darken_pipelines_.CreateDefault(
470  *context_, options_trianglestrip,
471  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
472  blend_difference_pipelines_.CreateDefault(
473  *context_, options_trianglestrip,
474  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
475  blend_exclusion_pipelines_.CreateDefault(
476  *context_, options_trianglestrip,
477  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
478  blend_hardlight_pipelines_.CreateDefault(
479  *context_, options_trianglestrip,
480  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
481  blend_hue_pipelines_.CreateDefault(
482  *context_, options_trianglestrip,
483  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
484  blend_lighten_pipelines_.CreateDefault(
485  *context_, options_trianglestrip,
486  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
487  blend_luminosity_pipelines_.CreateDefault(
488  *context_, options_trianglestrip,
489  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
490  blend_multiply_pipelines_.CreateDefault(
491  *context_, options_trianglestrip,
492  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
493  blend_overlay_pipelines_.CreateDefault(
494  *context_, options_trianglestrip,
495  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
496  blend_saturation_pipelines_.CreateDefault(
497  *context_, options_trianglestrip,
498  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
499  blend_screen_pipelines_.CreateDefault(
500  *context_, options_trianglestrip,
501  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
502  blend_softlight_pipelines_.CreateDefault(
503  *context_, options_trianglestrip,
504  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
505  }
506 
507  morphology_filter_pipelines_.CreateDefault(*context_, options_trianglestrip,
508  {supports_decal});
509  linear_to_srgb_filter_pipelines_.CreateDefault(*context_,
510  options_trianglestrip);
511  srgb_to_linear_filter_pipelines_.CreateDefault(*context_,
512  options_trianglestrip);
513  yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip);
514 
515 #if defined(IMPELLER_ENABLE_OPENGLES)
516  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
517 #if !defined(FML_OS_MACOSX)
518  // GLES only shader that is unsupported on macOS.
519  tiled_texture_external_pipelines_.CreateDefault(*context_, options);
520  tiled_texture_uv_external_pipelines_.CreateDefault(*context_, options);
521 #endif // !defined(FML_OS_MACOSX)
522  texture_downsample_gles_pipelines_.CreateDefault(*context_,
523  options_trianglestrip);
524  }
525 #endif // IMPELLER_ENABLE_OPENGLES
526 
527  is_valid_ = true;
528  InitializeCommonlyUsedShadersIfNeeded();
529 }
BufferView buffer_view
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
std::shared_ptr< Context > GetContext() const
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator, const std::shared_ptr< const IdleWaiter > &idle_waiter)
Definition: host_buffer.cc:21
float Scalar
Definition: scalar.h:18
std::array< std::vector< Scalar >, 15 > GetPorterDuffSpecConstants(bool supports_decal)
ISize64 ISize
Definition: size.h:174
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:245
static constexpr Color BlackTransparent()
Definition: color.h:269
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:64
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::Color::BlackTransparent(), buffer_view, data, impeller::TextureDescriptor::format, GetContext(), impeller::GetPorterDuffSpecConstants(), GetTransientsBuffer(), impeller::kA8UNormInt, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kCount4, impeller::kDarken, impeller::kDevicePrivate, impeller::kDifference, impeller::kExclusion, impeller::kHardLight, impeller::kHue, impeller::kLighten, impeller::kLuminosity, impeller::kMultiply, impeller::kNone, impeller::Context::kOpenGLES, impeller::kOverlay, impeller::kR8G8B8A8UNormInt, impeller::kSaturation, impeller::kScreen, impeller::kSoftLight, impeller::kTriangleStrip, impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::MakeDefaultPipelineDescriptor(), impeller::ContentContextOptions::sample_count, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, impeller::Color::ToR8G8B8A8(), and VALIDATION_LOG.

◆ ~ContentContext()

impeller::ContentContext::~ContentContext ( )
default

Member Function Documentation

◆ ClearCachedRuntimeEffectPipeline()

void impeller::ContentContext::ClearCachedRuntimeEffectPipeline ( const std::string &  unique_entrypoint_name) const

Used by hot reload/hot restart to clear a cached pipeline from GetCachedRuntimeEffectPipeline.

Definition at line 638 of file content_context.cc.

639  {
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 }

◆ GetBlendColorBurnPipeline()

PipelineRef impeller::ContentContext::GetBlendColorBurnPipeline ( ContentContextOptions  opts) const
inline

Definition at line 649 of file content_context.h.

649  {
650  return GetPipeline(blend_colorburn_pipelines_, opts);
651  }

◆ GetBlendColorDodgePipeline()

PipelineRef impeller::ContentContext::GetBlendColorDodgePipeline ( ContentContextOptions  opts) const
inline

Definition at line 653 of file content_context.h.

653  {
654  return GetPipeline(blend_colordodge_pipelines_, opts);
655  }

◆ GetBlendColorPipeline()

PipelineRef impeller::ContentContext::GetBlendColorPipeline ( ContentContextOptions  opts) const
inline

Definition at line 645 of file content_context.h.

645  {
646  return GetPipeline(blend_color_pipelines_, opts);
647  }

◆ GetBlendDarkenPipeline()

PipelineRef impeller::ContentContext::GetBlendDarkenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 657 of file content_context.h.

657  {
658  return GetPipeline(blend_darken_pipelines_, opts);
659  }

◆ GetBlendDifferencePipeline()

PipelineRef impeller::ContentContext::GetBlendDifferencePipeline ( ContentContextOptions  opts) const
inline

Definition at line 661 of file content_context.h.

661  {
662  return GetPipeline(blend_difference_pipelines_, opts);
663  }

◆ GetBlendExclusionPipeline()

PipelineRef impeller::ContentContext::GetBlendExclusionPipeline ( ContentContextOptions  opts) const
inline

Definition at line 665 of file content_context.h.

665  {
666  return GetPipeline(blend_exclusion_pipelines_, opts);
667  }

◆ GetBlendHardLightPipeline()

PipelineRef impeller::ContentContext::GetBlendHardLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 669 of file content_context.h.

669  {
670  return GetPipeline(blend_hardlight_pipelines_, opts);
671  }

◆ GetBlendHuePipeline()

PipelineRef impeller::ContentContext::GetBlendHuePipeline ( ContentContextOptions  opts) const
inline

Definition at line 673 of file content_context.h.

673  {
674  return GetPipeline(blend_hue_pipelines_, opts);
675  }

◆ GetBlendLightenPipeline()

PipelineRef impeller::ContentContext::GetBlendLightenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 677 of file content_context.h.

677  {
678  return GetPipeline(blend_lighten_pipelines_, opts);
679  }

◆ GetBlendLuminosityPipeline()

PipelineRef impeller::ContentContext::GetBlendLuminosityPipeline ( ContentContextOptions  opts) const
inline

Definition at line 681 of file content_context.h.

681  {
682  return GetPipeline(blend_luminosity_pipelines_, opts);
683  }

◆ GetBlendMultiplyPipeline()

PipelineRef impeller::ContentContext::GetBlendMultiplyPipeline ( ContentContextOptions  opts) const
inline

Definition at line 685 of file content_context.h.

685  {
686  return GetPipeline(blend_multiply_pipelines_, opts);
687  }

◆ GetBlendOverlayPipeline()

PipelineRef impeller::ContentContext::GetBlendOverlayPipeline ( ContentContextOptions  opts) const
inline

Definition at line 689 of file content_context.h.

689  {
690  return GetPipeline(blend_overlay_pipelines_, opts);
691  }

◆ GetBlendSaturationPipeline()

PipelineRef impeller::ContentContext::GetBlendSaturationPipeline ( ContentContextOptions  opts) const
inline

Definition at line 693 of file content_context.h.

693  {
694  return GetPipeline(blend_saturation_pipelines_, opts);
695  }

◆ GetBlendScreenPipeline()

PipelineRef impeller::ContentContext::GetBlendScreenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 697 of file content_context.h.

697  {
698  return GetPipeline(blend_screen_pipelines_, opts);
699  }

◆ GetBlendSoftLightPipeline()

PipelineRef impeller::ContentContext::GetBlendSoftLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 701 of file content_context.h.

701  {
702  return GetPipeline(blend_softlight_pipelines_, opts);
703  }

◆ GetBorderMaskBlurPipeline()

PipelineRef impeller::ContentContext::GetBorderMaskBlurPipeline ( ContentContextOptions  opts) const
inline

Definition at line 493 of file content_context.h.

493  {
494  return GetPipeline(border_mask_blur_pipelines_, opts);
495  }

◆ GetCachedRuntimeEffectPipeline()

PipelineRef impeller::ContentContext::GetCachedRuntimeEffectPipeline ( const std::string &  unique_entrypoint_name,
const ContentContextOptions options,
const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &  create_callback 
) const

RuntimeEffect pipelines must be obtained via this method to avoid re-creating them every frame.

The unique_entrypoint_name comes from RuntimeEffect::GetEntrypoint. Impellerc generates a unique entrypoint name for runtime effect shaders based on the input file name and shader stage.

The create_callback is synchronously invoked exactly once if a cached pipeline is not found.

Definition at line 625 of file content_context.cc.

629  {
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 }

Referenced by impeller::RuntimeEffectContents::Render().

◆ GetClearBlendPipeline()

PipelineRef impeller::ContentContext::GetClearBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 581 of file content_context.h.

581  {
582  return GetPipeline(clear_blend_pipelines_, opts);
583  }

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

PipelineRef impeller::ContentContext::GetClipPipeline ( ContentContextOptions  opts) const
inline

Definition at line 514 of file content_context.h.

514  {
515  return GetPipeline(clip_pipelines_, opts);
516  }

Referenced by impeller::ColorSourceContents::DrawGeometry(), impeller::ClipContents::Render(), and impeller::RenderClipRestore().

◆ GetColorMatrixColorFilterPipeline()

PipelineRef impeller::ContentContext::GetColorMatrixColorFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 501 of file content_context.h.

502  {
503  return GetPipeline(color_matrix_color_filter_pipelines_, opts);
504  }

◆ GetConicalGradientFillPipeline()

PipelineRef impeller::ContentContext::GetConicalGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 440 of file content_context.h.

440  {
441  return GetPipeline(conical_gradient_fill_pipelines_, opts);
442  }

◆ GetConicalGradientSSBOFillPipeline()

PipelineRef impeller::ContentContext::GetConicalGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 424 of file content_context.h.

425  {
426  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
427  return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
428  }
const Capabilities & GetDeviceCapabilities() const

References GetDeviceCapabilities().

◆ GetConicalGradientUniformFillPipeline()

PipelineRef impeller::ContentContext::GetConicalGradientUniformFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 402 of file content_context.h.

403  {
404  return GetPipeline(conical_gradient_uniform_fill_pipelines_, opts);
405  }

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

PipelineRef impeller::ContentContext::GetDestinationATopBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 622 of file content_context.h.

623  {
624  return GetPipeline(destination_a_top_blend_pipelines_, opts);
625  }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

PipelineRef impeller::ContentContext::GetDestinationBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 589 of file content_context.h.

589  {
590  return GetPipeline(destination_blend_pipelines_, opts);
591  }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

PipelineRef impeller::ContentContext::GetDestinationInBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 606 of file content_context.h.

606  {
607  return GetPipeline(destination_in_blend_pipelines_, opts);
608  }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

PipelineRef impeller::ContentContext::GetDestinationOutBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 614 of file content_context.h.

614  {
615  return GetPipeline(destination_out_blend_pipelines_, opts);
616  }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

PipelineRef impeller::ContentContext::GetDestinationOverBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 597 of file content_context.h.

598  {
599  return GetPipeline(destination_over_blend_pipelines_, opts);
600  }

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsamplePipeline()

PipelineRef impeller::ContentContext::GetDownsamplePipeline ( ContentContextOptions  opts) const
inline

Definition at line 705 of file content_context.h.

705  {
706  return GetPipeline(texture_downsample_pipelines_, opts);
707  }

◆ GetDrawVerticesUberShader()

PipelineRef impeller::ContentContext::GetDrawVerticesUberShader ( ContentContextOptions  opts) const
inline

Definition at line 799 of file content_context.h.

799  {
800  return GetPipeline(vertices_uber_shader_, opts);
801  }

Referenced by impeller::AtlasContents::Render(), and impeller::VerticesSimpleBlendContents::Render().

◆ GetEmptyTexture()

std::shared_ptr< Texture > impeller::ContentContext::GetEmptyTexture ( ) const

Definition at line 537 of file content_context.cc.

537  {
538  return empty_texture_;
539 }

Referenced by impeller::VerticesSimpleBlendContents::Render().

◆ GetFastGradientPipeline()

PipelineRef impeller::ContentContext::GetFastGradientPipeline ( ContentContextOptions  opts) const
inline

Definition at line 384 of file content_context.h.

384  {
385  return GetPipeline(fast_gradient_pipelines_, opts);
386  }

◆ GetFramebufferBlendColorBurnPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendColorBurnPipeline ( ContentContextOptions  opts) const
inline

Definition at line 716 of file content_context.h.

717  {
718  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
719  return GetPipeline(framebuffer_blend_colorburn_pipelines_, opts);
720  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendColorDodgePipeline ( ContentContextOptions  opts) const
inline

Definition at line 722 of file content_context.h.

723  {
724  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
725  return GetPipeline(framebuffer_blend_colordodge_pipelines_, opts);
726  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendColorPipeline ( ContentContextOptions  opts) const
inline

Definition at line 710 of file content_context.h.

711  {
712  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
713  return GetPipeline(framebuffer_blend_color_pipelines_, opts);
714  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendDarkenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 728 of file content_context.h.

729  {
730  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
731  return GetPipeline(framebuffer_blend_darken_pipelines_, opts);
732  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendDifferencePipeline ( ContentContextOptions  opts) const
inline

Definition at line 734 of file content_context.h.

735  {
736  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
737  return GetPipeline(framebuffer_blend_difference_pipelines_, opts);
738  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendExclusionPipeline ( ContentContextOptions  opts) const
inline

Definition at line 740 of file content_context.h.

741  {
742  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
743  return GetPipeline(framebuffer_blend_exclusion_pipelines_, opts);
744  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendHardLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 746 of file content_context.h.

747  {
748  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
749  return GetPipeline(framebuffer_blend_hardlight_pipelines_, opts);
750  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendHuePipeline ( ContentContextOptions  opts) const
inline

Definition at line 752 of file content_context.h.

752  {
753  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
754  return GetPipeline(framebuffer_blend_hue_pipelines_, opts);
755  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendLightenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 757 of file content_context.h.

758  {
759  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
760  return GetPipeline(framebuffer_blend_lighten_pipelines_, opts);
761  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendLuminosityPipeline ( ContentContextOptions  opts) const
inline

Definition at line 763 of file content_context.h.

764  {
765  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
766  return GetPipeline(framebuffer_blend_luminosity_pipelines_, opts);
767  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendMultiplyPipeline ( ContentContextOptions  opts) const
inline

Definition at line 769 of file content_context.h.

770  {
771  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
772  return GetPipeline(framebuffer_blend_multiply_pipelines_, opts);
773  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendOverlayPipeline ( ContentContextOptions  opts) const
inline

Definition at line 775 of file content_context.h.

776  {
777  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
778  return GetPipeline(framebuffer_blend_overlay_pipelines_, opts);
779  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendSaturationPipeline ( ContentContextOptions  opts) const
inline

Definition at line 781 of file content_context.h.

782  {
783  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
784  return GetPipeline(framebuffer_blend_saturation_pipelines_, opts);
785  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendScreenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 787 of file content_context.h.

788  {
789  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
790  return GetPipeline(framebuffer_blend_screen_pipelines_, opts);
791  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendSoftLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 793 of file content_context.h.

794  {
795  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
796  return GetPipeline(framebuffer_blend_softlight_pipelines_, opts);
797  }

References GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

PipelineRef impeller::ContentContext::GetGaussianBlurPipeline ( ContentContextOptions  opts) const
inline

Definition at line 489 of file content_context.h.

489  {
490  return GetPipeline(gaussian_blur_pipelines_, opts);
491  }

◆ GetGlyphAtlasPipeline()

PipelineRef impeller::ContentContext::GetGlyphAtlasPipeline ( ContentContextOptions  opts) const
inline

Definition at line 518 of file content_context.h.

518  {
519  return GetPipeline(glyph_atlas_pipelines_, opts);
520  }

Referenced by impeller::TextContents::Render().

◆ GetLazyGlyphAtlas()

const std::shared_ptr<LazyGlyphAtlas>& impeller::ContentContext::GetLazyGlyphAtlas ( ) const
inline

◆ GetLinearGradientFillPipeline()

PipelineRef impeller::ContentContext::GetLinearGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 388 of file content_context.h.

388  {
389  return GetPipeline(linear_gradient_fill_pipelines_, opts);
390  }

◆ GetLinearGradientSSBOFillPipeline()

PipelineRef impeller::ContentContext::GetLinearGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 412 of file content_context.h.

413  {
414  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
415  return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
416  }

References GetDeviceCapabilities().

◆ GetLinearGradientUniformFillPipeline()

PipelineRef impeller::ContentContext::GetLinearGradientUniformFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 392 of file content_context.h.

393  {
394  return GetPipeline(linear_gradient_uniform_fill_pipelines_, opts);
395  }

◆ GetLinearToSrgbFilterPipeline()

PipelineRef impeller::ContentContext::GetLinearToSrgbFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 506 of file content_context.h.

506  {
507  return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
508  }

◆ GetModulateBlendPipeline()

PipelineRef impeller::ContentContext::GetModulateBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 635 of file content_context.h.

635  {
636  return GetPipeline(modulate_blend_pipelines_, opts);
637  }

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

PipelineRef impeller::ContentContext::GetMorphologyFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 497 of file content_context.h.

497  {
498  return GetPipeline(morphology_filter_pipelines_, opts);
499  }

◆ GetPlusBlendPipeline()

PipelineRef impeller::ContentContext::GetPlusBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 631 of file content_context.h.

631  {
632  return GetPipeline(plus_blend_pipelines_, opts);
633  }

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

PipelineRef impeller::ContentContext::GetPorterDuffPipeline ( BlendMode  mode,
ContentContextOptions  opts 
) const
inline

Definition at line 527 of file content_context.h.

528  {
529  switch (mode) {
530  case BlendMode::kClear:
531  return GetClearBlendPipeline(opts);
532  case BlendMode::kSource:
533  return GetSourceBlendPipeline(opts);
535  return GetDestinationBlendPipeline(opts);
537  return GetSourceOverBlendPipeline(opts);
539  return GetDestinationOverBlendPipeline(opts);
541  return GetSourceInBlendPipeline(opts);
543  return GetDestinationInBlendPipeline(opts);
545  return GetSourceOutBlendPipeline(opts);
547  return GetDestinationOutBlendPipeline(opts);
549  return GetSourceATopBlendPipeline(opts);
551  return GetDestinationATopBlendPipeline(opts);
552  case BlendMode::kXor:
553  return GetXorBlendPipeline(opts);
554  case BlendMode::kPlus:
555  return GetPlusBlendPipeline(opts);
557  return GetModulateBlendPipeline(opts);
558  case BlendMode::kScreen:
559  return GetScreenBlendPipeline(opts);
560  case BlendMode::kOverlay:
561  case BlendMode::kDarken:
562  case BlendMode::kLighten:
570  case BlendMode::kHue:
572  case BlendMode::kColor:
574  VALIDATION_LOG << "Invalid porter duff blend mode "
575  << BlendModeToString(mode);
576  return GetClearBlendPipeline(opts);
577  break;
578  }
579  }
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47

References impeller::BlendModeToString(), GetClearBlendPipeline(), GetDestinationATopBlendPipeline(), GetDestinationBlendPipeline(), GetDestinationInBlendPipeline(), GetDestinationOutBlendPipeline(), GetDestinationOverBlendPipeline(), GetModulateBlendPipeline(), GetPlusBlendPipeline(), GetScreenBlendPipeline(), GetSourceATopBlendPipeline(), GetSourceBlendPipeline(), GetSourceInBlendPipeline(), GetSourceOutBlendPipeline(), GetSourceOverBlendPipeline(), GetXorBlendPipeline(), impeller::kClear, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kDarken, impeller::kDestination, impeller::kDestinationATop, impeller::kDestinationIn, impeller::kDestinationOut, impeller::kDestinationOver, impeller::kDifference, impeller::kExclusion, impeller::kHardLight, impeller::kHue, impeller::kLighten, impeller::kLuminosity, impeller::kModulate, impeller::kMultiply, impeller::kOverlay, impeller::kPlus, impeller::kSaturation, impeller::kScreen, impeller::kSoftLight, impeller::kSource, impeller::kSourceATop, impeller::kSourceIn, impeller::kSourceOut, impeller::kSourceOver, impeller::kXor, and VALIDATION_LOG.

Referenced by impeller::AtlasContents::Render(), and impeller::VerticesSimpleBlendContents::Render().

◆ GetRadialGradientFillPipeline()

PipelineRef impeller::ContentContext::GetRadialGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 436 of file content_context.h.

436  {
437  return GetPipeline(radial_gradient_fill_pipelines_, opts);
438  }

◆ GetRadialGradientSSBOFillPipeline()

PipelineRef impeller::ContentContext::GetRadialGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 418 of file content_context.h.

419  {
420  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
421  return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
422  }

References GetDeviceCapabilities().

◆ GetRadialGradientUniformFillPipeline()

PipelineRef impeller::ContentContext::GetRadialGradientUniformFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 397 of file content_context.h.

398  {
399  return GetPipeline(radial_gradient_uniform_fill_pipelines_, opts);
400  }

◆ GetRenderTargetCache()

const std::shared_ptr<RenderTargetAllocator>& impeller::ContentContext::GetRenderTargetCache ( ) const
inline

Definition at line 838 of file content_context.h.

838  {
839  return render_target_cache_;
840  }

Referenced by impeller::EntityPassTarget::Flip(), MakeSubpass(), impeller::EntityPlayground::OpenPlaygroundHere(), and impeller::testing::TEST_P().

◆ GetRRectBlurPipeline()

PipelineRef impeller::ContentContext::GetRRectBlurPipeline ( ContentContextOptions  opts) const
inline

Definition at line 444 of file content_context.h.

444  {
445  return GetPipeline(rrect_blur_pipelines_, opts);
446  }

Referenced by impeller::SolidRRectBlurContents::Render().

◆ GetScreenBlendPipeline()

PipelineRef impeller::ContentContext::GetScreenBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 639 of file content_context.h.

639  {
640  return GetPipeline(screen_blend_pipelines_, opts);
641  }

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

PipelineRef impeller::ContentContext::GetSolidFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 452 of file content_context.h.

452  {
453  return GetPipeline(solid_fill_pipelines_, opts);
454  }

Referenced by impeller::SolidColorContents::Render(), and impeller::testing::TEST_P().

◆ GetSourceATopBlendPipeline()

PipelineRef impeller::ContentContext::GetSourceATopBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 618 of file content_context.h.

618  {
619  return GetPipeline(source_a_top_blend_pipelines_, opts);
620  }

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

PipelineRef impeller::ContentContext::GetSourceBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 585 of file content_context.h.

585  {
586  return GetPipeline(source_blend_pipelines_, opts);
587  }

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

PipelineRef impeller::ContentContext::GetSourceInBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 602 of file content_context.h.

602  {
603  return GetPipeline(source_in_blend_pipelines_, opts);
604  }

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

PipelineRef impeller::ContentContext::GetSourceOutBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 610 of file content_context.h.

610  {
611  return GetPipeline(source_out_blend_pipelines_, opts);
612  }

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

PipelineRef impeller::ContentContext::GetSourceOverBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 593 of file content_context.h.

593  {
594  return GetPipeline(source_over_blend_pipelines_, opts);
595  }

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

PipelineRef impeller::ContentContext::GetSrgbToLinearFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 510 of file content_context.h.

510  {
511  return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
512  }

◆ GetSweepGradientFillPipeline()

PipelineRef impeller::ContentContext::GetSweepGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 448 of file content_context.h.

448  {
449  return GetPipeline(sweep_gradient_fill_pipelines_, opts);
450  }

◆ GetSweepGradientSSBOFillPipeline()

PipelineRef impeller::ContentContext::GetSweepGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 430 of file content_context.h.

431  {
432  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
433  return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
434  }

References GetDeviceCapabilities().

◆ GetSweepGradientUniformFillPipeline()

PipelineRef impeller::ContentContext::GetSweepGradientUniformFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 407 of file content_context.h.

408  {
409  return GetPipeline(sweep_gradient_uniform_fill_pipelines_, opts);
410  }

◆ GetTessellator()

Tessellator & impeller::ContentContext::GetTessellator ( ) const

Definition at line 609 of file content_context.cc.

609  {
610  return *tessellator_;
611 }

◆ GetTexturePipeline()

PipelineRef impeller::ContentContext::GetTexturePipeline ( ContentContextOptions  opts) const
inline

Definition at line 456 of file content_context.h.

456  {
457  return GetPipeline(texture_pipelines_, opts);
458  }

Referenced by impeller::PipelineBlend(), impeller::AtlasContents::Render(), and impeller::TextureContents::Render().

◆ GetTextureStrictSrcPipeline()

PipelineRef impeller::ContentContext::GetTextureStrictSrcPipeline ( ContentContextOptions  opts) const
inline

Definition at line 460 of file content_context.h.

460  {
461  return GetPipeline(texture_strict_src_pipelines_, opts);
462  }

Referenced by impeller::TextureContents::Render().

◆ GetTiledTexturePipeline()

PipelineRef impeller::ContentContext::GetTiledTexturePipeline ( ContentContextOptions  opts) const
inline

Definition at line 485 of file content_context.h.

485  {
486  return GetPipeline(tiled_texture_pipelines_, opts);
487  }

Referenced by impeller::TiledTextureContents::Render().

◆ GetTransientsBuffer()

◆ GetXorBlendPipeline()

PipelineRef impeller::ContentContext::GetXorBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 627 of file content_context.h.

627  {
628  return GetPipeline(xor_blend_pipelines_, opts);
629  }

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

PipelineRef impeller::ContentContext::GetYUVToRGBFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 522 of file content_context.h.

522  {
523  return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
524  }

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 533 of file content_context.cc.

533  {
534  return is_valid_;
535 }

Referenced by impeller::EntityPlayground::OpenPlaygroundHere().

◆ MakeSubpass() [1/2]

fml::StatusOr< RenderTarget > impeller::ContentContext::MakeSubpass ( std::string_view  label,
const RenderTarget subpass_target,
const std::shared_ptr< CommandBuffer > &  command_buffer,
const SubpassCallback subpass_callback 
) const

Makes a subpass that will render to subpass_target.

Definition at line 570 of file content_context.cc.

574  {
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 }
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.

References impeller::AddMipmapGeneration(), GetContext(), and impeller::RenderTarget::GetRenderTargetTexture().

◆ MakeSubpass() [2/2]

fml::StatusOr< RenderTarget > impeller::ContentContext::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 to the texture.

Definition at line 541 of file content_context.cc.

548  {
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 }
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 std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() 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

References GetContext(), GetRenderTargetCache(), impeller::RenderTarget::kDefaultColorAttachmentConfig, impeller::RenderTarget::kDefaultColorAttachmentConfigMSAA, and impeller::RenderTarget::kDefaultStencilAttachmentConfig.

Referenced by impeller::AdvancedBlend(), impeller::PipelineBlend(), and impeller::Contents::RenderToSnapshot().

◆ SetWireframe()

void impeller::ContentContext::SetWireframe ( bool  wireframe)

Definition at line 621 of file content_context.cc.

621  {
622  wireframe_ = wireframe;
623 }

Referenced by impeller::EntityPlayground::OpenPlaygroundHere().


The documentation for this class was generated from the following files: