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

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

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

◆ GetBlendColorBurnPipeline()

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

Definition at line 519 of file content_context.h.

520  {
521  return GetPipeline(blend_colorburn_pipelines_, opts);
522  }

◆ GetBlendColorDodgePipeline()

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

Definition at line 524 of file content_context.h.

525  {
526  return GetPipeline(blend_colordodge_pipelines_, opts);
527  }

◆ GetBlendColorPipeline()

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

Definition at line 514 of file content_context.h.

515  {
516  return GetPipeline(blend_color_pipelines_, opts);
517  }

◆ GetBlendDarkenPipeline()

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

Definition at line 529 of file content_context.h.

530  {
531  return GetPipeline(blend_darken_pipelines_, opts);
532  }

◆ GetBlendDifferencePipeline()

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

Definition at line 534 of file content_context.h.

535  {
536  return GetPipeline(blend_difference_pipelines_, opts);
537  }

◆ GetBlendExclusionPipeline()

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

Definition at line 539 of file content_context.h.

540  {
541  return GetPipeline(blend_exclusion_pipelines_, opts);
542  }

◆ GetBlendHardLightPipeline()

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

Definition at line 544 of file content_context.h.

545  {
546  return GetPipeline(blend_hardlight_pipelines_, opts);
547  }

◆ GetBlendHuePipeline()

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

Definition at line 549 of file content_context.h.

550  {
551  return GetPipeline(blend_hue_pipelines_, opts);
552  }

◆ GetBlendLightenPipeline()

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

Definition at line 554 of file content_context.h.

555  {
556  return GetPipeline(blend_lighten_pipelines_, opts);
557  }

◆ GetBlendLuminosityPipeline()

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

Definition at line 559 of file content_context.h.

560  {
561  return GetPipeline(blend_luminosity_pipelines_, opts);
562  }

◆ GetBlendMultiplyPipeline()

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

Definition at line 564 of file content_context.h.

565  {
566  return GetPipeline(blend_multiply_pipelines_, opts);
567  }

◆ GetBlendOverlayPipeline()

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

Definition at line 569 of file content_context.h.

570  {
571  return GetPipeline(blend_overlay_pipelines_, opts);
572  }

◆ GetBlendSaturationPipeline()

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

Definition at line 574 of file content_context.h.

575  {
576  return GetPipeline(blend_saturation_pipelines_, opts);
577  }

◆ GetBlendScreenPipeline()

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

Definition at line 579 of file content_context.h.

580  {
581  return GetPipeline(blend_screen_pipelines_, opts);
582  }

◆ GetBlendSoftLightPipeline()

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

Definition at line 584 of file content_context.h.

585  {
586  return GetPipeline(blend_softlight_pipelines_, opts);
587  }

◆ GetBorderMaskBlurPipeline()

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

Definition at line 467 of file content_context.h.

468  {
469  return GetPipeline(border_mask_blur_pipelines_, opts);
470  }

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

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

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

◆ GetClipPipeline()

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

Definition at line 492 of file content_context.h.

493  {
494  return GetPipeline(clip_pipelines_, opts);
495  }

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

478  {
479  return GetPipeline(color_matrix_color_filter_pipelines_, opts);
480  }

◆ GetConicalGradientFillPipeline()

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

Definition at line 418 of file content_context.h.

419  {
420  return GetPipeline(conical_gradient_fill_pipelines_, opts);
421  }

◆ GetConicalGradientSSBOFillPipeline()

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

Definition at line 402 of file content_context.h.

402  {
403  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
404  return GetPipeline(conical_gradient_ssbo_fill_pipelines_, opts);
405  }

References GetDeviceCapabilities().

◆ GetContext()

◆ GetDeviceCapabilities()

◆ GetDownsamplePipeline()

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

Definition at line 589 of file content_context.h.

590  {
591  return GetPipeline(texture_downsample_pipelines_, opts);
592  }

◆ GetDrawVerticesUberShader()

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

Definition at line 685 of file content_context.h.

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

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

◆ GetEmptyTexture()

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

Definition at line 474 of file content_context.cc.

474  {
475  return empty_texture_;
476 }

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

◆ GetFastGradientPipeline()

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

Definition at line 379 of file content_context.h.

380  {
381  return GetPipeline(fast_gradient_pipelines_, opts);
382  }

◆ GetFramebufferBlendColorBurnPipeline()

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

Definition at line 602 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorDodgePipeline()

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

Definition at line 608 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendColorPipeline()

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

Definition at line 596 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendDarkenPipeline()

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

Definition at line 614 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendDifferencePipeline()

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

Definition at line 620 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendExclusionPipeline()

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

Definition at line 626 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendHardLightPipeline()

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

Definition at line 632 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendHuePipeline()

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

Definition at line 637 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendLightenPipeline()

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

Definition at line 644 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendLuminosityPipeline()

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

Definition at line 650 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendMultiplyPipeline()

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

Definition at line 656 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendOverlayPipeline()

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

Definition at line 662 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendSaturationPipeline()

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

Definition at line 668 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendScreenPipeline()

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

Definition at line 674 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetFramebufferBlendSoftLightPipeline()

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

Definition at line 680 of file content_context.h.

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

References GetDeviceCapabilities().

◆ GetGaussianBlurPipeline()

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

Definition at line 462 of file content_context.h.

463  {
464  return GetPipeline(gaussian_blur_pipelines_, opts);
465  }

◆ GetGlyphAtlasPipeline()

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

Definition at line 497 of file content_context.h.

498  {
499  return GetPipeline(glyph_atlas_pipelines_, opts);
500  }

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

385  {
386  return GetPipeline(linear_gradient_fill_pipelines_, opts);
387  }

◆ GetLinearGradientSSBOFillPipeline()

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

Definition at line 390 of file content_context.h.

390  {
391  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
392  return GetPipeline(linear_gradient_ssbo_fill_pipelines_, opts);
393  }

References GetDeviceCapabilities().

◆ GetLinearToSrgbFilterPipeline()

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

Definition at line 482 of file content_context.h.

483  {
484  return GetPipeline(linear_to_srgb_filter_pipelines_, opts);
485  }

◆ GetMorphologyFilterPipeline()

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

Definition at line 472 of file content_context.h.

473  {
474  return GetPipeline(morphology_filter_pipelines_, opts);
475  }

◆ GetPorterDuffBlendPipeline()

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

Definition at line 507 of file content_context.h.

508  {
509  return GetPipeline(porter_duff_blend_pipelines_, opts);
510  }

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

414  {
415  return GetPipeline(radial_gradient_fill_pipelines_, opts);
416  }

◆ GetRadialGradientSSBOFillPipeline()

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

Definition at line 396 of file content_context.h.

396  {
397  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
398  return GetPipeline(radial_gradient_ssbo_fill_pipelines_, opts);
399  }

References GetDeviceCapabilities().

◆ GetRenderTargetCache()

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

Definition at line 725 of file content_context.h.

725  {
726  return render_target_cache_;
727  }

Referenced by impeller::testing::CreateTestCanvas(), MakeSubpass(), impeller::EntityPlayground::OpenPlaygroundHere(), and impeller::testing::TEST_P().

◆ GetRRectBlurPipeline()

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

Definition at line 423 of file content_context.h.

424  {
425  return GetPipeline(rrect_blur_pipelines_, opts);
426  }

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

◆ GetSolidFillPipeline()

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

Definition at line 433 of file content_context.h.

434  {
435  return GetPipeline(solid_fill_pipelines_, opts);
436  }

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

488  {
489  return GetPipeline(srgb_to_linear_filter_pipelines_, opts);
490  }

◆ GetSweepGradientFillPipeline()

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

Definition at line 428 of file content_context.h.

429  {
430  return GetPipeline(sweep_gradient_fill_pipelines_, opts);
431  }

◆ GetSweepGradientSSBOFillPipeline()

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

Definition at line 408 of file content_context.h.

408  {
409  FML_DCHECK(GetDeviceCapabilities().SupportsSSBO());
410  return GetPipeline(sweep_gradient_ssbo_fill_pipelines_, opts);
411  }

References GetDeviceCapabilities().

◆ GetTessellator()

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

Definition at line 546 of file content_context.cc.

546  {
547  return tessellator_;
548 }

◆ GetTexturePipeline()

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

Definition at line 438 of file content_context.h.

439  {
440  return GetPipeline(texture_pipelines_, opts);
441  }

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

◆ GetTextureStrictSrcPipeline()

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

Definition at line 443 of file content_context.h.

444  {
445  return GetPipeline(texture_strict_src_pipelines_, opts);
446  }

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

◆ GetTiledTexturePipeline()

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

Definition at line 457 of file content_context.h.

458  {
459  return GetPipeline(tiled_texture_pipelines_, opts);
460  }

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

◆ GetTransientsBuffer()

◆ GetYUVToRGBFilterPipeline()

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

Definition at line 502 of file content_context.h.

503  {
504  return GetPipeline(yuv_to_rgb_filter_pipelines_, opts);
505  }

◆ IsValid()

bool impeller::ContentContext::IsValid ( ) const

Definition at line 470 of file content_context.cc.

470  {
471  return is_valid_;
472 }

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

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

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

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

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

558  {
559  wireframe_ = wireframe;
560 }

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:21
impeller::BlendSelectValues::kSoftLight
@ kSoftLight
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:128
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:550
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:478
impeller::Color::ToR8G8B8A8
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
Definition: color.h:245
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::ContentContext::GetRenderTargetCache
const std::shared_ptr< RenderTargetAllocator > & GetRenderTargetCache() const
Definition: content_context.h:725
impeller::ContentContext::GetDeviceCapabilities
const Capabilities & GetDeviceCapabilities() const
Definition: content_context.cc:554
impeller::BlendSelectValues::kHardLight
@ kHardLight
impeller::BlendSelectValues::kScreen
@ kScreen
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:269
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:753