mesa: generate GL_INVALID_OPERATION in _mesa_get_uniform_location() if program isn...
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 4 Jul 2008 15:58:14 +0000 (09:58 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 4 Jul 2008 16:02:43 +0000 (10:02 -0600)
src/mesa/shader/shader_api.c

index 3e28d92fe18b841ed18299e493d6f91daf5bb5d4..182de37b50df8af6b655f58815a1aa2b29c6d957 100644 (file)
@@ -1011,6 +1011,11 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
    if (!shProg)
       return -1;
 
+   if (shProg->LinkStatus == GL_FALSE) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)");
+      return -1;
+   }
+
    /* XXX we should return -1 if the uniform was declared, but not
     * actually used.
     */