summaryrefslogtreecommitdiff
path: root/src/mesa/array_cache
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-04-21 21:03:02 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-04-21 21:03:02 +0000
commit28c61d5b4918cec89ada335bfb9f83d5ae3872f0 (patch)
treee70e68923d616578a5cc2471b99f159f48501eaa /src/mesa/array_cache
parent12bab63f09975504c20a5dc9b9831a8072c43506 (diff)
fixed assertion, replaced switch() with if/elseif
Diffstat (limited to 'src/mesa/array_cache')
-rw-r--r--src/mesa/array_cache/ac_import.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index 0f45dc1f89..47afdd9d12 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);