| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrGLUtil.h" | 9 #include "GrGLUtil.h" |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 // check for ES2 | 116 // check for ES2 |
| 117 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); | 117 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); |
| 118 if (2 == n) { | 118 if (2 == n) { |
| 119 return kES2_GrGLBinding; | 119 return kES2_GrGLBinding; |
| 120 } | 120 } |
| 121 return kNone_GrGLBinding; | 121 return kNone_GrGLBinding; |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool GrGLIsMesaFromVersionString(const char* versionString) { |
| 125 int major, minor, mesaMajor, mesaMinor; |
| 126 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); |
| 127 return 4 == n; |
| 128 } |
| 129 |
| 124 GrGLVersion GrGLGetVersionFromString(const char* versionString) { | 130 GrGLVersion GrGLGetVersionFromString(const char* versionString) { |
| 125 if (NULL == versionString) { | 131 if (NULL == versionString) { |
| 126 GrAssert(!"NULL GL version string."); | 132 GrAssert(!"NULL GL version string."); |
| 127 return 0; | 133 return 0; |
| 128 } | 134 } |
| 129 | 135 |
| 130 int major, minor; | 136 int major, minor; |
| 131 | 137 |
| 132 // check for mesa | 138 // check for mesa |
| 133 int mesaMajor, mesaMinor; | 139 int mesaMajor, mesaMinor; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 const GrGLubyte* v; | 226 const GrGLubyte* v; |
| 221 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION)); | 227 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION)); |
| 222 return GrGLGetGLSLVersionFromString((const char*) v); | 228 return GrGLGetGLSLVersionFromString((const char*) v); |
| 223 } | 229 } |
| 224 | 230 |
| 225 GrGLVendor GrGLGetVendor(const GrGLInterface* gl) { | 231 GrGLVendor GrGLGetVendor(const GrGLInterface* gl) { |
| 226 const GrGLubyte* v; | 232 const GrGLubyte* v; |
| 227 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); | 233 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); |
| 228 return GrGLGetVendorFromString((const char*) v); | 234 return GrGLGetVendorFromString((const char*) v); |
| 229 } | 235 } |
| OLD | NEW |