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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (0 == strcmp(vendorString, "Intel")) { | 207 if (0 == strcmp(vendorString, "Intel")) { |
208 return kIntel_GrGLVendor; | 208 return kIntel_GrGLVendor; |
209 } | 209 } |
210 if (0 == strcmp(vendorString, "Qualcomm")) { | 210 if (0 == strcmp(vendorString, "Qualcomm")) { |
211 return kQualcomm_GrGLVendor; | 211 return kQualcomm_GrGLVendor; |
212 } | 212 } |
213 } | 213 } |
214 return kOther_GrGLVendor; | 214 return kOther_GrGLVendor; |
215 } | 215 } |
216 | 216 |
| 217 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { |
| 218 if (NULL != rendererString) { |
| 219 if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) { |
| 220 return kTegra3_GrGLRenderer; |
| 221 } |
| 222 } |
| 223 return kOther_GrGLRenderer; |
| 224 } |
| 225 |
217 GrGLBinding GrGLGetBindingInUse(const GrGLInterface* gl) { | 226 GrGLBinding GrGLGetBindingInUse(const GrGLInterface* gl) { |
218 const GrGLubyte* v; | 227 const GrGLubyte* v; |
219 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION)); | 228 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION)); |
220 return GrGLGetBindingInUseFromString((const char*) v); | 229 return GrGLGetBindingInUseFromString((const char*) v); |
221 } | 230 } |
222 | 231 |
223 GrGLVersion GrGLGetVersion(const GrGLInterface* gl) { | 232 GrGLVersion GrGLGetVersion(const GrGLInterface* gl) { |
224 const GrGLubyte* v; | 233 const GrGLubyte* v; |
225 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION)); | 234 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VERSION)); |
226 return GrGLGetVersionFromString((const char*) v); | 235 return GrGLGetVersionFromString((const char*) v); |
227 } | 236 } |
228 | 237 |
229 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface* gl) { | 238 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface* gl) { |
230 const GrGLubyte* v; | 239 const GrGLubyte* v; |
231 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION)); | 240 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION)); |
232 return GrGLGetGLSLVersionFromString((const char*) v); | 241 return GrGLGetGLSLVersionFromString((const char*) v); |
233 } | 242 } |
234 | 243 |
235 GrGLVendor GrGLGetVendor(const GrGLInterface* gl) { | 244 GrGLVendor GrGLGetVendor(const GrGLInterface* gl) { |
236 const GrGLubyte* v; | 245 const GrGLubyte* v; |
237 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); | 246 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); |
238 return GrGLGetVendorFromString((const char*) v); | 247 return GrGLGetVendorFromString((const char*) v); |
239 } | 248 } |
240 | 249 |
| 250 GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) { |
| 251 const GrGLubyte* v; |
| 252 GR_GL_CALL_RET(gl, v, GetString(GR_GL_RENDERER)); |
| 253 return GrGLGetRendererFromString((const char*) v); |
| 254 } |
| 255 |
241 template<> void GrGLGetMatrix<3>(GrGLfloat* dest, const SkMatrix& src) { | 256 template<> void GrGLGetMatrix<3>(GrGLfloat* dest, const SkMatrix& src) { |
242 // Col 0 | 257 // Col 0 |
243 dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]); | 258 dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]); |
244 dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]); | 259 dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]); |
245 dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]); | 260 dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]); |
246 | 261 |
247 // Col 1 | 262 // Col 1 |
248 dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]); | 263 dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]); |
249 dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]); | 264 dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]); |
250 dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]); | 265 dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]); |
(...skipping 22 matching lines...) Expand all Loading... |
273 dest[9] = 0; | 288 dest[9] = 0; |
274 dest[10] = 1; | 289 dest[10] = 1; |
275 dest[11] = 0; | 290 dest[11] = 0; |
276 | 291 |
277 // Col 3 | 292 // Col 3 |
278 dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]); | 293 dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]); |
279 dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]); | 294 dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]); |
280 dest[14] = 0; | 295 dest[14] = 0; |
281 dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]); | 296 dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]); |
282 } | 297 } |
OLD | NEW |