fix error strings, add a sanity check
authorBrian <brian@yutani.localnet.net>
Wed, 18 Apr 2007 21:22:43 +0000 (15:22 -0600)
committerBrian <brian@yutani.localnet.net>
Wed, 18 Apr 2007 23:14:13 +0000 (17:14 -0600)
src/mesa/shader/shader_api.c

index 0c4f4837fbfc711cea1c3e1ef5c84b7150a9bd2b..a8ca7d62212ae26d04bbe7f6eaac874b78a1eb47 100644 (file)
@@ -575,6 +575,18 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
 
          shProg->Shaders = newList;
          shProg->NumShaders = n - 1;
+
+#ifdef DEBUG
+         /* sanity check */
+         {
+            for (j = 0; j < shProg->NumShaders; j++) {
+               assert(shProg->Shaders[j]->Type == GL_VERTEX_SHADER ||
+                      shProg->Shaders[j]->Type == GL_FRAGMENT_SHADER);
+               assert(shProg->Shaders[j]->RefCount > 0);
+            }
+         }
+#endif
+
          return;
       }
    }
@@ -598,12 +610,12 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
    GLint sz;
 
    if (!shProg) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform");
+      _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib");
       return;
    }
 
    if (!shProg->Attributes || index >= shProg->Attributes->NumParameters) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
+      _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)");
       return;
    }