OSDN Git Service

better fix for [3028370] GL get error should return a valid error if no context is...
authorMathias Agopian <mathias@google.com>
Thu, 23 Sep 2010 23:38:38 +0000 (16:38 -0700)
committerMathias Agopian <mathias@google.com>
Thu, 23 Sep 2010 23:44:48 +0000 (16:44 -0700)
commit6f0871222f04dfeb479d37fe9753d491e3150e42
tree5b3d05242cd96085a01eb327b04e2cd762dabebf
parent05c53113e0c73c7cab61edf53524c61c20a547c2
better fix for [3028370] GL get error should return a valid error if no context is bound.

it turns out that we cannot return INVALID_OPERATION from glGetError() because the
GL spec says that it must be called in a loop until it returns GL_NO_ERROR.

now, we always return 0 from GL functions called from a thread with no
context bound. This means that glGetError() will return NO_ERROR in this case,
which is better than returning a random value (which could trap the app in a loop).

if this happens in the main thread of a process, we LOG an error message once.

Change-Id: Id59620e675a890286ef62a257c02b06e0fdcaf69
opengl/libs/EGL/egl.cpp
opengl/libs/GLES2/gl2.cpp
opengl/libs/GLES_CM/gl.cpp