r300: fix StrideB == 0 case when converting data format
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 11 Jul 2009 13:53:01 +0000 (15:53 +0200)
committerMaciej Cencora <m.cencora@gmail.com>
Mon, 13 Jul 2009 17:28:13 +0000 (19:28 +0200)
Reported-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/mesa/drivers/dri/r300/r300_draw.c

index 5420293b919308ced5608e24b6bfd58613aab23a..9769ff539941fd89e1b26052f59ff32d1c57c713 100644 (file)
@@ -195,6 +195,11 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st
                }
 
                GLfloat *dst_ptr, *tmp;
+
+               /* Convert value for first element only */
+               if (input->StrideB == 0)
+                       count = 1;
+
                tmp = dst_ptr = _mesa_malloc(sizeof(GLfloat) * input->Size * count);
 
                switch (input->Type) {
@@ -228,7 +233,11 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st
                type = GL_FLOAT;
                r300_attr.free_needed = GL_TRUE;
                r300_attr.data = tmp;
-               r300_attr.stride = sizeof(GLfloat) * input->Size;
+               if (input->StrideB == 0) {
+                       r300_attr.stride = 0;
+               } else {
+                       r300_attr.stride = sizeof(GLfloat) * input->Size;
+               }
                r300_attr.dwords = input->Size;
        } else {
                type = input->Type;