diff --git a/engine/src/flutter/impeller/toolkit/egl/display.cc b/engine/src/flutter/impeller/toolkit/egl/display.cc index b1c4fca1a3..7cabc314e6 100644 --- a/engine/src/flutter/impeller/toolkit/egl/display.cc +++ b/engine/src/flutter/impeller/toolkit/egl/display.cc @@ -141,9 +141,9 @@ std::unique_ptr Display::ChooseConfig(ConfigDescriptor config) const { if (sample_count > 1) { attributes.push_back(EGL_SAMPLE_BUFFERS); attributes.push_back(1); + attributes.push_back(EGL_SAMPLES); + attributes.push_back(sample_count); } - attributes.push_back(EGL_SAMPLES); - attributes.push_back(sample_count); } // termination sentinel must be present. diff --git a/engine/src/flutter/shell/platform/android/android_surface_gl_impeller.cc b/engine/src/flutter/shell/platform/android/android_surface_gl_impeller.cc index 3200822776..ca4040ec5e 100644 --- a/engine/src/flutter/shell/platform/android/android_surface_gl_impeller.cc +++ b/engine/src/flutter/shell/platform/android/android_surface_gl_impeller.cc @@ -98,10 +98,19 @@ AndroidSurfaceGLImpeller::AndroidSurfaceGLImpeller( desc.samples = impeller::egl::Samples::kFour; desc.surface_type = impeller::egl::SurfaceType::kWindow; - auto onscreen_config = display->ChooseConfig(desc); + std::unique_ptr onscreen_config = + display->ChooseConfig(desc); if (!onscreen_config) { - FML_DLOG(ERROR) << "Could not choose onscreen config."; - return; + // Fallback for Android emulator. + desc.samples = impeller::egl::Samples::kOne; + onscreen_config = display->ChooseConfig(desc); + if (onscreen_config) { + FML_LOG(INFO) << "Warning: This device doesn't support MSAA for onscreen " + "framebuffers. Falling back to a single sample."; + } else { + FML_DLOG(ERROR) << "Could not choose onscreen config."; + return; + } } desc.surface_type = impeller::egl::SurfaceType::kPBuffer;