Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: ui/gfx/gl/gl_implementation.cc

Issue 8381001: Split GL binding init into core and extension part (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added dependencies to gl.gyp. Used NOT_REACHED() instead of DCHECK(0). Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/gl/gl_implementation.h ('k') | ui/gfx/gl/gl_implementation_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/gfx/gl/gl_implementation.h ('k') | ui/gfx/gl/gl_implementation_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698