Chromium Code Reviews| Index: ui/gl/gl_surface_egl.cc |
| diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc |
| index 8c3ed9fa9b876ae50090713841424278b44db784..a444ab1fb45c4bf7754de4c9989742c00cdae0b7 100644 |
| --- a/ui/gl/gl_surface_egl.cc |
| +++ b/ui/gl/gl_surface_egl.cc |
| @@ -251,11 +251,12 @@ bool ValidateEglConfig(EGLDisplay display, |
| return true; |
| } |
| -EGLConfig ChooseConfig(GLSurface::Format format) { |
| - static std::map<GLSurface::Format, EGLConfig> config_map; |
| +EGLConfig ChooseConfig(GLSurface::Format format, bool is_surfaceless) { |
| + static std::map<std::pair<GLSurface::Format, bool>, EGLConfig> config_map; |
|
no sievers
2016/03/08 22:02:00
It seems odd that surfaceless even cares about |Fo
kylechar
2016/03/09 15:07:30
This is all sort of black magic to me (and documen
|
| - if (config_map.find(format) != config_map.end()) { |
| - return config_map[format]; |
| + auto config_type = std::make_pair(format, is_surfaceless); |
| + if (config_map.find(config_type) != config_map.end()) { |
| + return config_map[config_type]; |
| } |
| // Choose an EGL configuration. |
| @@ -283,6 +284,9 @@ EGLConfig ChooseConfig(GLSurface::Format format) { |
| } |
| #endif |
| + EGLint surface_type = |
| + is_surfaceless ? EGL_DONT_CARE : EGL_WINDOW_BIT | EGL_PBUFFER_BIT; |
| + |
| EGLint config_attribs_8888[] = { |
| EGL_BUFFER_SIZE, buffer_size, |
| EGL_ALPHA_SIZE, alpha_size, |
| @@ -290,7 +294,7 @@ EGLConfig ChooseConfig(GLSurface::Format format) { |
| EGL_GREEN_SIZE, 8, |
| EGL_RED_SIZE, 8, |
| EGL_RENDERABLE_TYPE, renderable_type, |
| - EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
| + EGL_SURFACE_TYPE, surface_type, |
| EGL_NONE |
| }; |
| @@ -301,7 +305,7 @@ EGLConfig ChooseConfig(GLSurface::Format format) { |
| EGL_GREEN_SIZE, 6, |
| EGL_RED_SIZE, 5, |
| EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
| - EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
| + EGL_SURFACE_TYPE, surface_type, |
| EGL_NONE |
| }; |
| if (format == GLSurface::SURFACE_RGB565) { |
| @@ -374,7 +378,7 @@ EGLConfig ChooseConfig(GLSurface::Format format) { |
| } |
| } |
| } |
| - config_map[format] = config; |
| + config_map[config_type] = config; |
| return config; |
| } |
| @@ -506,7 +510,7 @@ EGLDisplay GLSurfaceEGL::GetDisplay() { |
| EGLConfig GLSurfaceEGL::GetConfig() { |
| if (!config_) { |
| - config_ = ChooseConfig(format_); |
| + config_ = ChooseConfig(format_, IsSurfaceless()); |
| } |
| return config_; |
| } |