Index: src/gpu/gl/GrGLUtil.cpp |
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp |
index 0a17c19c2a7be2a253c14bceba524f32cc0c0e2c..5db541ca7f879435a6fa5fd4ac1dae8d524e70a9 100644 |
--- a/src/gpu/gl/GrGLUtil.cpp |
+++ b/src/gpu/gl/GrGLUtil.cpp |
@@ -92,24 +92,62 @@ GrGLStandard GrGLGetStandardInUseFromString(const char* versionString) { |
return kNone_GrGLStandard; |
} |
-bool GrGLIsMesaFromVersionString(const char* versionString) { |
- int major, minor, mesaMajor, mesaMinor; |
- |
- GrGLStandard standard = GrGLGetStandardInUseFromString(versionString); |
+void GrGLGetDriverInfo(GrGLStandard standard, |
+ GrGLVendor vendor, |
+ const char* rendererString, |
+ const char* versionString, |
+ GrGLDriver* outDriver, |
+ GrGLDriverVersion* outVersion) { |
+ int major, minor, rev, driverMajor, driverMinor; |
+ |
+ *outDriver = kUnknown_GrGLDriver; |
+ *outVersion = GR_GL_DRIVER_UNKNOWN_VER; |
+ |
+ if (0 == strcmp(rendererString, "Chromium")) { |
+ *outDriver = kChromium_GrGLDriver; |
+ return; |
+ } |
if (standard == kGL_GrGLStandard) { |
- int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor, &mesaMinor); |
- return 4 == n; |
+ if (kNVIDIA_GrGLVendor == vendor) { |
+ *outDriver = kNVIDIA_GrGLDriver; |
+ int n = sscanf(versionString, "%d.%d.%d NVIDIA %d.%d", |
+ &major, &minor, &rev, &driverMajor, &driverMinor); |
+ // Some older NVIDIA drivers don't report the driver version. |
+ if (5 == n) { |
+ *outVersion = GR_GL_DRIVER_VER(driverMajor, driverMinor); |
+ } |
+ return; |
+ } |
+ |
+ int n = sscanf(versionString, "%d.%d Mesa %d.%d", |
+ &major, &minor, &driverMajor, &driverMinor); |
+ if (4 == n) { |
+ *outDriver = kMesa_GrGLDriver; |
+ *outVersion = GR_GL_DRIVER_VER(driverMajor, driverMinor); |
+ return; |
+ } |
} |
else { |
- int n = sscanf(versionString, "OpenGL ES %d.%d Mesa %d.%d", &major, &minor, &mesaMajor, &mesaMinor); |
- return 4 == n; |
- } |
- return false; |
-} |
+ if (kNVIDIA_GrGLVendor == vendor) { |
+ *outDriver = kNVIDIA_GrGLDriver; |
+ int n = sscanf(versionString, "OpenGL ES %d.%d NVIDIA %d.%d", |
+ &major, &minor, &driverMajor, &driverMinor); |
+ // Some older NVIDIA drivers don't report the driver version. |
+ if (4 == n) { |
+ *outVersion = GR_GL_DRIVER_VER(driverMajor, driverMinor); |
+ } |
+ return; |
+ } |
-bool GrGLIsChromiumFromRendererString(const char* rendererString) { |
- return 0 == strcmp(rendererString, "Chromium"); |
+ int n = sscanf(versionString, "OpenGL ES %d.%d Mesa %d.%d", |
+ &major, &minor, &driverMajor, &driverMinor); |
+ if (4 == n) { |
+ *outDriver = kMesa_GrGLDriver; |
+ *outVersion = GR_GL_DRIVER_VER(driverMajor, driverMinor); |
+ return; |
+ } |
+ } |
} |
GrGLVersion GrGLGetVersionFromString(const char* versionString) { |