OSDN Git Service

fix [3028370] GL get error should return a valid error if no context is bound.
authorMathias Agopian <mathias@google.com>
Thu, 23 Sep 2010 18:32:52 +0000 (11:32 -0700)
committerMathias Agopian <mathias@google.com>
Thu, 23 Sep 2010 20:19:02 +0000 (13:19 -0700)
glGetError() will now always return GL_INVALID_OPERATION if called from a thread
with no GL context bound.

Change-Id: I28ba458871db051bb4f5a26668a1fa123526869c

opengl/libs/EGL/egl.cpp

index 105ebb4..0437263 100644 (file)
@@ -437,6 +437,12 @@ static void gl_no_context() {
     }
 }
 
+// Always return GL_INVALID_OPERATION from glGetError() when called from
+// a thread without a bound context.
+static GLenum gl_no_context_glGetError() {
+    return GL_INVALID_OPERATION;
+}
+
 static void early_egl_init(void) 
 {
 #if !USE_FAST_TLS_KEY
@@ -447,6 +453,9 @@ static void early_egl_init(void)
             (uint32_t*)(void*)&gHooksNoContext, 
             addr, 
             sizeof(gHooksNoContext));
+
+    gHooksNoContext.gl.glGetError = gl_no_context_glGetError;
+
     setGlThreadSpecific(&gHooksNoContext);
 }