OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "gl/GrGLExtensions.h" | 8 #include "gl/GrGLExtensions.h" |
9 #include "gl/GrGLDefines.h" | 9 #include "gl/GrGLDefines.h" |
10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 GrGLGetIntegervProc getIntegerv) { | 47 GrGLGetIntegervProc getIntegerv) { |
48 fInitialized = false; | 48 fInitialized = false; |
49 fStrings->reset(); | 49 fStrings->reset(); |
50 | 50 |
51 if (NULL == getString) { | 51 if (NULL == getString) { |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
55 // glGetStringi and indexed extensions were added in version 3.0 of desktop
GL and ES. | 55 // glGetStringi and indexed extensions were added in version 3.0 of desktop
GL and ES. |
56 const GrGLubyte* verString = getString(GR_GL_VERSION); | 56 const GrGLubyte* verString = getString(GR_GL_VERSION); |
57 if (NULL == verString) { | 57 GrGLVersion version = GrGLGetVersionFromString((const char*) verString); |
| 58 if (GR_GL_INVALID_VER == version) { |
58 return false; | 59 return false; |
59 } | 60 } |
60 GrGLVersion version = GrGLGetVersionFromString((const char*) verString); | 61 |
61 bool indexed = version >= GR_GL_VER(3, 0); | 62 bool indexed = version >= GR_GL_VER(3, 0); |
62 | 63 |
63 if (indexed) { | 64 if (indexed) { |
64 if (NULL == getStringi || NULL == getIntegerv) { | 65 if (NULL == getStringi || NULL == getIntegerv) { |
65 return false; | 66 return false; |
66 } | 67 } |
67 GrGLint extensionCnt = 0; | 68 GrGLint extensionCnt = 0; |
68 getIntegerv(GR_GL_NUM_EXTENSIONS, &extensionCnt); | 69 getIntegerv(GR_GL_NUM_EXTENSIONS, &extensionCnt); |
69 fStrings->push_back_n(extensionCnt); | 70 fStrings->push_back_n(extensionCnt); |
70 for (int i = 0; i < extensionCnt; ++i) { | 71 for (int i = 0; i < extensionCnt; ++i) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 void GrGLExtensions::print(const char* sep) const { | 135 void GrGLExtensions::print(const char* sep) const { |
135 if (NULL == sep) { | 136 if (NULL == sep) { |
136 sep = " "; | 137 sep = " "; |
137 } | 138 } |
138 int cnt = fStrings->count(); | 139 int cnt = fStrings->count(); |
139 for (int i = 0; i < cnt; ++i) { | 140 for (int i = 0; i < cnt; ++i) { |
140 GrPrintf("%s%s", (*fStrings)[i].c_str(), (i < cnt - 1) ? sep : ""); | 141 GrPrintf("%s%s", (*fStrings)[i].c_str(), (i < cnt - 1) ? sep : ""); |
141 } | 142 } |
142 } | 143 } |
OLD | NEW |