diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index 6993606b513..125d1df923d 100755 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -1031,6 +1031,7 @@ FILE: ../../../flutter/shell/common/canvas_spy.h FILE: ../../../flutter/shell/common/canvas_spy_unittests.cc FILE: ../../../flutter/shell/common/context_options.cc FILE: ../../../flutter/shell/common/context_options.h +FILE: ../../../flutter/shell/common/context_options_unittests.cc FILE: ../../../flutter/shell/common/dart_native_benchmarks.cc FILE: ../../../flutter/shell/common/display.cc FILE: ../../../flutter/shell/common/display.h diff --git a/engine/src/flutter/shell/common/BUILD.gn b/engine/src/flutter/shell/common/BUILD.gn index c1f81633133..50a2881ec08 100644 --- a/engine/src/flutter/shell/common/BUILD.gn +++ b/engine/src/flutter/shell/common/BUILD.gn @@ -261,6 +261,7 @@ if (enable_unittests) { sources = [ "animator_unittests.cc", "canvas_spy_unittests.cc", + "context_options_unittests.cc", "engine_unittests.cc", "input_events_unittests.cc", "persistent_cache_unittests.cc", diff --git a/engine/src/flutter/shell/common/context_options.cc b/engine/src/flutter/shell/common/context_options.cc index 50dbdcd6297..073c9fcb7fb 100644 --- a/engine/src/flutter/shell/common/context_options.cc +++ b/engine/src/flutter/shell/common/context_options.cc @@ -19,8 +19,6 @@ GrContextOptions MakeDefaultContextOptions(ContextType type, options.fPersistentCache = PersistentCache::GetCacheForProcess(); if (api.has_value() && api.value() == GrBackendApi::kOpenGL) { - options.fAvoidStencilBuffers = true; - // To get video playback on the widest range of devices, we limit Skia to // ES2 shading language when the ES3 external image extension is missing. options.fPreferExternalImagesOverES3 = true; diff --git a/engine/src/flutter/shell/common/context_options_unittests.cc b/engine/src/flutter/shell/common/context_options_unittests.cc new file mode 100644 index 00000000000..7e576eeeff4 --- /dev/null +++ b/engine/src/flutter/shell/common/context_options_unittests.cc @@ -0,0 +1,19 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "context_options.h" + +#include "gtest/gtest.h" + +namespace flutter { +namespace testing { + +TEST(ContextOptionsTest, OpenGLAllowsStencilBuffers) { + auto options = MakeDefaultContextOptions(flutter::ContextType::kRender, + GrBackendApi::kOpenGL); + EXPECT_FALSE(options.fAvoidStencilBuffers); +} + +} // namespace testing +} // namespace flutter diff --git a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc index 296a41d97a9..bfdab01f584 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc +++ b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc @@ -136,7 +136,7 @@ static sk_sp WrapOnscreenSurface(GrDirectContext* context, GrBackendRenderTarget render_target(size.width(), // width size.height(), // height 0, // sample count - 0, // stencil bits (TODO) + 8, // stencil bits framebuffer_info // framebuffer info ); diff --git a/engine/src/flutter/shell/platform/android/android_context_gl.cc b/engine/src/flutter/shell/platform/android/android_context_gl.cc index c70136d23c8..a04c333abe1 100644 --- a/engine/src/flutter/shell/platform/android/android_context_gl.cc +++ b/engine/src/flutter/shell/platform/android/android_context_gl.cc @@ -83,7 +83,7 @@ static EGLResult ChooseEGLConfiguration(EGLDisplay display) { EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 0, - EGL_STENCIL_SIZE, 0, + EGL_STENCIL_SIZE, 8, EGL_NONE, // termination sentinel // clang-format on }; diff --git a/engine/src/flutter/shell/platform/embedder/embedder.cc b/engine/src/flutter/shell/platform/embedder/embedder.cc index 0ab8a3a8706..693f6f69bcf 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder.cc @@ -621,7 +621,7 @@ static sk_sp MakeSkSurfaceFromBackingStore( config.size.width, // width config.size.height, // height 1, // sample count - 0, // stencil bits + 8, // stencil bits framebuffer_info // framebuffer info );