aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-09-07 16:25:53 -0700
committerKenneth Graunke <[email protected]>2010-09-07 16:25:53 -0700
commita09a8ec12d76e1fb1583fa99cf9f48246c108d7b (patch)
treebad76f6269429f26abca6974f44a8ec1f7bc5282 /src/mesa/program
parent1e28dd4ebe73f85cdc38a6bdaeef23fd10223cf3 (diff)
glsl: Make sure shader source isn't NULL.
This should only occur if glCompileShader is called without a prior call to glShaderSource. An empty source program should be the empty string.
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 1a260c7e536..4f6535fa479 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2755,6 +2755,14 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
const char *source = shader->Source;
+ /* Check if the user called glCompileShader without first calling
+ * glShaderSource. This should fail to compile, but not raise a GL_ERROR.
+ */
+ if (source == NULL) {
+ shader->CompileStatus = GL_FALSE;
+ return;
+ }
+
state->error = preprocess(state, &source, &state->info_log,
&ctx->Extensions);