Mesa (master): glsl: Make sure shader source isn't NULL.
Kenneth Graunke
kwg at kemper.freedesktop.org
Tue Sep 7 23:29:56 UTC 2010
Module: Mesa
Branch: master
Commit: a09a8ec12d76e1fb1583fa99cf9f48246c108d7b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a09a8ec12d76e1fb1583fa99cf9f48246c108d7b
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Tue Sep 7 16:25:53 2010 -0700
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.
---
src/mesa/program/ir_to_mesa.cpp | 8 ++++++++
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 1a260c7..4f6535f 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);
More information about the mesa-commit
mailing list