From 574f3c7daf755c6b61aee661a1d322e1226d9cbe Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 10 Jan 2005 14:36:25 +0000 Subject: [PATCH] More changes to cope with color stride == 0 --- src/mesa/tnl_dd/t_dd_tritmp.h | 45 ++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h index a483dbb1de1..5b17a6f6f00 100644 --- a/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/src/mesa/tnl_dd/t_dd_tritmp.h @@ -196,20 +196,34 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } else { GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; - ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLfloat)); (void) vbcolor; if (!DO_FLAT) { VERT_SAVE_RGBA( 0 ); VERT_SAVE_RGBA( 1 ); - VERT_SET_RGBA( v[0], vbcolor[e0] ); - VERT_SET_RGBA( v[1], vbcolor[e1] ); } VERT_SAVE_RGBA( 2 ); - VERT_SET_RGBA( v[2], vbcolor[e2] ); + + if (VB->ColorPtr[1]->stride) { + ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLfloat)); + + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[e0] ); + VERT_SET_RGBA( v[1], vbcolor[e1] ); + } + VERT_SET_RGBA( v[2], vbcolor[e2] ); + } + else { + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[0] ); + VERT_SET_RGBA( v[1], vbcolor[0] ); + } + VERT_SET_RGBA( v[2], vbcolor[0] ); + } if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLfloat)); if (!DO_FLAT) { VERT_SAVE_SPEC( 0 ); @@ -458,12 +472,25 @@ static void TAG(quad)( GLcontext *ctx, VERT_SAVE_RGBA( 0 ); VERT_SAVE_RGBA( 1 ); VERT_SAVE_RGBA( 2 ); - VERT_SET_RGBA( v[0], vbcolor[e0] ); - VERT_SET_RGBA( v[1], vbcolor[e1] ); - VERT_SET_RGBA( v[2], vbcolor[e2] ); - } + } VERT_SAVE_RGBA( 3 ); - VERT_SET_RGBA( v[3], vbcolor[e3] ); + + if (VB->ColorPtr[1]->stride) { + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[e0] ); + VERT_SET_RGBA( v[1], vbcolor[e1] ); + VERT_SET_RGBA( v[2], vbcolor[e2] ); + } + VERT_SET_RGBA( v[3], vbcolor[e3] ); + } + else { + if (!DO_FLAT) { + VERT_SET_RGBA( v[0], vbcolor[0] ); + VERT_SET_RGBA( v[1], vbcolor[0] ); + VERT_SET_RGBA( v[2], vbcolor[0] ); + } + VERT_SET_RGBA( v[3], vbcolor[0] ); + } if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; -- 2.30.2