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>
136class RenderTargetCache;
141 std::shared_ptr<Context> context,
142 std::shared_ptr<TypographerContext> typographer_context,
143 std::shared_ptr<RenderTargetAllocator> render_target_allocator =
nullptr);
230#ifdef IMPELLER_ENABLE_OPENGLES
251 std::string_view label,
253 const std::shared_ptr<CommandBuffer>& command_buffer,
255 bool msaa_enabled =
true,
256 bool depth_stencil_enabled =
false,
257 int32_t mip_count = 1)
const;
261 std::string_view label,
263 const std::shared_ptr<CommandBuffer>& command_buffer,
267 return lazy_glyph_atlas_;
271 return render_target_cache_;
284 const std::string& unique_entrypoint_name,
287 create_callback)
const;
292 const std::string& unique_entrypoint_name)
const;
303 return *indexes_host_buffer_;
321 indexes_host_buffer_ = std::move(host_buffer);
326 data_host_buffer_ = std::move(host_buffer);
330 std::shared_ptr<Context> context_;
331 std::shared_ptr<LazyGlyphAtlas> lazy_glyph_atlas_;
339 void InitializeCommonlyUsedShadersIfNeeded()
const;
341 struct RuntimeEffectPipelineKey {
342 std::string unique_entrypoint_name;
348 key.options.ToKey());
354 const RuntimeEffectPipelineKey& rhs)
const {
355 return lhs.unique_entrypoint_name == rhs.unique_entrypoint_name &&
356 lhs.options.ToKey() == rhs.options.ToKey();
361 mutable std::unordered_map<RuntimeEffectPipelineKey,
362 std::shared_ptr<Pipeline<PipelineDescriptor>>,
363 RuntimeEffectPipelineKey::Hash,
364 RuntimeEffectPipelineKey::Equal>
365 runtime_effect_pipelines_;
370 bool is_valid_ =
false;
371 std::shared_ptr<Tessellator> tessellator_;
372 std::shared_ptr<RenderTargetAllocator> render_target_cache_;
373 std::shared_ptr<HostBuffer> data_host_buffer_;
374 std::shared_ptr<HostBuffer> indexes_host_buffer_;
375 std::shared_ptr<Texture> empty_texture_;
376 std::unique_ptr<TextShadowCache> text_shadow_cache_;
PipelineRef GetBlendLuminosityPipeline(ContentContextOptions opts) const
PipelineRef GetTiledTexturePipeline(ContentContextOptions opts) const
PipelineRef GetFramebufferBlendColorPipeline(ContentContextOptions opts) const
PipelineRef GetDownsamplePipeline(ContentContextOptions opts) const
PipelineRef GetSourceInBlendPipeline(ContentContextOptions opts) const
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
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
PipelineRef GetPorterDuffPipeline(BlendMode mode, ContentContextOptions opts) const
std::shared_ptr< Texture > GetEmptyTexture() const
PipelineRef GetSourceOutBlendPipeline(ContentContextOptions opts) const
void SetTransientsDataBuffer(std::shared_ptr< HostBuffer > host_buffer)
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< RenderTargetAllocator > & GetRenderTargetCache() const
void ResetTransientsBuffers()
Resets the transients buffers held onto by the content context.
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas() const
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 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
TextShadowCache & GetTextShadowCache() const
PipelineRef GetTexturePipeline(ContentContextOptions opts) const
PipelineRef GetBlendHardLightPipeline(ContentContextOptions opts) const
PipelineRef GetClearBlendPipeline(ContentContextOptions opts) const
PipelineRef GetCirclePipeline(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 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
void SetTransientsIndexesBuffer(std::shared_ptr< HostBuffer > host_buffer)
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
HostBuffer & GetTransientsIndexesBuffer() const
Retrieve the current host buffer for transient storage of indexes used for indexed draws.
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
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
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
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_
constexpr std::size_t HashCombine()
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