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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #endif | 86 #endif |
87 | 87 |
88 #if GR_GL_CHECK_ERROR | 88 #if GR_GL_CHECK_ERROR |
89 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); | 89 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); |
90 #endif | 90 #endif |
91 | 91 |
92 /////////////////////////////////////////////////////////////////////////////// | 92 /////////////////////////////////////////////////////////////////////////////// |
93 | 93 |
94 GrGLBinding GrGLGetBindingInUseFromString(const char* versionString) { | 94 GrGLBinding GrGLGetBindingInUseFromString(const char* versionString) { |
95 if (NULL == versionString) { | 95 if (NULL == versionString) { |
96 SkASSERT(!"NULL GL version string."); | 96 SkDEBUGFAIL("NULL GL version string."); |
97 return kNone_GrGLBinding; | 97 return kNone_GrGLBinding; |
98 } | 98 } |
99 | 99 |
100 int major, minor; | 100 int major, minor; |
101 | 101 |
102 // check for desktop | 102 // check for desktop |
103 int n = sscanf(versionString, "%d.%d", &major, &minor); | 103 int n = sscanf(versionString, "%d.%d", &major, &minor); |
104 if (2 == n) { | 104 if (2 == n) { |
105 return kDesktop_GrGLBinding; | 105 return kDesktop_GrGLBinding; |
106 } | 106 } |
(...skipping 15 matching lines...) Expand all Loading... |
122 } | 122 } |
123 | 123 |
124 bool GrGLIsMesaFromVersionString(const char* versionString) { | 124 bool GrGLIsMesaFromVersionString(const char* versionString) { |
125 int major, minor, mesaMajor, mesaMinor; | 125 int major, minor, mesaMajor, mesaMinor; |
126 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); | 126 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); |
127 return 4 == n; | 127 return 4 == n; |
128 } | 128 } |
129 | 129 |
130 GrGLVersion GrGLGetVersionFromString(const char* versionString) { | 130 GrGLVersion GrGLGetVersionFromString(const char* versionString) { |
131 if (NULL == versionString) { | 131 if (NULL == versionString) { |
132 SkASSERT(!"NULL GL version string."); | 132 SkDEBUGFAIL("NULL GL version string."); |
133 return 0; | 133 return 0; |
134 } | 134 } |
135 | 135 |
136 int major, minor; | 136 int major, minor; |
137 | 137 |
138 // check for mesa | 138 // check for mesa |
139 int mesaMajor, mesaMinor; | 139 int mesaMajor, mesaMinor; |
140 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); | 140 int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor
, &mesaMinor); |
141 if (4 == n) { | 141 if (4 == n) { |
142 if (get_gl_version_for_mesa(mesaMajor, &major, &minor)) { | 142 if (get_gl_version_for_mesa(mesaMajor, &major, &minor)) { |
(...skipping 18 matching lines...) Expand all Loading... |
161 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); | 161 n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor); |
162 if (2 == n) { | 162 if (2 == n) { |
163 return GR_GL_VER(major, minor); | 163 return GR_GL_VER(major, minor); |
164 } | 164 } |
165 | 165 |
166 return 0; | 166 return 0; |
167 } | 167 } |
168 | 168 |
169 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { | 169 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString) { |
170 if (NULL == versionString) { | 170 if (NULL == versionString) { |
171 SkASSERT(!"NULL GLSL version string."); | 171 SkDEBUGFAIL("NULL GLSL version string."); |
172 return 0; | 172 return 0; |
173 } | 173 } |
174 | 174 |
175 int major, minor; | 175 int major, minor; |
176 | 176 |
177 int n = sscanf(versionString, "%d.%d", &major, &minor); | 177 int n = sscanf(versionString, "%d.%d", &major, &minor); |
178 if (2 == n) { | 178 if (2 == n) { |
179 return GR_GLSL_VER(major, minor); | 179 return GR_GLSL_VER(major, minor); |
180 } | 180 } |
181 | 181 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 const GrGLubyte* v; | 229 const GrGLubyte* v; |
230 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION)); | 230 GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION)); |
231 return GrGLGetGLSLVersionFromString((const char*) v); | 231 return GrGLGetGLSLVersionFromString((const char*) v); |
232 } | 232 } |
233 | 233 |
234 GrGLVendor GrGLGetVendor(const GrGLInterface* gl) { | 234 GrGLVendor GrGLGetVendor(const GrGLInterface* gl) { |
235 const GrGLubyte* v; | 235 const GrGLubyte* v; |
236 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); | 236 GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR)); |
237 return GrGLGetVendorFromString((const char*) v); | 237 return GrGLGetVendorFromString((const char*) v); |
238 } | 238 } |
OLD | NEW |