Skip to content

Commit

Permalink
Soft revert of cd7a1e2 (flutter#32465)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnfield authored Apr 7, 2022
1 parent e5ceb46 commit bcdadab
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions shell/common/context_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ GrContextOptions MakeDefaultContextOptions(ContextType type,
options.fPersistentCache = PersistentCache::GetCacheForProcess();

if (api.has_value() && api.value() == GrBackendApi::kOpenGL) {
// Using stencil buffers has caused memory and performance regressions.
// See b/226484927 for internal customer regressions doc.
// Before enabling, we need to show a motivating case for where it will
// improve performance on OpenGL backend.
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;
Expand Down
4 changes: 2 additions & 2 deletions shell/common/context_options_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
namespace flutter {
namespace testing {

TEST(ContextOptionsTest, OpenGLAllowsStencilBuffers) {
TEST(ContextOptionsTest, OpenGLDisablesStencilBuffers) {
auto options = MakeDefaultContextOptions(flutter::ContextType::kRender,
GrBackendApi::kOpenGL);
EXPECT_FALSE(options.fAvoidStencilBuffers);
EXPECT_TRUE(options.fAvoidStencilBuffers);
}

} // namespace testing
Expand Down
2 changes: 1 addition & 1 deletion shell/gpu/gpu_surface_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static sk_sp<SkSurface> WrapOnscreenSurface(GrDirectContext* context,
GrBackendRenderTarget render_target(size.width(), // width
size.height(), // height
0, // sample count
8, // stencil bits
0, // stencil bits
framebuffer_info // framebuffer info
);

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/android_context_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static EGLResult<EGLConfig> ChooseEGLConfiguration(EGLDisplay display,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 8,
EGL_STENCIL_SIZE, 0,
EGL_SAMPLES, static_cast<EGLint>(msaa_samples),
EGL_SAMPLE_BUFFERS, sample_buffers,
EGL_NONE, // termination sentinel
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
config.size.width, // width
config.size.height, // height
1, // sample count
8, // stencil bits
0, // stencil bits
framebuffer_info // framebuffer info
);

Expand Down

0 comments on commit bcdadab

Please sign in to comment.