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

Side by Side Diff: src/gpu/gl/GrGLContext.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/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLExtensions.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 "GrGLContext.h" 8 #include "GrGLContext.h"
9 9
10 //////////////////////////////////////////////////////////////////////////////// 10 ////////////////////////////////////////////////////////////////////////////////
(...skipping 19 matching lines...) Expand all
30 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); 30 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION));
31 const char* ver = reinterpret_cast<const char*>(verUByte); 31 const char* ver = reinterpret_cast<const char*>(verUByte);
32 32
33 const GrGLubyte* rendererUByte; 33 const GrGLubyte* rendererUByte;
34 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER)); 34 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER));
35 const char* renderer = reinterpret_cast<const char*>(rendererUByte); 35 const char* renderer = reinterpret_cast<const char*>(rendererUByte);
36 36
37 if (interface->validate()) { 37 if (interface->validate()) {
38 38
39 fGLVersion = GrGLGetVersionFromString(ver); 39 fGLVersion = GrGLGetVersionFromString(ver);
40 if (GR_GL_INVALID_VER == fGLVersion) {
41 return false;
42 }
40 43
41 fGLSLGeneration = GrGetGLSLGeneration(interface); 44 if (!GrGetGLSLGeneration(interface, &fGLSLGeneration)) {
45 return false;
46 }
42 47
43 fVendor = GrGLGetVendor(interface); 48 fVendor = GrGLGetVendor(interface);
44 49
45 fRenderer = GrGLGetRendererFromString(renderer); 50 fRenderer = GrGLGetRendererFromString(renderer);
46 51
47 fIsMesa = GrGLIsMesaFromVersionString(ver); 52 fIsMesa = GrGLIsMesaFromVersionString(ver);
48 53
49 fIsChromium = GrGLIsChromiumFromRendererString(renderer); 54 fIsChromium = GrGLIsChromiumFromRendererString(renderer);
50 55
51 // This must occur before caps init. 56 // This must occur before caps init.
52 fInterface.reset(SkRef(interface)); 57 fInterface.reset(SkRef(interface));
53 58
54 fGLCaps->init(*this, interface); 59 return fGLCaps->init(*this, interface);
55
56 return true;
57 } 60 }
58 } 61 }
59 return false; 62 return false;
60 } 63 }
61 64
62 bool GrGLContextInfo::isInitialized() const { 65 bool GrGLContextInfo::isInitialized() const {
63 return NULL != fInterface.get(); 66 return NULL != fInterface.get();
64 } 67 }
65 68
66 void GrGLContextInfo::reset() { 69 void GrGLContextInfo::reset() {
67 fInterface.reset(NULL); 70 fInterface.reset(NULL);
68 fGLVersion = GR_GL_VER(0, 0); 71 fGLVersion = GR_GL_VER(0, 0);
69 fGLSLGeneration = static_cast<GrGLSLGeneration>(0); 72 fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
70 fVendor = kOther_GrGLVendor; 73 fVendor = kOther_GrGLVendor;
71 fRenderer = kOther_GrGLRenderer; 74 fRenderer = kOther_GrGLRenderer;
72 fIsMesa = false; 75 fIsMesa = false;
73 fIsChromium = false; 76 fIsChromium = false;
74 fGLCaps->reset(); 77 fGLCaps->reset();
75 } 78 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLExtensions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698