5 #ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_CONTENT_CONTEXT_H_
8 #include <initializer_list>
11 #include <unordered_map>
14 #include "flutter/fml/logging.h"
15 #include "flutter/fml/status_or.h"
136 class RenderTargetCache;
141 std::shared_ptr<Context> context,
142 std::shared_ptr<TypographerContext> typographer_context,
143 std::shared_ptr<RenderTargetAllocator> render_target_allocator =
nullptr);
229 #ifdef IMPELLER_ENABLE_OPENGLES
250 std::string_view label,
252 const std::shared_ptr<CommandBuffer>& command_buffer,
254 bool msaa_enabled =
true,
255 bool depth_stencil_enabled =
false,
256 int32_t mip_count = 1)
const;
260 std::string_view label,
262 const std::shared_ptr<CommandBuffer>& command_buffer,
266 return lazy_glyph_atlas_;
270 return render_target_cache_;
283 const std::string& unique_entrypoint_name,
286 create_callback)
const;
291 const std::string& unique_entrypoint_name)
const;
304 host_buffer_ = std::move(host_buffer);
308 std::shared_ptr<Context> context_;
309 std::shared_ptr<LazyGlyphAtlas> lazy_glyph_atlas_;
317 void InitializeCommonlyUsedShadersIfNeeded()
const;
319 struct RuntimeEffectPipelineKey {
320 std::string unique_entrypoint_name;
324 std::size_t
operator()(
const RuntimeEffectPipelineKey& key)
const {
325 return fml::HashCombine(key.unique_entrypoint_name,
326 key.options.ToKey());
332 const RuntimeEffectPipelineKey& rhs)
const {
333 return lhs.unique_entrypoint_name == rhs.unique_entrypoint_name &&
334 lhs.options.ToKey() == rhs.options.ToKey();
339 mutable std::unordered_map<RuntimeEffectPipelineKey,
340 std::shared_ptr<Pipeline<PipelineDescriptor>>,
341 RuntimeEffectPipelineKey::Hash,
342 RuntimeEffectPipelineKey::Equal>
343 runtime_effect_pipelines_;
348 bool is_valid_ =
false;
349 std::shared_ptr<Tessellator> tessellator_;
350 std::shared_ptr<RenderTargetAllocator> render_target_cache_;
351 std::shared_ptr<HostBuffer> host_buffer_;
352 std::shared_ptr<Texture> empty_texture_;
353 std::unique_ptr<TextShadowCache> text_shadow_cache_;
PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
void ClearCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name) const
PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendOverlayPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorDodgePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorBurnPipeline(ContentContextOptions opts) const
void SetTransientsBuffer(std::shared_ptr< HostBuffer > host_buffer)
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
std::shared_ptr< Texture > GetEmptyTexture() const
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetScreenBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetLinePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendLuminosityPipeline(ContentContextOptions opts) const
PipelineRef GetPlusBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFastGradientPipeline(ContentContextOptions opts) const
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() const
ContentContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::shared_ptr< RenderTargetAllocator > render_target_allocator=nullptr)
PipelineRef GetSolidFillPipeline(ContentContextOptions opts) 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...
const Capabilities & GetDeviceCapabilities() const
PipelineRef GetModulateBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendHardLightPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorDodgePipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetBlendSoftLightPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetTextureStrictSrcPipeline(ContentContextOptions opts) const
PipelineRef GetCachedRuntimeEffectPipeline(const std::string &unique_entrypoint_name, const ContentContextOptions &options, const std::function< std::shared_ptr< Pipeline< PipelineDescriptor >>()> &create_callback) const
PipelineRef GetRadialGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetBlendColorBurnPipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetLinearGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendScreenPipeline(ContentContextOptions opts) const
PipelineRef GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const
PipelineRef GetRadialGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientUniformFillPipeline(ContentContextOptions opts, ConicalKind kind) const
PipelineRef GetRadialGradientUniformFillPipeline(ContentContextOptions opts) const
PipelineRef GetSweepGradientFillPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendExclusionPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendDarkenPipeline(ContentContextOptions opts) const
PipelineRef GetBlendSaturationPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendLightenPipeline(ContentContextOptions opts) const
PipelineRef GetMorphologyFilterPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendSaturationPipeline(ContentContextOptions opts) const
PipelineRef GetBlendDifferencePipeline(ContentContextOptions opts) const
PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBlendHuePipeline(ContentContextOptions opts) const
PipelineRef GetSrgbToLinearFilterPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOutBlendPipeline(ContentContextOptions opts) const
PipelineRef GetYUVToRGBFilterPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendDifferencePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendHuePipeline(ContentContextOptions opts) const
PipelineRef GetSourceATopBlendPipeline(ContentContextOptions opts) const
PipelineRef GetXorBlendPipeline(ContentContextOptions opts) const
PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const
PipelineRef GetClipPipeline(ContentContextOptions opts) const
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBlendScreenPipeline(ContentContextOptions opts) const
std::function< bool(const ContentContext &, RenderPass &)> SubpassCallback
PipelineRef GetBlendDarkenPipeline(ContentContextOptions opts) const
PipelineRef GetSourceBlendPipeline(ContentContextOptions opts) const
PipelineRef GetLinearToSrgbFilterPipeline(ContentContextOptions opts) const
TextShadowCache & GetTextShadowCache() const
PipelineRef GetBlendOverlayPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationBlendPipeline(ContentContextOptions opts) const
PipelineRef GetDestinationOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendMultiplyPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientSSBOFillPipeline(ContentContextOptions opts, ConicalKind kind) const
Tessellator & GetTessellator() const
PipelineRef GetBlendLightenPipeline(ContentContextOptions opts) const
PipelineRef GetBlendMultiplyPipeline(ContentContextOptions opts) const
PipelineRef GetSourceOverBlendPipeline(ContentContextOptions opts) const
PipelineRef GetBlendExclusionPipeline(ContentContextOptions opts) const
PipelineRef GetColorMatrixColorFilterPipeline(ContentContextOptions opts) const
PipelineRef GetConicalGradientFillPipeline(ContentContextOptions opts, ConicalKind kind) const
std::shared_ptr< Context > GetContext() const
PipelineRef GetDestinationInBlendPipeline(ContentContextOptions opts) const
PipelineRef GetRSuperellipseBlurPipeline(ContentContextOptions opts) const
PipelineRef GetBorderMaskBlurPipeline(ContentContextOptions opts) const
PipelineRef GetDrawVerticesUberPipeline(BlendMode blend_mode, ContentContextOptions opts) const
Render passes encode render commands directed as one specific render target into an underlying comman...
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
A cache for blurred text that re-uses these across frames.
std::vector< std::pair< uint64_t, std::unique_ptr< GenericRenderPipelineHandle > > > pipelines_
PrimitiveType
Decides how backend draws pixels based on input vertices.
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
@ kAlways
Comparison test passes always passes.
bool operator()(const RuntimeEffectPipelineKey &lhs, const RuntimeEffectPipelineKey &rhs) const
std::size_t operator()(const RuntimeEffectPipelineKey &key) const
PrimitiveType primitive_type
bool has_depth_stencil_attachments
void ApplyToPipelineDescriptor(PipelineDescriptor &desc) const
constexpr uint64_t ToKey() const
PixelFormat color_attachment_pixel_format
@ kOverdrawPreventionRestore
@ kOverdrawPreventionIncrement
bool is_for_rrect_blur_clear
CompareFunction depth_compare