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
 
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 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
 
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
 
HostBufferGetTransientsIndexesBuffer () const
 Retrieve the current host buffer for transient storage of indexes used for indexed draws. More...
 
HostBufferGetTransientsDataBuffer () 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...
 
TextShadowCacheGetTextShadowCache () 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 122 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

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

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

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

References GetContext().

◆ GetBlendColorBurnPipeline()

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

Definition at line 1344 of file content_context.cc.

1345  {
1346  return GetPipeline(this, pipelines_->blend_colorburn, opts);
1347 }

References pipelines_.

◆ GetBlendColorDodgePipeline()

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

Definition at line 1349 of file content_context.cc.

1350  {
1351  return GetPipeline(this, pipelines_->blend_colordodge, opts);
1352 }

References pipelines_.

◆ GetBlendColorPipeline()

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

Definition at line 1339 of file content_context.cc.

1340  {
1341  return GetPipeline(this, pipelines_->blend_color, opts);
1342 }

References pipelines_.

◆ GetBlendDarkenPipeline()

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

Definition at line 1354 of file content_context.cc.

1355  {
1356  return GetPipeline(this, pipelines_->blend_darken, opts);
1357 }

References pipelines_.

◆ GetBlendDifferencePipeline()

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

Definition at line 1359 of file content_context.cc.

1360  {
1361  return GetPipeline(this, pipelines_->blend_difference, opts);
1362 }

References pipelines_.

◆ GetBlendExclusionPipeline()

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

Definition at line 1364 of file content_context.cc.

1365  {
1366  return GetPipeline(this, pipelines_->blend_exclusion, opts);
1367 }

References pipelines_.

◆ GetBlendHardLightPipeline()

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

Definition at line 1369 of file content_context.cc.

1370  {
1371  return GetPipeline(this, pipelines_->blend_hardlight, opts);
1372 }

References pipelines_.

◆ GetBlendHuePipeline()

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

Definition at line 1374 of file content_context.cc.

1375  {
1376  return GetPipeline(this, pipelines_->blend_hue, opts);
1377 }

References pipelines_.

◆ GetBlendLightenPipeline()

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

Definition at line 1379 of file content_context.cc.

1380  {
1381  return GetPipeline(this, pipelines_->blend_lighten, opts);
1382 }

References pipelines_.

◆ GetBlendLuminosityPipeline()

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

Definition at line 1384 of file content_context.cc.

1385  {
1386  return GetPipeline(this, pipelines_->blend_luminosity, opts);
1387 }

References pipelines_.

◆ GetBlendMultiplyPipeline()

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

Definition at line 1389 of file content_context.cc.

1390  {
1391  return GetPipeline(this, pipelines_->blend_multiply, opts);
1392 }

References pipelines_.

◆ GetBlendOverlayPipeline()

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

Definition at line 1394 of file content_context.cc.

1395  {
1396  return GetPipeline(this, pipelines_->blend_overlay, opts);
1397 }

References pipelines_.

◆ GetBlendSaturationPipeline()

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

Definition at line 1399 of file content_context.cc.

1400  {
1401  return GetPipeline(this, pipelines_->blend_saturation, opts);
1402 }

References pipelines_.

◆ GetBlendScreenPipeline()

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

Definition at line 1404 of file content_context.cc.

1405  {
1406  return GetPipeline(this, pipelines_->blend_screen, opts);
1407 }

References pipelines_.

◆ GetBlendSoftLightPipeline()

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

Definition at line 1409 of file content_context.cc.

1410  {
1411  return GetPipeline(this, pipelines_->blend_softlight, opts);
1412 }

References pipelines_.

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1165 of file content_context.cc.

1166  {
1167  return GetPipeline(this, pipelines_->border_mask_blur, opts);
1168 }

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

980  {
981  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
982  auto it = runtime_effect_pipelines_.find(key);
983  if (it == runtime_effect_pipelines_.end()) {
984  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
985  }
986  return raw_ptr(it->second);
987 }

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

◆ GetCirclePipeline()

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

Definition at line 1529 of file content_context.cc.

1530  {
1531  return GetPipeline(this, pipelines_->circle, opts);
1532 }

References pipelines_.

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

◆ GetClearBlendPipeline()

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

Definition at line 1264 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1190 of file content_context.cc.

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

References pipelines_.

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1175 of file content_context.cc.

1176  {
1177  return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1178 }

References pipelines_.

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

◆ GetConicalGradientFillPipeline()

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

Definition at line 1109 of file content_context.cc.

1111  {
1112  switch (kind) {
1113  case ConicalKind::kConical:
1114  return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1115  case ConicalKind::kRadial:
1116  return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1117  case ConicalKind::kStrip:
1118  return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1120  return GetPipeline(
1121  this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1122  }
1123 }

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

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 1079 of file content_context.cc.

1081  {
1082  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1083  switch (kind) {
1084  case ConicalKind::kConical:
1085  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1086  case ConicalKind::kRadial:
1087  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1088  opts);
1089  case ConicalKind::kStrip:
1090  return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1091  opts);
1093  return GetPipeline(
1094  this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1095  }
1096 }
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 1060 of file content_context.cc.

1062  {
1063  switch (kind) {
1064  case ConicalKind::kConical:
1065  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1066  case ConicalKind::kRadial:
1067  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1068  opts);
1069  case ConicalKind::kStrip:
1070  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1071  opts);
1073  return GetPipeline(
1074  this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1075  opts);
1076  }
1077 }

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

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1314 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1274 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1294 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1304 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1284 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsampleBoundedPipeline()

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

Definition at line 1419 of file content_context.cc.

1420  {
1421  return GetPipeline(this, pipelines_->texture_downsample_bounded, opts);
1422 }

References pipelines_.

◆ GetDownsamplePipeline()

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

Definition at line 1414 of file content_context.cc.

1415  {
1416  return GetPipeline(this, pipelines_->texture_downsample, opts);
1417 }

References pipelines_.

◆ GetDrawShadowVerticesPipeline()

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

Definition at line 1514 of file content_context.cc.

1515  {
1516  return GetPipeline(this, pipelines_->shadow_vertices_, opts);
1517 }

References pipelines_.

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

◆ GetDrawVerticesUberPipeline()

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

Definition at line 1519 of file content_context.cc.

1521  {
1522  if (blend_mode <= BlendMode::kHardLight) {
1523  return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1524  } else {
1525  return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1526  }
1527 }

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

884  {
885  return empty_texture_;
886 }

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

◆ GetFastGradientPipeline()

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

Definition at line 1023 of file content_context.cc.

1024  {
1025  return GetPipeline(this, pipelines_->fast_gradient, opts);
1026 }

References pipelines_.

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 1430 of file content_context.cc.

1431  {
1432  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1433  return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1434 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 1436 of file content_context.cc.

1437  {
1438  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1439  return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1440 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 1424 of file content_context.cc.

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

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendDarkenPipeline()

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

Definition at line 1442 of file content_context.cc.

1443  {
1444  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1445  return GetPipeline(this, pipelines_->framebuffer_blend_darken, opts);
1446 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendDifferencePipeline()

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

Definition at line 1448 of file content_context.cc.

1449  {
1450  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1451  return GetPipeline(this, pipelines_->framebuffer_blend_difference, opts);
1452 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendExclusionPipeline()

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

Definition at line 1454 of file content_context.cc.

1455  {
1456  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1457  return GetPipeline(this, pipelines_->framebuffer_blend_exclusion, opts);
1458 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendHardLightPipeline()

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

Definition at line 1460 of file content_context.cc.

1461  {
1462  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1463  return GetPipeline(this, pipelines_->framebuffer_blend_hardlight, opts);
1464 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendHuePipeline()

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

Definition at line 1466 of file content_context.cc.

1467  {
1468  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1469  return GetPipeline(this, pipelines_->framebuffer_blend_hue, opts);
1470 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendLightenPipeline()

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

Definition at line 1472 of file content_context.cc.

1473  {
1474  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1475  return GetPipeline(this, pipelines_->framebuffer_blend_lighten, opts);
1476 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendLuminosityPipeline()

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

Definition at line 1478 of file content_context.cc.

1479  {
1480  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1481  return GetPipeline(this, pipelines_->framebuffer_blend_luminosity, opts);
1482 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 1484 of file content_context.cc.

1485  {
1486  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1487  return GetPipeline(this, pipelines_->framebuffer_blend_multiply, opts);
1488 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 1490 of file content_context.cc.

1491  {
1492  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1493  return GetPipeline(this, pipelines_->framebuffer_blend_overlay, opts);
1494 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 1496 of file content_context.cc.

1497  {
1498  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1499  return GetPipeline(this, pipelines_->framebuffer_blend_saturation, opts);
1500 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 1502 of file content_context.cc.

1503  {
1504  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1505  return GetPipeline(this, pipelines_->framebuffer_blend_screen, opts);
1506 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 1508 of file content_context.cc.

1509  {
1510  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1511  return GetPipeline(this, pipelines_->framebuffer_blend_softlight, opts);
1512 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetGaussianBlurPipeline()

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

Definition at line 1160 of file content_context.cc.

1161  {
1162  return GetPipeline(this, pipelines_->gaussian_blur, opts);
1163 }

References pipelines_.

◆ GetGlyphAtlasPipeline()

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

Definition at line 1194 of file content_context.cc.

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

References pipelines_.

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

◆ GetLazyGlyphAtlas()

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

Definition at line 255 of file content_context.h.

255  {
256  return lazy_glyph_atlas_;
257  }

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

◆ GetLinearGradientFillPipeline()

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

Definition at line 1028 of file content_context.cc.

1029  {
1030  return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1031 }

References pipelines_.

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 1048 of file content_context.cc.

1049  {
1050  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1051  return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1052 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 1033 of file content_context.cc.

1034  {
1035  return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1036 }

References pipelines_.

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1180 of file content_context.cc.

1181  {
1182  return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1183 }

References pipelines_.

◆ GetLinePipeline()

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

Definition at line 1534 of file content_context.cc.

1534  {
1535  return GetPipeline(this, pipelines_->line, opts);
1536 }

References pipelines_.

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

◆ GetModulateBlendPipeline()

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

Definition at line 1329 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1170 of file content_context.cc.

1171  {
1172  return GetPipeline(this, pipelines_->morphology_filter, opts);
1173 }

References pipelines_.

◆ GetPlusBlendPipeline()

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

Definition at line 1324 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1209 of file content_context.cc.

1211  {
1212  switch (mode) {
1213  case BlendMode::kClear:
1214  return GetClearBlendPipeline(opts);
1215  case BlendMode::kSrc:
1216  return GetSourceBlendPipeline(opts);
1217  case BlendMode::kDst:
1218  return GetDestinationBlendPipeline(opts);
1219  case BlendMode::kSrcOver:
1220  return GetSourceOverBlendPipeline(opts);
1221  case BlendMode::kDstOver:
1222  return GetDestinationOverBlendPipeline(opts);
1223  case BlendMode::kSrcIn:
1224  return GetSourceInBlendPipeline(opts);
1225  case BlendMode::kDstIn:
1226  return GetDestinationInBlendPipeline(opts);
1227  case BlendMode::kSrcOut:
1228  return GetSourceOutBlendPipeline(opts);
1229  case BlendMode::kDstOut:
1230  return GetDestinationOutBlendPipeline(opts);
1231  case BlendMode::kSrcATop:
1232  return GetSourceATopBlendPipeline(opts);
1233  case BlendMode::kDstATop:
1234  return GetDestinationATopBlendPipeline(opts);
1235  case BlendMode::kXor:
1236  return GetXorBlendPipeline(opts);
1237  case BlendMode::kPlus:
1238  return GetPlusBlendPipeline(opts);
1239  case BlendMode::kModulate:
1240  return GetModulateBlendPipeline(opts);
1241  case BlendMode::kScreen:
1242  return GetScreenBlendPipeline(opts);
1243  case BlendMode::kOverlay:
1244  case BlendMode::kDarken:
1245  case BlendMode::kLighten:
1247  case BlendMode::kColorBurn:
1248  case BlendMode::kHardLight:
1249  case BlendMode::kSoftLight:
1251  case BlendMode::kExclusion:
1252  case BlendMode::kMultiply:
1253  case BlendMode::kHue:
1255  case BlendMode::kColor:
1257  VALIDATION_LOG << "Invalid porter duff blend mode "
1258  << BlendModeToString(mode);
1259  return GetClearBlendPipeline(opts);
1260  break;
1261  }
1262 }
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 1104 of file content_context.cc.

1105  {
1106  return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1107 }

References pipelines_.

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 1054 of file content_context.cc.

1055  {
1056  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1057  return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1058 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 1038 of file content_context.cc.

1039  {
1040  return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
1041 }

References pipelines_.

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1125 of file content_context.cc.

1126  {
1127  return GetPipeline(this, pipelines_->rrect_blur, opts);
1128 }

References pipelines_.

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

◆ GetRSuperellipseBlurPipeline()

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

Definition at line 1130 of file content_context.cc.

1131  {
1132  return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1133 }

References pipelines_.

◆ GetScreenBlendPipeline()

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

Definition at line 1334 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1140 of file content_context.cc.

1141  {
1142  return GetPipeline(this, pipelines_->solid_fill, opts);
1143 }

References pipelines_.

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1309 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1269 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1289 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1299 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1279 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1185 of file content_context.cc.

1186  {
1187  return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1188 }

References pipelines_.

◆ GetSweepGradientFillPipeline()

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

Definition at line 1135 of file content_context.cc.

1136  {
1137  return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1138 }

References pipelines_.

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1098 of file content_context.cc.

1099  {
1100  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1101  return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1102 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 1043 of file content_context.cc.

1044  {
1045  return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1046 }

References pipelines_.

◆ GetTessellator()

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

Definition at line 964 of file content_context.cc.

964  {
965  return *tessellator_;
966 }

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

◆ GetTextShadowCache()

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

Definition at line 305 of file content_context.h.

305 { 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 1145 of file content_context.cc.

1146  {
1147  return GetPipeline(this, pipelines_->texture, opts);
1148 }

References pipelines_.

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1150 of file content_context.cc.

1151  {
1152  return GetPipeline(this, pipelines_->texture_strict_src, opts);
1153 }

References pipelines_.

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

◆ GetTiledTexturePipeline()

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

Definition at line 1155 of file content_context.cc.

1156  {
1157  return GetPipeline(this, pipelines_->tiled_texture, opts);
1158 }

References pipelines_.

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

◆ GetTransientsDataBuffer()

◆ 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 291 of file content_context.h.

291  {
292  return *indexes_host_buffer_;
293  }

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

◆ GetUberSDFPipeline()

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

Definition at line 1204 of file content_context.cc.

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

References pipelines_.

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

◆ GetXorBlendPipeline()

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

Definition at line 1319 of file content_context.cc.

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

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1199 of file content_context.cc.

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

References pipelines_.

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 880 of file content_context.cc.

880  {
881  return is_valid_;
882 }

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

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

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

◆ ResetTransientsBuffers()

void impeller::ContentContext::ResetTransientsBuffers ( )

Resets the transients buffers held onto by the content context.

Definition at line 1008 of file content_context.cc.

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

Referenced by impeller::RenderToTarget().

◆ SetTransientsDataBuffer()

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

Definition at line 314 of file content_context.h.

314  {
315  data_host_buffer_ = std::move(host_buffer);
316  }

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

◆ SetTransientsIndexesBuffer()

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

Definition at line 309 of file content_context.h.

309  {
310  indexes_host_buffer_ = std::move(host_buffer);
311  }

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


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