diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-10 14:36:25 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-10 14:36:25 +0000 |
commit | 574f3c7daf755c6b61aee661a1d322e1226d9cbe (patch) | |
tree | c50e10eae5884d5866e26338b0526f89230b5a47 | |
parent | a887a44b2da48dfa50b5c19c2be9ebbef79ae2db (diff) |
More changes to cope with color stride == 0
-rw-r--r-- | src/mesa/tnl_dd/t_dd_tritmp.h | 45 |
1 files 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 a483dbb1de..5b17a6f6f0 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; |