mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Support stencil buffers on OpenGL for Windows and Android (flutter/engine#31967)
This commit is contained in:
parent
91c9272b4c
commit
3a0d0b6e36
@ -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
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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;
|
||||
|
||||
19
engine/src/flutter/shell/common/context_options_unittests.cc
Normal file
19
engine/src/flutter/shell/common/context_options_unittests.cc
Normal 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
|
||||
@ -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
|
||||
);
|
||||
|
||||
|
||||
@ -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
|
||||
};
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user