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); |
} |