Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 85d989e

Browse files
authored
[Impeller] Reorder pipeline construction in content context. (#54373)
Fixes the regression to the first-frame time on the Mokey. Also add a trace that should allow for easier identification of problematic pipelines. A more involved job-queue that allows construction jobs to skip the queue was written in #54355. But the Mokey case is not important enough for the additional complexity. See the context in the linked patch. <img width="2137" alt="Screenshot 2024-08-06 at 1 20 26�PM" src="https://github.com/user-attachments/assets/aed671c1-b7f7-4c9f-8553-485f8c0dd35e"> [start_up_timeline.json.zip](https://github.com/user-attachments/files/16515389/start_up_timeline.json.zip)
1 parent 483ff70 commit 85d989e

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

impeller/entity/contents/content_context.cc

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,15 @@ ContentContext::ContentContext(
292292
const auto supports_decal = static_cast<Scalar>(
293293
context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
294294

295+
// Futures for the following pipelines may block in case the first frame is
296+
// rendered without the pipelines being ready. Put pipelines that are more
297+
// likely to be used first.
295298
{
299+
glyph_atlas_pipelines_.CreateDefault(
300+
*context_, options,
301+
{static_cast<Scalar>(
302+
GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
303+
PixelFormat::kA8UNormInt)});
296304
solid_fill_pipelines_.CreateDefault(*context_, options);
297305
texture_pipelines_.CreateDefault(*context_, options);
298306
fast_gradient_pipelines_.CreateDefault(*context_, options);
@@ -310,7 +318,6 @@ ContentContext::ContentContext(
310318
}
311319

312320
/// Setup default clip pipeline.
313-
314321
auto clip_pipeline_descriptor =
315322
ClipPipeline::Builder::MakeDefaultPipelineDescriptor(*context_);
316323
if (!clip_pipeline_descriptor.has_value()) {
@@ -332,6 +339,20 @@ ContentContext::ContentContext(
332339
clip_pipelines_.SetDefault(
333340
options,
334341
std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
342+
texture_downsample_pipelines_.CreateDefault(*context_,
343+
options_trianglestrip);
344+
rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
345+
texture_strict_src_pipelines_.CreateDefault(*context_, options);
346+
tiled_texture_pipelines_.CreateDefault(*context_, options,
347+
{supports_decal});
348+
gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
349+
{supports_decal});
350+
border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
351+
color_matrix_color_filter_pipelines_.CreateDefault(*context_,
352+
options_trianglestrip);
353+
porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
354+
{supports_decal});
355+
vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
335356
}
336357

337358
if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
@@ -428,30 +449,14 @@ ContentContext::ContentContext(
428449
{static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
429450
}
430451

431-
texture_downsample_pipelines_.CreateDefault(*context_, options_trianglestrip);
432-
rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
433-
texture_strict_src_pipelines_.CreateDefault(*context_, options);
434-
tiled_texture_pipelines_.CreateDefault(*context_, options, {supports_decal});
435-
gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
436-
{supports_decal});
437-
border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
438452
morphology_filter_pipelines_.CreateDefault(*context_, options_trianglestrip,
439453
{supports_decal});
440-
color_matrix_color_filter_pipelines_.CreateDefault(*context_,
441-
options_trianglestrip);
442454
linear_to_srgb_filter_pipelines_.CreateDefault(*context_,
443455
options_trianglestrip);
444456
srgb_to_linear_filter_pipelines_.CreateDefault(*context_,
445457
options_trianglestrip);
446-
glyph_atlas_pipelines_.CreateDefault(
447-
*context_, options,
448-
{static_cast<Scalar>(
449-
GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
450-
PixelFormat::kA8UNormInt)});
451458
yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip);
452-
porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
453-
{supports_decal});
454-
vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
459+
455460
// GLES only shader that is unsupported on macOS.
456461
#if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX)
457462
if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {

impeller/renderer/backend/vulkan/pipeline_vk.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ std::unique_ptr<PipelineVK> PipelineVK::Create(
451451
const std::shared_ptr<DeviceHolderVK>& device_holder,
452452
const std::weak_ptr<PipelineLibrary>& weak_library,
453453
std::shared_ptr<SamplerVK> immutable_sampler) {
454-
TRACE_EVENT0("flutter", "PipelineVK::Create");
454+
TRACE_EVENT1("flutter", "PipelineVK::Create", "Name",
455+
desc.GetLabel().c_str());
455456

456457
auto library = weak_library.lock();
457458

0 commit comments

Comments
 (0)