generic attribute 0 wasn't handled correctly (Jesse Allen)
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 29 May 2006 14:37:56 +0000 (14:37 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 29 May 2006 14:37:56 +0000 (14:37 +0000)
src/mesa/shader/arbprogparse.c

index b596b79bc7922d48af7600b12b588b048a16366d..cdf1b3dc1d2c06f7dc69223a3299a6871bb10425 100644 (file)
@@ -1538,12 +1538,20 @@ parse_attrib_binding(GLcontext * ctx, GLubyte ** inst,
                GLuint attrib;
                if (!parse_generic_attrib_num(ctx, inst, Program, &attrib)) {
                   *is_generic = 1;
+                  if (attrib >= MAX_VERTEX_PROGRAM_ATTRIBS) {
+                     const char *msg = "Invalid generic vertex attribute reference";
+                     _mesa_set_program_error (ctx, Program->Position, msg);
+                     _mesa_error (ctx, GL_INVALID_OPERATION, msg);
+                     return 1;
+                  }
                   /* Add VERT_ATTRIB_GENERIC0 here because ARB_vertex_program's
                    * attributes do not alias the conventional vertex
                    * attributes.
                    */
                   if (attrib > 0)
                      *inputReg = attrib + VERT_ATTRIB_GENERIC0;
+                  else
+                     *inputReg = 0;
                }
             }
             break;