summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tao Wu <lepton@google.com> 2020-06-22 21:11:07 -0700
committer Tao Wu <lepton@google.com> 2020-06-24 17:18:28 -0700
commitf470a8e7f6233e49440d73829d75a2a024f58a4c (patch)
tree6fc046d13c8413e7664e0f6edbe11205bb7ba975
parentd451a4712405b2ae4a25c293686b110af3412d4e (diff)
opengl: Check GL_EXT_debug_marker before using it.
The old code just use eglGetProcAddress to get function pointers without checking if GL_EXT_debug_marker is supported. This doesn't work for some implementation like MESA. If GL_EXT_debug_marker isn't supported, reset those function pointers to gl_noop. Bug: 155935219 Test: manual - Run dEQP-GLES2.functional.debug_marker#random on ARCVM Change-Id: I93fa8fb419ccde46fef6dd9a2a4ec84f15db3284
-rw-r--r--opengl/libs/EGL/egl_object.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index ff4fe2dd9c..fd426c24e2 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -309,6 +309,18 @@ void egl_context_t::onMakeCurrent(EGLSurface draw, EGLSurface read) {
gl_extensions = exts;
if (gl_extensions.find("GL_EXT_debug_marker") == std::string::npos) {
gl_extensions.insert(0, "GL_EXT_debug_marker ");
+ // eglGetProcAddress could return function pointers to these
+ // functions while they actually don't work. Fix them now.
+ __eglMustCastToProperFunctionPointerType* f;
+ f = (__eglMustCastToProperFunctionPointerType*)&gEGLImpl.hooks[version]
+ ->gl.glInsertEventMarkerEXT;
+ if (*f != gl_noop) *f = gl_noop;
+ f = (__eglMustCastToProperFunctionPointerType*)&gEGLImpl.hooks[version]
+ ->gl.glPushGroupMarkerEXT;
+ if (*f != gl_noop) *f = gl_noop;
+ f = (__eglMustCastToProperFunctionPointerType*)&gEGLImpl.hooks[version]
+ ->gl.glPopGroupMarkerEXT;
+ if (*f != gl_noop) *f = gl_noop;
}
// tokenize the supported extensions for the glGetStringi() wrapper