1
# Description: Set the API to GLES rather than OpenGL when binding and
2
# creating contexts. The Ubuntu QPA plugin explicitly selects OpenGL on
3
# desktop, but we depend on GLES for surfaceless contexts
4
# Author: Chris Coulson <chris.coulson@canonical.com>
6
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc
7
--- a/ui/gl/gl_context_egl.cc
8
+++ b/ui/gl/gl_context_egl.cc
9
@@ -57,16 +57,18 @@ bool GLContextEGL::Initialize(
10
context_attributes = kContextRobustnessAttributes;
12
// At some point we should require the presence of the robustness
13
// extension and remove this code path.
14
DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported.";
15
context_attributes = kContextAttributes;
18
+ eglBindAPI(EGL_OPENGL_ES_API);
20
context_ = eglCreateContext(
23
share_group() ? share_group()->GetHandle() : NULL,
27
LOG(ERROR) << "eglCreateContext failed with error "
28
@@ -88,16 +90,18 @@ void GLContextEGL::Destroy() {
32
bool GLContextEGL::MakeCurrent(GLSurface* surface) {
34
if (IsCurrent(surface))
37
+ eglBindAPI(EGL_OPENGL_ES_API);
39
ScopedReleaseCurrent release_current;
40
TRACE_EVENT2("gpu", "GLContextEGL::MakeCurrent",
44
if (unbind_fbo_on_makecurrent_ &&
45
eglGetCurrentContext() != EGL_NO_CONTEXT) {
46
glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
47
@@ -132,29 +136,33 @@ bool GLContextEGL::MakeCurrent(GLSurface
48
void GLContextEGL::SetUnbindFboOnMakeCurrent() {
49
unbind_fbo_on_makecurrent_ = true;
52
void GLContextEGL::ReleaseCurrent(GLSurface* surface) {
53
if (!IsCurrent(surface))
56
+ eglBindAPI(EGL_OPENGL_ES_API);
58
if (unbind_fbo_on_makecurrent_)
59
glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
62
eglMakeCurrent(display_,
68
bool GLContextEGL::IsCurrent(GLSurface* surface) {
71
+ eglBindAPI(EGL_OPENGL_ES_API);
73
bool native_context_is_current = context_ == eglGetCurrentContext();
75
// If our context is current then our notion of which GLContext is
76
// current must be correct. On the other hand, third-party code
77
// using OpenGL might change the current context.
78
DCHECK(!native_context_is_current || (GetRealCurrent() == this));
80
if (!native_context_is_current)