summaryrefslogtreecommitdiffstats
path: root/progs/util/shaderutil.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-12-21 19:18:41 +0000
committerKeith Whitwell <[email protected]>2009-12-21 19:18:41 +0000
commita5585cb533af3d4e5d5324d5f526447b98597402 (patch)
tree6706dbb8b4f994b919e247647c3e8853d067b45c /progs/util/shaderutil.c
parentd288a30610767f87e3e7c069730d4bc255246568 (diff)
parent574715d8368f99c0a5720a9676385d58d6cfdf30 (diff)
Merge commit 'origin/master' into i965g-restart
Conflicts: SConstruct configs/default configs/linux-dri
Diffstat (limited to 'progs/util/shaderutil.c')
-rw-r--r--progs/util/shaderutil.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index 4db950016b8..2f44c388d8a 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -25,7 +25,11 @@ GLboolean
ShadersSupported(void)
{
const char *version = (const char *) glGetString(GL_VERSION);
- if (version[0] == '2' && version[1] == '.') {
+
+ /* NVIDIA binary drivers will return "3.0.0", and they clearly support
+ * shaders.
+ */
+ if (version[0] >= '2' && version[1] == '.') {
return GL_TRUE;
}
else if (glutExtensionSupported("GL_ARB_vertex_shader")
@@ -34,7 +38,8 @@ ShadersSupported(void)
fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n");
return GL_TRUE;
}
- return GL_TRUE;
+ fprintf(stderr, "Sorry, GLSL not supported with this OpenGL.\n");
+ return GL_FALSE;
}
@@ -84,6 +89,7 @@ CompileShaderFile(GLenum shaderType, const char *filename)
f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "Unable to open shader file %s\n", filename);
+ free(buffer);
return 0;
}
@@ -94,6 +100,8 @@ CompileShaderFile(GLenum shaderType, const char *filename)
shader = CompileShaderText(shaderType, buffer);
}
else {
+ fclose(f);
+ free(buffer);
return 0;
}