| 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 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); | 56 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 #if GR_GL_CHECK_ERROR | 59 #if GR_GL_CHECK_ERROR |
| 60 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); | 60 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 /////////////////////////////////////////////////////////////////////////////// | 63 /////////////////////////////////////////////////////////////////////////////// |
| 64 | 64 |
| 65 GrGLStandard GrGLGetStandardInUseFromString(const char* versionString) { | 65 GrGLStandard GrGLGetStandardInUseFromString(const char* versionString) { |
| 66 if (NULL == versionString) { | 66 if (nullptr == versionString) { |
| 67 SkDebugf("NULL GL version string."); | 67 SkDebugf("nullptr GL version string."); |
| 68 return kNone_GrGLStandard; | 68 return kNone_GrGLStandard; |
| 69 } | 69 } |
| 70 | 70 |
| 71 int major, minor; | 71 int major, minor; |
| 72 | 72 |
| 73 // check for desktop | 73 // check for desktop |
| 74 int n = sscanf(versionString, "%d.%d", &major, &minor); | 74 int n = sscanf(versionString, "%d.%d", &major, &minor); |
| 75 if (2 == n) { | 75 if (2 == n) { |
| 76 return kGL_GrGLStandard; | 76 return kGL_GrGLStandard; |
| 77 } | 77 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (kIntel_GrGLVendor == vendor) { | 161 if (kIntel_GrGLVendor == vendor) { |
| 162 // We presume we're on the Intel driver since it hasn't identified itsel
f as Mesa. | 162 // We presume we're on the Intel driver since it hasn't identified itsel
f as Mesa. |
| 163 *outDriver = kIntel_GrGLDriver; | 163 *outDriver = kIntel_GrGLDriver; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 GrGLVersion GrGLGetVersionFromString(const char* versionString) { | 167 GrGLVersion GrGLGetVersionFromString(const char* versionString) { |
| 168 if (NULL == versionString) { | 168 if (nullptr == versionString) { |
| 169 SkDebugf("NULL GL version string."); | 169 SkDebugf("nullptr GL version string."); |
| 170 return GR_GL_INVALID_VER; | 170 return GR_GL_INVALID_VER; |
| 171 } | 171 } |
| 172 | 172 |
| 173 int major, minor; | 173 int major, minor; |
| 174 | 174 |
| 175 // check for mesa | 175 // check for mesa |
| 176 int mesaMajor, mesaMinor; | 176 int mesaMajor, mesaMinor; |
| 177 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); | 177 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); |
| 178 if (4 == n) { | 178 if (4 == n) { |
| 179 return GR_GL_VER(major, minor); | 179 return GR_GL_VER(major, minor); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 193 | 193 |
| 194 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); | 194 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); |
| 195 if (2 == n) { | 195 if (2 == n) { |
| 196 return GR_GL_VER(major, minor); | 196 return GR_GL_VER(major, minor); |
| 197 } | 197 } |
| 198 | 198 |
| 199 return GR_GL_INVALID_VER; | 199 return GR_GL_INVALID_VER; |
| 200 } | 200 } |
| 201 | 201 |
| 202 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { | 202 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { |
| 203 if (NULL == versionString) { | 203 if (nullptr == versionString) { |
| 204 SkDebugf("NULL GLSL version string."); | 204 SkDebugf("nullptr GLSL version string."); |
| 205 return GR_GLSL_INVALID_VER; | 205 return GR_GLSL_INVALID_VER; |
| 206 } | 206 } |
| 207 | 207 |
| 208 int major, minor; | 208 int major, minor; |
| 209 | 209 |
| 210 int n = sscanf(versionString, "%d.%d", &major, &minor); | 210 int n = sscanf(versionString, "%d.%d", &major, &minor); |
| 211 if (2 == n) { | 211 if (2 == n) { |
| 212 return GR_GLSL_VER(major, minor); | 212 return GR_GLSL_VER(major, minor); |
| 213 } | 213 } |
| 214 | 214 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); | 366 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); |
| 367 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); | 367 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); |
| 368 GR_STATIC_ASSERT(4 == kLess_StencilFunc); | 368 GR_STATIC_ASSERT(4 == kLess_StencilFunc); |
| 369 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); | 369 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); |
| 370 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); | 370 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); |
| 371 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); | 371 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); |
| 372 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); | 372 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); |
| 373 | 373 |
| 374 return gTable[basicFunc]; | 374 return gTable[basicFunc]; |
| 375 } | 375 } |
| OLD | NEW |