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

Unified Diff: src/gpu/gl/GrGLUtil.cpp

Issue 15779009: Get correct GLVersion for Mesa to avoid GrContext creation failure (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLUtil.cpp
===================================================================
--- src/gpu/gl/GrGLUtil.cpp (revision 9286)
+++ src/gpu/gl/GrGLUtil.cpp (working copy)
@@ -48,6 +48,37 @@
}
}
+namespace {
+bool get_gl_version_for_mesa(const int mesaMajorVersion,
+ int* major,
+ int* minor) {
+ switch (mesaMajorVersion) {
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ *major = 1;
+ *minor = mesaMajorVersion - 1;
+ return true;
+ case 7:
+ *major = 2;
+ *minor = 1;
+ return true;
+ case 8:
+ *major = 3;
+ *minor = 0;
+ return true;
+ case 9:
+ *major = 3;
+ *minor = 1;
+ return true;
+ default:
+ return false;
+ }
+}
+}
+
///////////////////////////////////////////////////////////////////////////////
#if GR_GL_LOG_CALLS
@@ -99,7 +130,19 @@
int major, minor;
- int n = sscanf(versionString, "%d.%d", &major, &minor);
+ // check for mesa
+ int mesaMajor, mesaMinor;
+ int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor,
+ &mesaMajor, &mesaMinor);
+ if (4 == n) {
+ if (get_gl_version_for_mesa(mesaMajor, &major, &minor)) {
+ return GR_GL_VER(major, minor);
+ } else {
+ return 0;
+ }
+ }
+
+ n = sscanf(versionString, "%d.%d", &major, &minor);
if (2 == n) {
return GR_GL_VER(major, minor);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698