Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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 GetDrawShadowVerticesPipeline (ContentContextOptions opts) const
 
PipelineRef GetDownsampleBoundedPipeline (ContentContextOptions opts) const
 
PipelineRef GetDrawVerticesUberPipeline (BlendMode blend_mode, ContentContextOptions opts) const
 
PipelineRef GetFastGradientPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorBurnPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorDodgePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendColorPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendDarkenPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendDifferencePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendExclusionPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendHardLightPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendHuePipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendLightenPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendLuminosityPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendMultiplyPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendOverlayPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendSaturationPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendScreenPipeline (ContentContextOptions opts) const
 
PipelineRef GetFramebufferBlendSoftLightPipeline (ContentContextOptions opts) const
 
PipelineRef GetGaussianBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetGlyphAtlasPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinePipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetLinearToSrgbFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetModulateBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetMorphologyFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetPlusBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetPorterDuffPipeline (BlendMode mode, ContentContextOptions opts) const
 
PipelineRef GetRadialGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRadialGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetRRectBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetRSuperellipseBlurPipeline (ContentContextOptions opts) const
 
PipelineRef GetScreenBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSolidFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceATopBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceInBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceOutBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSourceOverBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetSrgbToLinearFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientSSBOFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetSweepGradientUniformFillPipeline (ContentContextOptions opts) const
 
PipelineRef GetTexturePipeline (ContentContextOptions opts) const
 
PipelineRef GetTextureStrictSrcPipeline (ContentContextOptions opts) const
 
PipelineRef GetTiledTexturePipeline (ContentContextOptions opts) const
 
PipelineRef GetXorBlendPipeline (ContentContextOptions opts) const
 
PipelineRef GetYUVToRGBFilterPipeline (ContentContextOptions opts) const
 
PipelineRef GetUberSDFPipeline (ContentContextOptions opts) const
 
PipelineRef GetComplexRSEPipeline (ContentContextOptions opts) const
 
std::shared_ptr< 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
 
void SetTextureCachingEnabled (bool enabled)
 Enable or disable texture caching.
 
std::shared_ptr< TextureGetCachedTexture (const flutter::DlImage *image) const
 Get a cached texture for the given image.
 
void SetCachedTexture (const flutter::DlImage *image, const std::shared_ptr< Texture > &texture) const
 Set a cached texture for the given image.
 
void RemoveCachedTexture (const flutter::DlImage *image) const
 Remove a cached texture for the given image.
 
void ClearCachedTextures () const
 Clear all cached textures.
 
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 123 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

Definition at line 236 of file content_context.h.

Constructor & Destructor Documentation

◆ ContentContext()

impeller::ContentContext::ContentContext ( std::shared_ptr< Context context,
std::shared_ptr< TypographerContext typographer_context,
std::shared_ptr< RenderTargetAllocator render_target_allocator = nullptr 
)
explicit

Setup default clip pipeline.

Definition at line 552 of file content_context.cc.

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

References impeller::Color::BlackTransparent(), impeller::HostBuffer::Create(), impeller::HostBuffer::Emplace(), impeller::TextureDescriptor::format, GetContext(), impeller::GetPorterDuffSpecConstants(), GetTransientsDataBuffer(), impeller::kA8UNormInt, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kCount1, impeller::kCount4, impeller::kDarken, impeller::kDevicePrivate, impeller::kDifference, impeller::kExclusion, impeller::kHardLight, impeller::kHue, impeller::kLighten, impeller::kLuminosity, impeller::kMultiply, impeller::kNone, impeller::Context::kOpenGLES, impeller::kOverlay, impeller::kR8G8B8A8UNormInt, impeller::kSaturation, impeller::kScreen, impeller::kSoftLight, impeller::kTriangleStrip, impeller::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 992 of file content_context.cc.

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

References GetContext().

◆ ClearCachedTextures()

void impeller::ContentContext::ClearCachedTextures ( ) const

Clear all cached textures.

Definition at line 1605 of file content_context.cc.

1605 {
1606 texture_cache_.clear();
1607}

◆ GetBlendColorBurnPipeline()

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

Definition at line 1352 of file content_context.cc.

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

◆ GetBlendColorDodgePipeline()

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

Definition at line 1357 of file content_context.cc.

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

◆ GetBlendColorPipeline()

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

Definition at line 1347 of file content_context.cc.

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

◆ GetBlendDarkenPipeline()

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

Definition at line 1362 of file content_context.cc.

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

◆ GetBlendDifferencePipeline()

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

Definition at line 1367 of file content_context.cc.

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

◆ GetBlendExclusionPipeline()

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

Definition at line 1372 of file content_context.cc.

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

◆ GetBlendHardLightPipeline()

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

Definition at line 1377 of file content_context.cc.

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

◆ GetBlendHuePipeline()

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

Definition at line 1382 of file content_context.cc.

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

◆ GetBlendLightenPipeline()

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

Definition at line 1387 of file content_context.cc.

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

◆ GetBlendLuminosityPipeline()

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

Definition at line 1392 of file content_context.cc.

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

◆ GetBlendMultiplyPipeline()

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

Definition at line 1397 of file content_context.cc.

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

◆ GetBlendOverlayPipeline()

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

Definition at line 1402 of file content_context.cc.

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

◆ GetBlendSaturationPipeline()

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

Definition at line 1407 of file content_context.cc.

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

◆ GetBlendScreenPipeline()

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

Definition at line 1412 of file content_context.cc.

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

◆ GetBlendSoftLightPipeline()

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

Definition at line 1417 of file content_context.cc.

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

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1168 of file content_context.cc.

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

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

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

References key.

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

◆ GetCachedTexture()

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

Get a cached texture for the given image.

Definition at line 1576 of file content_context.cc.

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

References image.

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

◆ GetCirclePipeline()

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

Definition at line 1537 of file content_context.cc.

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

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

◆ GetClearBlendPipeline()

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

Definition at line 1272 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1193 of file content_context.cc.

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

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1178 of file content_context.cc.

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

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

◆ GetComplexRSEPipeline()

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

Definition at line 1212 of file content_context.cc.

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

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

◆ GetConicalGradientFillPipeline()

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

Definition at line 1112 of file content_context.cc.

1114 {
1115 switch (kind) {
1117 return GetPipeline(this, pipelines_->conical_gradient_fill, opts);
1119 return GetPipeline(this, pipelines_->conical_gradient_fill_radial, opts);
1121 return GetPipeline(this, pipelines_->conical_gradient_fill_strip, opts);
1123 return GetPipeline(
1124 this, pipelines_->conical_gradient_fill_strip_and_radial, opts);
1125 }
1126}

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

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 1082 of file content_context.cc.

1084 {
1085 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1086 switch (kind) {
1088 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1090 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1091 opts);
1093 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1094 opts);
1096 return GetPipeline(
1097 this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1098 }
1099}
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 1063 of file content_context.cc.

1065 {
1066 switch (kind) {
1068 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1070 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1071 opts);
1073 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1074 opts);
1076 return GetPipeline(
1077 this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1078 opts);
1079 }
1080}

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

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1322 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1282 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1302 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1312 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1292 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsampleBoundedPipeline()

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

Definition at line 1427 of file content_context.cc.

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

◆ GetDownsamplePipeline()

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

Definition at line 1422 of file content_context.cc.

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

◆ GetDrawShadowVerticesPipeline()

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

Definition at line 1522 of file content_context.cc.

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

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

◆ GetDrawVerticesUberPipeline()

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

Definition at line 1527 of file content_context.cc.

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

References impeller::kHardLight.

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

◆ GetEmptyTexture()

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

Definition at line 887 of file content_context.cc.

887 {
888 return empty_texture_;
889}

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

◆ GetFastGradientPipeline()

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

Definition at line 1026 of file content_context.cc.

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

◆ GetFramebufferBlendColorBurnPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendColorBurnPipeline ( 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_colorburn, opts);
1442}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendColorDodgePipeline ( 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_colordodge, opts);
1448}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

PipelineRef impeller::ContentContext::GetFramebufferBlendColorPipeline ( 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_color, opts);
1436}

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 1492 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 1498 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 1504 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 1510 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 1516 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

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

Definition at line 1163 of file content_context.cc.

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

◆ GetGlyphAtlasPipeline()

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

Definition at line 1197 of file content_context.cc.

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

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

◆ GetLazyGlyphAtlas()

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

Definition at line 257 of file content_context.h.

257 {
258 return lazy_glyph_atlas_;
259 }

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

◆ GetLinearGradientFillPipeline()

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

Definition at line 1031 of file content_context.cc.

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

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 1051 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 1036 of file content_context.cc.

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

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1183 of file content_context.cc.

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

◆ GetLinePipeline()

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

Definition at line 1542 of file content_context.cc.

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

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

◆ GetModulateBlendPipeline()

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

Definition at line 1337 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1173 of file content_context.cc.

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

◆ GetPlusBlendPipeline()

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

Definition at line 1332 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1217 of file content_context.cc.

1219 {
1220 switch (mode) {
1221 case BlendMode::kClear:
1222 return GetClearBlendPipeline(opts);
1223 case BlendMode::kSrc:
1224 return GetSourceBlendPipeline(opts);
1225 case BlendMode::kDst:
1226 return GetDestinationBlendPipeline(opts);
1228 return GetSourceOverBlendPipeline(opts);
1231 case BlendMode::kSrcIn:
1232 return GetSourceInBlendPipeline(opts);
1233 case BlendMode::kDstIn:
1234 return GetDestinationInBlendPipeline(opts);
1235 case BlendMode::kSrcOut:
1236 return GetSourceOutBlendPipeline(opts);
1237 case BlendMode::kDstOut:
1238 return GetDestinationOutBlendPipeline(opts);
1240 return GetSourceATopBlendPipeline(opts);
1243 case BlendMode::kXor:
1244 return GetXorBlendPipeline(opts);
1245 case BlendMode::kPlus:
1246 return GetPlusBlendPipeline(opts);
1248 return GetModulateBlendPipeline(opts);
1249 case BlendMode::kScreen:
1250 return GetScreenBlendPipeline(opts);
1252 case BlendMode::kDarken:
1261 case BlendMode::kHue:
1263 case BlendMode::kColor:
1265 VALIDATION_LOG << "Invalid porter duff blend mode "
1266 << BlendModeToString(mode);
1267 return GetClearBlendPipeline(opts);
1268 break;
1269 }
1270}
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
const char * BlendModeToString(BlendMode blend_mode)
Definition color.cc:45

References impeller::BlendModeToString(), GetClearBlendPipeline(), GetDestinationATopBlendPipeline(), GetDestinationBlendPipeline(), GetDestinationInBlendPipeline(), GetDestinationOutBlendPipeline(), GetDestinationOverBlendPipeline(), GetModulateBlendPipeline(), GetPlusBlendPipeline(), GetScreenBlendPipeline(), GetSourceATopBlendPipeline(), GetSourceBlendPipeline(), GetSourceInBlendPipeline(), GetSourceOutBlendPipeline(), GetSourceOverBlendPipeline(), GetXorBlendPipeline(), impeller::kClear, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kDarken, impeller::kDifference, impeller::kDst, impeller::kDstATop, impeller::kDstIn, impeller::kDstOut, impeller::kDstOver, impeller::kExclusion, impeller::kHardLight, impeller::kHue, impeller::kLighten, impeller::kLuminosity, impeller::kModulate, impeller::kMultiply, impeller::kOverlay, impeller::kPlus, impeller::kSaturation, impeller::kScreen, impeller::kSoftLight, impeller::kSrc, impeller::kSrcATop, impeller::kSrcIn, impeller::kSrcOut, impeller::kSrcOver, impeller::kXor, and VALIDATION_LOG.

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

◆ GetRadialGradientFillPipeline()

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

Definition at line 1107 of file content_context.cc.

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

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 1057 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 1041 of file content_context.cc.

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

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1128 of file content_context.cc.

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

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

◆ GetRSuperellipseBlurPipeline()

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

Definition at line 1133 of file content_context.cc.

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

◆ GetScreenBlendPipeline()

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

Definition at line 1342 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1143 of file content_context.cc.

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

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1317 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1277 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1297 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1307 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1287 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1188 of file content_context.cc.

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

◆ GetSweepGradientFillPipeline()

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

Definition at line 1138 of file content_context.cc.

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

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1101 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 1046 of file content_context.cc.

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

◆ GetTessellator()

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

Definition at line 967 of file content_context.cc.

967 {
968 return *tessellator_;
969}

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

◆ GetTextShadowCache()

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

Definition at line 324 of file content_context.h.

324{ return *text_shadow_cache_; }

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

◆ GetTexturePipeline()

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

Definition at line 1148 of file content_context.cc.

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

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1153 of file content_context.cc.

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

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

◆ GetTiledTexturePipeline()

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

Definition at line 1158 of file content_context.cc.

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

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

◆ GetTransientsDataBuffer()

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

◆ GetTransientsIndexesBuffer()

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

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

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

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

Definition at line 310 of file content_context.h.

310 {
311 return *indexes_host_buffer_;
312 }

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

◆ GetUberSDFPipeline()

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

Definition at line 1207 of file content_context.cc.

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

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

◆ GetXorBlendPipeline()

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

Definition at line 1327 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1202 of file content_context.cc.

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

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 883 of file content_context.cc.

883 {
884 return is_valid_;
885}

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

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

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

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

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

◆ RemoveCachedTexture()

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

Remove a cached texture for the given image.

Definition at line 1601 of file content_context.cc.

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

References image.

◆ ResetTransientsBuffers()

void impeller::ContentContext::ResetTransientsBuffers ( )

Resets the transients buffers held onto by the content context.

Definition at line 1011 of file content_context.cc.

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

◆ SetCachedTexture()

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

Set a cached texture for the given image.

Definition at line 1590 of file content_context.cc.

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

References image, and texture.

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

◆ SetTextureCachingEnabled()

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

Enable or disable texture caching.

Definition at line 1569 of file content_context.cc.

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

◆ SetTransientsDataBuffer()

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

Definition at line 333 of file content_context.h.

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

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

◆ SetTransientsIndexesBuffer()

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

Definition at line 328 of file content_context.h.

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

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


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