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 22 matching lines...) Expand all Loading... |
33 return "Unknown"; | 33 return "Unknown"; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 void GrGLCheckErr(const GrGLInterface* gl, | 37 void GrGLCheckErr(const GrGLInterface* gl, |
38 const char* location, | 38 const char* location, |
39 const char* call) { | 39 const char* call) { |
40 uint32_t err = GR_GL_GET_ERROR(gl); | 40 uint32_t err = GR_GL_GET_ERROR(gl); |
41 if (GR_GL_NO_ERROR != err) { | 41 if (GR_GL_NO_ERROR != err) { |
42 GrPrintf("---- glGetError 0x%x(%s)", err, get_error_string(err)); | 42 GrPrintf("---- glGetError 0x%x(%s)", err, get_error_string(err)); |
43 if (NULL != location) { | 43 if (location) { |
44 GrPrintf(" at\n\t%s", location); | 44 GrPrintf(" at\n\t%s", location); |
45 } | 45 } |
46 if (NULL != call) { | 46 if (call) { |
47 GrPrintf("\n\t\t%s", call); | 47 GrPrintf("\n\t\t%s", call); |
48 } | 48 } |
49 GrPrintf("\n"); | 49 GrPrintf("\n"); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 /////////////////////////////////////////////////////////////////////////////// | 53 /////////////////////////////////////////////////////////////////////////////// |
54 | 54 |
55 #if GR_GL_LOG_CALLS | 55 #if GR_GL_LOG_CALLS |
56 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); | 56 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 n = sscanf(versionString, "OpenGL ES GLSL %d.%d", &major, &minor); | 160 n = sscanf(versionString, "OpenGL ES GLSL %d.%d", &major, &minor); |
161 if (2 == n) { | 161 if (2 == n) { |
162 return GR_GLSL_VER(major, minor); | 162 return GR_GLSL_VER(major, minor); |
163 } | 163 } |
164 #endif | 164 #endif |
165 | 165 |
166 return GR_GLSL_INVALID_VER; | 166 return GR_GLSL_INVALID_VER; |
167 } | 167 } |
168 | 168 |
169 GrGLVendor GrGLGetVendorFromString(const char* vendorString) { | 169 GrGLVendor GrGLGetVendorFromString(const char* vendorString) { |
170 if (NULL != vendorString) { | 170 if (vendorString) { |
171 if (0 == strcmp(vendorString, "ARM")) { | 171 if (0 == strcmp(vendorString, "ARM")) { |
172 return kARM_GrGLVendor; | 172 return kARM_GrGLVendor; |
173 } | 173 } |
174 if (0 == strcmp(vendorString, "Imagination Technologies")) { | 174 if (0 == strcmp(vendorString, "Imagination Technologies")) { |
175 return kImagination_GrGLVendor; | 175 return kImagination_GrGLVendor; |
176 } | 176 } |
177 if (0 == strncmp(vendorString, "Intel ", 6) || 0 == strcmp(vendorString,
"Intel")) { | 177 if (0 == strncmp(vendorString, "Intel ", 6) || 0 == strcmp(vendorString,
"Intel")) { |
178 return kIntel_GrGLVendor; | 178 return kIntel_GrGLVendor; |
179 } | 179 } |
180 if (0 == strcmp(vendorString, "Qualcomm")) { | 180 if (0 == strcmp(vendorString, "Qualcomm")) { |
181 return kQualcomm_GrGLVendor; | 181 return kQualcomm_GrGLVendor; |
182 } | 182 } |
183 if (0 == strcmp(vendorString, "NVIDIA Corporation")) { | 183 if (0 == strcmp(vendorString, "NVIDIA Corporation")) { |
184 return kNVIDIA_GrGLVendor; | 184 return kNVIDIA_GrGLVendor; |
185 } | 185 } |
186 } | 186 } |
187 return kOther_GrGLVendor; | 187 return kOther_GrGLVendor; |
188 } | 188 } |
189 | 189 |
190 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { | 190 GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { |
191 if (NULL != rendererString) { | 191 if (rendererString) { |
192 if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) { | 192 if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) { |
193 return kTegra3_GrGLRenderer; | 193 return kTegra3_GrGLRenderer; |
194 } else if (0 == strcmp(rendererString, "NVIDIA Tegra")) { | 194 } else if (0 == strcmp(rendererString, "NVIDIA Tegra")) { |
195 return kTegra2_GrGLRenderer; | 195 return kTegra2_GrGLRenderer; |
196 } | 196 } |
197 } | 197 } |
198 return kOther_GrGLRenderer; | 198 return kOther_GrGLRenderer; |
199 } | 199 } |
200 | 200 |
201 GrGLVersion GrGLGetVersion(const GrGLInterface* gl) { | 201 GrGLVersion GrGLGetVersion(const GrGLInterface* gl) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); | 282 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); |
283 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); | 283 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); |
284 GR_STATIC_ASSERT(4 == kLess_StencilFunc); | 284 GR_STATIC_ASSERT(4 == kLess_StencilFunc); |
285 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); | 285 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); |
286 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); | 286 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); |
287 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); | 287 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); |
288 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); | 288 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); |
289 | 289 |
290 return gTable[basicFunc]; | 290 return gTable[basicFunc]; |
291 } | 291 } |
OLD | NEW |