diff options
author | Kevin Lubick <kjlubick@google.com> | 2018-06-05 16:05:58 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-05 20:37:09 +0000 |
commit | da2b9f397f04300d2a706da3888ff781b21818ab (patch) | |
tree | 16d8e15540d1088ccac2039b420fba378550e27d | |
parent | 4225b3220ef4bf50f0d9403f812ea94d50c4ee59 (diff) |
Add Gr enums and version parsing for SwiftShader
Bug: skia:
Change-Id: I1f29cde915a0ae7fa59d7cfdf30f51632c1c24c4
Reviewed-on: https://skia-review.googlesource.com/132264
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
-rw-r--r-- | src/gpu/gl/GrGLUtil.cpp | 21 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.h | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index 0d622f5e3d..0a65f5628a 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -174,6 +174,21 @@ void GrGLGetDriverInfo(GrGLStandard standard, } } + if (kGoogle_GrGLVendor == vendor) { + // Swiftshader is the only Google vendor at the moment + *outDriver = kSwiftShader_GrGLDriver; + + // Swiftshader has a strange version string: w.x.y.z Going to arbitrarily ignore + // y and assume w,x and z are major, minor, point. + // As of writing, version is 4.0.0.6 + int n = sscanf(versionString, "OpenGL ES %d.%d SwiftShader %d.%d.0.%d", &major, &minor, + &driverMajor, &driverMinor, &driverPoint); + if (5 == n) { + *outVersion = GR_GL_DRIVER_VER(driverMajor, driverMinor, driverPoint); + } + return; + } + if (kIntel_GrGLVendor == vendor) { // We presume we're on the Intel driver since it hasn't identified itself as Mesa. *outDriver = kIntel_GrGLDriver; @@ -267,6 +282,9 @@ GrGLVendor GrGLGetVendorFromString(const char* vendorString) { if (0 == strcmp(vendorString, "ARM")) { return kARM_GrGLVendor; } + if (0 == strcmp(vendorString, "Google Inc.")) { + return kGoogle_GrGLVendor; + } if (0 == strcmp(vendorString, "Imagination Technologies")) { return kImagination_GrGLVendor; } @@ -345,6 +363,9 @@ GrGLRenderer GrGLGetRendererFromStrings(const char* rendererString, } } } + if (0 == strcmp("Google SwiftShader", rendererString)) { + return kGoogleSwiftShader_GrGLRenderer; + } if (0 == strcmp("Intel Iris Pro OpenGL Engine", rendererString)) { return kIntelIrisPro_GrGLRenderer; } diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h index 96d024d8b8..2658139239 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -38,6 +38,7 @@ typedef uint64_t GrGLDriverVersion; */ enum GrGLVendor { kARM_GrGLVendor, + kGoogle_GrGLVendor, kImagination_GrGLVendor, kIntel_GrGLVendor, kQualcomm_GrGLVendor, @@ -56,6 +57,7 @@ enum GrGLRenderer { kAdreno4xx_GrGLRenderer, kAdreno5xx_GrGLRenderer, kOSMesa_GrGLRenderer, + kGoogleSwiftShader_GrGLRenderer, kIntelIrisPro_GrGLRenderer, /** Either HD 4xxx or Iris 4xxx */ kIntel4xxx_GrGLRenderer, @@ -80,6 +82,7 @@ enum GrGLDriver { kNVIDIA_GrGLDriver, kIntel_GrGLDriver, kANGLE_GrGLDriver, + kSwiftShader_GrGLDriver, kQualcomm_GrGLDriver, kUnknown_GrGLDriver }; |