summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-04-11 09:00:56 -0600
committerBrian <[email protected]>2007-04-11 09:00:56 -0600
commit9f66025f54a3a9cc33cba56ec7c9f59721ddbec7 (patch)
tree75b0550316038beb6699cd80b16fb01d701f9dd5 /src/mesa/shader/shader_api.c
parent183d8e06206dd264adabdf8d6b6ad06143d237e8 (diff)
fix invalid error detection problem in _mesa_bind_attrib_location(), bug 10602
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 1831d0fb2e7..cf42a5843ec 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -323,7 +323,13 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
return;
}
- oldIndex = _mesa_get_attrib_location(ctx, program, name);
+ if (shProg->LinkStatus) {
+ /* get current index/location for the attribute */
+ oldIndex = _mesa_get_attrib_location(ctx, program, name);
+ }
+ else {
+ oldIndex = -1;
+ }
/* this will replace the current value if it's already in the list */
i = _mesa_add_attribute(shProg->Attributes, name, size, index);
@@ -331,14 +337,12 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation");
}
- if (shProg->VertexProgram && oldIndex >= 0) {
+ if (shProg->VertexProgram && oldIndex >= 0 && oldIndex != index) {
+ /* If the index changed, need to search/replace references to that attribute
+ * in the vertex program.
+ */
_slang_remap_attribute(&shProg->VertexProgram->Base, oldIndex, index);
}
-
-#if 0
- printf("===== post BindAttrib:\n");
- _mesa_print_program(&shProg->VertexProgram->Base);
-#endif
}