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

Unified Diff: src/gpu/gl/GrGLSL.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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLSL.h ('k') | src/gpu/gl/GrGLUtil.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLSL.cpp
diff --git a/src/gpu/gl/GrGLSL.cpp b/src/gpu/gl/GrGLSL.cpp
index 1ff0850a1db5d89768894f6aed5c1f4e53630ce0..7587fe8d647a1cb9973d51a47883a5459b517335 100644
--- a/src/gpu/gl/GrGLSL.cpp
+++ b/src/gpu/gl/GrGLSL.cpp
@@ -9,27 +9,33 @@
#include "GrGLShaderVar.h"
#include "SkString.h"
-GrGLSLGeneration GrGetGLSLGeneration(const GrGLInterface* gl) {
+bool GrGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) {
+ SkASSERT(NULL != generation);
GrGLSLVersion ver = GrGLGetGLSLVersion(gl);
+ if (GR_GLSL_INVALID_VER == ver) {
+ return false;
+ }
switch (gl->fStandard) {
case kGL_GrGLStandard:
SkASSERT(ver >= GR_GLSL_VER(1,10));
if (ver >= GR_GLSL_VER(1,50)) {
- return k150_GrGLSLGeneration;
+ *generation = k150_GrGLSLGeneration;
} else if (ver >= GR_GLSL_VER(1,40)) {
- return k140_GrGLSLGeneration;
+ *generation = k140_GrGLSLGeneration;
} else if (ver >= GR_GLSL_VER(1,30)) {
- return k130_GrGLSLGeneration;
+ *generation = k130_GrGLSLGeneration;
} else {
- return k110_GrGLSLGeneration;
+ *generation = k110_GrGLSLGeneration;
}
+ return true;
case kGLES_GrGLStandard:
// version 1.00 of ES GLSL based on ver 1.20 of desktop GLSL
SkASSERT(ver >= GR_GL_VER(1,00));
- return k110_GrGLSLGeneration;
+ *generation = k110_GrGLSLGeneration;
+ return true;
default:
GrCrash("Unknown GL Standard");
- return k110_GrGLSLGeneration; // suppress warning
+ return false;
}
}
« no previous file with comments | « src/gpu/gl/GrGLSL.h ('k') | src/gpu/gl/GrGLUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698