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

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

References impeller::Color::BlackTransparent(), buffer_view, impeller::HostBuffer::Create(), data, 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 985 of file content_context.cc.

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

References GetContext().

◆ GetBlendColorBurnPipeline()

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

Definition at line 1335 of file content_context.cc.

1336  {
1337  return GetPipeline(this, pipelines_->blend_colorburn, opts);
1338 }

References pipelines_.

◆ GetBlendColorDodgePipeline()

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

Definition at line 1340 of file content_context.cc.

1341  {
1342  return GetPipeline(this, pipelines_->blend_colordodge, opts);
1343 }

References pipelines_.

◆ GetBlendColorPipeline()

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

Definition at line 1330 of file content_context.cc.

1331  {
1332  return GetPipeline(this, pipelines_->blend_color, opts);
1333 }

References pipelines_.

◆ GetBlendDarkenPipeline()

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

Definition at line 1345 of file content_context.cc.

1346  {
1347  return GetPipeline(this, pipelines_->blend_darken, opts);
1348 }

References pipelines_.

◆ GetBlendDifferencePipeline()

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

Definition at line 1350 of file content_context.cc.

1351  {
1352  return GetPipeline(this, pipelines_->blend_difference, opts);
1353 }

References pipelines_.

◆ GetBlendExclusionPipeline()

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

Definition at line 1355 of file content_context.cc.

1356  {
1357  return GetPipeline(this, pipelines_->blend_exclusion, opts);
1358 }

References pipelines_.

◆ GetBlendHardLightPipeline()

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

Definition at line 1360 of file content_context.cc.

1361  {
1362  return GetPipeline(this, pipelines_->blend_hardlight, opts);
1363 }

References pipelines_.

◆ GetBlendHuePipeline()

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

Definition at line 1365 of file content_context.cc.

1366  {
1367  return GetPipeline(this, pipelines_->blend_hue, opts);
1368 }

References pipelines_.

◆ GetBlendLightenPipeline()

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

Definition at line 1370 of file content_context.cc.

1371  {
1372  return GetPipeline(this, pipelines_->blend_lighten, opts);
1373 }

References pipelines_.

◆ GetBlendLuminosityPipeline()

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

Definition at line 1375 of file content_context.cc.

1376  {
1377  return GetPipeline(this, pipelines_->blend_luminosity, opts);
1378 }

References pipelines_.

◆ GetBlendMultiplyPipeline()

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

Definition at line 1380 of file content_context.cc.

1381  {
1382  return GetPipeline(this, pipelines_->blend_multiply, opts);
1383 }

References pipelines_.

◆ GetBlendOverlayPipeline()

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

Definition at line 1385 of file content_context.cc.

1386  {
1387  return GetPipeline(this, pipelines_->blend_overlay, opts);
1388 }

References pipelines_.

◆ GetBlendSaturationPipeline()

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

Definition at line 1390 of file content_context.cc.

1391  {
1392  return GetPipeline(this, pipelines_->blend_saturation, opts);
1393 }

References pipelines_.

◆ GetBlendScreenPipeline()

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

Definition at line 1395 of file content_context.cc.

1396  {
1397  return GetPipeline(this, pipelines_->blend_screen, opts);
1398 }

References pipelines_.

◆ GetBlendSoftLightPipeline()

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

Definition at line 1400 of file content_context.cc.

1401  {
1402  return GetPipeline(this, pipelines_->blend_softlight, opts);
1403 }

References pipelines_.

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1161 of file content_context.cc.

1162  {
1163  return GetPipeline(this, pipelines_->border_mask_blur, opts);
1164 }

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

976  {
977  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
978  auto it = runtime_effect_pipelines_.find(key);
979  if (it == runtime_effect_pipelines_.end()) {
980  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
981  }
982  return raw_ptr(it->second);
983 }

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

◆ GetCirclePipeline()

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

Definition at line 1520 of file content_context.cc.

1521  {
1522  return GetPipeline(this, pipelines_->circle, opts);
1523 }

References pipelines_.

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

◆ GetClearBlendPipeline()

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

Definition at line 1255 of file content_context.cc.

1256  {
1257  return GetPipeline(this, pipelines_->clear_blend, opts);
1258 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1186 of file content_context.cc.

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

References pipelines_.

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1171 of file content_context.cc.

1172  {
1173  return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1174 }

References pipelines_.

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

◆ GetConicalGradientFillPipeline()

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

Definition at line 1105 of file content_context.cc.

1107  {
1108  switch (kind) {
1109  case ConicalKind::kConical:
1110  return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1111  case ConicalKind::kRadial:
1112  return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1113  case ConicalKind::kStrip:
1114  return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1116  return GetPipeline(
1117  this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1118  }
1119 }

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

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 1075 of file content_context.cc.

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

1058  {
1059  switch (kind) {
1060  case ConicalKind::kConical:
1061  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1062  case ConicalKind::kRadial:
1063  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1064  opts);
1065  case ConicalKind::kStrip:
1066  return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1067  opts);
1069  return GetPipeline(
1070  this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1071  opts);
1072  }
1073 }

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

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1305 of file content_context.cc.

1306  {
1307  return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1308 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1265 of file content_context.cc.

1266  {
1267  return GetPipeline(this, pipelines_->destination_blend, opts);
1268 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1285 of file content_context.cc.

1286  {
1287  return GetPipeline(this, pipelines_->destination_in_blend, opts);
1288 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1295 of file content_context.cc.

1296  {
1297  return GetPipeline(this, pipelines_->destination_out_blend, opts);
1298 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1275 of file content_context.cc.

1276  {
1277  return GetPipeline(this, pipelines_->destination_over_blend, opts);
1278 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsampleBoundedPipeline()

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

Definition at line 1410 of file content_context.cc.

1411  {
1412  return GetPipeline(this, pipelines_->texture_downsample_bounded, opts);
1413 }

References pipelines_.

◆ GetDownsamplePipeline()

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

Definition at line 1405 of file content_context.cc.

1406  {
1407  return GetPipeline(this, pipelines_->texture_downsample, opts);
1408 }

References pipelines_.

◆ GetDrawShadowVerticesPipeline()

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

Definition at line 1505 of file content_context.cc.

1506  {
1507  return GetPipeline(this, pipelines_->shadow_vertices_, opts);
1508 }

References pipelines_.

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

◆ GetDrawVerticesUberPipeline()

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

Definition at line 1510 of file content_context.cc.

1512  {
1513  if (blend_mode <= BlendMode::kHardLight) {
1514  return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1515  } else {
1516  return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1517  }
1518 }

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

880  {
881  return empty_texture_;
882 }

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

◆ GetFastGradientPipeline()

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

Definition at line 1019 of file content_context.cc.

1020  {
1021  return GetPipeline(this, pipelines_->fast_gradient, opts);
1022 }

References pipelines_.

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 1421 of file content_context.cc.

1422  {
1423  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1424  return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1425 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 1427 of file content_context.cc.

1428  {
1429  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1430  return GetPipeline(this, pipelines_->framebuffer_blend_colordodge, opts);
1431 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 1415 of file content_context.cc.

1416  {
1417  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1418  return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1419 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendDarkenPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendDarkenPipeline ( 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_darken, opts);
1437 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendDifferencePipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendDifferencePipeline ( 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_difference, opts);
1443 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendExclusionPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendExclusionPipeline ( 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_exclusion, opts);
1449 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendHardLightPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendHardLightPipeline ( 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_hardlight, opts);
1455 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendHuePipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendHuePipeline ( 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_hue, opts);
1461 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendLightenPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendLightenPipeline ( 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_lighten, opts);
1467 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendLuminosityPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendLuminosityPipeline ( 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_luminosity, opts);
1473 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendMultiplyPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendMultiplyPipeline ( 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_multiply, opts);
1479 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendOverlayPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendOverlayPipeline ( 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_overlay, opts);
1485 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendSaturationPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendSaturationPipeline ( 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_saturation, opts);
1491 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendScreenPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendScreenPipeline ( 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_screen, opts);
1497 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetFramebufferBlendSoftLightPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendSoftLightPipeline ( 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_softlight, opts);
1503 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetGaussianBlurPipeline()

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

Definition at line 1156 of file content_context.cc.

1157  {
1158  return GetPipeline(this, pipelines_->gaussian_blur, opts);
1159 }

References pipelines_.

◆ GetGlyphAtlasPipeline()

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

Definition at line 1190 of file content_context.cc.

1191  {
1192  return GetPipeline(this, pipelines_->glyph_atlas, opts);
1193 }

References pipelines_.

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

◆ GetLazyGlyphAtlas()

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

Definition at line 254 of file content_context.h.

254  {
255  return lazy_glyph_atlas_;
256  }

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

1025  {
1026  return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1027 }

References pipelines_.

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 1044 of file content_context.cc.

1045  {
1046  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1047  return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1048 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 1029 of file content_context.cc.

1030  {
1031  return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1032 }

References pipelines_.

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1176 of file content_context.cc.

1177  {
1178  return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1179 }

References pipelines_.

◆ GetLinePipeline()

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

Definition at line 1525 of file content_context.cc.

1525  {
1526  return GetPipeline(this, pipelines_->line, opts);
1527 }

References pipelines_.

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

◆ GetModulateBlendPipeline()

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

Definition at line 1320 of file content_context.cc.

1321  {
1322  return GetPipeline(this, pipelines_->modulate_blend, opts);
1323 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1166 of file content_context.cc.

1167  {
1168  return GetPipeline(this, pipelines_->morphology_filter, opts);
1169 }

References pipelines_.

◆ GetPlusBlendPipeline()

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

Definition at line 1315 of file content_context.cc.

1316  {
1317  return GetPipeline(this, pipelines_->plus_blend, opts);
1318 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1200 of file content_context.cc.

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

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

References pipelines_.

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 1050 of file content_context.cc.

1051  {
1052  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1053  return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1054 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 1034 of file content_context.cc.

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

References pipelines_.

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1121 of file content_context.cc.

1122  {
1123  return GetPipeline(this, pipelines_->rrect_blur, opts);
1124 }

References pipelines_.

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

◆ GetRSuperellipseBlurPipeline()

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

Definition at line 1126 of file content_context.cc.

1127  {
1128  return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1129 }

References pipelines_.

◆ GetScreenBlendPipeline()

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

Definition at line 1325 of file content_context.cc.

1326  {
1327  return GetPipeline(this, pipelines_->screen_blend, opts);
1328 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1136 of file content_context.cc.

1137  {
1138  return GetPipeline(this, pipelines_->solid_fill, opts);
1139 }

References pipelines_.

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1300 of file content_context.cc.

1301  {
1302  return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1303 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1260 of file content_context.cc.

1261  {
1262  return GetPipeline(this, pipelines_->source_blend, opts);
1263 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1280 of file content_context.cc.

1281  {
1282  return GetPipeline(this, pipelines_->source_in_blend, opts);
1283 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1290 of file content_context.cc.

1291  {
1292  return GetPipeline(this, pipelines_->source_out_blend, opts);
1293 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1270 of file content_context.cc.

1271  {
1272  return GetPipeline(this, pipelines_->source_over_blend, opts);
1273 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1181 of file content_context.cc.

1182  {
1183  return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1184 }

References pipelines_.

◆ GetSweepGradientFillPipeline()

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

Definition at line 1131 of file content_context.cc.

1132  {
1133  return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1134 }

References pipelines_.

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1094 of file content_context.cc.

1095  {
1096  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1097  return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1098 }

References GetDeviceCapabilities(), and pipelines_.

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 1039 of file content_context.cc.

1040  {
1041  return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1042 }

References pipelines_.

◆ GetTessellator()

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

Definition at line 960 of file content_context.cc.

960  {
961  return *tessellator_;
962 }

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

◆ GetTextShadowCache()

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

Definition at line 304 of file content_context.h.

304 { 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 1141 of file content_context.cc.

1142  {
1143  return GetPipeline(this, pipelines_->texture, opts);
1144 }

References pipelines_.

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1146 of file content_context.cc.

1147  {
1148  return GetPipeline(this, pipelines_->texture_strict_src, opts);
1149 }

References pipelines_.

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

◆ GetTiledTexturePipeline()

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

Definition at line 1151 of file content_context.cc.

1152  {
1153  return GetPipeline(this, pipelines_->tiled_texture, opts);
1154 }

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

290  {
291  return *indexes_host_buffer_;
292  }

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

◆ GetXorBlendPipeline()

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

Definition at line 1310 of file content_context.cc.

1311  {
1312  return GetPipeline(this, pipelines_->xor_blend, opts);
1313 }

References pipelines_.

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1195 of file content_context.cc.

1196  {
1197  return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1198 }

References pipelines_.

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 876 of file content_context.cc.

876  {
877  return is_valid_;
878 }

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

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

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

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

Referenced by impeller::RenderToTarget().

◆ SetTransientsDataBuffer()

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

Definition at line 313 of file content_context.h.

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

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

◆ SetTransientsIndexesBuffer()

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

Definition at line 308 of file content_context.h.

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

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


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