Setup default clip pipeline.
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
252 render_target_cache_(render_target_allocator == nullptr
253 ? std::make_shared<RenderTargetCache>(
254 context_->GetResourceAllocator())
255 : std::move(render_target_allocator)),
257 if (!context_ || !context_->IsValid()) {
258 return;
259 }
260
261 {
262 TextureDescriptor
desc;
266 empty_texture_ =
GetContext()->GetResourceAllocator()->CreateTexture(
desc);
268 auto cmd_buffer =
GetContext()->CreateCommandBuffer();
269 auto blit_pass = cmd_buffer->CreateBlitPass();
273
274 if (!blit_pass->EncodeCommands(
GetContext()->GetResourceAllocator()) ||
276 ->GetCommandQueue()
277 ->Submit({std::move(cmd_buffer)})
280 }
281 }
282
283 auto options = ContentContextOptions{
285 .color_attachment_pixel_format =
286 context_->GetCapabilities()->GetDefaultColorFormat()};
287 auto options_trianglestrip = ContentContextOptions{
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
313
314 auto clip_pipeline_descriptor =
316 if (!clip_pipeline_descriptor.has_value()) {
317 return;
318 }
319 ContentContextOptions{
321 .color_attachment_pixel_format =
322 context_->GetCapabilities()->GetDefaultColorFormat()}
323 .ApplyToPipelineDescriptor(*clip_pipeline_descriptor);
324
325 auto clip_color_attachments =
326 clip_pipeline_descriptor->GetColorAttachmentDescriptors();
327 for (auto& color_attachment : clip_color_attachments) {
329 }
330 clip_pipeline_descriptor->SetColorAttachmentDescriptors(
331 std::move(clip_color_attachments));
332 clip_pipelines_.SetDefault(
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,
341 framebuffer_blend_colorburn_pipelines_.CreateDefault(
342 *context_, options_trianglestrip,
344 framebuffer_blend_colordodge_pipelines_.CreateDefault(
345 *context_, options_trianglestrip,
347 framebuffer_blend_darken_pipelines_.CreateDefault(
348 *context_, options_trianglestrip,
350 framebuffer_blend_difference_pipelines_.CreateDefault(
351 *context_, options_trianglestrip,
353 framebuffer_blend_exclusion_pipelines_.CreateDefault(
354 *context_, options_trianglestrip,
356 framebuffer_blend_hardlight_pipelines_.CreateDefault(
357 *context_, options_trianglestrip,
359 framebuffer_blend_hue_pipelines_.CreateDefault(
360 *context_, options_trianglestrip,
362 framebuffer_blend_lighten_pipelines_.CreateDefault(
363 *context_, options_trianglestrip,
365 framebuffer_blend_luminosity_pipelines_.CreateDefault(
366 *context_, options_trianglestrip,
368 framebuffer_blend_multiply_pipelines_.CreateDefault(
369 *context_, options_trianglestrip,
371 framebuffer_blend_overlay_pipelines_.CreateDefault(
372 *context_, options_trianglestrip,
374 framebuffer_blend_saturation_pipelines_.CreateDefault(
375 *context_, options_trianglestrip,
377 framebuffer_blend_screen_pipelines_.CreateDefault(
378 *context_, options_trianglestrip,
380 framebuffer_blend_softlight_pipelines_.CreateDefault(
381 *context_, options_trianglestrip,
383 } else {
384 blend_color_pipelines_.CreateDefault(
385 *context_, options_trianglestrip,
387 blend_colorburn_pipelines_.CreateDefault(
388 *context_, options_trianglestrip,
390 blend_colordodge_pipelines_.CreateDefault(
391 *context_, options_trianglestrip,
393 blend_darken_pipelines_.CreateDefault(
394 *context_, options_trianglestrip,
396 blend_difference_pipelines_.CreateDefault(
397 *context_, options_trianglestrip,
399 blend_exclusion_pipelines_.CreateDefault(
400 *context_, options_trianglestrip,
402 blend_hardlight_pipelines_.CreateDefault(
403 *context_, options_trianglestrip,
405 blend_hue_pipelines_.CreateDefault(
406 *context_, options_trianglestrip,
408 blend_lighten_pipelines_.CreateDefault(
409 *context_, options_trianglestrip,
411 blend_luminosity_pipelines_.CreateDefault(
412 *context_, options_trianglestrip,
414 blend_multiply_pipelines_.CreateDefault(
415 *context_, options_trianglestrip,
417 blend_overlay_pipelines_.CreateDefault(
418 *context_, options_trianglestrip,
420 blend_saturation_pipelines_.CreateDefault(
421 *context_, options_trianglestrip,
423 blend_screen_pipelines_.CreateDefault(
424 *context_, options_trianglestrip,
426 blend_softlight_pipelines_.CreateDefault(
427 *context_, options_trianglestrip,
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(
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
455#if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX)
457 tiled_texture_external_pipelines_.CreateDefault(*context_,
options);
458 }
459#endif
460
461 is_valid_ = true;
462 InitializeCommonlyUsedShadersIfNeeded();
463}
static bool ok(int result)
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
std::shared_ptr< Context > GetContext() const
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator)
constexpr std::array< uint8_t, 4 > ToR8G8B8A8() const
Convert to R8G8B8A8 representation.
static constexpr Color BlackTransparent()
static std::optional< PipelineDescriptor > MakeDefaultPipelineDescriptor(const Context &context, const std::vector< Scalar > &constants={})
Create a default pipeline descriptor using the combination reflected shader information....
std::shared_ptr< const fml::Mapping > data