Index: ui/gfx/gl/gl_implementation.cc |
diff --git a/ui/gfx/gl/gl_implementation.cc b/ui/gfx/gl/gl_implementation.cc |
index 19cc91c05f92ee7f31ad99462d45cbcba10ec706..f7ad2ee94c2995f47e35f4378744717bd16cc0ad 100644 |
--- a/ui/gfx/gl/gl_implementation.cc |
+++ b/ui/gfx/gl/gl_implementation.cc |
@@ -41,6 +41,21 @@ void CleanupNativeLibraries(void* unused) { |
g_libraries = NULL; |
} |
} |
+ |
+bool ExportsCoreFunctionsFromGetProcAddress(GLImplementation implementation) { |
+ switch (GetGLImplementation()) { |
+ case kGLImplementationDesktopGL: |
+ case kGLImplementationOSMesaGL: |
+ case kGLImplementationMockGL: |
+ return true; |
+ case kGLImplementationEGLGLES2: |
+ return false; |
+ default: |
+ NOTREACHED(); |
+ return true; |
+ } |
+} |
+ |
} |
GLImplementation GetNamedGLImplementation(const std::string& name) { |
@@ -137,7 +152,7 @@ void SetGLGetProcAddressProc(GLGetProcAddressProc proc) { |
g_get_proc_address = proc; |
} |
-void* GetGLProcAddress(const char* name) { |
+void* GetGLCoreProcAddress(const char* name) { |
DCHECK(g_gl_implementation != kGLImplementationNone); |
if (g_libraries) { |
@@ -148,8 +163,8 @@ void* GetGLProcAddress(const char* name) { |
return proc; |
} |
} |
- |
- if (g_get_proc_address) { |
+ if (ExportsCoreFunctionsFromGetProcAddress(g_gl_implementation) && |
+ g_get_proc_address) { |
void* proc = g_get_proc_address(name); |
if (proc) |
return proc; |
@@ -158,4 +173,17 @@ void* GetGLProcAddress(const char* name) { |
return NULL; |
} |
+void* GetGLProcAddress(const char* name) { |
+ DCHECK(g_gl_implementation != kGLImplementationNone); |
+ |
+ void* proc = GetGLCoreProcAddress(name); |
+ if (!proc && g_get_proc_address) { |
+ proc = g_get_proc_address(name); |
+ if (proc) |
+ return proc; |
+ } |
+ |
+ return proc; |
+} |
+ |
} // namespace gfx |