diff options
-rw-r--r-- | src/mesa/main/shaderapi.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 4204a930743..bf372dceecd 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2050,7 +2050,7 @@ shader_source(struct gl_context *ctx, GLuint shaderObj, GLsizei count, if (!sh) return; - if (string == NULL) { + if (string == NULL || count < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB"); return; } @@ -2058,6 +2058,10 @@ shader_source(struct gl_context *ctx, GLuint shaderObj, GLsizei count, sh = _mesa_lookup_shader(ctx, shaderObj); } + /* Return silently the spec doesn't define this as an error */ + if (count == 0) + return; + /* * This array holds offsets of where the appropriate string ends, thus the * last element will be set to the total length of the source code. |