Flutter Impeller
impeller::ContentContext Class Reference

#include <content_context.h>

Classes

struct  Pipelines
 

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 GetBlendColorBurnPipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendColorDodgePipeline (ContentContextOptions opts) const
 
PipelineRef GetBlendColorPipeline (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 GetBorderMaskBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetClearBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetClipPipeline (ContentContextOptions opts) const
 
PipelineRef GetColorMatrixColorFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetConicalGradientFillPipeline (ContentContextOptions opts, ConicalKind kind) const
 
PipelineRef GetConicalGradientSSBOFillPipeline (ContentContextOptions opts, ConicalKind kind) const
 
PipelineRef GetConicalGradientUniformFillPipeline (ContentContextOptions opts, ConicalKind kind) const
 
PipelineRef GetDestinationATopBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationInBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationOutBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDestinationOverBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetDownsamplePipeline (ContentContextOptions opts) const
 
PipelineRef GetDrawVerticesUberPipeline (BlendMode blend_mode, ContentContextOptions opts) const
 
PipelineRef GetFastGradientPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorBurnPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorDodgePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorPipeline (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 GetGaussianBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetGlyphAtlasPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinePipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearToSrgbFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetModulateBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetMorphologyFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetPlusBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetPorterDuffPipeline (BlendMode mode, ContentContextOptions opts) const
 
PipelineRef GetRadialGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRRectBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetScreenBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSolidFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceATopBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceInBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceOutBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceOverBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSrgbToLinearFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetTexturePipeline (ContentContextOptions opts) const
 
PipelineRef GetTextureStrictSrcPipeline (ContentContextOptions opts) const
 
PipelineRef GetTiledTexturePipeline (ContentContextOptions opts) const
 
PipelineRef GetXorBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetYUVToRGBFilterPipeline (ContentContextOptions opts) const
 
std::shared_ptr< TextureGetEmptyTexture () const
 
std::shared_ptr< ContextGetContext () const
 
const CapabilitiesGetDeviceCapabilities () const
 
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...
 
TextShadowCacheGetTextShadowCache () const
 

Detailed Description

Definition at line 138 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

Definition at line 243 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 522 of file content_context.cc.

526  : context_(std::move(context)),
527  lazy_glyph_atlas_(
528  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
529  pipelines_(new Pipelines()),
530  tessellator_(std::make_shared<Tessellator>()),
531  render_target_cache_(render_target_allocator == nullptr
532  ? std::make_shared<RenderTargetCache>(
533  context_->GetResourceAllocator())
534  : std::move(render_target_allocator)),
535  host_buffer_(HostBuffer::Create(context_->GetResourceAllocator(),
536  context_->GetIdleWaiter())),
537  text_shadow_cache_(std::make_unique<TextShadowCache>()) {
538  if (!context_ || !context_->IsValid()) {
539  return;
540  }
541 
542  {
543  TextureDescriptor desc;
544  desc.storage_mode = StorageMode::kDevicePrivate;
545  desc.format = PixelFormat::kR8G8B8A8UNormInt;
546  desc.size = ISize{1, 1};
547  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
548 
549  std::array<uint8_t, 4> data = Color::BlackTransparent().ToR8G8B8A8();
550  std::shared_ptr<CommandBuffer> cmd_buffer =
551  GetContext()->CreateCommandBuffer();
552  std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
553  HostBuffer& host_buffer = GetTransientsBuffer();
554  BufferView buffer_view = host_buffer.Emplace(data);
555  blit_pass->AddCopy(buffer_view, empty_texture_);
556 
557  if (!blit_pass->EncodeCommands() || !GetContext()
558  ->GetCommandQueue()
559  ->Submit({std::move(cmd_buffer)})
560  .ok()) {
561  VALIDATION_LOG << "Failed to create empty texture.";
562  }
563  }
564 
565  auto options = ContentContextOptions{
566  .sample_count = SampleCount::kCount4,
567  .color_attachment_pixel_format =
568  context_->GetCapabilities()->GetDefaultColorFormat()};
569  auto options_trianglestrip = ContentContextOptions{
570  .sample_count = SampleCount::kCount4,
571  .primitive_type = PrimitiveType::kTriangleStrip,
572  .color_attachment_pixel_format =
573  context_->GetCapabilities()->GetDefaultColorFormat()};
574  auto options_no_msaa_no_depth_stencil = ContentContextOptions{
575  .sample_count = SampleCount::kCount1,
576  .primitive_type = PrimitiveType::kTriangleStrip,
577  .color_attachment_pixel_format =
578  context_->GetCapabilities()->GetDefaultColorFormat(),
579  .has_depth_stencil_attachments = false};
580  const auto supports_decal = static_cast<Scalar>(
581  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
582 
583  // Futures for the following pipelines may block in case the first frame is
584  // rendered without the pipelines being ready. Put pipelines that are more
585  // likely to be used first.
586  {
587  pipelines_->glyph_atlas.CreateDefault(
588  *context_, options,
589  {static_cast<Scalar>(
590  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
592  pipelines_->solid_fill.CreateDefault(*context_, options);
593  pipelines_->texture.CreateDefault(*context_, options);
594  pipelines_->fast_gradient.CreateDefault(*context_, options);
595  pipelines_->line.CreateDefault(*context_, options);
596 
597  if (context_->GetCapabilities()->SupportsSSBO()) {
598  pipelines_->linear_gradient_ssbo_fill.CreateDefault(*context_, options);
599  pipelines_->radial_gradient_ssbo_fill.CreateDefault(*context_, options);
600  pipelines_->conical_gradient_ssbo_fill.CreateDefault(*context_, options,
601  {3.0});
602  pipelines_->conical_gradient_ssbo_fill_radial.CreateDefault(
603  *context_, options, {1.0});
604  pipelines_->conical_gradient_ssbo_fill_strip.CreateDefault(
605  *context_, options, {2.0});
606  pipelines_->conical_gradient_ssbo_fill_strip_and_radial.CreateDefault(
607  *context_, options, {0.0});
608  pipelines_->sweep_gradient_ssbo_fill.CreateDefault(*context_, options);
609  } else {
610  pipelines_->linear_gradient_uniform_fill.CreateDefault(*context_,
611  options);
612  pipelines_->radial_gradient_uniform_fill.CreateDefault(*context_,
613  options);
614  pipelines_->conical_gradient_uniform_fill.CreateDefault(*context_,
615  options);
616  pipelines_->conical_gradient_uniform_fill_radial.CreateDefault(*context_,
617  options);
618  pipelines_->conical_gradient_uniform_fill_strip.CreateDefault(*context_,
619  options);
620  pipelines_->conical_gradient_uniform_fill_strip_and_radial.CreateDefault(
621  *context_, options);
622  pipelines_->sweep_gradient_uniform_fill.CreateDefault(*context_, options);
623 
624  pipelines_->linear_gradient_fill.CreateDefault(*context_, options);
625  pipelines_->radial_gradient_fill.CreateDefault(*context_, options);
626  pipelines_->conical_gradient_fill.CreateDefault(*context_, options);
627  pipelines_->conical_gradient_fill_radial.CreateDefault(*context_,
628  options);
629  pipelines_->conical_gradient_fill_strip.CreateDefault(*context_, options);
630  pipelines_->conical_gradient_fill_strip_and_radial.CreateDefault(
631  *context_, options);
632  pipelines_->sweep_gradient_fill.CreateDefault(*context_, options);
633  }
634 
635  /// Setup default clip pipeline.
636  auto clip_pipeline_descriptor =
638  if (!clip_pipeline_descriptor.has_value()) {
639  return;
640  }
641  ContentContextOptions{
642  .sample_count = SampleCount::kCount4,
643  .color_attachment_pixel_format =
644  context_->GetCapabilities()->GetDefaultColorFormat()}
645  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
646  // Disable write to all color attachments.
647  auto clip_color_attachments =
648  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
649  for (auto& color_attachment : clip_color_attachments) {
650  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
651  }
652  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
653  std::move(clip_color_attachments));
654  if (GetContext()->GetFlags().lazy_shader_mode) {
655  pipelines_->clip.SetDefaultDescriptor(clip_pipeline_descriptor);
656  pipelines_->clip.SetDefault(options, nullptr);
657  } else {
658  pipelines_->clip.SetDefault(
659  options,
660  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
661  }
662  pipelines_->texture_downsample.CreateDefault(
663  *context_, options_no_msaa_no_depth_stencil);
664  pipelines_->rrect_blur.CreateDefault(*context_, options_trianglestrip);
665  pipelines_->texture_strict_src.CreateDefault(*context_, options);
666  pipelines_->tiled_texture.CreateDefault(*context_, options,
667  {supports_decal});
668  pipelines_->gaussian_blur.CreateDefault(
669  *context_, options_no_msaa_no_depth_stencil, {supports_decal});
670  pipelines_->border_mask_blur.CreateDefault(*context_,
671  options_trianglestrip);
672  pipelines_->color_matrix_color_filter.CreateDefault(*context_,
673  options_trianglestrip);
674  pipelines_->vertices_uber_1_.CreateDefault(*context_, options,
675  {supports_decal});
676  pipelines_->vertices_uber_2_.CreateDefault(*context_, options,
677  {supports_decal});
678 
679  const std::array<std::vector<Scalar>, 15> porter_duff_constants =
680  GetPorterDuffSpecConstants(supports_decal);
681  pipelines_->clear_blend.CreateDefault(*context_, options_trianglestrip,
682  porter_duff_constants[0]);
683  pipelines_->source_blend.CreateDefault(*context_, options_trianglestrip,
684  porter_duff_constants[1]);
685  pipelines_->destination_blend.CreateDefault(
686  *context_, options_trianglestrip, porter_duff_constants[2]);
687  pipelines_->source_over_blend.CreateDefault(
688  *context_, options_trianglestrip, porter_duff_constants[3]);
689  pipelines_->destination_over_blend.CreateDefault(
690  *context_, options_trianglestrip, porter_duff_constants[4]);
691  pipelines_->source_in_blend.CreateDefault(*context_, options_trianglestrip,
692  porter_duff_constants[5]);
693  pipelines_->destination_in_blend.CreateDefault(
694  *context_, options_trianglestrip, porter_duff_constants[6]);
695  pipelines_->source_out_blend.CreateDefault(*context_, options_trianglestrip,
696  porter_duff_constants[7]);
697  pipelines_->destination_out_blend.CreateDefault(
698  *context_, options_trianglestrip, porter_duff_constants[8]);
699  pipelines_->source_a_top_blend.CreateDefault(
700  *context_, options_trianglestrip, porter_duff_constants[9]);
701  pipelines_->destination_a_top_blend.CreateDefault(
702  *context_, options_trianglestrip, porter_duff_constants[10]);
703  pipelines_->xor_blend.CreateDefault(*context_, options_trianglestrip,
704  porter_duff_constants[11]);
705  pipelines_->plus_blend.CreateDefault(*context_, options_trianglestrip,
706  porter_duff_constants[12]);
707  pipelines_->modulate_blend.CreateDefault(*context_, options_trianglestrip,
708  porter_duff_constants[13]);
709  pipelines_->screen_blend.CreateDefault(*context_, options_trianglestrip,
710  porter_duff_constants[14]);
711  }
712 
713  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
714  pipelines_->framebuffer_blend_color.CreateDefault(
715  *context_, options_trianglestrip,
716  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
717  pipelines_->framebuffer_blend_colorburn.CreateDefault(
718  *context_, options_trianglestrip,
719  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
720  pipelines_->framebuffer_blend_colordodge.CreateDefault(
721  *context_, options_trianglestrip,
722  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
723  pipelines_->framebuffer_blend_darken.CreateDefault(
724  *context_, options_trianglestrip,
725  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
726  pipelines_->framebuffer_blend_difference.CreateDefault(
727  *context_, options_trianglestrip,
728  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
729  pipelines_->framebuffer_blend_exclusion.CreateDefault(
730  *context_, options_trianglestrip,
731  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
732  pipelines_->framebuffer_blend_hardlight.CreateDefault(
733  *context_, options_trianglestrip,
734  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
735  pipelines_->framebuffer_blend_hue.CreateDefault(
736  *context_, options_trianglestrip,
737  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
738  pipelines_->framebuffer_blend_lighten.CreateDefault(
739  *context_, options_trianglestrip,
740  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
741  pipelines_->framebuffer_blend_luminosity.CreateDefault(
742  *context_, options_trianglestrip,
743  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
744  pipelines_->framebuffer_blend_multiply.CreateDefault(
745  *context_, options_trianglestrip,
746  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
747  pipelines_->framebuffer_blend_overlay.CreateDefault(
748  *context_, options_trianglestrip,
749  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
750  pipelines_->framebuffer_blend_saturation.CreateDefault(
751  *context_, options_trianglestrip,
752  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
753  pipelines_->framebuffer_blend_screen.CreateDefault(
754  *context_, options_trianglestrip,
755  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
756  pipelines_->framebuffer_blend_softlight.CreateDefault(
757  *context_, options_trianglestrip,
758  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
759  } else {
760  pipelines_->blend_color.CreateDefault(
761  *context_, options_trianglestrip,
762  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
763  pipelines_->blend_colorburn.CreateDefault(
764  *context_, options_trianglestrip,
765  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
766  pipelines_->blend_colordodge.CreateDefault(
767  *context_, options_trianglestrip,
768  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
769  pipelines_->blend_darken.CreateDefault(
770  *context_, options_trianglestrip,
771  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
772  pipelines_->blend_difference.CreateDefault(
773  *context_, options_trianglestrip,
774  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
775  pipelines_->blend_exclusion.CreateDefault(
776  *context_, options_trianglestrip,
777  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
778  pipelines_->blend_hardlight.CreateDefault(
779  *context_, options_trianglestrip,
780  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
781  pipelines_->blend_hue.CreateDefault(
782  *context_, options_trianglestrip,
783  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
784  pipelines_->blend_lighten.CreateDefault(
785  *context_, options_trianglestrip,
786  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
787  pipelines_->blend_luminosity.CreateDefault(
788  *context_, options_trianglestrip,
789  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
790  pipelines_->blend_multiply.CreateDefault(
791  *context_, options_trianglestrip,
792  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
793  pipelines_->blend_overlay.CreateDefault(
794  *context_, options_trianglestrip,
795  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
796  pipelines_->blend_saturation.CreateDefault(
797  *context_, options_trianglestrip,
798  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
799  pipelines_->blend_screen.CreateDefault(
800  *context_, options_trianglestrip,
801  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
802  pipelines_->blend_softlight.CreateDefault(
803  *context_, options_trianglestrip,
804  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
805  }
806 
807  pipelines_->morphology_filter.CreateDefault(*context_, options_trianglestrip,
808  {supports_decal});
809  pipelines_->linear_to_srgb_filter.CreateDefault(*context_,
810  options_trianglestrip);
811  pipelines_->srgb_to_linear_filter.CreateDefault(*context_,
812  options_trianglestrip);
813  pipelines_->yuv_to_rgb_filter.CreateDefault(*context_, options_trianglestrip);
814 
815 #if defined(IMPELLER_ENABLE_OPENGLES)
816  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
817 #if !defined(FML_OS_MACOSX)
818  // GLES only shader that is unsupported on macOS.
819  pipelines_->tiled_texture_external.CreateDefault(*context_, options);
820  pipelines_->tiled_texture_uv_external.CreateDefault(*context_, options);
821 #endif // !defined(FML_OS_MACOSX)
822  pipelines_->texture_downsample_gles.CreateDefault(*context_,
823  options_trianglestrip);
824  }
825 #endif // IMPELLER_ENABLE_OPENGLES
826 
827  is_valid_ = true;
828  InitializeCommonlyUsedShadersIfNeeded();
829 }
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:162
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:246
static constexpr Color BlackTransparent()
Definition: color.h:270
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:67
#define VALIDATION_LOG
Definition: validation.h:91

◆ ~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 934 of file content_context.cc.

935  {
936  for (auto it = runtime_effect_pipelines_.begin();
937  it != runtime_effect_pipelines_.end();) {
938  if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
939  it = runtime_effect_pipelines_.erase(it);
940  } else {
941  it++;
942  }
943  }
944 }

◆ GetBlendColorBurnPipeline()

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

Definition at line 1264 of file content_context.cc.

1265  {
1266  return GetPipeline(this, pipelines_->blend_colorburn, opts);
1267 }

◆ GetBlendColorDodgePipeline()

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

Definition at line 1269 of file content_context.cc.

1270  {
1271  return GetPipeline(this, pipelines_->blend_colordodge, opts);
1272 }

◆ GetBlendColorPipeline()

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

Definition at line 1259 of file content_context.cc.

1260  {
1261  return GetPipeline(this, pipelines_->blend_color, opts);
1262 }

◆ GetBlendDarkenPipeline()

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

Definition at line 1274 of file content_context.cc.

1275  {
1276  return GetPipeline(this, pipelines_->blend_darken, opts);
1277 }

◆ GetBlendDifferencePipeline()

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

Definition at line 1279 of file content_context.cc.

1280  {
1281  return GetPipeline(this, pipelines_->blend_difference, opts);
1282 }

◆ GetBlendExclusionPipeline()

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

Definition at line 1284 of file content_context.cc.

1285  {
1286  return GetPipeline(this, pipelines_->blend_exclusion, opts);
1287 }

◆ GetBlendHardLightPipeline()

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

Definition at line 1289 of file content_context.cc.

1290  {
1291  return GetPipeline(this, pipelines_->blend_hardlight, opts);
1292 }

◆ GetBlendHuePipeline()

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

Definition at line 1294 of file content_context.cc.

1295  {
1296  return GetPipeline(this, pipelines_->blend_hue, opts);
1297 }

◆ GetBlendLightenPipeline()

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

Definition at line 1299 of file content_context.cc.

1300  {
1301  return GetPipeline(this, pipelines_->blend_lighten, opts);
1302 }

◆ GetBlendLuminosityPipeline()

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

Definition at line 1304 of file content_context.cc.

1305  {
1306  return GetPipeline(this, pipelines_->blend_luminosity, opts);
1307 }

◆ GetBlendMultiplyPipeline()

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

Definition at line 1309 of file content_context.cc.

1310  {
1311  return GetPipeline(this, pipelines_->blend_multiply, opts);
1312 }

◆ GetBlendOverlayPipeline()

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

Definition at line 1314 of file content_context.cc.

1315  {
1316  return GetPipeline(this, pipelines_->blend_overlay, opts);
1317 }

◆ GetBlendSaturationPipeline()

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

Definition at line 1319 of file content_context.cc.

1320  {
1321  return GetPipeline(this, pipelines_->blend_saturation, opts);
1322 }

◆ GetBlendScreenPipeline()

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

Definition at line 1324 of file content_context.cc.

1325  {
1326  return GetPipeline(this, pipelines_->blend_screen, opts);
1327 }

◆ GetBlendSoftLightPipeline()

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

Definition at line 1329 of file content_context.cc.

1330  {
1331  return GetPipeline(this, pipelines_->blend_softlight, opts);
1332 }

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1090 of file content_context.cc.

1091  {
1092  return GetPipeline(this, pipelines_->border_mask_blur, opts);
1093 }

◆ 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 921 of file content_context.cc.

925  {
926  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
927  auto it = runtime_effect_pipelines_.find(key);
928  if (it == runtime_effect_pipelines_.end()) {
929  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
930  }
931  return raw_ptr(it->second);
932 }

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

◆ GetClearBlendPipeline()

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

Definition at line 1184 of file content_context.cc.

1185  {
1186  return GetPipeline(this, pipelines_->clear_blend, opts);
1187 }

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1115 of file content_context.cc.

1115  {
1116  return GetPipeline(this, pipelines_->clip, opts);
1117 }

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1100 of file content_context.cc.

1101  {
1102  return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1103 }

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

◆ GetConicalGradientFillPipeline()

PipelineRef impeller::ContentContext::GetConicalGradientFillPipeline ( ContentContextOptions  opts,
ConicalKind  kind 
) const

Definition at line 1039 of file content_context.cc.

1041  {
1042  switch (kind) {
1043  case ConicalKind::kConical:
1044  return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1045  case ConicalKind::kRadial:
1046  return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1047  case ConicalKind::kStrip:
1048  return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1050  return GetPipeline(
1051  this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1052  }
1053 }

References impeller::kConical, impeller::kRadial, impeller::kStrip, and impeller::kStripAndRadial.

◆ GetConicalGradientSSBOFillPipeline()

PipelineRef impeller::ContentContext::GetConicalGradientSSBOFillPipeline ( ContentContextOptions  opts,
ConicalKind  kind 
) const

Definition at line 1009 of file content_context.cc.

1011  {
1012  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1013  switch (kind) {
1014  case ConicalKind::kConical:
1015  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1016  case ConicalKind::kRadial:
1017  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1018  opts);
1019  case ConicalKind::kStrip:
1020  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1021  opts);
1023  return GetPipeline(
1024  this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1025  }
1026 }
const Capabilities & GetDeviceCapabilities() const

References GetDeviceCapabilities(), impeller::kConical, impeller::kRadial, impeller::kStrip, and impeller::kStripAndRadial.

◆ GetConicalGradientUniformFillPipeline()

PipelineRef impeller::ContentContext::GetConicalGradientUniformFillPipeline ( ContentContextOptions  opts,
ConicalKind  kind 
) const

Definition at line 990 of file content_context.cc.

992  {
993  switch (kind) {
995  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
997  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
998  opts);
999  case ConicalKind::kStrip:
1000  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1001  opts);
1003  return GetPipeline(
1004  this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1005  opts);
1006  }
1007 }

References impeller::kConical, impeller::kRadial, impeller::kStrip, and impeller::kStripAndRadial.

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1234 of file content_context.cc.

1235  {
1236  return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1237 }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1194 of file content_context.cc.

1195  {
1196  return GetPipeline(this, pipelines_->destination_blend, opts);
1197 }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1214 of file content_context.cc.

1215  {
1216  return GetPipeline(this, pipelines_->destination_in_blend, opts);
1217 }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1224 of file content_context.cc.

1225  {
1226  return GetPipeline(this, pipelines_->destination_out_blend, opts);
1227 }

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1204 of file content_context.cc.

1205  {
1206  return GetPipeline(this, pipelines_->destination_over_blend, opts);
1207 }

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsamplePipeline()

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

Definition at line 1334 of file content_context.cc.

1335  {
1336  return GetPipeline(this, pipelines_->texture_downsample, opts);
1337 }

◆ GetDrawVerticesUberPipeline()

PipelineRef impeller::ContentContext::GetDrawVerticesUberPipeline ( BlendMode  blend_mode,
ContentContextOptions  opts 
) const

Definition at line 1429 of file content_context.cc.

1431  {
1432  if (blend_mode <= BlendMode::kHardLight) {
1433  return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1434  } else {
1435  return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1436  }
1437 }

References impeller::kHardLight.

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

◆ GetEmptyTexture()

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

Definition at line 837 of file content_context.cc.

837  {
838  return empty_texture_;
839 }

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

◆ GetFastGradientPipeline()

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

Definition at line 953 of file content_context.cc.

954  {
955  return GetPipeline(this, pipelines_->fast_gradient, opts);
956 }

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 1345 of file content_context.cc.

1346  {
1347  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1348  return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1349 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 1351 of file content_context.cc.

1352  {
1353  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1354  return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1355 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 1339 of file content_context.cc.

1340  {
1341  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1342  return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1343 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

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

Definition at line 1357 of file content_context.cc.

1358  {
1359  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1360  return GetPipeline(this, pipelines_->framebuffer_blend_darken, opts);
1361 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

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

Definition at line 1363 of file content_context.cc.

1364  {
1365  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1366  return GetPipeline(this, pipelines_->framebuffer_blend_difference, opts);
1367 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

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

Definition at line 1369 of file content_context.cc.

1370  {
1371  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1372  return GetPipeline(this, pipelines_->framebuffer_blend_exclusion, opts);
1373 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

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

Definition at line 1375 of file content_context.cc.

1376  {
1377  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1378  return GetPipeline(this, pipelines_->framebuffer_blend_hardlight, opts);
1379 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

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

Definition at line 1381 of file content_context.cc.

1382  {
1383  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1384  return GetPipeline(this, pipelines_->framebuffer_blend_hue, opts);
1385 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

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

Definition at line 1387 of file content_context.cc.

1388  {
1389  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1390  return GetPipeline(this, pipelines_->framebuffer_blend_lighten, opts);
1391 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

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

Definition at line 1393 of file content_context.cc.

1394  {
1395  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1396  return GetPipeline(this, pipelines_->framebuffer_blend_luminosity, opts);
1397 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 1399 of file content_context.cc.

1400  {
1401  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1402  return GetPipeline(this, pipelines_->framebuffer_blend_multiply, opts);
1403 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 1405 of file content_context.cc.

1406  {
1407  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1408  return GetPipeline(this, pipelines_->framebuffer_blend_overlay, opts);
1409 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 1411 of file content_context.cc.

1412  {
1413  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1414  return GetPipeline(this, pipelines_->framebuffer_blend_saturation, opts);
1415 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 1417 of file content_context.cc.

1418  {
1419  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1420  return GetPipeline(this, pipelines_->framebuffer_blend_screen, opts);
1421 }

References GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 1423 of file content_context.cc.

1424  {
1425  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1426  return GetPipeline(this, pipelines_->framebuffer_blend_softlight, opts);
1427 }

References GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

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

Definition at line 1085 of file content_context.cc.

1086  {
1087  return GetPipeline(this, pipelines_->gaussian_blur, opts);
1088 }

◆ GetGlyphAtlasPipeline()

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

Definition at line 1119 of file content_context.cc.

1120  {
1121  return GetPipeline(this, pipelines_->glyph_atlas, opts);
1122 }

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

◆ GetLazyGlyphAtlas()

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

Definition at line 264 of file content_context.h.

264  {
265  return lazy_glyph_atlas_;
266  }

Referenced by impeller::FirstPassDispatcher::drawTextFrame(), impeller::TextContents::Render(), impeller::RenderToTarget(), and impeller::testing::TEST_P().

◆ GetLinearGradientFillPipeline()

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

Definition at line 958 of file content_context.cc.

959  {
960  return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
961 }

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 978 of file content_context.cc.

979  {
980  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
981  return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
982 }

References GetDeviceCapabilities().

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 963 of file content_context.cc.

964  {
965  return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
966 }

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1105 of file content_context.cc.

1106  {
1107  return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1108 }

◆ GetLinePipeline()

PipelineRef impeller::ContentContext::GetLinePipeline ( ContentContextOptions  opts) const

Definition at line 1439 of file content_context.cc.

1439  {
1440  return GetPipeline(this, pipelines_->line, opts);
1441 }

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

◆ GetModulateBlendPipeline()

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

Definition at line 1249 of file content_context.cc.

1250  {
1251  return GetPipeline(this, pipelines_->modulate_blend, opts);
1252 }

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1095 of file content_context.cc.

1096  {
1097  return GetPipeline(this, pipelines_->morphology_filter, opts);
1098 }

◆ GetPlusBlendPipeline()

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

Definition at line 1244 of file content_context.cc.

1245  {
1246  return GetPipeline(this, pipelines_->plus_blend, opts);
1247 }

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1129 of file content_context.cc.

1131  {
1132  switch (mode) {
1133  case BlendMode::kClear:
1134  return GetClearBlendPipeline(opts);
1135  case BlendMode::kSrc:
1136  return GetSourceBlendPipeline(opts);
1137  case BlendMode::kDst:
1138  return GetDestinationBlendPipeline(opts);
1139  case BlendMode::kSrcOver:
1140  return GetSourceOverBlendPipeline(opts);
1141  case BlendMode::kDstOver:
1142  return GetDestinationOverBlendPipeline(opts);
1143  case BlendMode::kSrcIn:
1144  return GetSourceInBlendPipeline(opts);
1145  case BlendMode::kDstIn:
1146  return GetDestinationInBlendPipeline(opts);
1147  case BlendMode::kSrcOut:
1148  return GetSourceOutBlendPipeline(opts);
1149  case BlendMode::kDstOut:
1150  return GetDestinationOutBlendPipeline(opts);
1151  case BlendMode::kSrcATop:
1152  return GetSourceATopBlendPipeline(opts);
1153  case BlendMode::kDstATop:
1154  return GetDestinationATopBlendPipeline(opts);
1155  case BlendMode::kXor:
1156  return GetXorBlendPipeline(opts);
1157  case BlendMode::kPlus:
1158  return GetPlusBlendPipeline(opts);
1159  case BlendMode::kModulate:
1160  return GetModulateBlendPipeline(opts);
1161  case BlendMode::kScreen:
1162  return GetScreenBlendPipeline(opts);
1163  case BlendMode::kOverlay:
1164  case BlendMode::kDarken:
1165  case BlendMode::kLighten:
1167  case BlendMode::kColorBurn:
1168  case BlendMode::kHardLight:
1169  case BlendMode::kSoftLight:
1171  case BlendMode::kExclusion:
1172  case BlendMode::kMultiply:
1173  case BlendMode::kHue:
1175  case BlendMode::kColor:
1177  VALIDATION_LOG << "Invalid porter duff blend mode "
1178  << BlendModeToString(mode);
1179  return GetClearBlendPipeline(opts);
1180  break;
1181  }
1182 }
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::kDifference, impeller::kDst, impeller::kDstATop, impeller::kDstIn, impeller::kDstOut, impeller::kDstOver, 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::kSrc, impeller::kSrcATop, impeller::kSrcIn, impeller::kSrcOut, impeller::kSrcOver, impeller::kXor, and VALIDATION_LOG.

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

◆ GetRadialGradientFillPipeline()

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

Definition at line 1034 of file content_context.cc.

1035  {
1036  return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1037 }

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 984 of file content_context.cc.

985  {
986  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
987  return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
988 }

References GetDeviceCapabilities().

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 968 of file content_context.cc.

969  {
970  return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
971 }

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1055 of file content_context.cc.

1056  {
1057  return GetPipeline(this, pipelines_->rrect_blur, opts);
1058 }

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

◆ GetScreenBlendPipeline()

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

Definition at line 1254 of file content_context.cc.

1255  {
1256  return GetPipeline(this, pipelines_->screen_blend, opts);
1257 }

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1065 of file content_context.cc.

1066  {
1067  return GetPipeline(this, pipelines_->solid_fill, opts);
1068 }

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1229 of file content_context.cc.

1230  {
1231  return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1232 }

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1189 of file content_context.cc.

1190  {
1191  return GetPipeline(this, pipelines_->source_blend, opts);
1192 }

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1209 of file content_context.cc.

1210  {
1211  return GetPipeline(this, pipelines_->source_in_blend, opts);
1212 }

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1219 of file content_context.cc.

1220  {
1221  return GetPipeline(this, pipelines_->source_out_blend, opts);
1222 }

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1199 of file content_context.cc.

1200  {
1201  return GetPipeline(this, pipelines_->source_over_blend, opts);
1202 }

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1110 of file content_context.cc.

1111  {
1112  return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1113 }

◆ GetSweepGradientFillPipeline()

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

Definition at line 1060 of file content_context.cc.

1061  {
1062  return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1063 }

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1028 of file content_context.cc.

1029  {
1030  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1031  return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1032 }

References GetDeviceCapabilities().

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 973 of file content_context.cc.

974  {
975  return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
976 }

◆ GetTessellator()

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

Definition at line 909 of file content_context.cc.

909  {
910  return *tessellator_;
911 }

◆ GetTextShadowCache()

TextShadowCache& impeller::ContentContext::GetTextShadowCache ( ) const
inline

Definition at line 298 of file content_context.h.

298 { return *text_shadow_cache_; }

Referenced by impeller::DisplayListToTexture(), impeller::RenderToTarget(), and impeller::testing::TEST_P().

◆ GetTexturePipeline()

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

Definition at line 1070 of file content_context.cc.

1071  {
1072  return GetPipeline(this, pipelines_->texture, opts);
1073 }

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1075 of file content_context.cc.

1076  {
1077  return GetPipeline(this, pipelines_->texture_strict_src, opts);
1078 }

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

◆ GetTiledTexturePipeline()

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

Definition at line 1080 of file content_context.cc.

1081  {
1082  return GetPipeline(this, pipelines_->tiled_texture, opts);
1083 }

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

◆ GetTransientsBuffer()

◆ GetXorBlendPipeline()

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

Definition at line 1239 of file content_context.cc.

1240  {
1241  return GetPipeline(this, pipelines_->xor_blend, opts);
1242 }

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1124 of file content_context.cc.

1125  {
1126  return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1127 }

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 833 of file content_context.cc.

833  {
834  return is_valid_;
835 }

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 870 of file content_context.cc.

874  {
875  const std::shared_ptr<Context>& context = GetContext();
876 
877  auto subpass_texture = subpass_target.GetRenderTargetTexture();
878  if (!subpass_texture) {
879  return fml::Status(fml::StatusCode::kUnknown, "");
880  }
881 
882  auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
883  if (!sub_renderpass) {
884  return fml::Status(fml::StatusCode::kUnknown, "");
885  }
886  sub_renderpass->SetLabel(label);
887 
888  if (!subpass_callback(*this, *sub_renderpass)) {
889  return fml::Status(fml::StatusCode::kUnknown, "");
890  }
891 
892  if (!sub_renderpass->EncodeCommands()) {
893  return fml::Status(fml::StatusCode::kUnknown, "");
894  }
895 
896  const std::shared_ptr<Texture>& target_texture =
897  subpass_target.GetRenderTargetTexture();
898  if (target_texture->GetMipCount() > 1) {
899  fml::Status mipmap_status =
900  AddMipmapGeneration(command_buffer, context, target_texture);
901  if (!mipmap_status.ok()) {
902  return mipmap_status;
903  }
904  }
905 
906  return subpass_target;
907 }
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

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 841 of file content_context.cc.

848  {
849  const std::shared_ptr<Context>& context = GetContext();
850  RenderTarget subpass_target;
851 
852  std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
853  depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
854  : std::optional<RenderTarget::AttachmentConfig>();
855 
856  if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
857  subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
858  *context, texture_size,
859  /*mip_count=*/mip_count, label,
861  } else {
862  subpass_target = GetRenderTargetCache()->CreateOffscreen(
863  *context, texture_size,
864  /*mip_count=*/mip_count, label,
865  RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
866  }
867  return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
868 }
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().


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