mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Impeller] Remove additional shader bootstrap. (flutter/engine#52368)
Because these shaders must first acquire the prototype shader, it causes ContentContext creation to block. We can re-explore dealing with PSO generation in a different manner that isn't on the startup fast path. https://github.com/flutter/flutter/issues/143540
This commit is contained in:
parent
b81845d228
commit
a9414aa74e
@ -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);
|
||||
@ -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.
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user