1919
2020namespace flutter {
2121
22- TizenRendererEgl::TizenRendererEgl () {}
22+ TizenRendererEgl::TizenRendererEgl (bool enable_impeller)
23+ : enable_impeller_(enable_impeller) {}
2324
2425TizenRendererEgl::~TizenRendererEgl () {
2526 DestroySurface ();
@@ -144,20 +145,6 @@ void TizenRendererEgl::DestroySurface() {
144145}
145146
146147bool TizenRendererEgl::ChooseEGLConfiguration () {
147- EGLint config_attribs[] = {
148- // clang-format off
149- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
150- EGL_RED_SIZE, 8 ,
151- EGL_GREEN_SIZE, 8 ,
152- EGL_BLUE_SIZE, 8 ,
153- EGL_ALPHA_SIZE, EGL_DONT_CARE,
154- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
155- EGL_SAMPLE_BUFFERS, EGL_DONT_CARE,
156- EGL_SAMPLES, EGL_DONT_CARE,
157- EGL_NONE
158- // clang-format on
159- };
160-
161148 if (!eglInitialize (egl_display_, nullptr , nullptr )) {
162149 PrintEGLError ();
163150 FT_LOG (Error) << " Could not initialize the EGL display." ;
@@ -179,12 +166,50 @@ bool TizenRendererEgl::ChooseEGLConfiguration() {
179166
180167 EGLConfig* configs = (EGLConfig*)calloc (config_size, sizeof (EGLConfig));
181168 EGLint num_config;
182- if (!eglChooseConfig (egl_display_, config_attribs, configs, config_size,
183- &num_config)) {
184- free (configs);
185- PrintEGLError ();
186- FT_LOG (Error) << " No matching configurations found." ;
187- return false ;
169+ if (enable_impeller_) {
170+ EGLint impeller_config_attribs[] = {
171+ // clang-format off
172+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
173+ EGL_RED_SIZE, 8 ,
174+ EGL_GREEN_SIZE, 8 ,
175+ EGL_BLUE_SIZE, 8 ,
176+ EGL_ALPHA_SIZE, 8 ,
177+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
178+ EGL_SAMPLE_BUFFERS, 1 ,
179+ EGL_SAMPLES, 4 ,
180+ EGL_STENCIL_SIZE, 8 ,
181+ EGL_DEPTH_SIZE, 0 ,
182+ EGL_NONE
183+ // clang-format on
184+ };
185+ if (!eglChooseConfig (egl_display_, impeller_config_attribs, configs,
186+ config_size, &num_config)) {
187+ free (configs);
188+ PrintEGLError ();
189+ FT_LOG (Error) << " No matching configurations found." ;
190+ return false ;
191+ }
192+ } else {
193+ EGLint config_attribs[] = {
194+ // clang-format off
195+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
196+ EGL_RED_SIZE, 8 ,
197+ EGL_GREEN_SIZE, 8 ,
198+ EGL_BLUE_SIZE, 8 ,
199+ EGL_ALPHA_SIZE, EGL_DONT_CARE,
200+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
201+ EGL_SAMPLE_BUFFERS, EGL_DONT_CARE,
202+ EGL_SAMPLES, EGL_DONT_CARE,
203+ EGL_NONE
204+ // clang-format on
205+ };
206+ if (!eglChooseConfig (egl_display_, config_attribs, configs, config_size,
207+ &num_config)) {
208+ free (configs);
209+ PrintEGLError ();
210+ FT_LOG (Error) << " No matching configurations found." ;
211+ return false ;
212+ }
188213 }
189214
190215 int buffer_size = 32 ;
0 commit comments