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

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

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

References GetContext().

◆ ClearCachedTextures()

void impeller::ContentContext::ClearCachedTextures ( ) const

Clear all cached textures.

Definition at line 1598 of file content_context.cc.

1598 {
1599 texture_cache_.clear();
1600}

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

◆ GetBlendColorBurnPipeline()

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

Definition at line 1345 of file content_context.cc.

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

◆ GetBlendColorDodgePipeline()

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

Definition at line 1350 of file content_context.cc.

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

◆ GetBlendColorPipeline()

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

Definition at line 1340 of file content_context.cc.

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

◆ GetBlendDarkenPipeline()

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

Definition at line 1355 of file content_context.cc.

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

◆ GetBlendDifferencePipeline()

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

Definition at line 1360 of file content_context.cc.

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

◆ GetBlendExclusionPipeline()

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

Definition at line 1365 of file content_context.cc.

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

◆ GetBlendHardLightPipeline()

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

Definition at line 1370 of file content_context.cc.

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

◆ GetBlendHuePipeline()

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

Definition at line 1375 of file content_context.cc.

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

◆ GetBlendLightenPipeline()

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

Definition at line 1380 of file content_context.cc.

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

◆ GetBlendLuminosityPipeline()

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

Definition at line 1385 of file content_context.cc.

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

◆ GetBlendMultiplyPipeline()

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

Definition at line 1390 of file content_context.cc.

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

◆ GetBlendOverlayPipeline()

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

Definition at line 1395 of file content_context.cc.

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

◆ GetBlendSaturationPipeline()

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

Definition at line 1400 of file content_context.cc.

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

◆ GetBlendScreenPipeline()

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

Definition at line 1405 of file content_context.cc.

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

◆ GetBlendSoftLightPipeline()

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

Definition at line 1410 of file content_context.cc.

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

◆ GetBorderMaskBlurPipeline()

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

Definition at line 1166 of file content_context.cc.

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

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

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

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

1570 {
1571 if (!image) {
1572 return nullptr;
1573 }
1574 if (is_texture_caching_enabled_) {
1575 auto it = texture_cache_.find(image);
1576 if (it != texture_cache_.end()) {
1577 return it->second;
1578 }
1579 }
1580 return nullptr;
1581}
FlutterVulkanImage * image

References image.

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

◆ GetCirclePipeline()

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

Definition at line 1530 of file content_context.cc.

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

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

◆ GetClearBlendPipeline()

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

Definition at line 1265 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetClipPipeline()

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

Definition at line 1191 of file content_context.cc.

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

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

◆ GetColorMatrixColorFilterPipeline()

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

Definition at line 1176 of file content_context.cc.

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

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

◆ GetConicalGradientFillPipeline()

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

Definition at line 1110 of file content_context.cc.

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

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

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 1080 of file content_context.cc.

1082 {
1083 FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
1084 switch (kind) {
1086 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill, opts);
1088 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_radial,
1089 opts);
1091 return GetPipeline(this, pipelines_->conical_gradient_ssbo_fill_strip,
1092 opts);
1094 return GetPipeline(
1095 this, pipelines_->conical_gradient_ssbo_fill_strip_and_radial, opts);
1096 }
1097}
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 1061 of file content_context.cc.

1063 {
1064 switch (kind) {
1066 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill, opts);
1068 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_radial,
1069 opts);
1071 return GetPipeline(this, pipelines_->conical_gradient_uniform_fill_strip,
1072 opts);
1074 return GetPipeline(
1075 this, pipelines_->conical_gradient_uniform_fill_strip_and_radial,
1076 opts);
1077 }
1078}

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

◆ GetContext()

◆ GetDestinationATopBlendPipeline()

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

Definition at line 1315 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationBlendPipeline()

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

Definition at line 1275 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationInBlendPipeline()

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

Definition at line 1295 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOutBlendPipeline()

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

Definition at line 1305 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDestinationOverBlendPipeline()

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

Definition at line 1285 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetDeviceCapabilities()

◆ GetDownsampleBoundedPipeline()

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

Definition at line 1420 of file content_context.cc.

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

◆ GetDownsamplePipeline()

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

Definition at line 1415 of file content_context.cc.

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

◆ GetDrawShadowVerticesPipeline()

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

Definition at line 1515 of file content_context.cc.

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

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

◆ GetDrawVerticesUberPipeline()

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

Definition at line 1520 of file content_context.cc.

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

References impeller::kHardLight.

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

◆ GetEmptyTexture()

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

Definition at line 885 of file content_context.cc.

885 {
886 return empty_texture_;
887}

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

◆ GetFastGradientPipeline()

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

Definition at line 1024 of file content_context.cc.

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

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 1431 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 1437 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 1425 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

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

Definition at line 1443 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

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

Definition at line 1449 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

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

Definition at line 1455 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

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

Definition at line 1461 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

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

Definition at line 1467 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

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

Definition at line 1473 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

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

Definition at line 1479 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 1485 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 1491 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 1497 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 1503 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 1509 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

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

Definition at line 1161 of file content_context.cc.

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

◆ GetGlyphAtlasPipeline()

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

Definition at line 1195 of file content_context.cc.

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

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

◆ GetLazyGlyphAtlas()

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

Definition at line 256 of file content_context.h.

256 {
257 return lazy_glyph_atlas_;
258 }

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

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

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 1049 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetLinearGradientUniformFillPipeline()

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

Definition at line 1034 of file content_context.cc.

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

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 1181 of file content_context.cc.

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

◆ GetLinePipeline()

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

Definition at line 1535 of file content_context.cc.

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

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

◆ GetModulateBlendPipeline()

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

Definition at line 1330 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetMorphologyFilterPipeline()

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

Definition at line 1171 of file content_context.cc.

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

◆ GetPlusBlendPipeline()

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

Definition at line 1325 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetPorterDuffPipeline()

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

Definition at line 1210 of file content_context.cc.

1212 {
1213 switch (mode) {
1214 case BlendMode::kClear:
1215 return GetClearBlendPipeline(opts);
1216 case BlendMode::kSrc:
1217 return GetSourceBlendPipeline(opts);
1218 case BlendMode::kDst:
1219 return GetDestinationBlendPipeline(opts);
1221 return GetSourceOverBlendPipeline(opts);
1224 case BlendMode::kSrcIn:
1225 return GetSourceInBlendPipeline(opts);
1226 case BlendMode::kDstIn:
1227 return GetDestinationInBlendPipeline(opts);
1228 case BlendMode::kSrcOut:
1229 return GetSourceOutBlendPipeline(opts);
1230 case BlendMode::kDstOut:
1231 return GetDestinationOutBlendPipeline(opts);
1233 return GetSourceATopBlendPipeline(opts);
1236 case BlendMode::kXor:
1237 return GetXorBlendPipeline(opts);
1238 case BlendMode::kPlus:
1239 return GetPlusBlendPipeline(opts);
1241 return GetModulateBlendPipeline(opts);
1242 case BlendMode::kScreen:
1243 return GetScreenBlendPipeline(opts);
1245 case BlendMode::kDarken:
1254 case BlendMode::kHue:
1256 case BlendMode::kColor:
1258 VALIDATION_LOG << "Invalid porter duff blend mode "
1259 << BlendModeToString(mode);
1260 return GetClearBlendPipeline(opts);
1261 break;
1262 }
1263}
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 1105 of file content_context.cc.

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

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 1055 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetRadialGradientUniformFillPipeline()

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

Definition at line 1039 of file content_context.cc.

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

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

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

Definition at line 1126 of file content_context.cc.

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

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

◆ GetRSuperellipseBlurPipeline()

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

Definition at line 1131 of file content_context.cc.

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

◆ GetScreenBlendPipeline()

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

Definition at line 1335 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSolidFillPipeline()

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

Definition at line 1141 of file content_context.cc.

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

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

◆ GetSourceATopBlendPipeline()

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

Definition at line 1310 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceBlendPipeline()

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

Definition at line 1270 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceInBlendPipeline()

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

Definition at line 1290 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceOutBlendPipeline()

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

Definition at line 1300 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSourceOverBlendPipeline()

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

Definition at line 1280 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetSrgbToLinearFilterPipeline()

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

Definition at line 1186 of file content_context.cc.

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

◆ GetSweepGradientFillPipeline()

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

Definition at line 1136 of file content_context.cc.

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

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 1099 of file content_context.cc.

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

References FML_DCHECK, and GetDeviceCapabilities().

◆ GetSweepGradientUniformFillPipeline()

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

Definition at line 1044 of file content_context.cc.

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

◆ GetTessellator()

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

Definition at line 965 of file content_context.cc.

965 {
966 return *tessellator_;
967}

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

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

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 1151 of file content_context.cc.

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

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

◆ GetTiledTexturePipeline()

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

Definition at line 1156 of file content_context.cc.

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

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

309 {
310 return *indexes_host_buffer_;
311 }

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

◆ GetUberSDFPipeline()

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

Definition at line 1205 of file content_context.cc.

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

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

◆ GetXorBlendPipeline()

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

Definition at line 1320 of file content_context.cc.

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

Referenced by GetPorterDuffPipeline().

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 1200 of file content_context.cc.

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

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 881 of file content_context.cc.

881 {
882 return is_valid_;
883}

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

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

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

◆ RemoveCachedTexture()

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

Remove a cached texture for the given image.

Definition at line 1594 of file content_context.cc.

1594 {
1595 texture_cache_.erase(image);
1596}

References image.

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

◆ ResetTransientsBuffers()

void impeller::ContentContext::ResetTransientsBuffers ( )

Resets the transients buffers held onto by the content context.

Definition at line 1009 of file content_context.cc.

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

Referenced by impeller::RenderToTarget().

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

1585 {
1586 if (!image || !texture) {
1587 return;
1588 }
1589 if (is_texture_caching_enabled_) {
1590 texture_cache_[image] = texture;
1591 }
1592}
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 1562 of file content_context.cc.

1562 {
1563 is_texture_caching_enabled_ = enabled;
1564 if (!enabled) {
1565 texture_cache_.clear();
1566 }
1567}

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

◆ SetTransientsDataBuffer()

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

Definition at line 332 of file content_context.h.

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

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

◆ SetTransientsIndexesBuffer()

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

Definition at line 327 of file content_context.h.

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

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


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