From bf4d90a46b6c1cec7fb513546cf175e0258814d5 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 13 Nov 2024 18:28:05 -0800 Subject: [PATCH] [Android] choose 24 bit depth buffer. (flutter/engine#56553) Fixes https://github.com/flutter/flutter/issues/158531 Make sure the onscreen framebuffer has a depth attachment that matches the depth24_s8 format expected. --- engine/src/flutter/impeller/toolkit/egl/config.h | 1 + .../shell/platform/android/android_context_gl_impeller.cc | 2 +- .../platform/android/android_context_gl_impeller_unittests.cc | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/impeller/toolkit/egl/config.h b/engine/src/flutter/impeller/toolkit/egl/config.h index 37de0e1374..6690ee2db6 100644 --- a/engine/src/flutter/impeller/toolkit/egl/config.h +++ b/engine/src/flutter/impeller/toolkit/egl/config.h @@ -35,6 +35,7 @@ enum class StencilBits { enum class DepthBits { kZero = 0, kEight = 8, + kTwentyFour = 24, }; enum class SurfaceType { diff --git a/engine/src/flutter/shell/platform/android/android_context_gl_impeller.cc b/engine/src/flutter/shell/platform/android/android_context_gl_impeller.cc index 79091a108f..c497565c7f 100644 --- a/engine/src/flutter/shell/platform/android/android_context_gl_impeller.cc +++ b/engine/src/flutter/shell/platform/android/android_context_gl_impeller.cc @@ -94,7 +94,7 @@ AndroidContextGLImpeller::AndroidContextGLImpeller( impeller::egl::ConfigDescriptor desc; desc.api = impeller::egl::API::kOpenGLES2; desc.color_format = impeller::egl::ColorFormat::kRGBA8888; - desc.depth_bits = impeller::egl::DepthBits::kZero; + desc.depth_bits = impeller::egl::DepthBits::kTwentyFour; desc.stencil_bits = impeller::egl::StencilBits::kEight; desc.samples = impeller::egl::Samples::kFour; diff --git a/engine/src/flutter/shell/platform/android/android_context_gl_impeller_unittests.cc b/engine/src/flutter/shell/platform/android/android_context_gl_impeller_unittests.cc index 6d8243e8dd..509c8df6f0 100644 --- a/engine/src/flutter/shell/platform/android/android_context_gl_impeller_unittests.cc +++ b/engine/src/flutter/shell/platform/android/android_context_gl_impeller_unittests.cc @@ -38,6 +38,8 @@ bool GetEGLConfigForSurface(EGLint surface_bit, EGLConfig* result) { EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 24, + EGL_STENCIL_SIZE, 8, EGL_NONE, // clang-format on };