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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 if (0 == strcmp(vendorString, "Imagination Technologies")) { | 184 if (0 == strcmp(vendorString, "Imagination Technologies")) { |
185 return kImagination_GrGLVendor; | 185 return kImagination_GrGLVendor; |
186 } | 186 } |
187 if (0 == strncmp(vendorString, "Intel ", 6) || 0 == strcmp(vendorString, "Intel")) { | 187 if (0 == strncmp(vendorString, "Intel ", 6) || 0 == strcmp(vendorString, "Intel")) { |
188 return kIntel_GrGLVendor; | 188 return kIntel_GrGLVendor; |
189 } | 189 } |
190 if (0 == strcmp(vendorString, "Qualcomm")) { | 190 if (0 == strcmp(vendorString, "Qualcomm")) { |
191 return kQualcomm_GrGLVendor; | 191 return kQualcomm_GrGLVendor; |
192 } | 192 } |
193 if (0 == strcmp(vendorString, "NVIDIA Corporation")) { | 193 if (0 == strcmp(vendorString, "NVIDIA Corporation")) { |
194 return kNVIDIA_GrGLVendor; | 194 return kNVIDIA_GrGLVendor; |
195 } | 195 } |
196 } | 196 } |
197 return kOther_GrGLVendor; | 197 return kOther_GrGLVendor; |
198 } | 198 } |
199 | 199 |
200 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { | 200 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { |
201 if (rendererString) { | 201 if (rendererString) { |
202 if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) { | 202 if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) { |
203 return kTegra3_GrGLRenderer; | 203 return kTegra3_GrGLRenderer; |
204 } else if (0 == strcmp(rendererString, "NVIDIA Tegra")) { | 204 } else if (0 == strcmp(rendererString, "NVIDIA Tegra")) { |
205 return kTegra2_GrGLRenderer; | 205 return kTegra2_GrGLRenderer; |
206 } | 206 } |
207 int lastDigit; | |
208 int n = sscanf(rendererString, "PowerVR SGX 54%d", &lastDigit); | |
209 if (1 == n && lastDigit >= 0 && lastDigit <= 9) { | |
210 return kPowerVR54x_GrGLRenderer; | |
211 } | |
212 static const char kPowerVRRogueStr[] = "PowerVR Rogue"; | |
213 if (0 == strncmp(rendererString, kPowerVRRogueStr, | |
214 SK_ARRAY_COUNT(kPowerVRRogueStr)-1)) { | |
tfarina
2014/11/06 14:23:01
can strlen() be used here?
bsalomon
2014/11/06 15:00:30
It could
| |
215 return kPowerVRRogue_GrGLRenderer; | |
216 } | |
207 } | 217 } |
208 return kOther_GrGLRenderer; | 218 return kOther_GrGLRenderer; |
209 } | 219 } |
210 | 220 |
211 GrGLVersion GrGLGetVersion(const GrGLInterface* gl) { | 221 GrGLVersion GrGLGetVersion(const GrGLInterface* gl) { |
212 const GrGLubyte* v; | 222 const GrGLubyte* v; |
213 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION)); | 223 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION)); |
214 return GrGLGetVersionFromString((const char*) v); | 224 return GrGLGetVersionFromString((const char*) v); |
215 } | 225 } |
216 | 226 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); | 302 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); |
293 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); | 303 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); |
294 GR_STATIC_ASSERT(4 == kLess_StencilFunc); | 304 GR_STATIC_ASSERT(4 == kLess_StencilFunc); |
295 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); | 305 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); |
296 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); | 306 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); |
297 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); | 307 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); |
298 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); | 308 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); |
299 | 309 |
300 return gTable[basicFunc]; | 310 return gTable[basicFunc]; |
301 } | 311 } |
OLD | NEW |