Support stencil buffers on OpenGL for Windows and Android (flutter/engine#31967)

This commit is contained in:
Dan Field 2022-03-15 16:50:07 -07:00 committed by GitHub
parent 91c9272b4c
commit 3a0d0b6e36
7 changed files with 24 additions and 5 deletions

View File

@ -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

View File

@ -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",

View File

@ -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;

View File

@ -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

View File

@ -136,7 +136,7 @@ static sk_sp<SkSurface> 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
);

View File

@ -83,7 +83,7 @@ static EGLResult<EGLConfig> 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
};

View File

@ -621,7 +621,7 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
config.size.width, // width
config.size.height, // height
1, // sample count
0, // stencil bits
8, // stencil bits
framebuffer_info // framebuffer info
);