normal, texcoords, fogcoord, secondary color, etc) to GLfloat[4] datatype.
Aliasing of glVertex, glNormal, glColor, glFogCoord, etc. to glVertexAttrib
now complete.
-/* $Id: ac_import.c,v 1.15 2001/12/14 02:50:57 brianp Exp $ */
+/* $Id: ac_import.c,v 1.16 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
-/* $Id: mtypes.h,v 1.56 2001/12/18 04:06:45 brianp Exp $ */
+/* $Id: mtypes.h,v 1.57 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define VERT_ATTRIB_TEX5 13
#define VERT_ATTRIB_TEX6 14
#define VERT_ATTRIB_TEX7 15
+#define VERT_ATTRIB_MAX 16
struct gl_current_attrib {
/* These values valid only when FLUSH_VERTICES has been called.
*/
- GLfloat Attrib[8 + MAX_TEXTURE_UNITS][4]; /* Current vertex attributes */
+ GLfloat Attrib[VERT_ATTRIB_MAX][4]; /* Current vertex attributes */
/* indexed by VERT_ATTRIB_* */
GLuint Index; /* Current color index */
GLboolean EdgeFlag; /* Current edge flag */
#define VP_MAX_INSTRUCTIONS 128
-#define VP_NUM_INPUT_REGS 16
+#define VP_NUM_INPUT_REGS VERT_ATTRIB_MAX
#define VP_NUM_OUTPUT_REGS 15
#define VP_NUM_TEMP_REGS 12
#define VP_NUM_PROG_REGS 96
-/* $Id: varray.c,v 1.39 2001/03/12 00:48:39 gareth Exp $ */
+/* $Id: varray.c,v 1.40 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
return;
}
}
+ ctx->Array.Normal.Size = 3;
ctx->Array.Normal.Type = type;
ctx->Array.Normal.Stride = stride;
ctx->Array.Normal.Ptr = (void *) ptr;
return;
}
}
+ ctx->Array.FogCoord.Size = 1;
ctx->Array.FogCoord.Type = type;
ctx->Array.FogCoord.Stride = stride;
ctx->Array.FogCoord.Ptr = (void *) ptr;
return;
}
}
+ ctx->Array.Index.Size = 1;
ctx->Array.Index.Type = type;
ctx->Array.Index.Stride = stride;
ctx->Array.Index.Ptr = (void *) ptr;
-/* $Id: m_debug_norm.c,v 1.7 2001/03/30 14:44:43 gareth Exp $ */
+/* $Id: m_debug_norm.c,v 1.8 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
static void ref_norm_transform_rescale( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
GLuint i;
const GLfloat *s = in->start;
const GLfloat *m = mat->inv;
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start;
(void) lengths;
static void ref_norm_transform_normalize( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
GLuint i;
const GLfloat *s = in->start;
const GLfloat *m = mat->inv;
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start;
for ( i = 0 ; i < in->count ; i++ ) {
GLfloat t[3];
static int test_norm_function( normal_func func, int mtype, long *cycles )
{
- GLvector3f source[1], dest[1], dest2[1], ref[1], ref2[1];
+ GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1];
GLmatrix mat[1];
- GLfloat s[TEST_COUNT][5], d[TEST_COUNT][3], r[TEST_COUNT][3];
- GLfloat d2[TEST_COUNT][3], r2[TEST_COUNT][3], length[TEST_COUNT];
+ GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4];
+ GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT];
GLfloat scale;
GLfloat *m;
int i, j;
length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) );
}
- source->data = (GLfloat(*)[3])s;
- source->start = (GLfloat *)s;
+ source->data = (GLfloat(*)[4]) s;
+ source->start = (GLfloat *) s;
source->count = TEST_COUNT;
source->stride = sizeof(s[0]);
source->flags = 0;
- dest->data = (GLfloat(*)[3])d;
- dest->start = (GLfloat *)d;
+ dest->data = d;
+ dest->start = (GLfloat *) d;
dest->count = TEST_COUNT;
- dest->stride = sizeof(float[3]);
+ dest->stride = sizeof(float[4]);
dest->flags = 0;
- dest2->data = (GLfloat(*)[3])d2;
- dest2->start = (GLfloat *)d2;
+ dest2->data = d2;
+ dest2->start = (GLfloat *) d2;
dest2->count = TEST_COUNT;
- dest2->stride = sizeof(float[3]);
+ dest2->stride = sizeof(float[4]);
dest2->flags = 0;
- ref->data = (GLfloat(*)[3])r;
- ref->start = (GLfloat *)r;
+ ref->data = r;
+ ref->start = (GLfloat *) r;
ref->count = TEST_COUNT;
- ref->stride = sizeof(float[3]);
+ ref->stride = sizeof(float[4]);
ref->flags = 0;
- ref2->data = (GLfloat(*)[3])r2;
- ref2->start = (GLfloat *)r2;
+ ref2->data = r2;
+ ref2->start = (GLfloat *) r2;
ref2->count = TEST_COUNT;
- ref2->stride = sizeof(float[3]);
+ ref2->stride = sizeof(float[4]);
ref2->flags = 0;
if ( norm_normalize_types[mtype] == 0 ) {
-/* $Id: m_norm_tmp.h,v 1.9 2002/01/05 14:12:24 brianp Exp $ */
+/* $Id: m_norm_tmp.h,v 1.10 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void _XFORMAPI
TAG(transform_normalize_normals)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(transform_rescale_normals)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(transform_normals_no_rot)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(transform_normals)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(normalize_normals)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
static void _XFORMAPI
TAG(rescale_normals)( const GLmatrix *mat,
GLfloat scale,
- const GLvector3f *in,
+ const GLvector4f *in,
const GLfloat *lengths,
- GLvector3f *dest )
+ GLvector4f *dest )
{
- GLfloat (*out)[3] = (GLfloat (*)[3])dest->start;
+ GLfloat (*out)[4] = (GLfloat (*)[4])dest->start;
const GLfloat *from = in->start;
const GLuint stride = in->stride;
const GLuint count = in->count;
-/* $Id: m_xform.h,v 1.10 2001/03/30 14:44:43 gareth Exp $ */
+/* $Id: m_xform.h,v 1.11 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat,
GLfloat scale,
- CONST GLvector3f *in,
+ CONST GLvector4f *in,
CONST GLfloat lengths[],
- GLvector3f *dest );
+ GLvector4f *dest );
/* Flags for selecting a normal transformation function.
-/* $Id: ss_vbtmp.h,v 1.18 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: ss_vbtmp.h,v 1.19 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
proj_stride = VB->NdcPtr->stride;
if (IND & FOG) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
+ fog = (GLfloat *) VB->AttribPtr[VERT_ATTRIB_FOG]->data;
+ fog_stride = VB->AttribPtr[VERT_ATTRIB_FOG]->stride;
}
if (IND & COLOR) {
if (VB->ColorPtr[0]->Type != CHAN_TYPE)
-/* $Id: t_array_api.c,v 1.22 2001/12/03 17:41:58 keithw Exp $ */
+/* $Id: t_array_api.c,v 1.23 2002/01/05 20:51:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* Setup vector pointers that will be used to bind arrays to VB's.
*/
_mesa_vector4f_init( &tmp->Obj, 0, 0 );
- _mesa_vector3f_init( &tmp->Normal, 0, 0 );
- _mesa_vector1f_init( &tmp->FogCoord, 0, 0 );
+ _mesa_vector4f_init( &tmp->Normal, 0, 0 );
+ _mesa_vector4f_init( &tmp->FogCoord, 0, 0 );
_mesa_vector1ui_init( &tmp->Index, 0, 0 );
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 );
-/* $Id: t_array_import.c,v 1.19 2001/12/14 02:51:42 brianp Exp $ */
+/* $Id: t_array_import.c,v 1.20 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
stride ? 3*sizeof(GLfloat) : 0, writeable,
&is_writeable);
- inputs->Normal.data = (GLfloat (*)[3]) tmp->Ptr;
+ inputs->Normal.data = tmp->Ptr;
inputs->Normal.start = (GLfloat *) tmp->Ptr;
inputs->Normal.stride = tmp->StrideB;
inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
stride ? sizeof(GLfloat) : 0, writeable,
&is_writeable);
- inputs->FogCoord.data = (GLfloat *) tmp->Ptr;
+ inputs->FogCoord.data = (GLfloat (*)[4]) tmp->Ptr;
inputs->FogCoord.start = (GLfloat *) tmp->Ptr;
inputs->FogCoord.stride = tmp->StrideB;
inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
VB->importable_data &= ~VERT_COLOR1_BIT;
}
- if ((required & VERT_FOG_BIT) && (VB->FogCoordPtr->flags & flags)) {
- ASSERT(VB->FogCoordPtr == &inputs->FogCoord);
+ if ((required & VERT_FOG_BIT)
+ && (VB->AttribPtr[VERT_ATTRIB_FOG]->flags & flags)) {
+ ASSERT(VB->AttribPtr[VERT_ATTRIB_FOG] == &inputs->FogCoord);
_tnl_import_fogcoord( ctx, writeable, stride );
VB->importable_data &= ~VERT_FOG_BIT;
}
if (inputs & VERT_FOG_BIT) {
_tnl_import_fogcoord( ctx, 0, 0 );
tmp->FogCoord.count = VB->Count;
- VB->FogCoordPtr = &tmp->FogCoord;
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &tmp->FogCoord;
}
if (inputs & VERT_EDGEFLAG_BIT) {
-/* $Id: t_context.h,v 1.34 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_context.h,v 1.35 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
/* Shorthands.
*/
-#define VERT_EVAL_ANY (VERT_EVAL_C1|VERT_EVAL_P1| \
- VERT_EVAL_C2|VERT_EVAL_P2)
+#define VERT_EVAL_ANY (VERT_EVAL_C1 | VERT_EVAL_P1 | \
+ VERT_EVAL_C2 | VERT_EVAL_P2)
-#define VERT_OBJ_23 (VERT_OBJ_3|VERT_OBJ_BIT)
-#define VERT_OBJ_234 (VERT_OBJ_4|VERT_OBJ_23)
+#define VERT_OBJ_23 (VERT_OBJ_3 | VERT_OBJ_BIT)
+#define VERT_OBJ_234 (VERT_OBJ_4 | VERT_OBJ_23)
#define VERT_TEX0_BIT_SHIFT 11
VERT_TEX6_BIT | \
VERT_TEX7_BIT)
-#define VERT_FIXUP (VERT_TEX_ANY | \
+#define VERT_FIXUP (VERT_TEX_ANY | \
VERT_COLOR0_BIT | \
- VERT_COLOR1_BIT | \
- VERT_FOG_BIT | \
+ VERT_COLOR1_BIT | \
+ VERT_FOG_BIT | \
VERT_INDEX_BIT | \
VERT_EDGEFLAG_BIT | \
VERT_NORMAL_BIT)
-#define VERT_CURRENT_DATA (VERT_FIXUP | \
+#define VERT_CURRENT_DATA (VERT_FIXUP | \
VERT_MATERIAL)
-#define VERT_DATA (VERT_TEX_ANY | \
+#define VERT_DATA (VERT_TEX_ANY | \
VERT_COLOR0_BIT | \
- VERT_COLOR1_BIT | \
- VERT_FOG_BIT | \
- VERT_INDEX_BIT | \
+ VERT_COLOR1_BIT | \
+ VERT_FOG_BIT | \
+ VERT_INDEX_BIT | \
VERT_EDGEFLAG_BIT | \
VERT_NORMAL_BIT | \
- VERT_OBJ_BIT | \
- VERT_MATERIAL | \
- VERT_ELT | \
+ VERT_OBJ_BIT | \
+ VERT_MATERIAL | \
+ VERT_ELT | \
VERT_EVAL_ANY)
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
GLuint Flag[IMM_SIZE]; /* VERT_* flags */
- GLfloat Obj[IMM_SIZE][4]; /* attrib 0 */
- GLfloat Normal[IMM_SIZE][3]; /* attrib 2 */
- GLfloat *NormalLengthPtr;
- GLfloat Color[IMM_SIZE][4]; /* attrib 3 */
- GLfloat SecondaryColor[IMM_SIZE][4]; /* attrib 4 */
- GLfloat FogCoord[IMM_SIZE]; /* attrib 5 */
- GLfloat TexCoord0[IMM_SIZE][4]; /* just VERT_TEX0_BIT */
- GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4]; /* attribs 8..15 */
+ /* All vertex attributes (position, normal, color, secondary color,
+ * texcoords, fog coord) are stored in the Attrib[] arrays instead
+ * of individual arrays as we did prior to Mesa 4.1.
+ *
+ * XXX may need to use 32-byte aligned allocation for this!!!
+ */
+ GLfloat Attrib[VERT_ATTRIB_MAX][IMM_SIZE][4]; /* GL_NV_vertex_program */
+
+ GLfloat *NormalLengthPtr; /* length of normal vectors (display list only) */
GLuint Elt[IMM_SIZE];
GLubyte EdgeFlag[IMM_SIZE];
GLuint Index[IMM_SIZE];
-
- GLfloat Attrib[16][IMM_SIZE][4]; /* GL_NV_vertex_program */
};
struct vertex_arrays
{
GLvector4f Obj;
- GLvector3f Normal;
+ GLvector4f Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
GLvector1ui Index;
GLvector1ub EdgeFlag;
GLvector4f TexCoord[MAX_TEXTURE_UNITS];
GLvector1ui Elt;
- GLvector1f FogCoord;
- GLvector4f Attribs[16];
+ GLvector4f FogCoord;
+ GLvector4f Attribs[VERT_ATTRIB_MAX];
};
GLuint FirstPrimitive; /* usually zero */
/* Pointers to current data.
+ * XXX Replace ObjPtr, NormalPtr, TexCoordPtr, etc with AttribPtr[] arrays.
*/
GLuint *Elts; /* VERT_ELT */
GLvector4f *ObjPtr; /* VERT_OBJ_BIT */
GLvector4f *NdcPtr; /* VERT_CLIP (2) */
GLubyte ClipOrMask; /* VERT_CLIP (3) */
GLubyte *ClipMask; /* VERT_CLIP (4) */
- GLvector3f *NormalPtr; /* VERT_NORMAL_BIT */
+ GLvector4f *NormalPtr; /* VERT_NORMAL_BIT */
GLfloat *NormalLengthPtr; /* VERT_NORMAL_BIT */
GLboolean *EdgeFlag; /* VERT_EDGEFLAG_BIT */
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
GLvector1ui *IndexPtr[2]; /* VERT_INDEX_BIT */
struct gl_client_array *ColorPtr[2]; /* VERT_COLOR0_BIT */
struct gl_client_array *SecondaryColorPtr[2];/* VERT_COLOR1_BIT */
- GLvector1f *FogCoordPtr; /* VERT_FOG_BIT */
GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */
GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */
GLuint *MaterialMask; /* VERT_MATERIAL, optional */
GLuint *Primitive; /* GL_(mode)|PRIM_* flags */
GLuint *PrimitiveLength; /* integers */
- GLvector4f *AttribPtr[16]; /* GL_NV_vertex_program */
+ GLvector4f *AttribPtr[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
GLuint importable_data;
void *import_source;
-/* $Id: t_imm_alloc.c,v 1.12 2001/12/15 00:49:00 brianp Exp $ */
+/* $Id: t_imm_alloc.c,v 1.13 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.0.1
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
static struct immediate *real_alloc_immediate( GLcontext *ctx )
{
struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 );
- GLuint j;
if (!IM)
return 0;
IM->CopyTexSize = 0;
IM->CopyStart = IM->Start;
-
- /* TexCoord0 is special.
- */
- IM->TexCoord[0] = IM->TexCoord0;
-
- for (j = 1; j < ctx->Const.MaxTextureUnits; j++) {
- IM->TexCoord[j] = (GLfloat (*)[4])
- ALIGN_MALLOC( IMM_SIZE * sizeof(GLfloat) * 4, 32 );
- }
-
/* KW: Removed initialization of normals as these are now treated
* identically to all other data types.
*/
MEMSET(IM->Flag, 0, sizeof(IM->Flag));
+#if 0
MEMSET(IM->Normal, 0.0 , sizeof(IM->Normal));
+#endif
return IM;
}
static void real_free_immediate( struct immediate *IM )
{
static int freed = 0;
- GLuint j;
if (IM->Material) {
FREE( IM->Material );
IM->MaterialMask = 0;
}
- for (j = 1; j < IM->MaxTextureUnits; j++)
- ALIGN_FREE( IM->TexCoord[j] );
-
if (IM->NormalLengthPtr)
ALIGN_FREE( IM->NormalLengthPtr );
-/* $Id: t_imm_api.c,v 1.22 2001/12/17 09:02:55 joukj Exp $ */
+/* $Id: t_imm_api.c,v 1.23 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "t_imm_dlist.h"
-extern void _tnl_vprog_vtxfmt_init( GLcontext *ctx );
-
-
/* A cassette is full or flushed on a statechange.
*/
void _tnl_flush_immediate( struct immediate *IM )
if (ctx->NewState)
_mesa_update_state(ctx);
- /* Either install the normal vertex functions or the vertex program funcs */
- if (ctx->VertexProgram.Enabled)
- _tnl_vprog_vtxfmt_init(ctx);
- else
- _tnl_imm_vtxfmt_init(ctx);
- /* XXX this should not be done here - inefficient */
- _mesa_install_exec_vtxfmt(ctx, &(TNL_CONTEXT(ctx)->vtxfmt));
-
/* if only a very few slots left, might as well flush now
*/
if (IM->Count > IMM_MAXDATA-8) {
}
-#define COLOR( IM, r, g, b, a ) \
-{ \
- GLuint count = IM->Count; \
- IM->Flag[count] |= VERT_COLOR0_BIT; \
- IM->Color[count][0] = r; \
- IM->Color[count][1] = g; \
- IM->Color[count][2] = b; \
- IM->Color[count][3] = a; \
+#define COLOR( r, g, b, a ) \
+{ \
+ GET_IMMEDIATE; \
+ GLuint count = IM->Count; \
+ GLfloat *color = IM->Attrib[VERT_ATTRIB_COLOR0][count]; \
+ IM->Flag[count] |= VERT_COLOR0_BIT; \
+ color[0] = r; \
+ color[1] = g; \
+ color[2] = b; \
+ color[3] = a; \
}
static void
_tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue )
{
- GET_IMMEDIATE;
- COLOR( IM, red, green, blue, 1.0 );
+ COLOR( red, green, blue, 1.0 );
}
static void
_tnl_Color3ub( GLubyte red, GLubyte green, GLubyte blue )
{
- GET_IMMEDIATE;
- COLOR(IM,
- UBYTE_TO_FLOAT(red),
+ COLOR(UBYTE_TO_FLOAT(red),
UBYTE_TO_FLOAT(green),
UBYTE_TO_FLOAT(blue),
1.0);
static void
_tnl_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
- GET_IMMEDIATE;
- COLOR( IM, red, green, blue, alpha );
+ COLOR( red, green, blue, alpha );
}
static void
_tnl_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
{
- GET_IMMEDIATE;
- COLOR(IM,
- UBYTE_TO_FLOAT(red),
+ COLOR(UBYTE_TO_FLOAT(red),
UBYTE_TO_FLOAT(green),
UBYTE_TO_FLOAT(blue),
UBYTE_TO_FLOAT(alpha));
static void
_tnl_Color3fv( const GLfloat *v )
{
- GET_IMMEDIATE;
- COLOR( IM, v[0], v[1], v[2], 1.0 );
+ COLOR( v[0], v[1], v[2], 1.0 );
}
static void
_tnl_Color3ubv( const GLubyte *v )
{
- GET_IMMEDIATE;
- COLOR(IM,
- UBYTE_TO_FLOAT(v[0]),
+ COLOR(UBYTE_TO_FLOAT(v[0]),
UBYTE_TO_FLOAT(v[1]),
UBYTE_TO_FLOAT(v[2]),
1.0 );
static void
_tnl_Color4fv( const GLfloat *v )
{
- GET_IMMEDIATE;
- COLOR( IM, v[0], v[1], v[2], v[3] );
+ COLOR( v[0], v[1], v[2], v[3] );
}
static void
_tnl_Color4ubv( const GLubyte *v)
{
- GET_IMMEDIATE;
- COLOR(IM,
- UBYTE_TO_FLOAT(v[0]),
+ COLOR(UBYTE_TO_FLOAT(v[0]),
UBYTE_TO_FLOAT(v[1]),
UBYTE_TO_FLOAT(v[2]),
UBYTE_TO_FLOAT(v[3]));
-#define SECONDARY_COLOR( IM, r, g, b ) \
-{ \
- GLuint count = IM->Count; \
- IM->Flag[count] |= VERT_COLOR1_BIT; \
- IM->SecondaryColor[count][0] = r; \
- IM->SecondaryColor[count][1] = g; \
- IM->SecondaryColor[count][2] = b; \
+#define SECONDARY_COLOR( r, g, b ) \
+{ \
+ GLuint count; \
+ GET_IMMEDIATE; \
+ count = IM->Count; \
+ IM->Flag[count] |= VERT_COLOR1_BIT; \
+ IM->Attrib[VERT_ATTRIB_COLOR1][count][0] = r; \
+ IM->Attrib[VERT_ATTRIB_COLOR1][count][1] = g; \
+ IM->Attrib[VERT_ATTRIB_COLOR1][count][2] = b; \
}
static void
_tnl_SecondaryColor3fEXT( GLfloat red, GLfloat green, GLfloat blue )
{
- GET_IMMEDIATE;
- SECONDARY_COLOR( IM, red, green, blue );
+ SECONDARY_COLOR( red, green, blue );
}
static void
_tnl_SecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue )
{
- GET_IMMEDIATE;
- SECONDARY_COLOR(IM,
- UBYTE_TO_FLOAT(red),
+ SECONDARY_COLOR(UBYTE_TO_FLOAT(red),
UBYTE_TO_FLOAT(green),
UBYTE_TO_FLOAT(blue));
}
static void
_tnl_SecondaryColor3fvEXT( const GLfloat *v )
{
- GET_IMMEDIATE;
- SECONDARY_COLOR( IM, v[0], v[1], v[2] );
+ SECONDARY_COLOR( v[0], v[1], v[2] );
}
static void
_tnl_SecondaryColor3ubvEXT( const GLubyte *v )
{
- GET_IMMEDIATE;
- SECONDARY_COLOR(IM,
- UBYTE_TO_FLOAT(v[0]),
+ SECONDARY_COLOR(UBYTE_TO_FLOAT(v[0]),
UBYTE_TO_FLOAT(v[1]),
UBYTE_TO_FLOAT(v[2]));
}
-
-
static void
_tnl_EdgeFlag( GLboolean flag )
{
GLuint count;
GET_IMMEDIATE;
count = IM->Count;
- IM->FogCoord[count] = f;
+ IM->Attrib[VERT_ATTRIB_FOG][count][0] = f; /*FogCoord[count] = f;*/
IM->Flag[count] |= VERT_FOG_BIT;
}
GLuint count;
GET_IMMEDIATE;
count = IM->Count;
- IM->FogCoord[count] = v[0];
+ IM->Attrib[VERT_ATTRIB_FOG][count][0] = v[0]; /*FogCoord[count] = v[0];*/
IM->Flag[count] |= VERT_FOG_BIT;
}
}
-#define NORMAL( x, y, z ) \
-{ \
- GLuint count; \
- GLfloat *normal; \
- GET_IMMEDIATE; \
- count = IM->Count; \
- IM->Flag[count] |= VERT_NORMAL_BIT; \
- normal = IM->Normal[count]; \
- ASSIGN_3V(normal, x,y,z); \
+#define NORMAL( x, y, z ) \
+{ \
+ GLuint count; \
+ GLfloat *normal; \
+ GET_IMMEDIATE; \
+ count = IM->Count; \
+ IM->Flag[count] |= VERT_NORMAL_BIT; \
+ normal = IM->Attrib[VERT_ATTRIB_NORMAL][count]; \
+ ASSIGN_3V(normal, x,y,z); \
}
#if defined(USE_IEEE)
GET_IMMEDIATE; \
count = IM->Count; \
IM->Flag[count] |= VERT_NORMAL_BIT; \
- normal = (fi_type *)IM->Normal[count]; \
+ normal = (fi_type *)IM->Attrib[VERT_ATTRIB_NORMAL][count]; \
normal[0].i = ((fi_type *)&(x))->i; \
normal[1].i = ((fi_type *)&(y))->i; \
normal[2].i = ((fi_type *)&(z))->i; \
GET_IMMEDIATE; \
count = IM->Count; \
IM->Flag[count] |= VERT_TEX0_BIT; \
- tc = IM->TexCoord0[count]; \
+ tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
ASSIGN_4V(tc,s,0,0,1); \
}
-#define TEXCOORD2(s,t) \
+#define TEXCOORD2(s, t) \
{ \
GLuint count; \
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
IM->Flag[count] |= VERT_TEX0_BIT; \
- tc = IM->TexCoord0[count]; \
- ASSIGN_4V(tc, s,t,0,1); \
+ tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
+ ASSIGN_4V(tc, s, t, 0, 1); \
}
-#define TEXCOORD3(s,t,u) \
+#define TEXCOORD3(s, t, u) \
{ \
GLuint count; \
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
IM->Flag[count] |= VERT_TEX0_BIT; \
- IM->TexSize |= TEX_0_SIZE_3; \
- tc = IM->TexCoord0[count]; \
- ASSIGN_4V(tc, s,t,u,1); \
+ IM->TexSize |= TEX_0_SIZE_3; \
+ tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
+ ASSIGN_4V(tc, s, t, u, 1); \
}
-#define TEXCOORD4(s,t,u,v) \
+#define TEXCOORD4(s, t, u, v) \
{ \
GLuint count; \
GLfloat *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
IM->Flag[count] |= VERT_TEX0_BIT; \
- IM->TexSize |= TEX_0_SIZE_4; \
- tc = IM->TexCoord0[count]; \
- ASSIGN_4V(tc, s,t,u,v); \
+ IM->TexSize |= TEX_0_SIZE_4; \
+ tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \
+ ASSIGN_4V(tc, s, t, u, v); \
}
#if defined(USE_IEEE)
-#define TEXCOORD2F(s,t) \
+#define TEXCOORD2F(s, t) \
{ \
GLuint count; \
fi_type *tc; \
GET_IMMEDIATE; \
count = IM->Count; \
IM->Flag[count] |= VERT_TEX0_BIT; \
- tc = (fi_type *)IM->TexCoord0[count]; \
+ tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0][count]; \
tc[0].i = ((fi_type *)&(s))->i; \
tc[1].i = ((fi_type *)&(t))->i; \
tc[2].i = 0; \
static void
_tnl_TexCoord2f( GLfloat s, GLfloat t )
{
- TEXCOORD2F(s,t);
+ TEXCOORD2F(s, t);
}
static void
_tnl_TexCoord3f( GLfloat s, GLfloat t, GLfloat r )
{
- TEXCOORD3(s,t,r);
+ TEXCOORD3(s, t, r);
}
static void
_tnl_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q )
{
- TEXCOORD4(s,t,r,q)
+ TEXCOORD4(s, t, r, q)
}
static void
static void
_tnl_TexCoord2fv( const GLfloat *v )
{
- TEXCOORD2F(v[0],v[1]);
+ TEXCOORD2F(v[0], v[1]);
}
static void
_tnl_TexCoord3fv( const GLfloat *v )
{
- TEXCOORD3(v[0],v[1],v[2]);
+ TEXCOORD3(v[0], v[1], v[2]);
}
static void
_tnl_TexCoord4fv( const GLfloat *v )
{
- TEXCOORD4(v[0],v[1],v[2],v[3]);
+ TEXCOORD4(v[0], v[1], v[2], v[3]);
}
/* KW: Run into bad problems in vertex copying if we don't fully pad
* the incoming vertices.
*/
-#define VERTEX2(IM, x,y) \
-{ \
- GLuint count = IM->Count++; \
- GLfloat *dest = IM->Obj[count]; \
+#define VERTEX2(IM, x,y) \
+{ \
+ GLuint count = IM->Count++; \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
IM->Flag[count] |= VERT_OBJ_BIT; \
- ASSIGN_4V(dest, x, y, 0, 1); \
-/* ASSERT(IM->Flag[IM->Count]==0); */\
- if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ ASSIGN_4V(dest, x, y, 0, 1); \
+/* ASSERT(IM->Flag[IM->Count]==0); */ \
+ if (count == IMM_MAXDATA - 1) \
+ _tnl_flush_immediate( IM ); \
}
-#define VERTEX3(IM,x,y,z) \
-{ \
- GLuint count = IM->Count++; \
- GLfloat *dest = IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ_23; \
- ASSIGN_4V(dest, x, y, z, 1); \
+#define VERTEX3(IM,x,y,z) \
+{ \
+ GLuint count = IM->Count++; \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
+ IM->Flag[count] |= VERT_OBJ_23; \
+ ASSIGN_4V(dest, x, y, z, 1); \
/* ASSERT(IM->Flag[IM->Count]==0); */ \
- if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
-}
-
-#define VERTEX4(IM, x,y,z,w) \
-{ \
- GLuint count = IM->Count++; \
- GLfloat *dest = IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ_234; \
- ASSIGN_4V(dest, x, y, z, w); \
if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+ _tnl_flush_immediate( IM ); \
}
-#if defined(USE_IEEE)
-#define VERTEX2F(IM, x, y) \
+#define VERTEX4(IM, x,y,z,w) \
{ \
GLuint count = IM->Count++; \
- fi_type *dest = (fi_type *)IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ_BIT; \
- dest[0].i = ((fi_type *)&(x))->i; \
- dest[1].i = ((fi_type *)&(y))->i; \
- dest[2].i = 0; \
- dest[3].i = IEEE_ONE; \
-/* ASSERT(IM->Flag[IM->Count]==0); */ \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
+ IM->Flag[count] |= VERT_OBJ_234; \
+ ASSIGN_4V(dest, x, y, z, w); \
if (count == IMM_MAXDATA - 1) \
_tnl_flush_immediate( IM ); \
}
+
+#if defined(USE_IEEE)
+#define VERTEX2F(IM, x, y) \
+{ \
+ GLuint count = IM->Count++; \
+ fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \
+ IM->Flag[count] |= VERT_OBJ_BIT; \
+ dest[0].i = ((fi_type *)&(x))->i; \
+ dest[1].i = ((fi_type *)&(y))->i; \
+ dest[2].i = 0; \
+ dest[3].i = IEEE_ONE; \
+/* ASSERT(IM->Flag[IM->Count]==0); */ \
+ if (count == IMM_MAXDATA - 1) \
+ _tnl_flush_immediate( IM ); \
+}
#else
#define VERTEX2F VERTEX2
#endif
#if defined(USE_IEEE)
-#define VERTEX3F(IM, x, y, z) \
-{ \
- GLuint count = IM->Count++; \
- fi_type *dest = (fi_type *)IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ_23; \
- dest[0].i = ((fi_type *)&(x))->i; \
- dest[1].i = ((fi_type *)&(y))->i; \
- dest[2].i = ((fi_type *)&(z))->i; \
- dest[3].i = IEEE_ONE; \
-/* ASSERT(IM->Flag[IM->Count]==0); */ \
- if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+#define VERTEX3F(IM, x, y, z) \
+{ \
+ GLuint count = IM->Count++; \
+ fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \
+ IM->Flag[count] |= VERT_OBJ_23; \
+ dest[0].i = ((fi_type *)&(x))->i; \
+ dest[1].i = ((fi_type *)&(y))->i; \
+ dest[2].i = ((fi_type *)&(z))->i; \
+ dest[3].i = IEEE_ONE; \
+/* ASSERT(IM->Flag[IM->Count]==0); */ \
+ if (count == IMM_MAXDATA - 1) \
+ _tnl_flush_immediate( IM ); \
}
#else
#define VERTEX3F VERTEX3
#endif
#if defined(USE_IEEE)
-#define VERTEX4F(IM, x, y, z, w) \
-{ \
- GLuint count = IM->Count++; \
- fi_type *dest = (fi_type *)IM->Obj[count]; \
- IM->Flag[count] |= VERT_OBJ_234; \
- dest[0].i = ((fi_type *)&(x))->i; \
- dest[1].i = ((fi_type *)&(y))->i; \
- dest[2].i = ((fi_type *)&(z))->i; \
- dest[3].i = ((fi_type *)&(w))->i; \
- if (count == IMM_MAXDATA - 1) \
- _tnl_flush_immediate( IM ); \
+#define VERTEX4F(IM, x, y, z, w) \
+{ \
+ GLuint count = IM->Count++; \
+ fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \
+ IM->Flag[count] |= VERT_OBJ_234; \
+ dest[0].i = ((fi_type *)&(x))->i; \
+ dest[1].i = ((fi_type *)&(y))->i; \
+ dest[2].i = ((fi_type *)&(z))->i; \
+ dest[3].i = ((fi_type *)&(w))->i; \
+ if (count == IMM_MAXDATA - 1) \
+ _tnl_flush_immediate( IM ); \
}
#else
#define VERTEX4F VERTEX4
GLuint texunit = target - GL_TEXTURE0_ARB; \
if (texunit < IM->MaxTextureUnits) { \
GLuint count = IM->Count; \
- GLfloat *tc = IM->TexCoord[texunit][count]; \
+ GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, 0.0F, 0.0F, 1.0F); \
IM->Flag[count] |= VERT_TEX(texunit); \
} \
GLuint texunit = target - GL_TEXTURE0_ARB; \
if (texunit < IM->MaxTextureUnits) { \
GLuint count = IM->Count; \
- GLfloat *tc = IM->TexCoord[texunit][count]; \
+ GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, t, 0.0F, 1.0F); \
IM->Flag[count] |= VERT_TEX(texunit); \
} \
GLuint texunit = target - GL_TEXTURE0_ARB; \
if (texunit < IM->MaxTextureUnits) { \
GLuint count = IM->Count; \
- GLfloat *tc = IM->TexCoord[texunit][count]; \
+ GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, t, u, 1.0F); \
IM->Flag[count] |= VERT_TEX(texunit); \
IM->TexSize |= TEX_SIZE_3(texunit); \
GLuint texunit = target - GL_TEXTURE0_ARB; \
if (texunit < IM->MaxTextureUnits) { \
GLuint count = IM->Count; \
- GLfloat *tc = IM->TexCoord[texunit][count]; \
+ GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \
ASSIGN_4V(tc, s, t, u, v); \
IM->Flag[count] |= VERT_TEX(texunit); \
IM->TexSize |= TEX_SIZE_4(texunit); \
GLuint texunit = target - GL_TEXTURE0_ARB; \
if (texunit < IM->MaxTextureUnits) { \
GLuint count = IM->Count; \
- fi_type *tc = (fi_type *)IM->TexCoord[texunit][count]; \
+ fi_type *tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count];\
IM->Flag[count] |= VERT_TEX(texunit); \
tc[0].i = ((fi_type *)&(s))->i; \
tc[1].i = ((fi_type *)&(t))->i; \
#define EVALCOORD1(IM, x) \
{ \
GLuint count = IM->Count++; \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
IM->Flag[count] |= VERT_EVAL_C1; \
- ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \
+ ASSIGN_4V(dest, x, 0, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
}
#define EVALCOORD2(IM, x, y) \
{ \
GLuint count = IM->Count++; \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
IM->Flag[count] |= VERT_EVAL_C2; \
- ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \
+ ASSIGN_4V(dest, x, y, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
}
#define EVALPOINT1(IM, x) \
{ \
GLuint count = IM->Count++; \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
IM->Flag[count] |= VERT_EVAL_P1; \
- ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \
+ ASSIGN_4V(dest, x, 0, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
}
#define EVALPOINT2(IM, x, y) \
{ \
GLuint count = IM->Count++; \
+ GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \
IM->Flag[count] |= VERT_EVAL_P2; \
- ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \
+ ASSIGN_4V(dest, x, y, 0, 1); \
if (count == IMM_MAXDATA-1) \
_tnl_flush_immediate( IM ); \
}
IM->Flag[count] |= VERT_ELT; \
IM->FlushElt = IM->ArrayEltFlush; \
IM->Count += IM->ArrayEltIncr; \
- if (IM->Count == IMM_MAXDATA) \
+ if (IM->Count == IMM_MAXDATA) \
_tnl_flush_immediate( IM ); \
}
*/
static void
-_tnl_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- /* no-op? */
-#ifndef __VMS
- printf("%s(%d, %f, %f, %f, %f)\n", __FUNCTION__, index, x, y, z, w);
-#endif
- (void) index;
- (void) x;
- (void) y;
- (void) z;
- (void) w;
-}
+_tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ if (index < 16) {
+ GET_IMMEDIATE;
+ const GLuint count = IM->Count;
+ GLfloat *attrib = IM->Attrib[index][count];
+ ASSIGN_4V(attrib, x, y, z, w);
+ IM->Flag[count] |= (1 << index);
+ if (index == 0) {
+ IM->Count++;
+ if (count == IMM_MAXDATA - 1)
+ _tnl_flush_immediate( IM );
+ }
+ }
+}
static void
-_tnl_VertexAttrib4fvNV(GLuint index, const GLfloat *v)
-{
- /* no-op? */
- (void) index;
- (void) v;
-}
-
+_tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+{
+ if (index < 16) {
+ GET_IMMEDIATE;
+ const GLuint count = IM->Count;
+ GLfloat *attrib = IM->Attrib[index][count];
+ COPY_4V(attrib, v);
+ IM->Flag[count] |= (1 << index);
+ if (index == 0) {
+ IM->Count++;
+ if (count == IMM_MAXDATA - 1)
+ _tnl_flush_immediate( IM );
+ }
+ }
+}
/* Execute a glRectf() function. _tnl_hard_begin() ensures the check
-/* $Id: t_imm_debug.c,v 1.5 2001/12/14 02:51:45 brianp Exp $ */
+/* $Id: t_imm_debug.c,v 1.6 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
fprintf(stderr, "%u: ", i);
if (req & VERT_OBJ_234) {
if (flags[i] & VERT_EVAL_C1)
- fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]);
+ fprintf(stderr, "EvalCoord %f ",
+ IM->Attrib[VERT_ATTRIB_POS][i][0]);
else if (flags[i] & VERT_EVAL_P1)
- fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]);
+ fprintf(stderr, "EvalPoint %.0f ",
+ IM->Attrib[VERT_ATTRIB_POS][i][0]);
else if (flags[i] & VERT_EVAL_C2)
- fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]);
+ fprintf(stderr, "EvalCoord %f %f ",
+ IM->Attrib[VERT_ATTRIB_POS][i][0],
+ IM->Attrib[VERT_ATTRIB_POS][i][1]);
else if (flags[i] & VERT_EVAL_P2)
- fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]);
+ fprintf(stderr, "EvalPoint %.0f %.0f ",
+ IM->Attrib[VERT_ATTRIB_POS][i][0],
+ IM->Attrib[VERT_ATTRIB_POS][i][1]);
else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
fprintf(stderr, "Obj %f %f %f %f",
- IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]);
+ IM->Attrib[VERT_ATTRIB_POS][i][0],
+ IM->Attrib[VERT_ATTRIB_POS][i][1],
+ IM->Attrib[VERT_ATTRIB_POS][i][2],
+ IM->Attrib[VERT_ATTRIB_POS][i][3]);
}
}
if (req & flags[i] & VERT_NORMAL_BIT)
fprintf(stderr, " Norm %f %f %f ",
- IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]);
+ IM->Attrib[VERT_ATTRIB_NORMAL][i][0],
+ IM->Attrib[VERT_ATTRIB_NORMAL][i][1],
+ IM->Attrib[VERT_ATTRIB_NORMAL][i][2]);
if (req & flags[i] & VERT_TEX_ANY) {
GLuint j;
for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) {
if (req & flags[i] & VERT_TEX(j)) {
- fprintf(stderr,
- "TC%d %f %f %f %f",
- j,
- IM->TexCoord[j][i][0], IM->TexCoord[j][i][1],
- IM->TexCoord[j][i][2], IM->TexCoord[j][i][2]);
+ fprintf(stderr, "TC%d %f %f %f %f", j,
+ IM->Attrib[VERT_ATTRIB_TEX0 + j][i][0],
+ IM->Attrib[VERT_ATTRIB_TEX0 + j][i][1],
+ IM->Attrib[VERT_ATTRIB_TEX0 + j][i][2],
+ IM->Attrib[VERT_ATTRIB_TEX0 + j][i][3]);
}
}
}
if (req & flags[i] & VERT_COLOR0_BIT)
fprintf(stderr, " Rgba %f %f %f %f ",
- IM->Color[i][0], IM->Color[i][1],
- IM->Color[i][2], IM->Color[i][3]);
+ IM->Attrib[VERT_ATTRIB_COLOR0][i][0],
+ IM->Attrib[VERT_ATTRIB_COLOR0][i][1],
+ IM->Attrib[VERT_ATTRIB_COLOR0][i][2],
+ IM->Attrib[VERT_ATTRIB_COLOR0][i][3]);
if (req & flags[i] & VERT_COLOR1_BIT)
fprintf(stderr, " Spec %f %f %f ",
- IM->SecondaryColor[i][0], IM->SecondaryColor[i][1],
- IM->SecondaryColor[i][2]);
+ IM->Attrib[VERT_ATTRIB_COLOR1][i][0],
+ IM->Attrib[VERT_ATTRIB_COLOR1][i][1],
+ IM->Attrib[VERT_ATTRIB_COLOR1][i][2]);
if (req & flags[i] & VERT_FOG_BIT)
- fprintf(stderr, " Fog %f ", IM->FogCoord[i]);
+ fprintf(stderr, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]);
if (req & flags[i] & VERT_INDEX_BIT)
fprintf(stderr, " Index %u ", IM->Index[i]);
-/* $Id: t_imm_dlist.c,v 1.34 2001/12/20 15:30:46 keithw Exp $ */
+/* $Id: t_imm_dlist.c,v 1.35 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
GLuint i;
GLfloat len;
- GLfloat (*data)[3] = IM->Normal + IM->Start;
+ GLfloat (*data)[4] = IM->Attrib[VERT_ATTRIB_NORMAL] + IM->Start;
GLfloat *dest = IM->NormalLengthPtr;
GLuint *flags = IM->Flag + IM->Start;
GLuint count = IM->Count - IM->Start;
{
GLuint i;
GLfloat len = 1.0F; /* just to silence warnings */
- GLfloat (*data)[3] = IM->Normal;
+ GLfloat (*data)[4] = IM->Attrib[VERT_ATTRIB_NORMAL];
GLfloat *dest = IM->NormalLengthPtr;
GLuint *flags = IM->Flag;
GLuint k;
for (k = 0 ; k < maxtex ; k++) {
if (flags[i] & VERT_TEX(k)) {
- texcoordfv[k]( GL_TEXTURE0_ARB + k, IM->TexCoord[k][i] );
+ texcoordfv[k]( GL_TEXTURE0_ARB + k,
+ IM->Attrib[VERT_ATTRIB_TEX0 + k][i] );
}
}
}
if (flags[i] & VERT_NORMAL_BIT)
- glNormal3fv(IM->Normal[i]);
+ glNormal3fv(IM->Attrib[VERT_ATTRIB_NORMAL][i]);
if (flags[i] & VERT_COLOR0_BIT)
- glColor4fv( IM->Color[i] );
+ glColor4fv( IM->Attrib[VERT_ATTRIB_COLOR0][i] );
if (flags[i] & VERT_COLOR1_BIT)
- _compat_SecondaryColor3fvEXT( IM->SecondaryColor[i] );
+ _compat_SecondaryColor3fvEXT( IM->Attrib[VERT_ATTRIB_COLOR1][i] );
if (flags[i] & VERT_FOG_BIT)
- _compat_FogCoordfEXT( IM->FogCoord[i] );
+ _compat_FogCoordfEXT( IM->Attrib[VERT_ATTRIB_FOG][i][0] );
if (flags[i] & VERT_INDEX_BIT)
glIndexi( IM->Index[i] );
emit_material( IM->Material[i], IM->MaterialMask[i] );
if (flags[i]&VERT_OBJ_234)
- vertex( IM->Obj[i] );
+ vertex( IM->Attrib[VERT_ATTRIB_POS][i] );
else if (flags[i] & VERT_EVAL_C1)
- glEvalCoord1f( IM->Obj[i][0] );
+ glEvalCoord1f( IM->Attrib[VERT_ATTRIB_POS][i][0] );
else if (flags[i] & VERT_EVAL_P1)
- glEvalPoint1( (GLint) IM->Obj[i][0] );
+ glEvalPoint1( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0] );
else if (flags[i] & VERT_EVAL_C2)
- glEvalCoord2f( IM->Obj[i][0], IM->Obj[i][1] );
+ glEvalCoord2f( IM->Attrib[VERT_ATTRIB_POS][i][0],
+ IM->Attrib[VERT_ATTRIB_POS][i][1] );
else if (flags[i] & VERT_EVAL_P2)
- glEvalPoint2( (GLint) IM->Obj[i][0], (GLint) IM->Obj[i][1] );
+ glEvalPoint2( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0],
+ (GLint) IM->Attrib[VERT_ATTRIB_POS][i][1] );
}
if (prim & PRIM_END) {
-/* $Id: t_imm_elt.c,v 1.13 2001/12/14 02:51:45 brianp Exp $ */
+/* $Id: t_imm_elt.c,v 1.14 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
+#if 00
static void _tnl_trans_elt_1f(GLfloat *to,
const struct gl_client_array *from,
GLuint *flags,
n );
}
+#endif
static void _tnl_trans_elt_1ui(GLuint *to,
const struct gl_client_array *from,
fprintf(stderr, "exec_array_elements %d .. %d\n", start, count);
if (translate & VERT_OBJ_BIT) {
- _tnl_trans_elt_4f( IM->Obj,
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
&ctx->Array.Vertex,
flags, elts, (VERT_ELT|VERT_OBJ_BIT),
start, count);
if (translate & VERT_NORMAL_BIT)
- _tnl_trans_elt_3f( IM->Normal,
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL],
&ctx->Array.Normal,
flags, elts, (VERT_ELT|VERT_NORMAL_BIT),
start, count);
start, count);
if (translate & VERT_COLOR0_BIT) {
- _tnl_trans_elt_4f( IM->Color,
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0],
&ctx->Array.Color,
flags, elts, (VERT_ELT|VERT_COLOR0_BIT),
start, count);
}
if (translate & VERT_COLOR1_BIT) {
- _tnl_trans_elt_4f( IM->SecondaryColor,
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1],
&ctx->Array.SecondaryColor,
flags, elts, (VERT_ELT|VERT_COLOR1_BIT),
start, count);
}
if (translate & VERT_FOG_BIT)
- _tnl_trans_elt_1f( IM->FogCoord,
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_FOG],
&ctx->Array.FogCoord,
flags, elts, (VERT_ELT|VERT_FOG_BIT),
start, count);
if (translate & VERT_TEX_ANY) {
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (translate & VERT_TEX(i)) {
- _tnl_trans_elt_4f( IM->TexCoord[i],
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i],
&ctx->Array.TexCoord[i],
flags, elts, (VERT_ELT|VERT_TEX(i)),
start, count);
-/* $Id: t_imm_eval.c,v 1.19 2001/12/14 02:51:45 brianp Exp $ */
+/* $Id: t_imm_eval.c,v 1.20 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
-static void eval1_norm( GLvector3f *dest,
+static void eval1_norm( GLvector4f *dest,
GLfloat coord[][4],
const GLuint *flags,
struct gl_1d_map *map )
{
const GLfloat u1 = map->u1;
const GLfloat du = map->du;
- GLfloat (*to)[3] = dest->data;
+ GLfloat (*to)[4] = dest->data;
GLuint i;
for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
static void eval2_obj_norm( GLvector4f *obj_ptr,
- GLvector3f *norm_ptr,
+ GLvector4f *norm_ptr,
GLfloat coord[][4],
GLuint *flags,
GLuint dimension,
const GLfloat v1 = map->v1;
const GLfloat dv = map->dv;
GLfloat (*obj)[4] = obj_ptr->data;
- GLfloat (*normal)[3] = norm_ptr->data;
+ GLfloat (*normal)[4] = norm_ptr->data;
GLuint i;
/* fprintf(stderr, "%s\n", __FUNCTION__); */
}
-static void eval2_norm( GLvector3f *dest,
+static void eval2_norm( GLvector4f *dest,
GLfloat coord[][4],
GLuint *flags,
struct gl_2d_map *map )
const GLfloat du = map->du;
const GLfloat v1 = map->v1;
const GLfloat dv = map->dv;
- GLfloat (*to)[3] = dest->data;
+ GLfloat (*to)[4] = dest->data;
GLuint i;
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
+ for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) {
if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) {
GLfloat u = (coord[i][0] - u1) * du;
GLfloat v = (coord[i][1] - v1) * dv;
_math_horner_bezier_surf(map->Points, to[i], u, v, 3,
map->Uorder, map->Vorder);
- }
-
+ }
+ }
}
}
}
-static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count )
+static void copy_3f( GLfloat to[][4], GLfloat from[][4], GLuint count )
{
GLuint i;
/* MEMCPY( to, from, (count) * sizeof(to[0])); */
GLuint any_eval2 = orflag & (VERT_EVAL_C2|VERT_EVAL_P2);
GLuint req = 0;
GLuint purge_flags = 0;
- GLfloat (*coord)[4] = IM->Obj + IM->CopyStart;
+ GLfloat (*coord)[4] = IM->Attrib[VERT_ATTRIB_POS] + IM->CopyStart;
if (IM->AndFlag & VERT_EVAL_ANY)
copycount = IM->Start - IM->CopyStart; /* just copy copied vertices */
purge_flags = (VERT_EVAL_P1|VERT_EVAL_C1);
if (orflag & VERT_EVAL_P1) {
- eval_points1( store->Obj + IM->CopyStart,
+ eval_points1( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart,
coord, flags,
ctx->Eval.MapGrid1du,
ctx->Eval.MapGrid1u1);
- coord = store->Obj + IM->CopyStart;
+ coord = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart;
}
}
purge_flags |= (VERT_EVAL_P2|VERT_EVAL_C2);
if (orflag & VERT_EVAL_P2) {
- eval_points2( store->Obj + IM->CopyStart,
+ eval_points2( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart,
coord, flags,
ctx->Eval.MapGrid2du,
ctx->Eval.MapGrid2u1,
ctx->Eval.MapGrid2dv,
ctx->Eval.MapGrid2v1 );
- coord = store->Obj + IM->CopyStart;
+ coord = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart;
}
}
GLuint generated = 0;
if (copycount)
- copy_4f_stride( store->Color + IM->CopyStart,
+ copy_4f_stride( store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart,
(GLfloat *)tmp->Color.Ptr,
tmp->Color.StrideB,
copycount );
- tmp->Color.Ptr = store->Color + IM->CopyStart;
+ tmp->Color.Ptr = store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart;
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
tnl->vb.importable_data &= ~VERT_COLOR0_BIT;
GLuint generated = 0;
if (copycount)
- copy_4f( store->TexCoord[0] + IM->CopyStart,
+ copy_4f( store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart,
tmp->TexCoord[0].data, copycount );
else
tmp->TexCoord[0].size = 0;
- tmp->TexCoord[0].data = store->TexCoord[0] + IM->CopyStart;
+ tmp->TexCoord[0].data = store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart;
tmp->TexCoord[0].start = (GLfloat *)tmp->TexCoord[0].data;
if (any_eval1) {
if (copycount) {
/* fprintf(stderr, "%s: Copy normals\n", __FUNCTION__); */
- copy_3f( store->Normal + IM->CopyStart, tmp->Normal.data,
- copycount );
+ copy_3f( store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart,
+ tmp->Normal.data, copycount );
}
- tmp->Normal.data = store->Normal + IM->CopyStart;
+ tmp->Normal.data = store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart;
tmp->Normal.start = (GLfloat *)tmp->Normal.data;
if (ctx->Eval.Map1Normal && any_eval1) {
- eval1_norm( &tmp->Normal, coord, flags,
- &ctx->EvalMap.Map1Normal );
+ eval1_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map1Normal );
generated |= VERT_EVAL_C1|VERT_EVAL_P1;
}
if (ctx->Eval.Map2Normal && any_eval2) {
- eval2_norm( &tmp->Normal, coord, flags,
- &ctx->EvalMap.Map2Normal );
+ eval2_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map2Normal );
generated |= VERT_EVAL_C2|VERT_EVAL_P2;
}
}
/* This copy may already have occurred when eliminating
* glEvalPoint calls:
*/
- if (coord != store->Obj + IM->CopyStart)
- copy_4f( store->Obj + IM->CopyStart, tmp->Obj.data, copycount );
- } else
+ if (coord != store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart) {
+ copy_4f( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart,
+ tmp->Obj.data, copycount );
+ }
+ }
+ else {
tmp->Obj.size = 0;
+ }
- tmp->Obj.data = store->Obj + IM->CopyStart;
+ tmp->Obj.data = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart;
tmp->Obj.start = (GLfloat *)tmp->Obj.data;
/* Note: Normal data is already prepared above.
}
if (any_eval2) {
- if (ctx->Eval.Map2Vertex4)
- {
+ if (ctx->Eval.Map2Vertex4) {
if (ctx->Eval.AutoNormal && (req & VERT_NORMAL_BIT))
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4,
&ctx->EvalMap.Map2Vertex4 );
eval2_4f( &tmp->Obj, coord, flags, 4,
&ctx->EvalMap.Map2Vertex4 );
}
- else if (ctx->Eval.Map2Vertex3)
- {
+ else if (ctx->Eval.Map2Vertex3) {
if (ctx->Eval.AutoNormal && (req & VERT_NORMAL_BIT))
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3,
&ctx->EvalMap.Map2Vertex3 );
-/* $Id: t_imm_exec.c,v 1.32 2001/12/15 02:13:32 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.33 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
_tnl_print_vert_flags("copy to current", flag);
+ /* XXX should be able t replace these conditions with a loop over
+ * the 16 vertex attributes.
+ */
if (flag & VERT_NORMAL_BIT)
- COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], IM->Normal[count]);
+ COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL],
+ IM->Attrib[VERT_ATTRIB_NORMAL][count]);
if (flag & VERT_INDEX_BIT)
ctx->Current.Index = IM->Index[count];
ctx->Current.EdgeFlag = IM->EdgeFlag[count];
if (flag & VERT_COLOR0_BIT) {
- COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], IM->Color[count]);
+ COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR0],
+ IM->Attrib[VERT_ATTRIB_COLOR0][count]);
if (ctx->Light.ColorMaterialEnabled) {
- _mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
+ _mesa_update_color_material( ctx,
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
_mesa_validate_all_lighting_tables( ctx );
}
}
if (flag & VERT_COLOR1_BIT)
- COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR1], IM->SecondaryColor[count]);
+ COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR1],
+ IM->Attrib[VERT_ATTRIB_COLOR1][count]);
if (flag & VERT_FOG_BIT)
- ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = IM->FogCoord[count];
+ ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = IM->Attrib[VERT_ATTRIB_FOG][count][0];
if (flag & VERT_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
if (flag & VERT_TEX(i)) {
- COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i], IM->TexCoord[i][count]);
+ COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i],
+ IM->Attrib[VERT_ATTRIB_TEX0 + i][count]);
}
}
}
struct vertex_buffer *VB = &tnl->vb;
struct vertex_arrays *tmp = &tnl->imm_inputs;
GLuint inputs = tnl->pipeline.inputs; /* for copy-to-current */
- GLuint start = IM->CopyStart;
- GLuint count = IM->Count - start;
+ const GLuint start = IM->CopyStart;
+ const GLuint count = IM->Count - start;
+ GLuint i;
/* TODO: optimize the case where nothing has changed. (Just bind
* tmp to vb).
*/
VB->NormalPtr = 0;
VB->NormalLengthPtr = 0;
- VB->FogCoordPtr = 0;
VB->EdgeFlag = 0;
VB->IndexPtr[0] = 0;
VB->IndexPtr[1] = 0;
VB->Elts = 0;
VB->MaterialMask = 0;
VB->Material = 0;
+ for (i = 0; i < 16; i++)
+ VB->AttribPtr[i] = NULL;
/* _tnl_print_vert_flags("copy-orflag", IM->CopyOrFlag); */
/* _tnl_print_vert_flags("orflag", IM->OrFlag); */
/* Setup the initial values of array pointers in the vb.
*/
if (inputs & VERT_OBJ_BIT) {
- tmp->Obj.data = IM->Obj + start;
- tmp->Obj.start = (GLfloat *)(IM->Obj + start);
+ tmp->Obj.data = IM->Attrib[VERT_ATTRIB_POS] + start;
+ tmp->Obj.start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_POS] + start);
tmp->Obj.count = count;
VB->ObjPtr = &tmp->Obj;
if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_234)
}
if (inputs & VERT_NORMAL_BIT) {
- tmp->Normal.data = IM->Normal + start;
- tmp->Normal.start = (GLfloat *)(IM->Normal + start);
+ tmp->Normal.data = IM->Attrib[VERT_ATTRIB_NORMAL] + start;
+ tmp->Normal.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_NORMAL] + start);
tmp->Normal.count = count;
VB->NormalPtr = &tmp->Normal;
if (IM->NormalLengthPtr)
}
if (inputs & VERT_FOG_BIT) {
- tmp->FogCoord.data = IM->FogCoord + start;
- tmp->FogCoord.start = IM->FogCoord + start;
+ tmp->FogCoord.data = IM->Attrib[VERT_ATTRIB_FOG] + start;
+ tmp->FogCoord.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_FOG] + start);
tmp->FogCoord.count = count;
- VB->FogCoordPtr = &tmp->FogCoord;
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &tmp->FogCoord;
}
if (inputs & VERT_COLOR1_BIT) {
- tmp->SecondaryColor.Ptr = IM->SecondaryColor + start;
+ tmp->SecondaryColor.Ptr = IM->Attrib[VERT_ATTRIB_COLOR1] + start;
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
}
if (inputs & VERT_COLOR0_BIT) {
if (IM->CopyOrFlag & VERT_COLOR0_BIT) {
- tmp->Color.Ptr = IM->Color + start;
+ tmp->Color.Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start;
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
}
VB->TexCoordPtr[i] = 0;
if (inputs & VERT_TEX(i)) {
tmp->TexCoord[i].count = count;
- tmp->TexCoord[i].data = IM->TexCoord[i] + start;
- tmp->TexCoord[i].start = (GLfloat *)(IM->TexCoord[i] + start);
+ tmp->TexCoord[i].data = IM->Attrib[VERT_ATTRIB_TEX0 + i] + start;
+ tmp->TexCoord[i].start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_TEX0 + i] + start);
tmp->TexCoord[i].size = 2;
if (IM->TexSize & TEX_SIZE_3(i)) {
tmp->TexCoord[i].size = 3;
/* GL_NV_vertex_program */
if (ctx->VertexProgram.Enabled) {
GLuint attr;
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
tmp->Attribs[attr].count = count;
tmp->Attribs[attr].data = IM->Attrib[attr] + start;
tmp->Attribs[attr].start = (GLfloat *) (IM->Attrib[attr] + start);
TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS;
_mesa_vector4f_init( &tmp->Obj, 0, 0 );
- _mesa_vector3f_init( &tmp->Normal, 0, 0 );
+ _mesa_vector4f_init( &tmp->Normal, 0, 0 );
tmp->Color.Ptr = 0;
tmp->Color.Type = GL_FLOAT;
tmp->SecondaryColor.StrideB = 4 * sizeof(GLfloat);
tmp->SecondaryColor.Flags = 0;
- _mesa_vector1f_init( &tmp->FogCoord, 0, 0 );
+ _mesa_vector4f_init( &tmp->FogCoord, 0, 0 );
_mesa_vector1ui_init( &tmp->Index, 0, 0 );
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 );
-/* $Id: t_imm_fixup.c,v 1.30 2001/12/15 02:13:32 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.31 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
data[i] = dflt;
}
+#if 00
static void
fixup_first_1f( GLfloat data[], GLuint flag[], GLuint match,
GLuint start, GLfloat dflt )
while ((flag[++i]&match) == 0)
data[i] = dflt;
}
-
+#endif
static void
fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match,
static void copy_from_current( GLcontext *ctx, struct immediate *IM,
GLuint pos, GLuint copyMask )
{
+ GLuint attrib, attribBit;
+
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
_tnl_print_vert_flags("copy from current", copyMask);
+#if 0
if (copyMask & VERT_NORMAL_BIT) {
- COPY_3V(IM->Normal[pos], ctx->Current.Attrib[VERT_ATTRIB_NORMAL]);
+ COPY_4V(IM->Attrib[VERT_ATTRIB_NORMAL][pos],
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL]);
}
if (copyMask & VERT_COLOR0_BIT) {
- COPY_4FV( IM->Color[pos], ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][pos],
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
}
if (copyMask & VERT_COLOR1_BIT)
- COPY_4FV( IM->SecondaryColor[pos], ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
+ COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR1][pos],
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
if (copyMask & VERT_FOG_BIT)
- IM->FogCoord[pos] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
-
- if (copyMask & VERT_INDEX_BIT)
- IM->Index[pos] = ctx->Current.Index;
-
- if (copyMask & VERT_EDGEFLAG_BIT)
- IM->EdgeFlag[pos] = ctx->Current.EdgeFlag;
+ IM->Attrib[VERT_ATTRIB_FOG][pos][0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
if (copyMask & VERT_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
if (copyMask & VERT_TEX(i))
- COPY_4FV(IM->TexCoord[i][pos], ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]);
+ COPY_4FV(IM->Attrib[VERT_ATTRIB_TEX0 + i][pos],
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]);
+ }
+ }
+#else
+ for (attrib = 0, attribBit = 1; attrib < 16; attrib++, attribBit <<= 1) {
+ if (copyMask & attribBit) {
+ COPY_4FV( IM->Attrib[attrib][pos], ctx->Current.Attrib[attrib]);
}
}
+#endif
+
+ if (copyMask & VERT_INDEX_BIT)
+ IM->Index[pos] = ctx->Current.Index;
+
+ if (copyMask & VERT_EDGEFLAG_BIT)
+ IM->EdgeFlag[pos] = ctx->Current.EdgeFlag;
}
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
_tnl_print_vert_flags("fixup", fixup);
+ /* XXX replace these conditionals with a loop over the 16
+ * vertex attributes.
+ */
+
if (fixup & VERT_TEX_ANY) {
GLuint i;
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
if (fixup & VERT_TEX(i)) {
if (orflag & VERT_TEX(i))
- _tnl_fixup_4f( IM->TexCoord[i], IM->Flag, start,
- VERT_TEX(i) );
+ _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag,
+ start, VERT_TEX(i) );
else
- fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_END_VB, start,
- IM->TexCoord[i][start]);
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag,
+ VERT_END_VB, start,
+ IM->Attrib[VERT_ATTRIB_TEX0 + i][start]);
}
}
}
if (fixup & VERT_COLOR0_BIT) {
if (orflag & VERT_COLOR0_BIT)
- _tnl_fixup_4f( IM->Color, IM->Flag, start, VERT_COLOR0_BIT );
+ _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, start,
+ VERT_COLOR0_BIT );
/* No need for else case as the drivers understand stride
* zero here. (TODO - propogate this)
*/
if (fixup & VERT_COLOR1_BIT) {
if (orflag & VERT_COLOR1_BIT)
- _tnl_fixup_4f( IM->SecondaryColor, IM->Flag, start,
+ _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, start,
VERT_COLOR1_BIT );
else
- fixup_first_4f( IM->SecondaryColor, IM->Flag, VERT_END_VB, start,
- IM->SecondaryColor[start] );
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, VERT_END_VB, start,
+ IM->Attrib[VERT_ATTRIB_COLOR1][start] );
}
if (fixup & VERT_FOG_BIT) {
if (orflag & VERT_FOG_BIT)
- _tnl_fixup_1f( IM->FogCoord, IM->Flag, start, VERT_FOG_BIT );
+ _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag,
+ start, VERT_FOG_BIT );
else
- fixup_first_1f( IM->FogCoord, IM->Flag, VERT_END_VB, start,
- IM->FogCoord[start] );
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, VERT_END_VB,
+ start, IM->Attrib[VERT_ATTRIB_FOG][start] );
}
if (fixup & VERT_NORMAL_BIT) {
if (orflag & VERT_NORMAL_BIT)
- _tnl_fixup_3f( IM->Normal, IM->Flag, start, VERT_NORMAL_BIT );
+ _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, start,
+ VERT_NORMAL_BIT );
else
- fixup_first_3f( IM->Normal, IM->Flag, VERT_END_VB, start,
- IM->Normal[start] );
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag,
+ VERT_END_VB, start,
+ IM->Attrib[VERT_ATTRIB_NORMAL][start] );
}
}
*
* Note these pointers are null when inactive.
*/
- COPY_4FV( next->Obj[dst], inputs->Obj.data[isrc] );
+ COPY_4FV( next->Attrib[VERT_ATTRIB_POS][dst],
+ inputs->Obj.data[isrc] );
if (copy & VERT_NORMAL_BIT) {
/* fprintf(stderr, "copy vert norm %d to %d (%p): %f %f %f\n", */
/* inputs->Normal.data[isrc][0], */
/* inputs->Normal.data[isrc][1], */
/* inputs->Normal.data[isrc][2]); */
- COPY_3FV( next->Normal[dst], inputs->Normal.data[isrc] );
+ COPY_3FV( next->Attrib[VERT_ATTRIB_NORMAL][dst], inputs->Normal.data[isrc] );
}
if (copy & VERT_COLOR0_BIT)
- COPY_4FV( next->Color[dst],
+ COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR0][dst],
((GLfloat (*)[4])inputs->Color.Ptr)[isrc] );
if (copy & VERT_INDEX_BIT)
GLuint i;
for (i = 0 ; i < prev->MaxTextureUnits ; i++) {
if (copy & VERT_TEX(i))
- COPY_4FV( next->TexCoord[i][dst],
+ COPY_4FV( next->Attrib[VERT_ATTRIB_TEX0 + i][dst],
inputs->TexCoord[i].data[isrc] );
}
}
next->Elt[dst] = prev->Elt[src];
next->EdgeFlag[dst] = prev->EdgeFlag[src];
- COPY_4FV( next->SecondaryColor[dst], prev->SecondaryColor[src] );
- next->FogCoord[dst] = prev->FogCoord[src];
+ COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR1][dst],
+ prev->Attrib[VERT_ATTRIB_COLOR1][src] );
+ COPY_4FV( next->Attrib[VERT_ATTRIB_FOG][dst],
+ prev->Attrib[VERT_ATTRIB_FOG][src] );
}
next->Flag[dst] = flag;
/* _tnl_print_vert_flags("fixup compiled", fixup); */
if (fixup) {
- if (fixup & VERT_TEX_ANY) {
- GLuint i;
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (fixup & VERT_TEX(i))
- fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_TEX(i), start,
- ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i] );
- }
- }
- if (fixup & VERT_EDGEFLAG_BIT)
- fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGEFLAG_BIT, start,
- ctx->Current.EdgeFlag );
+ /* XXX try to replace this code with a loop over the 16 vertex
+ * attributes.
+ */
- if (fixup & VERT_INDEX_BIT)
- fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX_BIT, start,
- ctx->Current.Index );
+ if (fixup & VERT_NORMAL_BIT) {
+ fixup_first_4f(IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag,
+ VERT_NORMAL_BIT, start,
+ ctx->Current.Attrib[VERT_ATTRIB_NORMAL] );
+ }
if (fixup & VERT_COLOR0_BIT) {
if (IM->CopyOrFlag & VERT_COLOR0_BIT)
- fixup_first_4f(IM->Color, IM->Flag, VERT_COLOR0_BIT, start,
+ fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag,
+ VERT_COLOR0_BIT, start,
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
else
fixup &= ~VERT_COLOR0_BIT;
}
if (fixup & VERT_COLOR1_BIT)
- fixup_first_4f(IM->SecondaryColor, IM->Flag, VERT_COLOR1_BIT, start,
+ fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag,
+ VERT_COLOR1_BIT, start,
ctx->Current.Attrib[VERT_ATTRIB_COLOR1] );
if (fixup & VERT_FOG_BIT)
- fixup_first_1f(IM->FogCoord, IM->Flag, VERT_FOG_BIT, start,
- ctx->Current.Attrib[VERT_ATTRIB_FOG][0] );
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag,
+ VERT_FOG_BIT, start,
+ ctx->Current.Attrib[VERT_ATTRIB_FOG] );
- if (fixup & VERT_NORMAL_BIT) {
- fixup_first_3f(IM->Normal, IM->Flag, VERT_NORMAL_BIT, start,
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL] );
+ if (fixup & VERT_TEX_ANY) {
+ GLuint i;
+ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
+ if (fixup & VERT_TEX(i))
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag,
+ VERT_TEX(i), start,
+ ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i] );
+ }
}
+ if (fixup & VERT_EDGEFLAG_BIT)
+ fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGEFLAG_BIT, start,
+ ctx->Current.EdgeFlag );
+
+ if (fixup & VERT_INDEX_BIT)
+ fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX_BIT, start,
+ ctx->Current.Index );
+
IM->CopyOrFlag |= fixup;
}
struct gl_client_array *tmp = &tnl->imm_inputs.Color;
GLuint start = IM->CopyStart;
- tmp->Ptr = IM->Color + start;
+ tmp->Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start;
tmp->StrideB = 4 * sizeof(GLfloat);
tmp->Flags = 0;
- COPY_4FV( IM->Color[start], ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
+ COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][start],
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
/*
ASSERT(IM->Flag[IM->LastData+1] & VERT_END_VB);
*/
- fixup_first_4f( IM->Color, IM->Flag, VERT_END_VB, start,
- IM->Color[start] );
+ fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, VERT_END_VB,
+ start, IM->Attrib[VERT_ATTRIB_COLOR0][start] );
VB->importable_data &= ~VERT_COLOR0_BIT;
}
-/* $Id: t_vb_fog.c,v 1.14 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_vb_fog.c,v 1.15 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct fog_stage_data {
- GLvector1f fogcoord; /* has actual storage allocated */
- GLvector1f input; /* points into VB->EyePtr Z values */
+ GLvector4f fogcoord; /* has actual storage allocated */
+ GLvector4f input; /* points into VB->EyePtr Z values */
};
#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr)
}
-static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out,
- const GLvector1f *in )
+static void make_win_fog_coords( GLcontext *ctx, GLvector4f *out,
+ const GLvector4f *in )
{
GLfloat end = ctx->Fog.End;
GLfloat *v = in->start;
GLuint stride = in->stride;
GLuint n = in->count;
- GLfloat *data = out->data;
+ GLfloat (*data)[4] = out->data;
GLfloat d;
GLuint i;
d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
GLfloat f = (end - ABSF(*v)) * d;
- data[i] = CLAMP(f, 0.0F, 1.0F);
+ data[i][0] = CLAMP(f, 0.0F, 1.0F);
}
break;
case GL_EXP:
d = ctx->Fog.Density;
for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride))
- NEG_EXP( data[i], d * ABSF(*v) );
+ NEG_EXP( data[i][0], d * ABSF(*v) );
break;
case GL_EXP2:
d = ctx->Fog.Density*ctx->Fog.Density;
for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
GLfloat z = *v;
- NEG_EXP( data[i], d * z * z );
+ NEG_EXP( data[i][0], d * z * z );
}
break;
default:
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct fog_stage_data *store = FOG_STAGE_DATA(stage);
- GLvector1f *input;
+ GLvector4f *input;
if (stage->changed_inputs == 0)
return GL_TRUE;
/* fog computed from Z depth */
/* source = VB->ObjPtr or VB->EyePtr coords */
/* dest = VB->FogCoordPtr = fog stage private storage */
- VB->FogCoordPtr = &store->fogcoord;
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &store->fogcoord;
if (!ctx->_NeedEyeCoords) {
const GLfloat *m = ctx->ModelviewMatrixStack.Top->m;
/* Full eye coords weren't required, just calculate the
* eye Z values.
*/
- _mesa_dotprod_tab[VB->ObjPtr->size]( input->data,
- sizeof(GLfloat),
+ _mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data,
+ 4 * sizeof(GLfloat),
VB->ObjPtr, plane );
input->count = VB->ObjPtr->count;
if (VB->EyePtr->size < 2)
_mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 );
- input->data = &(VB->EyePtr->data[0][2]);
+ input->data = (GLfloat (*)[4]) &(VB->EyePtr->data[0][2]);
input->start = VB->EyePtr->start+2;
input->stride = VB->EyePtr->stride;
input->count = VB->EyePtr->count;
else {
/* use glFogCoord() coordinates */
/* source = VB->FogCoordPtr */
- input = VB->FogCoordPtr;
+ input = VB->AttribPtr[VERT_ATTRIB_FOG];
/* dest = fog stage private storage */
- VB->FogCoordPtr = &store->fogcoord;
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &store->fogcoord;
}
- make_win_fog_coords( ctx, VB->FogCoordPtr, input );
+ make_win_fog_coords( ctx, VB->AttribPtr[VERT_ATTRIB_FOG], input );
return GL_TRUE;
}
if (!store)
return GL_FALSE;
- _mesa_vector1f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 );
- _mesa_vector1f_init( &store->input, 0, 0 );
+ _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 );
+ _mesa_vector4f_init( &store->input, 0, 0 );
if (!inited)
init_static_data();
{
struct fog_stage_data *store = FOG_STAGE_DATA(stage);
if (store) {
- _mesa_vector1f_free( &store->fogcoord );
+ _mesa_vector4f_free( &store->fogcoord );
FREE( store );
stage->privatePtr = NULL;
}
-/* $Id: t_vb_lighttmp.h,v 1.22 2002/01/05 14:03:33 brianp Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.23 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
#if (IDX & LIGHT_FLAGS)
# define VSTRIDE (4 * sizeof(GLfloat))
-# define NSTRIDE (3 * sizeof(GLfloat))
+# define NSTRIDE nstride /*(3 * sizeof(GLfloat))*/
# define CHECK_MATERIAL(x) (flags[x] & VERT_MATERIAL)
# define CHECK_END_VB(x) (flags[x] & VERT_END_VB)
# if (IDX & LIGHT_COLORMATERIAL)
-/* $Id: t_vb_normals.c,v 1.11 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_vb_normals.c,v 1.12 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct normal_stage_data {
normal_func NormalTransform;
- GLvector3f normal;
+ GLvector4f normal;
};
#define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr)
if (!store)
return GL_FALSE;
- _mesa_vector3f_alloc( &store->normal, 0, tnl->vb.Size, 32 );
+ _mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 );
/* Now run the stage.
*/
{
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
if (store) {
- _mesa_vector3f_free( &store->normal );
+ _mesa_vector4f_free( &store->normal );
FREE( store );
stage->privatePtr = NULL;
}
-/* $Id: t_vb_program.c,v 1.5 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_vb_program.c,v 1.6 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
-static void
-_vp_ArrayElement( GLint i )
-{
- /* XXX to do */
-}
-
-static void
-_vp_Color3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- ASSIGN_4V(attrib, r, g, b, 1.0F);
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color3fv( const GLfloat *color )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- ASSIGN_4V(attrib, color[0], color[1], color[2], 1.0F);
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color3ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- attrib[0] = UBYTE_TO_FLOAT(r);
- attrib[1] = UBYTE_TO_FLOAT(g);
- attrib[2] = UBYTE_TO_FLOAT(b);
- attrib[3] = 1.0F;
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color3ubv( const GLubyte *color )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- attrib[0] = UBYTE_TO_FLOAT(color[0]);
- attrib[1] = UBYTE_TO_FLOAT(color[1]);
- attrib[2] = UBYTE_TO_FLOAT(color[2]);
- attrib[3] = 1.0F;
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- ASSIGN_4V(attrib, r, g, b, a);
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color4fv( const GLfloat *color )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- COPY_4V(attrib, color);
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color4ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- attrib[0] = UBYTE_TO_FLOAT(r);
- attrib[1] = UBYTE_TO_FLOAT(g);
- attrib[2] = UBYTE_TO_FLOAT(b);
- attrib[3] = UBYTE_TO_FLOAT(a);
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_Color4ubv( const GLubyte *color )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR0][IM->Count];
- attrib[0] = UBYTE_TO_FLOAT(color[0]);
- attrib[1] = UBYTE_TO_FLOAT(color[1]);
- attrib[2] = UBYTE_TO_FLOAT(color[2]);
- attrib[3] = UBYTE_TO_FLOAT(color[3]);
- IM->Flag[IM->Count] |= VERT_COLOR0_BIT;
-}
-
-static void
-_vp_EdgeFlag( GLboolean flag )
-{
- GET_IMMEDIATE;
- IM->EdgeFlag[IM->Count] = flag;
- IM->Flag[IM->Count] |= VERT_EDGEFLAG_BIT;
-}
-
-static void
-_vp_EdgeFlagv( const GLboolean *flag )
-{
- GET_IMMEDIATE;
- IM->EdgeFlag[IM->Count] = *flag;
- IM->Flag[IM->Count] |= VERT_EDGEFLAG_BIT;
-}
-
-static void
-_vp_EvalCoord1f( GLfloat s )
-{
- (void) s;
- /* XXX no-op? */
-}
-
-static void
-_vp_EvalCoord1fv( const GLfloat *v )
-{
- (void) v;
- /* XXX no-op? */
-}
-
-static void
-_vp_EvalCoord2f( GLfloat s, GLfloat t )
-{
- (void) s;
- (void )t;
- /* XXX no-op? */
-}
-
-static void
-_vp_EvalCoord2fv( const GLfloat *v )
-{
- (void) v;
- /* XXX no-op? */
-}
-
-static void
-_vp_EvalPoint1( GLint i )
-{
- (void) i;
-}
-
-static void
-_vp_EvalPoint2( GLint i, GLint j )
-{
- (void) i;
- (void) j;
-}
-
-static void
-_vp_FogCoordf( GLfloat f )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_FOG][IM->Count];
- ASSIGN_4V(attrib, f, 0.0F, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= VERT_FOG_BIT;
-}
-
-static void
-_vp_FogCoordfv( const GLfloat *f )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_FOG][IM->Count];
- ASSIGN_4V(attrib, f[0], 0.0F, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= VERT_FOG_BIT;
-}
-
-static void
-_vp_Indexi( GLint i )
-{
- (void) i;
-}
-
-static void
-_vp_Indexiv( const GLint *i )
-{
- (void) i;
-}
-
-static void
-_vp_Materialfv( GLenum face, GLenum pname, const GLfloat *v)
-{
- /* XXX no-op? */
-}
-
-static void
-_vp_MultiTexCoord1f( GLenum unit, GLfloat s )
-{
- const GLint u = (GLint) unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, s, 0.0F, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord1fv( GLenum unit, const GLfloat *c )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, c[0], 0.0F, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord2f( GLenum unit, GLfloat s, GLfloat t )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, s, t, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord2fv( GLenum unit, const GLfloat *c )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, c[0], c[1], 0.0F, 1.0F);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord3f( GLenum unit, GLfloat s, GLfloat t, GLfloat r )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, s, t, r, 1.0F);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord3fv( GLenum unit, const GLfloat *c )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, c[0], c[1], c[2], 1.0F);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord4f( GLenum unit, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- ASSIGN_4V(attrib, s, t, r, q);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_MultiTexCoord4fv( GLenum unit, const GLfloat *c )
-{
- const GLint u = unit - GL_TEXTURE0_ARB;
- if (u >=0 && u < 8) {
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0 + u][IM->Count];
- COPY_4V(attrib, c);
- IM->Flag[IM->Count] |= (VERT_TEX0_BIT << u);
- }
-}
-
-static void
-_vp_Normal3f( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_NORMAL][IM->Count];
- ASSIGN_4V(attrib, x, y, z, 1.0F);
- IM->Flag[IM->Count] |= VERT_NORMAL_BIT;
-}
-
-static void
-_vp_Normal3fv( const GLfloat *n )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_NORMAL][IM->Count];
- ASSIGN_4V(attrib, n[0], n[1], n[2], 1.0F);
- IM->Flag[IM->Count] |= VERT_NORMAL_BIT;
-}
-
-static void
-_vp_SecondaryColor3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR1][IM->Count];
- ASSIGN_4V(attrib, r, g, b, 1.0F);
- IM->Flag[IM->Count] |= VERT_COLOR1_BIT;
-}
-
-static void
-_vp_SecondaryColor3fv( const GLfloat *color )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR1][IM->Count];
- ASSIGN_4V(attrib, color[0], color[1], color[2], 1.0F);
- IM->Flag[IM->Count] |= VERT_COLOR1_BIT;
-}
-
-static void
-_vp_SecondaryColor3ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR1][IM->Count];
- attrib[0] = UBYTE_TO_FLOAT(r);
- attrib[1] = UBYTE_TO_FLOAT(g);
- attrib[2] = UBYTE_TO_FLOAT(b);
- attrib[3] = 1.0F;
- IM->Flag[IM->Count] |= VERT_COLOR1_BIT;
-}
-
-static void
-_vp_SecondaryColor3ubv( const GLubyte *color )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_COLOR1][IM->Count];
- attrib[0] = UBYTE_TO_FLOAT(color[0]);
- attrib[1] = UBYTE_TO_FLOAT(color[1]);
- attrib[2] = UBYTE_TO_FLOAT(color[2]);
- attrib[3] = 1.0F;
- IM->Flag[IM->Count] |= VERT_COLOR1_BIT;
-}
-
-static void
-_vp_TexCoord1f( GLfloat s )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, s, 0.0F, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord1fv( const GLfloat *c )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, c[0], 0.0F, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord2f( GLfloat s, GLfloat t )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, s, t, 0.0F, 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord2fv( const GLfloat *c )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, c[0], c[1], 0.0F, 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord3f( GLfloat s, GLfloat t, GLfloat r )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, s, t, r, 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord3fv( const GLfloat *c )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, c[0], c[1], c[2], 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- ASSIGN_4V(attrib, s, t, r, 1.0F);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_TexCoord4fv( const GLfloat *c )
-{
- GET_IMMEDIATE;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_TEX0][IM->Count];
- COPY_4V(attrib, c);
- IM->Flag[IM->Count] |= VERT_TEX0_BIT;
-}
-
-static void
-_vp_Vertex2f( GLfloat x, GLfloat y )
-{
- GET_IMMEDIATE;
- const GLuint count = IM->Count++;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_POS][count];
- ASSIGN_4V(attrib, x, y, 0.0F, 1.0F);
- IM->Flag[count] |= VERT_OBJ_BIT;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
-}
-
-static void
-_vp_Vertex2fv( const GLfloat *v )
-{
- GET_IMMEDIATE;
- const GLuint count = IM->Count++;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_POS][count];
- ASSIGN_4V(attrib, v[0], v[1], 0.0F, 1.0F);
- IM->Flag[count] |= VERT_OBJ_BIT;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
-}
-
-static void
-_vp_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_IMMEDIATE;
- const GLuint count = IM->Count++;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_POS][count];
- ASSIGN_4V(attrib, x, y, z, 1.0F);
- IM->Flag[count] |= VERT_OBJ_BIT;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
-}
-
-static void
-_vp_Vertex3fv( const GLfloat *v )
-{
- GET_IMMEDIATE;
- const GLuint count = IM->Count++;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_POS][count];
- ASSIGN_4V(attrib, v[0], v[1], v[2], 1.0F);
- IM->Flag[count] |= VERT_OBJ_BIT;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
-}
-
-static void
-_vp_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- GET_IMMEDIATE;
- const GLuint count = IM->Count++;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_POS][count];
- ASSIGN_4V(attrib, x, y, z, w);
- IM->Flag[count] |= VERT_OBJ_BIT;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
-}
-
-static void
-_vp_Vertex4fv( const GLfloat *v )
-{
- GET_IMMEDIATE;
- const GLuint count = IM->Count++;
- GLfloat *attrib = IM->Attrib[VERT_ATTRIB_POS][count];
- COPY_4V(attrib, v);
- IM->Flag[count] |= VERT_OBJ_BIT;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
-}
-
-static void
-_vp_VertexAttrib4f( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- if (index < 16) {
- GET_IMMEDIATE;
- const GLuint count = IM->Count;
- GLfloat *attrib = IM->Attrib[index][count];
- ASSIGN_4V(attrib, x, y, z, w);
- IM->Flag[count] |= (1 << index);
- if (index == 0) {
- IM->Count++;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
- }
- }
-}
-
-static void
-_vp_VertexAttrib4fv( GLuint index, const GLfloat *v )
-{
- if (index < 16) {
- GET_IMMEDIATE;
- const GLuint count = IM->Count;
- GLfloat *attrib = IM->Attrib[index][count];
- COPY_4V(attrib, v);
- IM->Flag[count] |= (1 << index);
- if (index == 0) {
- IM->Count++;
- if (count == IMM_MAXDATA - 1)
- _tnl_flush_immediate( IM );
- }
- }
-}
-
-
-/*
- * When vertex program mode is enabled we hook in different per-vertex
- * functions.
- */
-void _tnl_vprog_vtxfmt_init( GLcontext *ctx )
-{
- GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt);
-
- /* All begin/end operations are handled by this vertex format:
- */
- vfmt->ArrayElement = _vp_ArrayElement;
- vfmt->Begin = _tnl_Begin;
- vfmt->Color3f = _vp_Color3f;
- vfmt->Color3fv = _vp_Color3fv;
- vfmt->Color3ub = _vp_Color3ub;
- vfmt->Color3ubv = _vp_Color3ubv;
- vfmt->Color4f = _vp_Color4f;
- vfmt->Color4fv = _vp_Color4fv;
- vfmt->Color4ub = _vp_Color4ub;
- vfmt->Color4ubv = _vp_Color4ubv;
- vfmt->EdgeFlag = _vp_EdgeFlag;
- vfmt->EdgeFlagv = _vp_EdgeFlagv;
- vfmt->End = _tnl_End;
- vfmt->EvalCoord1f = _vp_EvalCoord1f;
- vfmt->EvalCoord1fv = _vp_EvalCoord1fv;
- vfmt->EvalCoord2f = _vp_EvalCoord2f;
- vfmt->EvalCoord2fv = _vp_EvalCoord2fv;
- vfmt->EvalPoint1 = _vp_EvalPoint1;
- vfmt->EvalPoint2 = _vp_EvalPoint2;
- vfmt->FogCoordfEXT = _vp_FogCoordf;
- vfmt->FogCoordfvEXT = _vp_FogCoordfv;
- vfmt->Indexi = _vp_Indexi;
- vfmt->Indexiv = _vp_Indexiv;
- vfmt->Materialfv = _vp_Materialfv;
- vfmt->MultiTexCoord1fARB = _vp_MultiTexCoord1f;
- vfmt->MultiTexCoord1fvARB = _vp_MultiTexCoord1fv;
- vfmt->MultiTexCoord2fARB = _vp_MultiTexCoord2f;
- vfmt->MultiTexCoord2fvARB = _vp_MultiTexCoord2fv;
- vfmt->MultiTexCoord3fARB = _vp_MultiTexCoord3f;
- vfmt->MultiTexCoord3fvARB = _vp_MultiTexCoord3fv;
- vfmt->MultiTexCoord4fARB = _vp_MultiTexCoord4f;
- vfmt->MultiTexCoord4fvARB = _vp_MultiTexCoord4fv;
- vfmt->Normal3f = _vp_Normal3f;
- vfmt->Normal3fv = _vp_Normal3fv;
- vfmt->SecondaryColor3fEXT = _vp_SecondaryColor3f;
- vfmt->SecondaryColor3fvEXT = _vp_SecondaryColor3fv;
- vfmt->SecondaryColor3ubEXT = _vp_SecondaryColor3ub;
- vfmt->SecondaryColor3ubvEXT = _vp_SecondaryColor3ubv;
- vfmt->TexCoord1f = _vp_TexCoord1f;
- vfmt->TexCoord1fv = _vp_TexCoord1fv;
- vfmt->TexCoord2f = _vp_TexCoord2f;
- vfmt->TexCoord2fv = _vp_TexCoord2fv;
- vfmt->TexCoord3f = _vp_TexCoord3f;
- vfmt->TexCoord3fv = _vp_TexCoord3fv;
- vfmt->TexCoord4f = _vp_TexCoord4f;
- vfmt->TexCoord4fv = _vp_TexCoord4fv;
- vfmt->Vertex2f = _vp_Vertex2f;
- vfmt->Vertex2fv = _vp_Vertex2fv;
- vfmt->Vertex3f = _vp_Vertex3f;
- vfmt->Vertex3fv = _vp_Vertex3fv;
- vfmt->Vertex4f = _vp_Vertex4f;
- vfmt->Vertex4fv = _vp_Vertex4fv;
- vfmt->VertexAttrib4fNV = _vp_VertexAttrib4f;
- vfmt->VertexAttrib4fvNV = _vp_VertexAttrib4fv;
-
- /* Outside begin/end functions (from t_varray.c, t_eval.c, ...):
- */
- vfmt->Rectf = _mesa_noop_Rectf;
-
- /* Just use the core function:
- */
- vfmt->CallList = _mesa_CallList;
-
- vfmt->prefer_float_colors = GL_TRUE;
-}
-
-
-
struct vp_stage_data {
GLvector4f clipCoords; /* post-modelview/projection coords */
GLvector4f ndcCoords; /* normalized device coords */
struct gl_client_array color0[2]; /* front and back */
struct gl_client_array color1[2]; /* front and back */
GLvector4f texCoord[MAX_TEXTURE_UNITS];
- GLvector1f fogCoord;
+ GLvector4f fogCoord;
GLvector1f pointSize;
GLubyte *clipmask;
GLubyte ormask, andmask;
GLfloat (*color1)[4] = (GLfloat (*)[4]) store->color1[0].Ptr;
GLfloat (*bfcolor0)[4] = (GLfloat (*)[4]) store->color0[1].Ptr;
GLfloat (*bfcolor1)[4] = (GLfloat (*)[4]) store->color1[1].Ptr;
- GLfloat *fog = (GLfloat *) store->fogCoord.data;
+ GLfloat (*fog)[4] = (GLfloat (*)[4]) store->fogCoord.data;
GLfloat *pointSize = (GLfloat *) store->pointSize.data;
GLfloat (*texture0)[4] = (GLfloat (*)[4]) store->texCoord[0].data;
GLfloat (*texture1)[4] = (GLfloat (*)[4]) store->texCoord[1].data;
#endif
/* load the input attribute registers */
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if (VB->Flag[i] & (1 << attr)) {
COPY_4V(machine->Registers[VP_INPUT_REG_START + attr],
VB->AttribPtr[attr]->data[i]);
COPY_4V(color1[i], machine->Registers[VP_OUT_COL1]);
COPY_4V(bfcolor0[i], machine->Registers[VP_OUT_BFC0]);
COPY_4V(bfcolor1[i], machine->Registers[VP_OUT_BFC1]);
- fog[i] = machine->Registers[VP_OUT_FOGC][0];
+ fog[i][0] = machine->Registers[VP_OUT_FOGC][0];
pointSize[i] = machine->Registers[VP_OUT_PSIZ][0];
COPY_4V(texture0[i], machine->Registers[VP_OUT_TEX0]);
COPY_4V(texture1[i], machine->Registers[VP_OUT_TEX0]);
VB->ColorPtr[1] = &store->color0[1];
VB->SecondaryColorPtr[0] = &store->color1[0];
VB->SecondaryColorPtr[1] = &store->color1[1];
- VB->FogCoordPtr = &store->fogCoord;
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &store->fogCoord;
VB->PointSizePtr = &store->pointSize;
VB->TexCoordPtr[0] = &store->texCoord[0];
VB->TexCoordPtr[1] = &store->texCoord[1];
struct gl_pipeline_stage *stage )
{
#if 000
+ /* XXX do we need any validation for vertex programs? */
GLuint ind = 0;
light_func *tab;
alloc_4float( &store->color1[1], size );
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
_mesa_vector4f_alloc( &store->texCoord[i], 0, VB->Size, 32 );
- _mesa_vector1f_alloc( &store->fogCoord, 0, size, 32 );
+ _mesa_vector4f_alloc( &store->fogCoord, 0, size, 32 );
_mesa_vector1f_alloc( &store->pointSize, 0, size, 32 );
store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 );
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
if (store->texCoord[i].data)
_mesa_vector4f_free( &store->texCoord[i] );
- _mesa_vector1f_free( &store->fogCoord );
+ _mesa_vector4f_free( &store->fogCoord );
_mesa_vector1f_free( &store->pointSize );
ALIGN_FREE( store->clipmask );
-/* $Id: t_vb_texgen.c,v 1.10 2001/12/14 02:51:45 brianp Exp $ */
+/* $Id: t_vb_texgen.c,v 1.11 2002/01/05 20:51:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void build_m3( GLfloat f[][3], GLfloat m[],
- const GLvector3f *normal,
+ const GLvector4f *normal,
const GLvector4f *eye )
{
GLuint stride = eye->stride;
static void build_m2( GLfloat f[][3], GLfloat m[],
- const GLvector3f *normal,
+ const GLvector4f *normal,
const GLvector4f *eye )
{
GLuint stride = eye->stride;
typedef void (*build_m_func)( GLfloat f[][3],
GLfloat m[],
- const GLvector3f *normal,
+ const GLvector4f *normal,
const GLvector4f *eye );
*/
static void build_f3( GLfloat *f,
GLuint fstride,
- const GLvector3f *normal,
+ const GLvector4f *normal,
const GLvector4f *eye )
{
GLuint stride = eye->stride;
static void build_f2( GLfloat *f,
GLuint fstride,
- const GLvector3f *normal,
+ const GLvector4f *normal,
const GLvector4f *eye )
{
GLuint stride = eye->stride;
typedef void (*build_f_func)( GLfloat *f,
GLuint fstride,
- const GLvector3f *normal_vec,
+ const GLvector4f *normal_vec,
const GLvector4f *eye );
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLvector4f *in = VB->TexCoordPtr[unit];
GLvector4f *out = &store->texcoord[unit];
- GLvector3f *normal = VB->NormalPtr;
+ GLvector4f *normal = VB->NormalPtr;
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start;
GLuint count = VB->Count;
GLuint i;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const GLvector4f *obj = VB->ObjPtr;
const GLvector4f *eye = VB->EyePtr;
- const GLvector3f *normal = VB->NormalPtr;
+ const GLvector4f *normal = VB->NormalPtr;
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data;
GLfloat *indata;
GLuint count = VB->Count;