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

[Impeller] Remove additional shader bootstrap. #52368

Merged
merged 5 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions impeller/entity/contents/content_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ ContentContext::ContentContext(
checkerboard_pipelines_.CreateDefault(*context_, options);
#endif // IMPELLER_DEBUG

// These pipelines are created first since they are immediately used by
// InitializeCommonlyUsedShadersIfNeeded. Their order matches the order in
// InitializeCommonlyUsedShadersIfNeeded.
{
solid_fill_pipelines_.CreateDefault(*context_, options);
texture_pipelines_.CreateDefault(*context_, options);
Expand Down Expand Up @@ -571,48 +568,6 @@ void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
TRACE_EVENT0("flutter", "InitializeCommonlyUsedShadersIfNeeded");
GetContext()->InitializeCommonlyUsedShadersIfNeeded();

if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {
// TODO(jonahwilliams): The OpenGL Embedder Unittests hang if this code
// runs.
return;
}

// Initialize commonly used shaders that aren't defaults. These settings were
// chosen based on the knowledge that we mix and match triangle and
// triangle-strip geometry, and also have fairly agressive srcOver to src
// blend mode conversions.
Comment on lines -580 to -583
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a comment above that references this if I remember correctly, we should remove that too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to push it. It's this one:

  // These pipelines are created first since they are immediately used by
  // InitializeCommonlyUsedShadersIfNeeded. Their order matches the order in
  // InitializeCommonlyUsedShadersIfNeeded.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that one!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

auto options = ContentContextOptions{
.sample_count = SampleCount::kCount4,
.color_attachment_pixel_format =
context_->GetCapabilities()->GetDefaultColorFormat()};

// Note: When editing this, check the order the default pipelines are created.
// These should be first.
for (const auto mode : {BlendMode::kSource, BlendMode::kSourceOver}) {
for (const auto geometry :
{PrimitiveType::kTriangle, PrimitiveType::kTriangleStrip}) {
options.blend_mode = mode;
options.primitive_type = geometry;
CreateIfNeeded(solid_fill_pipelines_, options);
CreateIfNeeded(texture_pipelines_, options);
if (GetContext()->GetCapabilities()->SupportsSSBO()) {
CreateIfNeeded(linear_gradient_ssbo_fill_pipelines_, options);
CreateIfNeeded(radial_gradient_ssbo_fill_pipelines_, options);
CreateIfNeeded(sweep_gradient_ssbo_fill_pipelines_, options);
CreateIfNeeded(conical_gradient_ssbo_fill_pipelines_, options);
}
}
}

options.blend_mode = BlendMode::kDestination;
options.primitive_type = PrimitiveType::kTriangleStrip;
for (const auto stencil_mode :
{ContentContextOptions::StencilMode::kOverdrawPreventionIncrement,
ContentContextOptions::StencilMode::kOverdrawPreventionRestore}) {
options.stencil_mode = stencil_mode;
CreateIfNeeded(clip_pipelines_, options);
}

// On ARM devices, the initial usage of vkCmdCopyBufferToImage has been
// observed to take 10s of ms as an internal shader is compiled to perform
// the operation. Similarly, the initial render pass can also take 10s of ms
Expand Down