Flutter Impeller
impeller::ContentContext Class Reference

#include <content_context.h>

Inheritance diagram for impeller::ContentContext:
impeller::testing::FlushTestContentContext

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
 
Tessellator & GetTessellator () 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 GetCirclePipeline (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 GetDrawShadowVerticesPipeline (ContentContextOptions opts) const
 
PipelineRef GetDownsampleBoundedPipeline (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 GetRSuperellipseBlurPipeline (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
 
PipelineRef GetUberSDFPipeline (ContentContextOptions opts) const
 
PipelineRef GetComplexRSEPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Texture > GetEmptyTexture () const
 
std::shared_ptr< Context > GetContext () const
 
const Capabilities & GetDeviceCapabilities () const
 
fml::StatusOr< RenderTarget > MakeSubpass (std::string_view label, ISize texture_size, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback, bool msaa_enabled=true, bool depth_stencil_enabled=false, int32_t mip_count=1) const
 Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing to the texture. More...
 
fml::StatusOr< RenderTarget > 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. 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
 
void SetTextureCachingEnabled (bool enabled)
 Enable or disable texture caching. More...
 
std::shared_ptr< Texture > GetCachedTexture (const flutter::DlImage *image) const
 Get a cached texture for the given image. More...
 
void SetCachedTexture (const flutter::DlImage *image, const std::shared_ptr< Texture > &texture) const
 Set a cached texture for the given image. More...
 
void RemoveCachedTexture (const flutter::DlImage *image) const
 Remove a cached texture for the given image. More...
 
void ClearCachedTextures () const
 Clear all cached textures. More...
 
HostBuffer & GetTransientsIndexesBuffer () const
 Retrieve the current host buffer for transient storage of indexes used for indexed draws. More...
 
HostBuffer & GetTransientsDataBuffer () const
 Retrieve the current host buffer for transient storage of other non-index data. More...
 
void ResetTransientsBuffers ()
 Resets the transients buffers held onto by the content context. More...
 
TextShadowCache & GetTextShadowCache () const
 

Protected Member Functions

void SetTransientsIndexesBuffer (std::shared_ptr< HostBuffer > host_buffer)
 
void SetTransientsDataBuffer (std::shared_ptr< HostBuffer > host_buffer)
 

Detailed Description

Definition at line 123 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

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

556  : context_(std::move(context)),
557  lazy_glyph_atlas_(
558  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
559  pipelines_(new Pipelines()),
560  tessellator_(std::make_shared<Tessellator>(
561  context_->GetCapabilities()->Supports32BitPrimitiveIndices())),
562  render_target_cache_(render_target_allocator == nullptr
563  ? std::make_shared<RenderTargetCache>(
564  context_->GetResourceAllocator())
565  : std::move(render_target_allocator)),
566  data_host_buffer_(HostBuffer::Create(
567  context_->GetResourceAllocator(),
568  context_->GetIdleWaiter(),
569  context_->GetCapabilities()->GetMinimumUniformAlignment())),
570  text_shadow_cache_(std::make_unique<TextShadowCache>()) {
571  if (!context_ || !context_->IsValid()) {
572  return;
573  }
574 
575  // On most backends, indexes and other data can be allocated into the same
576  // buffers. However, some backends (namely WebGL) require indexes used in
577  // indexed draws to be allocated separately from other data. For those
578  // backends, we allocate a separate host buffer just for indexes.
579  indexes_host_buffer_ =
580  context_->GetCapabilities()->NeedsPartitionedHostBuffer()
582  context_->GetResourceAllocator(), context_->GetIdleWaiter(),
583  context_->GetCapabilities()->GetMinimumUniformAlignment())
584  : data_host_buffer_;
585  {
586  TextureDescriptor desc;
587  desc.storage_mode = StorageMode::kDevicePrivate;
588  desc.format = PixelFormat::kR8G8B8A8UNormInt;
589  desc.size = ISize{1, 1};
590  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
591 
592  std::array<uint8_t, 4> data = Color::BlackTransparent().ToR8G8B8A8();
593  std::shared_ptr<CommandBuffer> cmd_buffer =
594  GetContext()->CreateCommandBuffer();
595  std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
596  HostBuffer& data_host_buffer = GetTransientsDataBuffer();
597  BufferView buffer_view = data_host_buffer.Emplace(data);
598  blit_pass->AddCopy(buffer_view, empty_texture_);
599 
600  if (!blit_pass->EncodeCommands() || !GetContext()
601  ->GetCommandQueue()
602  ->Submit({std::move(cmd_buffer)})
603  .ok()) {
604  VALIDATION_LOG << "Failed to create empty texture.";
605  }
606  }
607 
608  auto options = ContentContextOptions{
609  .sample_count = SampleCount::kCount4,
610  .color_attachment_pixel_format =
611  context_->GetCapabilities()->GetDefaultColorFormat()};
612  auto options_trianglestrip = ContentContextOptions{
613  .sample_count = SampleCount::kCount4,
614  .primitive_type = PrimitiveType::kTriangleStrip,
615  .color_attachment_pixel_format =
616  context_->GetCapabilities()->GetDefaultColorFormat()};
617  auto options_no_msaa_no_depth_stencil = ContentContextOptions{
618  .sample_count = SampleCount::kCount1,
619  .primitive_type = PrimitiveType::kTriangleStrip,
620  .color_attachment_pixel_format =
621  context_->GetCapabilities()->GetDefaultColorFormat(),
622  .has_depth_stencil_attachments = false};
623  const auto supports_decal = static_cast<Scalar>(
624  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
625 
626  // Futures for the following pipelines may block in case the first frame is
627  // rendered without the pipelines being ready. Put pipelines that are more
628  // likely to be used first.
629  {
630  pipelines_->glyph_atlas.CreateDefault(
631  *context_, options,
632  {static_cast<Scalar>(
633  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
635  pipelines_->solid_fill.CreateDefault(*context_, options);
636  pipelines_->texture.CreateDefault(*context_, options);
637  pipelines_->fast_gradient.CreateDefault(*context_, options);
638  pipelines_->line.CreateDefault(*context_, options);
639  pipelines_->circle.CreateDefault(*context_, options);
640  if (context_->GetFlags().use_sdfs ||
641  context_->GetFlags().antialiased_lines) {
642  pipelines_->uber_sdf.CreateDefault(*context_, options);
643  pipelines_->complex_rse.CreateDefault(*context_, options);
644  }
645 
646  if (context_->GetCapabilities()->SupportsSSBO()) {
647  pipelines_->linear_gradient_ssbo_fill.CreateDefault(*context_, options);
648  pipelines_->radial_gradient_ssbo_fill.CreateDefault(*context_, options);
649  pipelines_->conical_gradient_ssbo_fill.CreateDefault(*context_, options,
650  {3.0});
651  pipelines_->conical_gradient_ssbo_fill_radial.CreateDefault(
652  *context_, options, {1.0});
653  pipelines_->conical_gradient_ssbo_fill_strip.CreateDefault(
654  *context_, options, {2.0});
655  pipelines_->conical_gradient_ssbo_fill_strip_and_radial.CreateDefault(
656  *context_, options, {0.0});
657  pipelines_->sweep_gradient_ssbo_fill.CreateDefault(*context_, options);
658  } else {
659  pipelines_->linear_gradient_uniform_fill.CreateDefault(*context_,
660  options);
661  pipelines_->radial_gradient_uniform_fill.CreateDefault(*context_,
662  options);
663  pipelines_->conical_gradient_uniform_fill.CreateDefault(*context_,
664  options);
665  pipelines_->conical_gradient_uniform_fill_radial.CreateDefault(*context_,
666  options);
667  pipelines_->conical_gradient_uniform_fill_strip.CreateDefault(*context_,
668  options);
669  pipelines_->conical_gradient_uniform_fill_strip_and_radial.CreateDefault(
670  *context_, options);
671  pipelines_->sweep_gradient_uniform_fill.CreateDefault(*context_, options);
672 
673  pipelines_->linear_gradient_fill.CreateDefault(*context_, options);
674  pipelines_->radial_gradient_fill.CreateDefault(*context_, options);
675  pipelines_->conical_gradient_fill.CreateDefault(*context_, options);
676  pipelines_->conical_gradient_fill_radial.CreateDefault(*context_,
677  options);
678  pipelines_->conical_gradient_fill_strip.CreateDefault(*context_, options);
679  pipelines_->conical_gradient_fill_strip_and_radial.CreateDefault(
680  *context_, options);
681  pipelines_->sweep_gradient_fill.CreateDefault(*context_, options);
682  }
683 
684  /// Setup default clip pipeline.
685  auto clip_pipeline_descriptor =
687  if (!clip_pipeline_descriptor.has_value()) {
688  return;
689  }
690  ContentContextOptions{
691  .sample_count = SampleCount::kCount4,
692  .color_attachment_pixel_format =
693  context_->GetCapabilities()->GetDefaultColorFormat()}
694  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
695  // Disable write to all color attachments.
696  auto clip_color_attachments =
697  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
698  for (auto& color_attachment : clip_color_attachments) {
699  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
700  }
701  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
702  std::move(clip_color_attachments));
703  pipelines_->clip.SetDefault(
704  options,
705  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
706  pipelines_->texture_downsample.CreateDefault(
707  *context_, options_no_msaa_no_depth_stencil);
708  pipelines_->texture_downsample_bounded.CreateDefault(
709  *context_, options_no_msaa_no_depth_stencil);
710  pipelines_->rrect_blur.CreateDefault(*context_, options_trianglestrip);
711  pipelines_->rsuperellipse_blur.CreateDefault(*context_,
712  options_trianglestrip);
713  pipelines_->texture_strict_src.CreateDefault(*context_, options);
714  pipelines_->tiled_texture.CreateDefault(*context_, options,
715  {supports_decal});
716  pipelines_->gaussian_blur.CreateDefault(
717  *context_, options_no_msaa_no_depth_stencil, {supports_decal});
718  pipelines_->border_mask_blur.CreateDefault(*context_,
719  options_trianglestrip);
720  pipelines_->color_matrix_color_filter.CreateDefault(*context_,
721  options_trianglestrip);
722  pipelines_->shadow_vertices_.CreateDefault(*context_, options);
723  pipelines_->vertices_uber_1_.CreateDefault(*context_, options,
724  {supports_decal});
725  pipelines_->vertices_uber_2_.CreateDefault(*context_, options,
726  {supports_decal});
727 
728  const std::array<std::vector<Scalar>, 15> porter_duff_constants =
729  GetPorterDuffSpecConstants(supports_decal);
730  pipelines_->clear_blend.CreateDefault(*context_, options_trianglestrip,
731  porter_duff_constants[0]);
732  pipelines_->source_blend.CreateDefault(*context_, options_trianglestrip,
733  porter_duff_constants[1]);
734  pipelines_->destination_blend.CreateDefault(
735  *context_, options_trianglestrip, porter_duff_constants[2]);
736  pipelines_->source_over_blend.CreateDefault(
737  *context_, options_trianglestrip, porter_duff_constants[3]);
738  pipelines_->destination_over_blend.CreateDefault(
739  *context_, options_trianglestrip, porter_duff_constants[4]);
740  pipelines_->source_in_blend.CreateDefault(*context_, options_trianglestrip,
741  porter_duff_constants[5]);
742  pipelines_->destination_in_blend.CreateDefault(
743  *context_, options_trianglestrip, porter_duff_constants[6]);
744  pipelines_->source_out_blend.CreateDefault(*context_, options_trianglestrip,
745  porter_duff_constants[7]);
746  pipelines_->destination_out_blend.CreateDefault(
747  *context_, options_trianglestrip, porter_duff_constants[8]);
748  pipelines_->source_a_top_blend.CreateDefault(
749  *context_, options_trianglestrip, porter_duff_constants[9]);
750  pipelines_->destination_a_top_blend.CreateDefault(
751  *context_, options_trianglestrip, porter_duff_constants[10]);
752  pipelines_->xor_blend.CreateDefault(*context_, options_trianglestrip,
753  porter_duff_constants[11]);
754  pipelines_->plus_blend.CreateDefault(*context_, options_trianglestrip,
755  porter_duff_constants[12]);
756  pipelines_->modulate_blend.CreateDefault(*context_, options_trianglestrip,
757  porter_duff_constants[13]);
758  pipelines_->screen_blend.CreateDefault(*context_, options_trianglestrip,
759  porter_duff_constants[14]);
760  }
761 
762  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
763  pipelines_->framebuffer_blend_color.CreateDefault(
764  *context_, options_trianglestrip,
765  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
766  pipelines_->framebuffer_blend_colorburn.CreateDefault(
767  *context_, options_trianglestrip,
768  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
769  pipelines_->framebuffer_blend_colordodge.CreateDefault(
770  *context_, options_trianglestrip,
771  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
772  pipelines_->framebuffer_blend_darken.CreateDefault(
773  *context_, options_trianglestrip,
774  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
775  pipelines_->framebuffer_blend_difference.CreateDefault(
776  *context_, options_trianglestrip,
777  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
778  pipelines_->framebuffer_blend_exclusion.CreateDefault(
779  *context_, options_trianglestrip,
780  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
781  pipelines_->framebuffer_blend_hardlight.CreateDefault(
782  *context_, options_trianglestrip,
783  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
784  pipelines_->framebuffer_blend_hue.CreateDefault(
785  *context_, options_trianglestrip,
786  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
787  pipelines_->framebuffer_blend_lighten.CreateDefault(
788  *context_, options_trianglestrip,
789  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
790  pipelines_->framebuffer_blend_luminosity.CreateDefault(
791  *context_, options_trianglestrip,
792  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
793  pipelines_->framebuffer_blend_multiply.CreateDefault(
794  *context_, options_trianglestrip,
795  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
796  pipelines_->framebuffer_blend_overlay.CreateDefault(
797  *context_, options_trianglestrip,
798  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
799  pipelines_->framebuffer_blend_saturation.CreateDefault(
800  *context_, options_trianglestrip,
801  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
802  pipelines_->framebuffer_blend_screen.CreateDefault(
803  *context_, options_trianglestrip,
804  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
805  pipelines_->framebuffer_blend_softlight.CreateDefault(
806  *context_, options_trianglestrip,
807  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
808  } else {
809  pipelines_->blend_color.CreateDefault(
810  *context_, options_trianglestrip,
811  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
812  pipelines_->blend_colorburn.CreateDefault(
813  *context_, options_trianglestrip,
814  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
815  pipelines_->blend_colordodge.CreateDefault(
816  *context_, options_trianglestrip,
817  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
818  pipelines_->blend_darken.CreateDefault(
819  *context_, options_trianglestrip,
820  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
821  pipelines_->blend_difference.CreateDefault(
822  *context_, options_trianglestrip,
823  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
824  pipelines_->blend_exclusion.CreateDefault(
825  *context_, options_trianglestrip,
826  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
827  pipelines_->blend_hardlight.CreateDefault(
828  *context_, options_trianglestrip,
829  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
830  pipelines_->blend_hue.CreateDefault(
831  *context_, options_trianglestrip,
832  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
833  pipelines_->blend_lighten.CreateDefault(
834  *context_, options_trianglestrip,
835  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
836  pipelines_->blend_luminosity.CreateDefault(
837  *context_, options_trianglestrip,
838  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
839  pipelines_->blend_multiply.CreateDefault(
840  *context_, options_trianglestrip,
841  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
842  pipelines_->blend_overlay.CreateDefault(
843  *context_, options_trianglestrip,
844  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
845  pipelines_->blend_saturation.CreateDefault(
846  *context_, options_trianglestrip,
847  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
848  pipelines_->blend_screen.CreateDefault(
849  *context_, options_trianglestrip,
850  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
851  pipelines_->blend_softlight.CreateDefault(
852  *context_, options_trianglestrip,
853  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
854  }
855 
856  pipelines_->morphology_filter.CreateDefault(*context_, options_trianglestrip,
857  {supports_decal});
858  pipelines_->linear_to_srgb_filter.CreateDefault(*context_,
859  options_trianglestrip);
860  pipelines_->srgb_to_linear_filter.CreateDefault(*context_,
861  options_trianglestrip);
862  pipelines_->yuv_to_rgb_filter.CreateDefault(*context_, options_trianglestrip);
863 
864  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
865 #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX) && \
866  !defined(FML_OS_EMSCRIPTEN)
867  // GLES only shader that is unsupported on macOS and web.
868  pipelines_->tiled_texture_external.CreateDefault(*context_, options);
869  pipelines_->tiled_texture_uv_external.CreateDefault(*context_, options);
870 #endif // !defined(FML_OS_MACOSX)
871 
872 #if defined(IMPELLER_ENABLE_OPENGLES)
873  pipelines_->texture_downsample_gles.CreateDefault(*context_,
874  options_trianglestrip);
875 #endif // IMPELLER_ENABLE_OPENGLES
876  }
877 
878  is_valid_ = true;
879  InitializeCommonlyUsedShadersIfNeeded();
880 }
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
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, size_t minimum_uniform_alignment)
Definition: host_buffer.cc:21
float Scalar
Definition: scalar.h:19
std::array< std::vector< Scalar >, 15 > GetPorterDuffSpecConstants(bool supports_decal)
ISize64 ISize
Definition: size.h:162
std::shared_ptr< ContextGLES > context
std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:246
static constexpr Color BlackTransparent()
Definition: color.h:275
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::Color::BlackTransparent(), impeller::HostBuffer::Create(), impeller::HostBuffer::Emplace(), impeller::TextureDescriptor::format, GetContext(), impeller::GetPorterDuffSpecConstants(), GetTransientsDataBuffer(), impeller::kA8UNormInt, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kCount1, 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(), pipelines_, 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 993 of file content_context.cc.

994  {
995 #ifdef IMPELLER_DEBUG
996  // destroying in-use pipleines is a validation error.
997  const auto& idle_waiter = GetContext()->GetIdleWaiter();
998  if (idle_waiter) {
999  idle_waiter->WaitIdle();
1000  }
1001 #endif // IMPELLER_DEBUG
1002  for (auto it = runtime_effect_pipelines_.begin();
1003  it != runtime_effect_pipelines_.end();) {
1004  if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
1005  it = runtime_effect_pipelines_.erase(it);
1006  } else {
1007  it++;
1008  }
1009  }
1010 }

References GetContext().

◆ ClearCachedTextures()

void impeller::ContentContext::ClearCachedTextures ( ) const

Clear all cached textures.

Definition at line 1606 of file content_context.cc.

1606  {
1607  texture_cache_.clear();
1608 }

◆ GetBlendColorBurnPipeline()

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

Definition at line 1353 of file content_context.cc.

1354  {
1355  return GetPipeline(this, pipelines_->blend_colorburn, opts);
1356 }

References pipelines_.

◆ GetBlendColorDodgePipeline()

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

Definition at line 1358 of file content_context.cc.

1359  {
1360  return GetPipeline(this, pipelines_->blend_colordodge, opts);
1361 }

References pipelines_.

◆ GetBlendColorPipeline()

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

Definition at line 1348 of file content_context.cc.

1349  {
1350  return GetPipeline(this, pipelines_->blend_color, opts);
1351 }

References pipelines_.

◆ GetBlendDarkenPipeline()

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

Definition at line 1363 of file content_context.cc.

1364  {
1365  return GetPipeline(this, pipelines_->blend_darken, opts);
1366 }

References pipelines_.

◆ GetBlendDifferencePipeline()

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

Definition at line 1368 of file content_context.cc.

1369  {
1370  return GetPipeline(this, pipelines_->blend_difference, opts);
1371 }

References pipelines_.

◆ GetBlendExclusionPipeline()

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

Definition at line 1373 of file content_context.cc.

1374  {
1375  return GetPipeline(this, pipelines_->blend_exclusion, opts);
1376 }

References pipelines_.

◆ GetBlendHardLightPipeline()

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

Definition at line 1378 of file content_context.cc.

1379  {
1380  return GetPipeline(this, pipelines_->blend_hardlight, opts);
1381 }

References pipelines_.

◆ GetBlendHuePipeline()

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

Definition at line 1383 of file content_context.cc.

1384  {
1385  return GetPipeline(this, pipelines_->blend_hue, opts);
1386 }

References pipelines_.

◆ GetBlendLightenPipeline()

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

Definition at line 1388 of file content_context.cc.

1389  {
1390  return GetPipeline(this, pipelines_->blend_lighten, opts);
1391 }

References pipelines_.

◆ GetBlendLuminosityPipeline()

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

Definition at line 1393 of file content_context.cc.

1394  {
1395  return GetPipeline(this, pipelines_->blend_luminosity, opts);
1396 }

References pipelines_.

◆ GetBlendMultiplyPipeline()

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

Definition at line 1398 of file content_context.cc.

1399  {
1400  return GetPipeline(this, pipelines_->blend_multiply, opts);
1401 }

References pipelines_.

◆ GetBlendOverlayPipeline()

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

Definition at line 1403 of file content_context.cc.

1404  {
1405  return GetPipeline(this, pipelines_->blend_overlay, opts);
1406 }

References pipelines_.

◆ GetBlendSaturationPipeline()

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

Definition at line 1408 of file content_context.cc.

1409  {
1410  return GetPipeline(this, pipelines_->blend_saturation, opts);
1411 }

References pipelines_.

◆ GetBlendScreenPipeline()

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

Definition at line 1413 of file content_context.cc.

1414  {
1415  return GetPipeline(this, pipelines_->blend_screen, opts);
1416 }

References pipelines_.

◆ GetBlendSoftLightPipeline()

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

Definition at line 1418 of file content_context.cc.

1419  {
1420  return GetPipeline(this, pipelines_->blend_softlight, opts);
1421 }

References pipelines_.

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1169 of file content_context.cc.

1170  {
1171  return GetPipeline(this, pipelines_->border_mask_blur, opts);
1172 }

References pipelines_.

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

984  {
985  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
986  auto it = runtime_effect_pipelines_.find(key);
987  if (it == runtime_effect_pipelines_.end()) {
988  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
989  }
990  return raw_ptr(it->second);
991 }

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

◆ GetCachedTexture()

std::shared_ptr< Texture > impeller::ContentContext::GetCachedTexture ( const flutter::DlImage *  image) const

Get a cached texture for the given image.

Definition at line 1577 of file content_context.cc.

1578  {
1579  if (!image) {
1580  return nullptr;
1581  }
1582  if (is_texture_caching_enabled_) {
1583  auto it = texture_cache_.find(image);
1584  if (it != texture_cache_.end()) {
1585  return it->second;
1586  }
1587  }
1588  return nullptr;
1589 }

Referenced by impeller::DlImageImpeller::GetCachedTexture().

◆ GetCirclePipeline()

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

Definition at line 1538 of file content_context.cc.

1539  {
1540  return GetPipeline(this, pipelines_->circle, opts);
1541 }

References pipelines_.

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

◆ GetClearBlendPipeline()

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

Definition at line 1273 of file content_context.cc.

1274  {
1275  return GetPipeline(this, pipelines_->clear_blend, opts);
1276 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1194 of file content_context.cc.

1194  {
1195  return GetPipeline(this, pipelines_->clip, opts);
1196 }

References pipelines_.

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1179 of file content_context.cc.

1180  {
1181  return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1182 }

References pipelines_.

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

◆ GetComplexRSEPipeline()

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

Definition at line 1213 of file content_context.cc.

1214  {
1215  return GetPipeline(this, pipelines_->complex_rse, opts);
1216 }

References pipelines_.

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

◆ GetConicalGradientFillPipeline()

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

Definition at line 1113 of file content_context.cc.

1115  {
1116  switch (kind) {
1117  case ConicalKind::kConical:
1118  return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1119  case ConicalKind::kRadial:
1120  return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1121  case ConicalKind::kStrip:
1122  return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1124  return GetPipeline(
1125  this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1126  }
1127 }

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

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 1083 of file content_context.cc.

1085  {
1086  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1087  switch (kind) {
1088  case ConicalKind::kConical:
1089  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1090  case ConicalKind::kRadial:
1091  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1092  opts);
1093  case ConicalKind::kStrip:
1094  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1095  opts);
1097  return GetPipeline(
1098  this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1099  }
1100 }
const Capabilities & GetDeviceCapabilities() const

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

◆ GetConicalGradientUniformFillPipeline()

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

Definition at line 1064 of file content_context.cc.

1066  {
1067  switch (kind) {
1068  case ConicalKind::kConical:
1069  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1070  case ConicalKind::kRadial:
1071  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1072  opts);
1073  case ConicalKind::kStrip:
1074  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1075  opts);
1077  return GetPipeline(
1078  this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1079  opts);
1080  }
1081 }

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

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1323 of file content_context.cc.

1324  {
1325  return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1326 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1283 of file content_context.cc.

1284  {
1285  return GetPipeline(this, pipelines_->destination_blend, opts);
1286 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1303 of file content_context.cc.

1304  {
1305  return GetPipeline(this, pipelines_->destination_in_blend, opts);
1306 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1313 of file content_context.cc.

1314  {
1315  return GetPipeline(this, pipelines_->destination_out_blend, opts);
1316 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1293 of file content_context.cc.

1294  {
1295  return GetPipeline(this, pipelines_->destination_over_blend, opts);
1296 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsampleBoundedPipeline()

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

Definition at line 1428 of file content_context.cc.

1429  {
1430  return GetPipeline(this, pipelines_->texture_downsample_bounded, opts);
1431 }

References pipelines_.

◆ GetDownsamplePipeline()

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

Definition at line 1423 of file content_context.cc.

1424  {
1425  return GetPipeline(this, pipelines_->texture_downsample, opts);
1426 }

References pipelines_.

◆ GetDrawShadowVerticesPipeline()

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

Definition at line 1523 of file content_context.cc.

1524  {
1525  return GetPipeline(this, pipelines_->shadow_vertices_, opts);
1526 }

References pipelines_.

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

◆ GetDrawVerticesUberPipeline()

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

Definition at line 1528 of file content_context.cc.

1530  {
1531  if (blend_mode <= BlendMode::kHardLight) {
1532  return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1533  } else {
1534  return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1535  }
1536 }

References impeller::kHardLight, and pipelines_.

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

◆ GetEmptyTexture()

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

Definition at line 888 of file content_context.cc.

888  {
889  return empty_texture_;
890 }

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

◆ GetFastGradientPipeline()

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

Definition at line 1027 of file content_context.cc.

1028  {
1029  return GetPipeline(this, pipelines_->fast_gradient, opts);
1030 }

References pipelines_.

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 1439 of file content_context.cc.

1440  {
1441  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1442  return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1443 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 1445 of file content_context.cc.

1446  {
1447  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1448  return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1449 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 1433 of file content_context.cc.

1434  {
1435  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1436  return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1437 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendDarkenPipeline()

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

Definition at line 1451 of file content_context.cc.

1452  {
1453  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1454  return GetPipeline(this, pipelines_->framebuffer_blend_darken, opts);
1455 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendDifferencePipeline()

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

Definition at line 1457 of file content_context.cc.

1458  {
1459  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1460  return GetPipeline(this, pipelines_->framebuffer_blend_difference, opts);
1461 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendExclusionPipeline()

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

Definition at line 1463 of file content_context.cc.

1464  {
1465  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1466  return GetPipeline(this, pipelines_->framebuffer_blend_exclusion, opts);
1467 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendHardLightPipeline()

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

Definition at line 1469 of file content_context.cc.

1470  {
1471  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1472  return GetPipeline(this, pipelines_->framebuffer_blend_hardlight, opts);
1473 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendHuePipeline()

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

Definition at line 1475 of file content_context.cc.

1476  {
1477  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1478  return GetPipeline(this, pipelines_->framebuffer_blend_hue, opts);
1479 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendLightenPipeline()

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

Definition at line 1481 of file content_context.cc.

1482  {
1483  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1484  return GetPipeline(this, pipelines_->framebuffer_blend_lighten, opts);
1485 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendLuminosityPipeline()

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

Definition at line 1487 of file content_context.cc.

1488  {
1489  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1490  return GetPipeline(this, pipelines_->framebuffer_blend_luminosity, opts);
1491 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 1493 of file content_context.cc.

1494  {
1495  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1496  return GetPipeline(this, pipelines_->framebuffer_blend_multiply, opts);
1497 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 1499 of file content_context.cc.

1500  {
1501  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1502  return GetPipeline(this, pipelines_->framebuffer_blend_overlay, opts);
1503 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 1505 of file content_context.cc.

1506  {
1507  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1508  return GetPipeline(this, pipelines_->framebuffer_blend_saturation, opts);
1509 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 1511 of file content_context.cc.

1512  {
1513  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1514  return GetPipeline(this, pipelines_->framebuffer_blend_screen, opts);
1515 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 1517 of file content_context.cc.

1518  {
1519  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1520  return GetPipeline(this, pipelines_->framebuffer_blend_softlight, opts);
1521 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetGaussianBlurPipeline()

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

Definition at line 1164 of file content_context.cc.

1165  {
1166  return GetPipeline(this, pipelines_->gaussian_blur, opts);
1167 }

References pipelines_.

◆ GetGlyphAtlasPipeline()

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

Definition at line 1198 of file content_context.cc.

1199  {
1200  return GetPipeline(this, pipelines_->glyph_atlas, opts);
1201 }

References pipelines_.

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

◆ GetLazyGlyphAtlas()

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

Definition at line 257 of file content_context.h.

257  {
258  return lazy_glyph_atlas_;
259  }

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

◆ GetLinearGradientFillPipeline()

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

Definition at line 1032 of file content_context.cc.

1033  {
1034  return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1035 }

References pipelines_.

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 1052 of file content_context.cc.

1053  {
1054  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1055  return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1056 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 1037 of file content_context.cc.

1038  {
1039  return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1040 }

References pipelines_.

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1184 of file content_context.cc.

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

References pipelines_.

◆ GetLinePipeline()

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

Definition at line 1543 of file content_context.cc.

1543  {
1544  return GetPipeline(this, pipelines_->line, opts);
1545 }

References pipelines_.

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

◆ GetModulateBlendPipeline()

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

Definition at line 1338 of file content_context.cc.

1339  {
1340  return GetPipeline(this, pipelines_->modulate_blend, opts);
1341 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1174 of file content_context.cc.

1175  {
1176  return GetPipeline(this, pipelines_->morphology_filter, opts);
1177 }

References pipelines_.

Referenced by impeller::testing::TEST_P().

◆ GetPlusBlendPipeline()

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

Definition at line 1333 of file content_context.cc.

1334  {
1335  return GetPipeline(this, pipelines_->plus_blend, opts);
1336 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1218 of file content_context.cc.

1220  {
1221  switch (mode) {
1222  case BlendMode::kClear:
1223  return GetClearBlendPipeline(opts);
1224  case BlendMode::kSrc:
1225  return GetSourceBlendPipeline(opts);
1226  case BlendMode::kDst:
1227  return GetDestinationBlendPipeline(opts);
1228  case BlendMode::kSrcOver:
1229  return GetSourceOverBlendPipeline(opts);
1230  case BlendMode::kDstOver:
1231  return GetDestinationOverBlendPipeline(opts);
1232  case BlendMode::kSrcIn:
1233  return GetSourceInBlendPipeline(opts);
1234  case BlendMode::kDstIn:
1235  return GetDestinationInBlendPipeline(opts);
1236  case BlendMode::kSrcOut:
1237  return GetSourceOutBlendPipeline(opts);
1238  case BlendMode::kDstOut:
1239  return GetDestinationOutBlendPipeline(opts);
1240  case BlendMode::kSrcATop:
1241  return GetSourceATopBlendPipeline(opts);
1242  case BlendMode::kDstATop:
1243  return GetDestinationATopBlendPipeline(opts);
1244  case BlendMode::kXor:
1245  return GetXorBlendPipeline(opts);
1246  case BlendMode::kPlus:
1247  return GetPlusBlendPipeline(opts);
1248  case BlendMode::kModulate:
1249  return GetModulateBlendPipeline(opts);
1250  case BlendMode::kScreen:
1251  return GetScreenBlendPipeline(opts);
1252  case BlendMode::kOverlay:
1253  case BlendMode::kDarken:
1254  case BlendMode::kLighten:
1256  case BlendMode::kColorBurn:
1257  case BlendMode::kHardLight:
1258  case BlendMode::kSoftLight:
1260  case BlendMode::kExclusion:
1261  case BlendMode::kMultiply:
1262  case BlendMode::kHue:
1264  case BlendMode::kColor:
1266  VALIDATION_LOG << "Invalid porter duff blend mode "
1267  << BlendModeToString(mode);
1268  return GetClearBlendPipeline(opts);
1269  break;
1270  }
1271 }
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:45

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

1109  {
1110  return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1111 }

References pipelines_.

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 1058 of file content_context.cc.

1059  {
1060  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1061  return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1062 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 1042 of file content_context.cc.

1043  {
1044  return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
1045 }

References pipelines_.

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1129 of file content_context.cc.

1130  {
1131  return GetPipeline(this, pipelines_->rrect_blur, opts);
1132 }

References pipelines_.

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

◆ GetRSuperellipseBlurPipeline()

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

Definition at line 1134 of file content_context.cc.

1135  {
1136  return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1137 }

References pipelines_.

◆ GetScreenBlendPipeline()

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

Definition at line 1343 of file content_context.cc.

1344  {
1345  return GetPipeline(this, pipelines_->screen_blend, opts);
1346 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1144 of file content_context.cc.

1145  {
1146  return GetPipeline(this, pipelines_->solid_fill, opts);
1147 }

References pipelines_.

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1318 of file content_context.cc.

1319  {
1320  return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1321 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1278 of file content_context.cc.

1279  {
1280  return GetPipeline(this, pipelines_->source_blend, opts);
1281 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1298 of file content_context.cc.

1299  {
1300  return GetPipeline(this, pipelines_->source_in_blend, opts);
1301 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1308 of file content_context.cc.

1309  {
1310  return GetPipeline(this, pipelines_->source_out_blend, opts);
1311 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1288 of file content_context.cc.

1289  {
1290  return GetPipeline(this, pipelines_->source_over_blend, opts);
1291 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1189 of file content_context.cc.

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

References pipelines_.

◆ GetSweepGradientFillPipeline()

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

Definition at line 1139 of file content_context.cc.

1140  {
1141  return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1142 }

References pipelines_.

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1102 of file content_context.cc.

1103  {
1104  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1105  return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1106 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 1047 of file content_context.cc.

1048  {
1049  return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1050 }

References pipelines_.

◆ GetTessellator()

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

Definition at line 968 of file content_context.cc.

968  {
969  return *tessellator_;
970 }

Referenced by impeller::CircleGeometry::GetPositionBuffer(), and impeller::StrokeRectGeometry::GetPositionBuffer().

◆ GetTextShadowCache()

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

Definition at line 324 of file content_context.h.

324 { return *text_shadow_cache_; }

Referenced by impeller::testing::TEST_P().

◆ GetTexturePipeline()

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

Definition at line 1149 of file content_context.cc.

1150  {
1151  return GetPipeline(this, pipelines_->texture, opts);
1152 }

References pipelines_.

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1154 of file content_context.cc.

1155  {
1156  return GetPipeline(this, pipelines_->texture_strict_src, opts);
1157 }

References pipelines_.

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

◆ GetTiledTexturePipeline()

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

Definition at line 1159 of file content_context.cc.

1160  {
1161  return GetPipeline(this, pipelines_->tiled_texture, opts);
1162 }

References pipelines_.

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

◆ GetTransientsDataBuffer()

HostBuffer& impeller::ContentContext::GetTransientsDataBuffer ( ) const
inline

◆ GetTransientsIndexesBuffer()

HostBuffer& impeller::ContentContext::GetTransientsIndexesBuffer ( ) const
inline

Retrieve the current host buffer for transient storage of indexes used for indexed draws.

This may or may not return the same value as GetTransientsDataBuffer depending on the backend.

This is only safe to use from the raster threads. Other threads should allocate their own device buffers.

Definition at line 310 of file content_context.h.

310  {
311  return *indexes_host_buffer_;
312  }

Referenced by impeller::ShadowVertices::GetPositionBuffer(), impeller::DlVerticesGeometry::GetPositionBuffer(), impeller::DlVerticesGeometry::GetPositionUVColorBuffer(), impeller::EntityPlayground::OpenPlaygroundHere(), and impeller::TextContents::Render().

◆ GetUberSDFPipeline()

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

Definition at line 1208 of file content_context.cc.

1209  {
1210  return GetPipeline(this, pipelines_->uber_sdf, opts);
1211 }

References pipelines_.

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

◆ GetXorBlendPipeline()

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

Definition at line 1328 of file content_context.cc.

1329  {
1330  return GetPipeline(this, pipelines_->xor_blend, opts);
1331 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1203 of file content_context.cc.

1204  {
1205  return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1206 }

References pipelines_.

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 884 of file content_context.cc.

884  {
885  return is_valid_;
886 }

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

933  {
934  const std::shared_ptr<Context>& context = GetContext();
935 
936  auto subpass_texture = subpass_target.GetRenderTargetTexture();
937  if (!subpass_texture) {
938  return fml::Status(fml::StatusCode::kUnknown, "");
939  }
940 
941  auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
942  if (!sub_renderpass) {
943  return fml::Status(fml::StatusCode::kUnknown, "");
944  }
945  sub_renderpass->SetLabel(label);
946 
947  if (!subpass_callback(*this, *sub_renderpass)) {
948  return fml::Status(fml::StatusCode::kUnknown, "");
949  }
950 
951  if (!sub_renderpass->EncodeCommands()) {
952  return fml::Status(fml::StatusCode::kUnknown, "");
953  }
954 
955  const std::shared_ptr<Texture>& target_texture =
956  subpass_target.GetRenderTargetTexture();
957  if (target_texture->GetMipCount() > 1) {
958  fml::Status mipmap_status =
959  AddMipmapGeneration(command_buffer, context, target_texture);
960  if (!mipmap_status.ok()) {
961  return mipmap_status;
962  }
963  }
964 
965  return subpass_target;
966 }
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
std::shared_ptr< CommandBuffer > command_buffer

References impeller::AddMipmapGeneration(), command_buffer, context, 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 892 of file content_context.cc.

899  {
900  const std::shared_ptr<Context>& context = GetContext();
901  RenderTarget subpass_target;
902 
903  std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
904  depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
905  : std::optional<RenderTarget::AttachmentConfig>();
906 
907  if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
908  subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
909  /*context=*/*context,
910  /*size=*/texture_size,
911  /*mip_count=*/mip_count,
912  /*label=*/label,
913  /*color_attachment_config=*/
915  /*stencil_attachment_config=*/depth_stencil_config,
916  /*existing_color_msaa_texture=*/nullptr,
917  /*existing_color_resolve_texture=*/nullptr,
918  /*existing_depth_stencil_texture=*/nullptr,
919  /*target_pixel_format=*/std::nullopt);
920  } else {
921  subpass_target = GetRenderTargetCache()->CreateOffscreen(
922  *context, texture_size,
923  /*mip_count=*/mip_count, label,
924  RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
925  }
926  return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
927 }
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 command_buffer, context, GetContext(), GetRenderTargetCache(), impeller::RenderTarget::kDefaultColorAttachmentConfig, impeller::RenderTarget::kDefaultColorAttachmentConfigMSAA, and impeller::RenderTarget::kDefaultStencilAttachmentConfig.

Referenced by impeller::AdvancedBlend(), impeller::testing::BlendFilterContentsTest::MakeTexture(), impeller::testing::GaussianBlurFilterContentsTest::MakeTexture(), impeller::testing::MatrixFilterContentsTest::MakeTexture(), impeller::testing::MorphologyFilterContentsTest::MakeTexture(), impeller::PipelineBlend(), and impeller::Contents::RenderToSnapshot().

◆ RemoveCachedTexture()

void impeller::ContentContext::RemoveCachedTexture ( const flutter::DlImage *  image) const

Remove a cached texture for the given image.

Definition at line 1602 of file content_context.cc.

1602  {
1603  texture_cache_.erase(image);
1604 }

◆ ResetTransientsBuffers()

void impeller::ContentContext::ResetTransientsBuffers ( )

Resets the transients buffers held onto by the content context.

Definition at line 1012 of file content_context.cc.

1012  {
1013  data_host_buffer_->Reset();
1014 
1015  // We should only reset the indexes host buffer if it is actually different
1016  // from the data host buffer. Otherwise we'll end up resetting the same host
1017  // buffer twice.
1018  if (data_host_buffer_ != indexes_host_buffer_) {
1019  indexes_host_buffer_->Reset();
1020  }
1021 }

◆ SetCachedTexture()

void impeller::ContentContext::SetCachedTexture ( const flutter::DlImage *  image,
const std::shared_ptr< Texture > &  texture 
) const

Set a cached texture for the given image.

Definition at line 1591 of file content_context.cc.

1593  {
1594  if (!image || !texture) {
1595  return;
1596  }
1597  if (is_texture_caching_enabled_) {
1598  texture_cache_[image] = texture;
1599  }
1600 }

Referenced by impeller::DlImageImpeller::GetCachedTexture().

◆ SetTextureCachingEnabled()

void impeller::ContentContext::SetTextureCachingEnabled ( bool  enabled)

Enable or disable texture caching.

Definition at line 1570 of file content_context.cc.

1570  {
1571  is_texture_caching_enabled_ = enabled;
1572  if (!enabled) {
1573  texture_cache_.clear();
1574  }
1575 }

◆ SetTransientsDataBuffer()

void impeller::ContentContext::SetTransientsDataBuffer ( std::shared_ptr< HostBuffer >  host_buffer)
inlineprotected

Definition at line 333 of file content_context.h.

333  {
334  data_host_buffer_ = std::move(host_buffer);
335  }

Referenced by impeller::testing::FlushTestContentContext::FlushTestContentContext().

◆ SetTransientsIndexesBuffer()

void impeller::ContentContext::SetTransientsIndexesBuffer ( std::shared_ptr< HostBuffer >  host_buffer)
inlineprotected

Definition at line 328 of file content_context.h.

328  {
329  indexes_host_buffer_ = std::move(host_buffer);
330  }

Referenced by impeller::testing::FlushTestContentContext::FlushTestContentContext().


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