Flutter Engine
 
Loading...
Searching...
No Matches
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 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.
 
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.
 
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.
 
HostBufferGetTransientsDataBuffer () const
 Retrieve the current host buffer for transient storage of other non-index data.
 
void ResetTransientsBuffers ()
 Resets the transients buffers held onto by the content context.
 
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 138 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

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

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

975 {
976#ifdef IMPELLER_DEBUG
977 // destroying in-use pipleines is a validation error.
978 const auto& idle_waiter = GetContext()->GetIdleWaiter();
979 if (idle_waiter) {
980 idle_waiter->WaitIdle();
981 }
982#endif // IMPELLER_DEBUG
983 for (auto it = runtime_effect_pipelines_.begin();
984 it != runtime_effect_pipelines_.end();) {
985 if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
986 it = runtime_effect_pipelines_.erase(it);
987 } else {
988 it++;
989 }
990 }
991}

References GetContext().

◆ GetBlendColorBurnPipeline()

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

Definition at line 1327 of file content_context.cc.

1328 {
1329 return GetPipeline(this, pipelines_->blend_colorburn, opts);
1330}

◆ GetBlendColorDodgePipeline()

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

Definition at line 1332 of file content_context.cc.

1333 {
1334 return GetPipeline(this, pipelines_->blend_colordodge, opts);
1335}

◆ GetBlendColorPipeline()

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

Definition at line 1322 of file content_context.cc.

1323 {
1324 return GetPipeline(this, pipelines_->blend_color, opts);
1325}

◆ GetBlendDarkenPipeline()

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

Definition at line 1337 of file content_context.cc.

1338 {
1339 return GetPipeline(this, pipelines_->blend_darken, opts);
1340}

◆ GetBlendDifferencePipeline()

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

Definition at line 1342 of file content_context.cc.

1343 {
1344 return GetPipeline(this, pipelines_->blend_difference, opts);
1345}

◆ GetBlendExclusionPipeline()

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

Definition at line 1347 of file content_context.cc.

1348 {
1349 return GetPipeline(this, pipelines_->blend_exclusion, opts);
1350}

◆ GetBlendHardLightPipeline()

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

Definition at line 1352 of file content_context.cc.

1353 {
1354 return GetPipeline(this, pipelines_->blend_hardlight, opts);
1355}

◆ GetBlendHuePipeline()

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

Definition at line 1357 of file content_context.cc.

1358 {
1359 return GetPipeline(this, pipelines_->blend_hue, opts);
1360}

◆ GetBlendLightenPipeline()

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

Definition at line 1362 of file content_context.cc.

1363 {
1364 return GetPipeline(this, pipelines_->blend_lighten, opts);
1365}

◆ GetBlendLuminosityPipeline()

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

Definition at line 1367 of file content_context.cc.

1368 {
1369 return GetPipeline(this, pipelines_->blend_luminosity, opts);
1370}

◆ GetBlendMultiplyPipeline()

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

Definition at line 1372 of file content_context.cc.

1373 {
1374 return GetPipeline(this, pipelines_->blend_multiply, opts);
1375}

◆ GetBlendOverlayPipeline()

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

Definition at line 1377 of file content_context.cc.

1378 {
1379 return GetPipeline(this, pipelines_->blend_overlay, opts);
1380}

◆ GetBlendSaturationPipeline()

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

Definition at line 1382 of file content_context.cc.

1383 {
1384 return GetPipeline(this, pipelines_->blend_saturation, opts);
1385}

◆ GetBlendScreenPipeline()

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

Definition at line 1387 of file content_context.cc.

1388 {
1389 return GetPipeline(this, pipelines_->blend_screen, opts);
1390}

◆ GetBlendSoftLightPipeline()

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

Definition at line 1392 of file content_context.cc.

1393 {
1394 return GetPipeline(this, pipelines_->blend_softlight, opts);
1395}

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1153 of file content_context.cc.

1154 {
1155 return GetPipeline(this, pipelines_->border_mask_blur, opts);
1156}

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

965 {
966 RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
967 auto it = runtime_effect_pipelines_.find(key);
968 if (it == runtime_effect_pipelines_.end()) {
969 it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
970 }
971 return raw_ptr(it->second);
972}

References key.

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

◆ GetCirclePipeline()

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

Definition at line 1502 of file content_context.cc.

1503 {
1504 return GetPipeline(this, pipelines_->circle, opts);
1505}

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

◆ GetClearBlendPipeline()

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

Definition at line 1247 of file content_context.cc.

1248 {
1249 return GetPipeline(this, pipelines_->clear_blend, opts);
1250}

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1178 of file content_context.cc.

1178 {
1179 return GetPipeline(this, pipelines_->clip, opts);
1180}

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1163 of file content_context.cc.

1164 {
1165 return GetPipeline(this, pipelines_->color_matrix_color_filter, opts);
1166}

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

◆ GetConicalGradientFillPipeline()

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

Definition at line 1097 of file content_context.cc.

1099 {
1100 switch (kind) {
1102 return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1104 return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1106 return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1108 return GetPipeline(
1109 this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1110 }
1111}

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

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 1067 of file content_context.cc.

1069 {
1070 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1071 switch (kind) {
1073 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1075 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1076 opts);
1078 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1079 opts);
1081 return GetPipeline(
1082 this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1083 }
1084}
const Capabilities & GetDeviceCapabilities() const
#define FML_DCHECK(condition)
Definition logging.h:122

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

◆ GetConicalGradientUniformFillPipeline()

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

Definition at line 1048 of file content_context.cc.

1050 {
1051 switch (kind) {
1053 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1055 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1056 opts);
1058 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1059 opts);
1061 return GetPipeline(
1062 this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1063 opts);
1064 }
1065}

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

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1297 of file content_context.cc.

1298 {
1299 return GetPipeline(this, pipelines_->destination_a_top_blend, opts);
1300}

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1257 of file content_context.cc.

1258 {
1259 return GetPipeline(this, pipelines_->destination_blend, opts);
1260}

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1277 of file content_context.cc.

1278 {
1279 return GetPipeline(this, pipelines_->destination_in_blend, opts);
1280}

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1287 of file content_context.cc.

1288 {
1289 return GetPipeline(this, pipelines_->destination_out_blend, opts);
1290}

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1267 of file content_context.cc.

1268 {
1269 return GetPipeline(this, pipelines_->destination_over_blend, opts);
1270}

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsamplePipeline()

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

Definition at line 1397 of file content_context.cc.

1398 {
1399 return GetPipeline(this, pipelines_->texture_downsample, opts);
1400}

◆ GetDrawVerticesUberPipeline()

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

Definition at line 1492 of file content_context.cc.

1494 {
1495 if (blend_mode <= BlendMode::kHardLight) {
1496 return GetPipeline(this, pipelines_->vertices_uber_1_, opts);
1497 } else {
1498 return GetPipeline(this, pipelines_->vertices_uber_2_, opts);
1499 }
1500}

References impeller::kHardLight.

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

◆ GetEmptyTexture()

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

Definition at line 877 of file content_context.cc.

877 {
878 return empty_texture_;
879}

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

◆ GetFastGradientPipeline()

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

Definition at line 1011 of file content_context.cc.

1012 {
1013 return GetPipeline(this, pipelines_->fast_gradient, opts);
1014}

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 1408 of file content_context.cc.

1409 {
1410 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1411 return GetPipeline(this, pipelines_->framebuffer_blend_colorburn, opts);
1412}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 1414 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 1402 of file content_context.cc.

1403 {
1404 FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
1405 return GetPipeline(this, pipelines_->framebuffer_blend_color, opts);
1406}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

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

Definition at line 1420 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

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

Definition at line 1426 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

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

Definition at line 1432 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

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

Definition at line 1438 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

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

Definition at line 1444 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

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

Definition at line 1450 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

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

Definition at line 1456 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 1462 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 1468 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 1474 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 1480 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 1486 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

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

Definition at line 1148 of file content_context.cc.

1149 {
1150 return GetPipeline(this, pipelines_->gaussian_blur, opts);
1151}

◆ GetGlyphAtlasPipeline()

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

Definition at line 1182 of file content_context.cc.

1183 {
1184 return GetPipeline(this, pipelines_->glyph_atlas, opts);
1185}

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

◆ GetLazyGlyphAtlas()

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

Definition at line 266 of file content_context.h.

266 {
267 return lazy_glyph_atlas_;
268 }

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

1017 {
1018 return GetPipeline(this, pipelines_->linear_gradient_fill, opts);
1019}

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 1036 of file content_context.cc.

1037 {
1038 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1039 return GetPipeline(this, pipelines_->linear_gradient_ssbo_fill, opts);
1040}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 1021 of file content_context.cc.

1022 {
1023 return GetPipeline(this, pipelines_->linear_gradient_uniform_fill, opts);
1024}

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1168 of file content_context.cc.

1169 {
1170 return GetPipeline(this, pipelines_->linear_to_srgb_filter, opts);
1171}

◆ GetLinePipeline()

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

Definition at line 1507 of file content_context.cc.

1507 {
1508 return GetPipeline(this, pipelines_->line, opts);
1509}

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

◆ GetModulateBlendPipeline()

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

Definition at line 1312 of file content_context.cc.

1313 {
1314 return GetPipeline(this, pipelines_->modulate_blend, opts);
1315}

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1158 of file content_context.cc.

1159 {
1160 return GetPipeline(this, pipelines_->morphology_filter, opts);
1161}

◆ GetPlusBlendPipeline()

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

Definition at line 1307 of file content_context.cc.

1308 {
1309 return GetPipeline(this, pipelines_->plus_blend, opts);
1310}

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1192 of file content_context.cc.

1194 {
1195 switch (mode) {
1196 case BlendMode::kClear:
1197 return GetClearBlendPipeline(opts);
1198 case BlendMode::kSrc:
1199 return GetSourceBlendPipeline(opts);
1200 case BlendMode::kDst:
1201 return GetDestinationBlendPipeline(opts);
1203 return GetSourceOverBlendPipeline(opts);
1206 case BlendMode::kSrcIn:
1207 return GetSourceInBlendPipeline(opts);
1208 case BlendMode::kDstIn:
1209 return GetDestinationInBlendPipeline(opts);
1210 case BlendMode::kSrcOut:
1211 return GetSourceOutBlendPipeline(opts);
1212 case BlendMode::kDstOut:
1213 return GetDestinationOutBlendPipeline(opts);
1215 return GetSourceATopBlendPipeline(opts);
1218 case BlendMode::kXor:
1219 return GetXorBlendPipeline(opts);
1220 case BlendMode::kPlus:
1221 return GetPlusBlendPipeline(opts);
1223 return GetModulateBlendPipeline(opts);
1224 case BlendMode::kScreen:
1225 return GetScreenBlendPipeline(opts);
1227 case BlendMode::kDarken:
1236 case BlendMode::kHue:
1238 case BlendMode::kColor:
1240 VALIDATION_LOG << "Invalid porter duff blend mode "
1241 << BlendModeToString(mode);
1242 return GetClearBlendPipeline(opts);
1243 break;
1244 }
1245}
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 1092 of file content_context.cc.

1093 {
1094 return GetPipeline(this, pipelines_->radial_gradient_fill, opts);
1095}

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 1042 of file content_context.cc.

1043 {
1044 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1045 return GetPipeline(this, pipelines_->radial_gradient_ssbo_fill, opts);
1046}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 1026 of file content_context.cc.

1027 {
1028 return GetPipeline(this, pipelines_->radial_gradient_uniform_fill, opts);
1029}

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1113 of file content_context.cc.

1114 {
1115 return GetPipeline(this, pipelines_->rrect_blur, opts);
1116}

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

◆ GetRSuperellipseBlurPipeline()

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

Definition at line 1118 of file content_context.cc.

1119 {
1120 return GetPipeline(this, pipelines_->rsuperellipse_blur, opts);
1121}

◆ GetScreenBlendPipeline()

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

Definition at line 1317 of file content_context.cc.

1318 {
1319 return GetPipeline(this, pipelines_->screen_blend, opts);
1320}

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1128 of file content_context.cc.

1129 {
1130 return GetPipeline(this, pipelines_->solid_fill, opts);
1131}

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1292 of file content_context.cc.

1293 {
1294 return GetPipeline(this, pipelines_->source_a_top_blend, opts);
1295}

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1252 of file content_context.cc.

1253 {
1254 return GetPipeline(this, pipelines_->source_blend, opts);
1255}

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1272 of file content_context.cc.

1273 {
1274 return GetPipeline(this, pipelines_->source_in_blend, opts);
1275}

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1282 of file content_context.cc.

1283 {
1284 return GetPipeline(this, pipelines_->source_out_blend, opts);
1285}

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1262 of file content_context.cc.

1263 {
1264 return GetPipeline(this, pipelines_->source_over_blend, opts);
1265}

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1173 of file content_context.cc.

1174 {
1175 return GetPipeline(this, pipelines_->srgb_to_linear_filter, opts);
1176}

◆ GetSweepGradientFillPipeline()

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

Definition at line 1123 of file content_context.cc.

1124 {
1125 return GetPipeline(this, pipelines_->sweep_gradient_fill, opts);
1126}

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1086 of file content_context.cc.

1087 {
1088 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1089 return GetPipeline(this, pipelines_->sweep_gradient_ssbo_fill, opts);
1090}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 1031 of file content_context.cc.

1032 {
1033 return GetPipeline(this, pipelines_->sweep_gradient_uniform_fill, opts);
1034}

◆ GetTessellator()

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

Definition at line 949 of file content_context.cc.

949 {
950 return *tessellator_;
951}

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

◆ GetTextShadowCache()

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

◆ GetTexturePipeline()

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

Definition at line 1133 of file content_context.cc.

1134 {
1135 return GetPipeline(this, pipelines_->texture, opts);
1136}

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1138 of file content_context.cc.

1139 {
1140 return GetPipeline(this, pipelines_->texture_strict_src, opts);
1141}

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

◆ GetTiledTexturePipeline()

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

Definition at line 1143 of file content_context.cc.

1144 {
1145 return GetPipeline(this, pipelines_->tiled_texture, opts);
1146}

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

302 {
303 return *indexes_host_buffer_;
304 }

Referenced by 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 1302 of file content_context.cc.

1303 {
1304 return GetPipeline(this, pipelines_->xor_blend, opts);
1305}

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1187 of file content_context.cc.

1188 {
1189 return GetPipeline(this, pipelines_->yuv_to_rgb_filter, opts);
1190}

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 873 of file content_context.cc.

873 {
874 return is_valid_;
875}

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

914 {
915 const std::shared_ptr<Context>& context = GetContext();
916
917 auto subpass_texture = subpass_target.GetRenderTargetTexture();
918 if (!subpass_texture) {
920 }
921
922 auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
923 if (!sub_renderpass) {
925 }
926 sub_renderpass->SetLabel(label);
927
928 if (!subpass_callback(*this, *sub_renderpass)) {
930 }
931
932 if (!sub_renderpass->EncodeCommands()) {
934 }
935
936 const std::shared_ptr<Texture>& target_texture =
937 subpass_target.GetRenderTargetTexture();
938 if (target_texture->GetMipCount() > 1) {
939 fml::Status mipmap_status =
940 AddMipmapGeneration(command_buffer, context, target_texture);
941 if (!mipmap_status.ok()) {
942 return mipmap_status;
943 }
944 }
945
946 return subpass_target;
947}
bool ok() const
Definition status.h:71
fml::Status AddMipmapGeneration(const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
Adds a blit command to the render pass.

References impeller::AddMipmapGeneration(), GetContext(), impeller::RenderTarget::GetRenderTargetTexture(), fml::kUnknown, and fml::Status::ok().

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

888 {
889 const std::shared_ptr<Context>& context = GetContext();
890 RenderTarget subpass_target;
891
892 std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
894 : std::optional<RenderTarget::AttachmentConfig>();
895
896 if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
897 subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
898 *context, texture_size,
899 /*mip_count=*/mip_count, label,
901 } else {
902 subpass_target = GetRenderTargetCache()->CreateOffscreen(
903 *context, texture_size,
904 /*mip_count=*/mip_count, label,
905 RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
906 }
907 return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
908}
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
fml::StatusOr< RenderTarget > MakeSubpass(std::string_view label, ISize texture_size, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback, bool msaa_enabled=true, bool depth_stencil_enabled=false, int32_t mip_count=1) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig

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

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

◆ ResetTransientsBuffers()

void impeller::ContentContext::ResetTransientsBuffers ( )

Resets the transients buffers held onto by the content context.

Definition at line 993 of file content_context.cc.

993 {
994 data_host_buffer_->Reset();
995
996 // We should only reset the indexes host buffer if it is actually different
997 // from the data host buffer. Otherwise we'll end up resetting the same host
998 // buffer twice.
999 if (data_host_buffer_ != indexes_host_buffer_) {
1000 indexes_host_buffer_->Reset();
1001 }
1002}

Referenced by impeller::RenderToTarget().

◆ SetTransientsDataBuffer()

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

Definition at line 325 of file content_context.h.

325 {
326 data_host_buffer_ = std::move(host_buffer);
327 }

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

◆ SetTransientsIndexesBuffer()

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

Definition at line 320 of file content_context.h.

320 {
321 indexes_host_buffer_ = std::move(host_buffer);
322 }

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


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