From: Brian Paul Date: Sun, 21 Apr 2002 21:03:02 +0000 (+0000) Subject: fixed assertion, replaced switch() with if/elseif X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28c61d5b4918cec89ada335bfb9f83d5ae3872f0;p=mesa.git fixed assertion, replaced switch() with if/elseif --- diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c index 0f45dc1f891..47afdd9d12b 100644 --- a/src/mesa/array_cache/ac_import.c +++ b/src/mesa/array_cache/ac_import.c @@ -1,4 +1,4 @@ -/* $Id: ac_import.c,v 1.18 2002/04/21 20:37:04 brianp Exp $ */ +/* $Id: ac_import.c,v 1.19 2002/04/21 21:03:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -74,7 +74,8 @@ static void reset_texcoord( GLcontext *ctx, GLuint unit ) static void reset_vertex( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); - ASSERT(ctx->Array.Vertex.Enabled); + ASSERT(ctx->Array.Vertex.Enabled + || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)); ac->Raw.Vertex = ctx->Array.Vertex; STRIDE_ARRAY(ac->Raw.Vertex, ac->start); ac->IsCached.Vertex = GL_FALSE; @@ -195,33 +196,30 @@ static void reset_attrib( GLcontext *ctx, GLuint index ) STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); } else if (ctx->Array._Enabled & (1 << index)) { - /* use conventional vertex array */ - switch (index) { - case VERT_ATTRIB_POS: - ac->Raw.Attrib[index] = ctx->Array.Vertex; - break; - case VERT_ATTRIB_NORMAL: - ac->Raw.Attrib[index] = ctx->Array.Normal; - break; - case VERT_ATTRIB_COLOR0: - ac->Raw.Attrib[index] = ctx->Array.Color; - break; - case VERT_ATTRIB_COLOR1: - ac->Raw.Attrib[index] = ctx->Array.SecondaryColor; - break; - case VERT_ATTRIB_FOG: - ac->Raw.Attrib[index] = ctx->Array.FogCoord; - break; - default: - if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { - GLuint unit = index - VERT_ATTRIB_TEX0; - ac->Raw.Attrib[index] = ctx->Array.TexCoord[unit]; - } - else { - /* missing conventional array (vertex weight, for example) */ - fallback = GL_TRUE; - } - break; + /* use conventional vertex array if possible */ + if (index == VERT_ATTRIB_POS) { + ac->Raw.Attrib[index] = ctx->Array.Vertex; + } + else if (index == VERT_ATTRIB_NORMAL) { + ac->Raw.Attrib[index] = ctx->Array.Normal; + } + else if (index == VERT_ATTRIB_COLOR0) { + ac->Raw.Attrib[index] = ctx->Array.Color; + } + else if (index == VERT_ATTRIB_COLOR1) { + ac->Raw.Attrib[index] = ctx->Array.SecondaryColor; + } + else if (index == VERT_ATTRIB_FOG) { + ac->Raw.Attrib[index] = ctx->Array.FogCoord; + } + else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { + GLuint unit = index - VERT_ATTRIB_TEX0; + ASSERT(unit < MAX_TEXTURE_UNITS); + ac->Raw.Attrib[index] = ctx->Array.TexCoord[unit]; + } + else { + /* missing conventional array (vertex weight, for example) */ + fallback = GL_TRUE; } if (!fallback) STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start);