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

Side by Side Diff: src/gpu/gl/GrGLAssembleInterface.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 | « no previous file | src/gpu/gl/GrGLCaps.h » ('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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrGLAssembleInterface.h" 10 #include "GrGLAssembleInterface.h"
11 #include "GrGLUtil.h" 11 #include "GrGLUtil.h"
12 12
13 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) 13 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F)
14 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, " gl" #F #S) 14 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, " gl" #F #S)
15 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl " #F) 15 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl " #F)
16 16
17 const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { 17 const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
18 GET_PROC_LOCAL(GetString); 18 GET_PROC_LOCAL(GetString);
19 GET_PROC_LOCAL(GetStringi); 19 GET_PROC_LOCAL(GetStringi);
20 GET_PROC_LOCAL(GetIntegerv); 20 GET_PROC_LOCAL(GetIntegerv);
21 21
22 // GetStringi may be NULL depending on the GL version. 22 // GetStringi may be NULL depending on the GL version.
23 if (NULL == GetString || NULL == GetIntegerv) { 23 if (NULL == GetString || NULL == GetIntegerv) {
24 return NULL; 24 return NULL;
25 } 25 }
26 26
27 const char* versionString = (const char*) GetString(GR_GL_VERSION); 27 const char* versionString = (const char*) GetString(GR_GL_VERSION);
28 GrGLVersion glVer = GrGLGetVersionFromString(versionString); 28 GrGLVersion glVer = GrGLGetVersionFromString(versionString);
29 29
30 if (glVer < GR_GL_VER(1,5)) { 30 if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) {
31 // We must have array and element_array buffer objects. 31 // We must have array and element_array buffer objects.
32 return NULL; 32 return NULL;
33 } 33 }
34 34
35 GrGLExtensions extensions; 35 GrGLExtensions extensions;
36 if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv)) { 36 if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
37 return NULL; 37 return NULL;
38 } 38 }
39 39
40 GrGLInterface* interface = SkNEW(GrGLInterface()); 40 GrGLInterface* interface = SkNEW(GrGLInterface());
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 GET_PROC(InvalidateSubFramebuffer); 280 GET_PROC(InvalidateSubFramebuffer);
281 GET_PROC(InvalidateTexImage); 281 GET_PROC(InvalidateTexImage);
282 GET_PROC(InvalidateTexSubImage); 282 GET_PROC(InvalidateTexSubImage);
283 } 283 }
284 284
285 interface->fStandard = kGL_GrGLStandard; 285 interface->fStandard = kGL_GrGLStandard;
286 interface->fExtensions.swap(&extensions); 286 interface->fExtensions.swap(&extensions);
287 287
288 return interface; 288 return interface;
289 } 289 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698