Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Side by Side Diff: src/gpu/gl/GrGLExtensions.cpp

Issue 254083002: Fail to create GrContext when we get a NULL for a GL/GLSL version string (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: check GrGLCaps::init return Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLContext.cpp ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLContext.cpp ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698