Flutter Impeller
impeller::ContentContext Class Reference

#include <content_context.h>

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
 
std::shared_ptr< TessellatorGetTessellator () const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFastGradientPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearGradientFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearGradientSSBOFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRadialGradientSSBOFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetConicalGradientSSBOFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSweepGradientSSBOFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRadialGradientFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetConicalGradientFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRRectBlurPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSweepGradientFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSolidFillPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTexturePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTextureStrictSrcPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetTiledTexturePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGaussianBlurPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBorderMaskBlurPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetMorphologyFilterPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetColorMatrixColorFilterPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetLinearToSrgbFilterPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetSrgbToLinearFilterPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetClipPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetGlyphAtlasPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetYUVToRGBFilterPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetPorterDuffBlendPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorBurnPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendColorDodgePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendDarkenPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendDifferencePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendExclusionPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendHardLightPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendHuePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendLightenPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendLuminosityPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendMultiplyPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendOverlayPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendSaturationPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendScreenPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetBlendSoftLightPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorBurnPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendColorDodgePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendDarkenPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendDifferencePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendExclusionPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendHardLightPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendHuePipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendLightenPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendLuminosityPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendMultiplyPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendOverlayPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendSaturationPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendScreenPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetFramebufferBlendSoftLightPipeline (ContentContextOptions opts) const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > GetDrawVerticesUberShader (ContentContextOptions opts) const
 
std::shared_ptr< TextureGetEmptyTexture () const
 
std::shared_ptr< ContextGetContext () const
 
const CapabilitiesGetDeviceCapabilities () const
 
void SetWireframe (bool wireframe)
 
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. More...
 
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. More...
 
const std::shared_ptr< LazyGlyphAtlas > & GetLazyGlyphAtlas () const
 
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache () const
 
std::shared_ptr< Pipeline< PipelineDescriptor > > 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
 
HostBufferGetTransientsBuffer () const
 Retrieve the currnent host buffer for transient storage. More...
 

Detailed Description

Definition at line 366 of file content_context.h.

Member Typedef Documentation

◆ SubpassCallback

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

245  : context_(std::move(context)),
246  lazy_glyph_atlas_(
247  std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
248  tessellator_(std::make_shared<Tessellator>()),
249 #if IMPELLER_ENABLE_3D
250  scene_context_(std::make_shared<scene::SceneContext>(context_)),
251 #endif // IMPELLER_ENABLE_3D
252  render_target_cache_(render_target_allocator == nullptr
253  ? std::make_shared<RenderTargetCache>(
254  context_->GetResourceAllocator())
255  : std::move(render_target_allocator)),
256  host_buffer_(HostBuffer::Create(context_->GetResourceAllocator())) {
257  if (!context_ || !context_->IsValid()) {
258  return;
259  }
260 
261  {
262  TextureDescriptor desc;
263  desc.storage_mode = StorageMode::kHostVisible;
264  desc.format = PixelFormat::kR8G8B8A8UNormInt;
265  desc.size = ISize{1, 1};
266  empty_texture_ = GetContext()->GetResourceAllocator()->CreateTexture(desc);
268  auto cmd_buffer = GetContext()->CreateCommandBuffer();
269  auto blit_pass = cmd_buffer->CreateBlitPass();
270  auto& host_buffer = GetTransientsBuffer();
271  auto buffer_view = host_buffer.Emplace(data);
272  blit_pass->AddCopy(buffer_view, empty_texture_);
273 
274  if (!blit_pass->EncodeCommands(GetContext()->GetResourceAllocator()) ||
275  !GetContext()
276  ->GetCommandQueue()
277  ->Submit({std::move(cmd_buffer)})
278  .ok()) {
279  VALIDATION_LOG << "Failed to create empty texture.";
280  }
281  }
282 
283  auto options = ContentContextOptions{
284  .sample_count = SampleCount::kCount4,
285  .color_attachment_pixel_format =
286  context_->GetCapabilities()->GetDefaultColorFormat()};
287  auto options_trianglestrip = ContentContextOptions{
288  .sample_count = SampleCount::kCount4,
289  .primitive_type = PrimitiveType::kTriangleStrip,
290  .color_attachment_pixel_format =
291  context_->GetCapabilities()->GetDefaultColorFormat()};
292  const auto supports_decal = static_cast<Scalar>(
293  context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
294 
295  {
296  solid_fill_pipelines_.CreateDefault(*context_, options);
297  texture_pipelines_.CreateDefault(*context_, options);
298  fast_gradient_pipelines_.CreateDefault(*context_, options);
299 
300  if (context_->GetCapabilities()->SupportsSSBO()) {
301  linear_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
302  radial_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
303  conical_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
304  sweep_gradient_ssbo_fill_pipelines_.CreateDefault(*context_, options);
305  } else {
306  linear_gradient_fill_pipelines_.CreateDefault(*context_, options);
307  radial_gradient_fill_pipelines_.CreateDefault(*context_, options);
308  conical_gradient_fill_pipelines_.CreateDefault(*context_, options);
309  sweep_gradient_fill_pipelines_.CreateDefault(*context_, options);
310  }
311 
312  /// Setup default clip pipeline.
313 
314  auto clip_pipeline_descriptor =
316  if (!clip_pipeline_descriptor.has_value()) {
317  return;
318  }
319  ContentContextOptions{
320  .sample_count = SampleCount::kCount4,
321  .color_attachment_pixel_format =
322  context_->GetCapabilities()->GetDefaultColorFormat()}
323  .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
324  // Disable write to all color attachments.
325  auto clip_color_attachments =
326  clip_pipeline_descriptor->GetColorAttachmentDescriptors();
327  for (auto& color_attachment : clip_color_attachments) {
328  color_attachment.second.write_mask = ColorWriteMaskBits::kNone;
329  }
330  clip_pipeline_descriptor->SetColorAttachmentDescriptors(
331  std::move(clip_color_attachments));
332  clip_pipelines_.SetDefault(
333  options,
334  std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
335  }
336 
337  if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
338  framebuffer_blend_color_pipelines_.CreateDefault(
339  *context_, options_trianglestrip,
340  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
341  framebuffer_blend_colorburn_pipelines_.CreateDefault(
342  *context_, options_trianglestrip,
343  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
344  framebuffer_blend_colordodge_pipelines_.CreateDefault(
345  *context_, options_trianglestrip,
346  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
347  framebuffer_blend_darken_pipelines_.CreateDefault(
348  *context_, options_trianglestrip,
349  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
350  framebuffer_blend_difference_pipelines_.CreateDefault(
351  *context_, options_trianglestrip,
352  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
353  framebuffer_blend_exclusion_pipelines_.CreateDefault(
354  *context_, options_trianglestrip,
355  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
356  framebuffer_blend_hardlight_pipelines_.CreateDefault(
357  *context_, options_trianglestrip,
358  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
359  framebuffer_blend_hue_pipelines_.CreateDefault(
360  *context_, options_trianglestrip,
361  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
362  framebuffer_blend_lighten_pipelines_.CreateDefault(
363  *context_, options_trianglestrip,
364  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
365  framebuffer_blend_luminosity_pipelines_.CreateDefault(
366  *context_, options_trianglestrip,
367  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
368  framebuffer_blend_multiply_pipelines_.CreateDefault(
369  *context_, options_trianglestrip,
370  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
371  framebuffer_blend_overlay_pipelines_.CreateDefault(
372  *context_, options_trianglestrip,
373  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
374  framebuffer_blend_saturation_pipelines_.CreateDefault(
375  *context_, options_trianglestrip,
376  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
377  framebuffer_blend_screen_pipelines_.CreateDefault(
378  *context_, options_trianglestrip,
379  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
380  framebuffer_blend_softlight_pipelines_.CreateDefault(
381  *context_, options_trianglestrip,
382  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
383  } else {
384  blend_color_pipelines_.CreateDefault(
385  *context_, options_trianglestrip,
386  {static_cast<Scalar>(BlendSelectValues::kColor), supports_decal});
387  blend_colorburn_pipelines_.CreateDefault(
388  *context_, options_trianglestrip,
389  {static_cast<Scalar>(BlendSelectValues::kColorBurn), supports_decal});
390  blend_colordodge_pipelines_.CreateDefault(
391  *context_, options_trianglestrip,
392  {static_cast<Scalar>(BlendSelectValues::kColorDodge), supports_decal});
393  blend_darken_pipelines_.CreateDefault(
394  *context_, options_trianglestrip,
395  {static_cast<Scalar>(BlendSelectValues::kDarken), supports_decal});
396  blend_difference_pipelines_.CreateDefault(
397  *context_, options_trianglestrip,
398  {static_cast<Scalar>(BlendSelectValues::kDifference), supports_decal});
399  blend_exclusion_pipelines_.CreateDefault(
400  *context_, options_trianglestrip,
401  {static_cast<Scalar>(BlendSelectValues::kExclusion), supports_decal});
402  blend_hardlight_pipelines_.CreateDefault(
403  *context_, options_trianglestrip,
404  {static_cast<Scalar>(BlendSelectValues::kHardLight), supports_decal});
405  blend_hue_pipelines_.CreateDefault(
406  *context_, options_trianglestrip,
407  {static_cast<Scalar>(BlendSelectValues::kHue), supports_decal});
408  blend_lighten_pipelines_.CreateDefault(
409  *context_, options_trianglestrip,
410  {static_cast<Scalar>(BlendSelectValues::kLighten), supports_decal});
411  blend_luminosity_pipelines_.CreateDefault(
412  *context_, options_trianglestrip,
413  {static_cast<Scalar>(BlendSelectValues::kLuminosity), supports_decal});
414  blend_multiply_pipelines_.CreateDefault(
415  *context_, options_trianglestrip,
416  {static_cast<Scalar>(BlendSelectValues::kMultiply), supports_decal});
417  blend_overlay_pipelines_.CreateDefault(
418  *context_, options_trianglestrip,
419  {static_cast<Scalar>(BlendSelectValues::kOverlay), supports_decal});
420  blend_saturation_pipelines_.CreateDefault(
421  *context_, options_trianglestrip,
422  {static_cast<Scalar>(BlendSelectValues::kSaturation), supports_decal});
423  blend_screen_pipelines_.CreateDefault(
424  *context_, options_trianglestrip,
425  {static_cast<Scalar>(BlendSelectValues::kScreen), supports_decal});
426  blend_softlight_pipelines_.CreateDefault(
427  *context_, options_trianglestrip,
428  {static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
429  }
430 
431  rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
432  texture_strict_src_pipelines_.CreateDefault(*context_, options);
433  tiled_texture_pipelines_.CreateDefault(*context_, options, {supports_decal});
434  gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
435  {supports_decal});
436  border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
437  morphology_filter_pipelines_.CreateDefault(*context_, options_trianglestrip,
438  {supports_decal});
439  color_matrix_color_filter_pipelines_.CreateDefault(*context_,
440  options_trianglestrip);
441  linear_to_srgb_filter_pipelines_.CreateDefault(*context_,
442  options_trianglestrip);
443  srgb_to_linear_filter_pipelines_.CreateDefault(*context_,
444  options_trianglestrip);
445  glyph_atlas_pipelines_.CreateDefault(
446  *context_, options,
447  {static_cast<Scalar>(
448  GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
450  yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip);
451  porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
452  {supports_decal});
453  vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
454  // GLES only shader that is unsupported on macOS.
455 #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX)
456  if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
457  tiled_texture_external_pipelines_.CreateDefault(*context_, options);
458  }
459 #endif // IMPELLER_ENABLE_OPENGLES
460 
461  is_valid_ = true;
462  InitializeCommonlyUsedShadersIfNeeded();
463 }

References impeller::Color::BlackTransparent(), buffer_view, data, impeller::TextureDescriptor::format, GetContext(), GetTransientsBuffer(), impeller::kA8UNormInt, impeller::kColor, impeller::kColorBurn, impeller::kColorDodge, impeller::kCount4, impeller::kDarken, impeller::kDifference, impeller::kExclusion, impeller::kHardLight, impeller::kHostVisible, 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::PipelineBuilder< VertexShader_, FragmentShader_ >::MakeDefaultPipelineDescriptor(), 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 579 of file content_context.cc.

580  {
581  for (auto it = runtime_effect_pipelines_.begin();
582  it != runtime_effect_pipelines_.end();) {
583  if (it->first.unique_entrypoint_name == unique_entrypoint_name) {
584  it = runtime_effect_pipelines_.erase(it);
585  } else {
586  it++;
587  }
588  }
589 }

◆ GetBlendColorBurnPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendColorBurnPipeline ( ContentContextOptions  opts) const
inline

Definition at line 523 of file content_context.h.

524  {
525  return GetPipeline(blend_colorburn_pipelines_, opts);
526  }

◆ GetBlendColorDodgePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendColorDodgePipeline ( ContentContextOptions  opts) const
inline

Definition at line 528 of file content_context.h.

529  {
530  return GetPipeline(blend_colordodge_pipelines_, opts);
531  }

◆ GetBlendColorPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendColorPipeline ( ContentContextOptions  opts) const
inline

Definition at line 518 of file content_context.h.

519  {
520  return GetPipeline(blend_color_pipelines_, opts);
521  }

◆ GetBlendDarkenPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendDarkenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 533 of file content_context.h.

534  {
535  return GetPipeline(blend_darken_pipelines_, opts);
536  }

◆ GetBlendDifferencePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendDifferencePipeline ( ContentContextOptions  opts) const
inline

Definition at line 538 of file content_context.h.

539  {
540  return GetPipeline(blend_difference_pipelines_, opts);
541  }

◆ GetBlendExclusionPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendExclusionPipeline ( ContentContextOptions  opts) const
inline

Definition at line 543 of file content_context.h.

544  {
545  return GetPipeline(blend_exclusion_pipelines_, opts);
546  }

◆ GetBlendHardLightPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendHardLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 548 of file content_context.h.

549  {
550  return GetPipeline(blend_hardlight_pipelines_, opts);
551  }

◆ GetBlendHuePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendHuePipeline ( ContentContextOptions  opts) const
inline

Definition at line 553 of file content_context.h.

554  {
555  return GetPipeline(blend_hue_pipelines_, opts);
556  }

◆ GetBlendLightenPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendLightenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 558 of file content_context.h.

559  {
560  return GetPipeline(blend_lighten_pipelines_, opts);
561  }

◆ GetBlendLuminosityPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendLuminosityPipeline ( ContentContextOptions  opts) const
inline

Definition at line 563 of file content_context.h.

564  {
565  return GetPipeline(blend_luminosity_pipelines_, opts);
566  }

◆ GetBlendMultiplyPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendMultiplyPipeline ( ContentContextOptions  opts) const
inline

Definition at line 568 of file content_context.h.

569  {
570  return GetPipeline(blend_multiply_pipelines_, opts);
571  }

◆ GetBlendOverlayPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendOverlayPipeline ( ContentContextOptions  opts) const
inline

Definition at line 573 of file content_context.h.

574  {
575  return GetPipeline(blend_overlay_pipelines_, opts);
576  }

◆ GetBlendSaturationPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendSaturationPipeline ( ContentContextOptions  opts) const
inline

Definition at line 578 of file content_context.h.

579  {
580  return GetPipeline(blend_saturation_pipelines_, opts);
581  }

◆ GetBlendScreenPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendScreenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 583 of file content_context.h.

584  {
585  return GetPipeline(blend_screen_pipelines_, opts);
586  }

◆ GetBlendSoftLightPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBlendSoftLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 588 of file content_context.h.

589  {
590  return GetPipeline(blend_softlight_pipelines_, opts);
591  }

◆ GetBorderMaskBlurPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetBorderMaskBlurPipeline ( ContentContextOptions  opts) const
inline

Definition at line 471 of file content_context.h.

472  {
473  return GetPipeline(border_mask_blur_pipelines_, opts);
474  }

◆ GetCachedRuntimeEffectPipeline()

std::shared_ptr< Pipeline< PipelineDescriptor > > 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 566 of file content_context.cc.

570  {
571  RuntimeEffectPipelineKey key{unique_entrypoint_name, options};
572  auto it = runtime_effect_pipelines_.find(key);
573  if (it == runtime_effect_pipelines_.end()) {
574  it = runtime_effect_pipelines_.insert(it, {key, create_callback()});
575  }
576  return it->second;
577 }

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

◆ GetClipPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetClipPipeline ( ContentContextOptions  opts) const
inline

Definition at line 496 of file content_context.h.

497  {
498  return GetPipeline(clip_pipelines_, opts);
499  }

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

◆ GetColorMatrixColorFilterPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetColorMatrixColorFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 482 of file content_context.h.

482  {
483  return GetPipeline(color_matrix_color_filter_pipelines_, opts);
484  }

◆ GetConicalGradientFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetConicalGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 422 of file content_context.h.

423  {
424  return GetPipeline(conical_gradient_fill_pipelines_, opts);
425  }

◆ GetConicalGradientSSBOFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetConicalGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 406 of file content_context.h.

406  {
407  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
408  return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
409  }

References GetDeviceCapabilities().

◆ GetContext()

◆ GetDeviceCapabilities()

◆ GetDrawVerticesUberShader()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetDrawVerticesUberShader ( ContentContextOptions  opts) const
inline

Definition at line 684 of file content_context.h.

685  {
686  return GetPipeline(vertices_uber_shader_, opts);
687  }

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

◆ GetEmptyTexture()

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

Definition at line 471 of file content_context.cc.

471  {
472  return empty_texture_;
473 }

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

◆ GetFastGradientPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFastGradientPipeline ( ContentContextOptions  opts) const
inline

Definition at line 383 of file content_context.h.

384  {
385  return GetPipeline(fast_gradient_pipelines_, opts);
386  }

◆ GetFramebufferBlendColorBurnPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendColorBurnPipeline ( ContentContextOptions  opts) const
inline

Definition at line 601 of file content_context.h.

601  {
602  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
603  return GetPipeline(framebuffer_blend_colorburn_pipelines_, opts);
604  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendColorDodgePipeline ( ContentContextOptions  opts) const
inline

Definition at line 607 of file content_context.h.

607  {
608  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
609  return GetPipeline(framebuffer_blend_colordodge_pipelines_, opts);
610  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendColorPipeline ( ContentContextOptions  opts) const
inline

Definition at line 595 of file content_context.h.

595  {
596  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
597  return GetPipeline(framebuffer_blend_color_pipelines_, opts);
598  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendDarkenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 613 of file content_context.h.

613  {
614  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
615  return GetPipeline(framebuffer_blend_darken_pipelines_, opts);
616  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendDifferencePipeline ( ContentContextOptions  opts) const
inline

Definition at line 619 of file content_context.h.

619  {
620  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
621  return GetPipeline(framebuffer_blend_difference_pipelines_, opts);
622  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendExclusionPipeline ( ContentContextOptions  opts) const
inline

Definition at line 625 of file content_context.h.

625  {
626  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
627  return GetPipeline(framebuffer_blend_exclusion_pipelines_, opts);
628  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendHardLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 631 of file content_context.h.

631  {
632  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
633  return GetPipeline(framebuffer_blend_hardlight_pipelines_, opts);
634  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendHuePipeline ( ContentContextOptions  opts) const
inline

Definition at line 636 of file content_context.h.

637  {
638  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
639  return GetPipeline(framebuffer_blend_hue_pipelines_, opts);
640  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendLightenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 643 of file content_context.h.

643  {
644  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
645  return GetPipeline(framebuffer_blend_lighten_pipelines_, opts);
646  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendLuminosityPipeline ( ContentContextOptions  opts) const
inline

Definition at line 649 of file content_context.h.

649  {
650  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
651  return GetPipeline(framebuffer_blend_luminosity_pipelines_, opts);
652  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendMultiplyPipeline ( ContentContextOptions  opts) const
inline

Definition at line 655 of file content_context.h.

655  {
656  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
657  return GetPipeline(framebuffer_blend_multiply_pipelines_, opts);
658  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendOverlayPipeline ( ContentContextOptions  opts) const
inline

Definition at line 661 of file content_context.h.

661  {
662  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
663  return GetPipeline(framebuffer_blend_overlay_pipelines_, opts);
664  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendSaturationPipeline ( ContentContextOptions  opts) const
inline

Definition at line 667 of file content_context.h.

667  {
668  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
669  return GetPipeline(framebuffer_blend_saturation_pipelines_, opts);
670  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendScreenPipeline ( ContentContextOptions  opts) const
inline

Definition at line 673 of file content_context.h.

673  {
674  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
675  return GetPipeline(framebuffer_blend_screen_pipelines_, opts);
676  }

References GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetFramebufferBlendSoftLightPipeline ( ContentContextOptions  opts) const
inline

Definition at line 679 of file content_context.h.

679  {
680  FML_DCHECK(GetDeviceCapabilities().SupportsFramebufferFetch());
681  return GetPipeline(framebuffer_blend_softlight_pipelines_, opts);
682  }

References GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetGaussianBlurPipeline ( ContentContextOptions  opts) const
inline

Definition at line 466 of file content_context.h.

467  {
468  return GetPipeline(gaussian_blur_pipelines_, opts);
469  }

◆ GetGlyphAtlasPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetGlyphAtlasPipeline ( ContentContextOptions  opts) const
inline

Definition at line 501 of file content_context.h.

502  {
503  return GetPipeline(glyph_atlas_pipelines_, opts);
504  }

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

◆ GetLazyGlyphAtlas()

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

◆ GetLinearGradientFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetLinearGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 388 of file content_context.h.

389  {
390  return GetPipeline(linear_gradient_fill_pipelines_, opts);
391  }

◆ GetLinearGradientSSBOFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetLinearGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 394 of file content_context.h.

394  {
395  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
396  return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
397  }

References GetDeviceCapabilities().

◆ GetLinearToSrgbFilterPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetLinearToSrgbFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 486 of file content_context.h.

487  {
488  return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
489  }

◆ GetMorphologyFilterPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetMorphologyFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 476 of file content_context.h.

477  {
478  return GetPipeline(morphology_filter_pipelines_, opts);
479  }

◆ GetPorterDuffBlendPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetPorterDuffBlendPipeline ( ContentContextOptions  opts) const
inline

Definition at line 511 of file content_context.h.

512  {
513  return GetPipeline(porter_duff_blend_pipelines_, opts);
514  }

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

◆ GetRadialGradientFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetRadialGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 417 of file content_context.h.

418  {
419  return GetPipeline(radial_gradient_fill_pipelines_, opts);
420  }

◆ GetRadialGradientSSBOFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetRadialGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 400 of file content_context.h.

400  {
401  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
402  return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
403  }

References GetDeviceCapabilities().

◆ GetRenderTargetCache()

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

◆ GetRRectBlurPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetRRectBlurPipeline ( ContentContextOptions  opts) const
inline

Definition at line 427 of file content_context.h.

428  {
429  return GetPipeline(rrect_blur_pipelines_, opts);
430  }

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

◆ GetSolidFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetSolidFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 437 of file content_context.h.

438  {
439  return GetPipeline(solid_fill_pipelines_, opts);
440  }

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

◆ GetSrgbToLinearFilterPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetSrgbToLinearFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 491 of file content_context.h.

492  {
493  return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
494  }

◆ GetSweepGradientFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetSweepGradientFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 432 of file content_context.h.

433  {
434  return GetPipeline(sweep_gradient_fill_pipelines_, opts);
435  }

◆ GetSweepGradientSSBOFillPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetSweepGradientSSBOFillPipeline ( ContentContextOptions  opts) const
inline

Definition at line 412 of file content_context.h.

412  {
413  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
414  return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
415  }

References GetDeviceCapabilities().

◆ GetTessellator()

std::shared_ptr< Tessellator > impeller::ContentContext::GetTessellator ( ) const

Definition at line 549 of file content_context.cc.

549  {
550  return tessellator_;
551 }

◆ GetTexturePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetTexturePipeline ( ContentContextOptions  opts) const
inline

Definition at line 442 of file content_context.h.

443  {
444  return GetPipeline(texture_pipelines_, opts);
445  }

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

◆ GetTextureStrictSrcPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetTextureStrictSrcPipeline ( ContentContextOptions  opts) const
inline

Definition at line 447 of file content_context.h.

448  {
449  return GetPipeline(texture_strict_src_pipelines_, opts);
450  }

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

◆ GetTiledTexturePipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetTiledTexturePipeline ( ContentContextOptions  opts) const
inline

Definition at line 461 of file content_context.h.

462  {
463  return GetPipeline(tiled_texture_pipelines_, opts);
464  }

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

◆ GetTransientsBuffer()

◆ GetYUVToRGBFilterPipeline()

std::shared_ptr<Pipeline<PipelineDescriptor> > impeller::ContentContext::GetYUVToRGBFilterPipeline ( ContentContextOptions  opts) const
inline

Definition at line 506 of file content_context.h.

507  {
508  return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
509  }

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 467 of file content_context.cc.

467  {
468  return is_valid_;
469 }

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

508  {
509  const std::shared_ptr<Context>& context = GetContext();
510 
511  auto subpass_texture = subpass_target.GetRenderTargetTexture();
512  if (!subpass_texture) {
513  return fml::Status(fml::StatusCode::kUnknown, "");
514  }
515 
516  auto sub_renderpass = command_buffer->CreateRenderPass(subpass_target);
517  if (!sub_renderpass) {
518  return fml::Status(fml::StatusCode::kUnknown, "");
519  }
520  sub_renderpass->SetLabel(SPrintF("%s RenderPass", label.data()));
521 
522  if (!subpass_callback(*this, *sub_renderpass)) {
523  return fml::Status(fml::StatusCode::kUnknown, "");
524  }
525 
526  if (!sub_renderpass->EncodeCommands()) {
527  return fml::Status(fml::StatusCode::kUnknown, "");
528  }
529 
530  const std::shared_ptr<Texture>& target_texture =
531  subpass_target.GetRenderTargetTexture();
532  if (target_texture->GetMipCount() > 1) {
533  fml::Status mipmap_status =
534  AddMipmapGeneration(command_buffer, context, target_texture);
535  if (!mipmap_status.ok()) {
536  return mipmap_status;
537  }
538  }
539 
540  return subpass_target;
541 }

References impeller::AddMipmapGeneration(), GetContext(), impeller::RenderTarget::GetRenderTargetTexture(), and impeller::SPrintF().

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

482  {
483  const std::shared_ptr<Context>& context = GetContext();
484  RenderTarget subpass_target;
485 
486  std::optional<RenderTarget::AttachmentConfig> depth_stencil_config =
487  depth_stencil_enabled ? RenderTarget::kDefaultStencilAttachmentConfig
488  : std::optional<RenderTarget::AttachmentConfig>();
489 
490  if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
491  subpass_target = GetRenderTargetCache()->CreateOffscreenMSAA(
492  *context, texture_size,
493  /*mip_count=*/mip_count, SPrintF("%s Offscreen", label.data()),
495  } else {
496  subpass_target = GetRenderTargetCache()->CreateOffscreen(
497  *context, texture_size,
498  /*mip_count=*/mip_count, SPrintF("%s Offscreen", label.data()),
499  RenderTarget::kDefaultColorAttachmentConfig, depth_stencil_config);
500  }
501  return MakeSubpass(label, subpass_target, command_buffer, subpass_callback);
502 }

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

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

◆ SetWireframe()

void impeller::ContentContext::SetWireframe ( bool  wireframe)

Definition at line 561 of file content_context.cc.

561  {
562  wireframe_ = wireframe;
563 }

Referenced by impeller::EntityPlayground::OpenPlaygroundHere().


The documentation for this class was generated from the following files:
impeller::ISize
ISize64 ISize
Definition: size.h:140
impeller::BlendSelectValues::kSaturation
@ kSaturation
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::BlendSelectValues::kColorBurn
@ kColorBurn
impeller::RenderTarget::kDefaultColorAttachmentConfig
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
Definition: render_target.h:55
impeller::BlendSelectValues::kMultiply
@ kMultiply
impeller::AddMipmapGeneration
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.
Definition: texture_mipmap.cc:11
impeller::ColorWriteMaskBits::kNone
@ kNone
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::RenderTarget::kDefaultColorAttachmentConfigMSAA
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
Definition: render_target.h:61
impeller::HostBuffer::Create
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator)
Definition: host_buffer.cc:20
impeller::BlendSelectValues::kSoftLight
@ kSoftLight
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:127
impeller::BlendSelectValues::kDifference
@ kDifference
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::BlendSelectValues::kDarken
@ kDarken
impeller::BlendSelectValues::kExclusion
@ kExclusion
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::BlendSelectValues::kColor
@ kColor
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::SPrintF
std::string SPrintF(const char *format,...)
Definition: strings.cc:12
impeller::ContentContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: content_context.cc:553
impeller::RenderTarget::kDefaultStencilAttachmentConfig
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
Definition: render_target.h:68
impeller::ContentContext::MakeSubpass
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...
Definition: content_context.cc:475
impeller::Color::ToR8G8B8A8
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:248
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::ContentContext::GetRenderTargetCache
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
Definition: content_context.h:724
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:557
impeller::BlendSelectValues::kHardLight
@ kHardLight
impeller::BlendSelectValues::kScreen
@ kScreen
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:272
impeller::BlendSelectValues::kLighten
@ kLighten
impeller::BlendSelectValues::kHue
@ kHue
impeller::SampleCount::kCount4
@ kCount4
impeller::BlendSelectValues::kLuminosity
@ kLuminosity
impeller::PipelineBuilder::MakeDefaultPipelineDescriptor
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
Definition: pipeline_builder.h:49
impeller::BlendSelectValues::kColorDodge
@ kColorDodge
impeller::BlendSelectValues::kOverlay
@ kOverlay
impeller::ContentContext::GetTransientsBuffer
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
Definition: content_context.h:752