summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-04-28 08:39:17 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-04-28 08:39:17 +0000
commit51c0c71811508b6658e0d5dcff8426b618322a73 (patch)
tree05ccb4905625b200ed1a5de00acb2295e1babec9 /src/mesa
parent27b0758a940f19ce344f21b8db708d91933ce06d (diff)
Support for floating point color representation in tnl module.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/array_cache/ac_context.c29
-rw-r--r--src/mesa/array_cache/ac_import.c101
-rw-r--r--src/mesa/drivers/common/t_dd_tritmp.h79
-rw-r--r--src/mesa/drivers/common/t_dd_vbtmp.h42
-rw-r--r--src/mesa/main/api_noop.c126
-rw-r--r--src/mesa/main/context.c24
-rw-r--r--src/mesa/main/drawpix.c13
-rw-r--r--src/mesa/main/get.c60
-rw-r--r--src/mesa/main/light.c10
-rw-r--r--src/mesa/main/light.h4
-rw-r--r--src/mesa/main/mtypes.h12
-rw-r--r--src/mesa/main/rastpos.c10
-rw-r--r--src/mesa/math/m_translate.c19
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c6
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h10
-rw-r--r--src/mesa/swrast_setup/ss_vbtmp.h18
-rw-r--r--src/mesa/tnl/t_array_api.c8
-rw-r--r--src/mesa/tnl/t_array_import.c114
-rw-r--r--src/mesa/tnl/t_array_import.h3
-rw-r--r--src/mesa/tnl/t_context.h14
-rw-r--r--src/mesa/tnl/t_imm_api.c127
-rw-r--r--src/mesa/tnl/t_imm_debug.c6
-rw-r--r--src/mesa/tnl/t_imm_elt.c41
-rw-r--r--src/mesa/tnl/t_imm_eval.c127
-rw-r--r--src/mesa/tnl/t_imm_exec.c48
-rw-r--r--src/mesa/tnl/t_imm_fixup.c91
-rw-r--r--src/mesa/tnl/t_imm_fixup.h12
-rw-r--r--src/mesa/tnl/t_vb_cliptmp.h58
-rw-r--r--src/mesa/tnl/t_vb_light.c43
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h274
-rw-r--r--src/mesa/tnl/t_vb_render.c23
31 files changed, 780 insertions, 772 deletions
diff --git a/src/mesa/array_cache/ac_context.c b/src/mesa/array_cache/ac_context.c
index 2e11414079..e9c4fe869a 100644
--- a/src/mesa/array_cache/ac_context.c
+++ b/src/mesa/array_cache/ac_context.c
@@ -1,4 +1,4 @@
-/* $Id: ac_context.c,v 1.3 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: ac_context.c,v 1.4 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -48,22 +48,25 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Normal;
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
cl = &ac->Fallback.Color;
cl->Size = 4;
- cl->Type = GL_UNSIGNED_BYTE;
+ cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Color;
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
cl = &ac->Fallback.SecondaryColor;
cl->Size = 3;
- cl->Type = GL_UNSIGNED_BYTE;
+ cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.SecondaryColor;
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
cl = &ac->Fallback.FogCoord;
cl->Size = 1;
@@ -72,6 +75,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.FogCoord;
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
cl = &ac->Fallback.Index;
cl->Size = 1;
@@ -80,6 +84,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.Index;
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) {
cl = &ac->Fallback.TexCoord[i];
@@ -89,6 +94,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Texcoord[i];
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
}
cl = &ac->Fallback.EdgeFlag;
@@ -98,6 +104,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.EdgeFlag;
cl->Enabled = 1;
+ cl->Flags = CA_CLIENT_DATA; /* hack */
}
@@ -115,6 +122,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
cl = &ac->Cache.Normal;
cl->Size = 3;
@@ -123,22 +131,25 @@ static void _ac_cache_init( GLcontext *ctx )
cl->StrideB = 3 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
cl = &ac->Cache.Color;
cl->Size = 4;
- cl->Type = GL_UNSIGNED_BYTE;
+ cl->Type = GL_FLOAT;
cl->Stride = 0;
- cl->StrideB = 4 * sizeof(GLubyte);
+ cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
cl = &ac->Cache.SecondaryColor;
cl->Size = 3;
- cl->Type = GL_UNSIGNED_BYTE;
+ cl->Type = GL_FLOAT;
cl->Stride = 0;
- cl->StrideB = 4 * sizeof(GLubyte);
+ cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
cl = &ac->Cache.FogCoord;
cl->Size = 1;
@@ -147,6 +158,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->StrideB = sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
cl = &ac->Cache.Index;
cl->Size = 1;
@@ -155,6 +167,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->StrideB = sizeof(GLuint);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) {
cl = &ac->Cache.TexCoord[i];
@@ -164,6 +177,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
}
cl = &ac->Cache.EdgeFlag;
@@ -173,6 +187,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->StrideB = sizeof(GLubyte);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
+ cl->Flags = 0;
}
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index 334b3673f2..a2f3ceabad 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.13 2001/04/17 21:08:32 brianp Exp $ */
+/* $Id: ac_import.c,v 1.14 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -178,6 +178,65 @@ static void reset_edgeflag( GLcontext *ctx )
}
+
+static void import( GLcontext *ctx,
+ GLenum type,
+ struct gl_client_array *to,
+ struct gl_client_array *from )
+{
+ ACcontext *ac = AC_CONTEXT(ctx);
+
+ if (type == 0)
+ type = from->Type;
+
+ switch (type) {
+ case GL_FLOAT:
+ _math_trans_4f( (GLfloat (*)[4]) to->Ptr,
+ from->Ptr,
+ from->StrideB,
+ from->Type,
+ from->Size,
+ 0,
+ ac->count - ac->start);
+
+ to->StrideB = 4 * sizeof(GLfloat);
+ to->Type = GL_FLOAT;
+ break;
+
+ case GL_UNSIGNED_BYTE:
+ _math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
+ from->Ptr,
+ from->StrideB,
+ from->Type,
+ from->Size,
+ 0,
+ ac->count - ac->start);
+
+ to->StrideB = 4 * sizeof(GLubyte);
+ to->Type = GL_UNSIGNED_BYTE;
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ _math_trans_4us( (GLushort (*)[4]) to->Ptr,
+ from->Ptr,
+ from->StrideB,
+ from->Type,
+ from->Size,
+ 0,
+ ac->count - ac->start);
+
+ to->StrideB = 4 * sizeof(GLushort);
+ to->Type = GL_UNSIGNED_SHORT;
+ break;
+
+ default:
+ ASSERT(0);
+ break;
+ }
+}
+
+
+
/* Functions to import array ranges with specified types and strides.
*/
static void import_texcoord( GLcontext *ctx, GLuint unit,
@@ -257,6 +316,9 @@ static void import_normal( GLcontext *ctx,
ac->IsCached.Normal = GL_TRUE;
}
+
+
+
static void import_color( GLcontext *ctx,
GLenum type, GLuint stride )
{
@@ -264,22 +326,8 @@ static void import_color( GLcontext *ctx,
struct gl_client_array *from = &ac->Raw.Color;
struct gl_client_array *to = &ac->Cache.Color;
- /* Limited choices at this stage:
- */
- ASSERT(type == CHAN_TYPE);
- ASSERT(stride == 4 * sizeof(GLchan) || stride == 0);
-
- _math_trans_4chan( (GLchan (*)[4]) to->Ptr,
- from->Ptr,
- from->StrideB,
- from->Type,
- from->Size,
- 0,
- ac->count - ac->start);
-
- to->Size = from->Size;
- to->StrideB = 4 * sizeof(GLchan);
- to->Type = CHAN_TYPE;
+ import( ctx, type, to, from );
+
ac->IsCached.Color = GL_TRUE;
}
@@ -314,21 +362,8 @@ static void import_secondarycolor( GLcontext *ctx,
struct gl_client_array *from = &ac->Raw.SecondaryColor;
struct gl_client_array *to = &ac->Cache.SecondaryColor;
- /* Limited choices at this stage:
- */
- ASSERT(type == CHAN_TYPE);
- ASSERT(stride == 4 * sizeof(GLchan) || stride == 0);
-
- _math_trans_4chan( (GLchan (*)[4]) to->Ptr,
- from->Ptr,
- from->StrideB,
- from->Type,
- from->Size,
- 0,
- ac->count - ac->start);
+ import( ctx, type, to, from );
- to->StrideB = 4 * sizeof(GLchan);
- to->Type = CHAN_TYPE;
ac->IsCached.SecondaryColor = GL_TRUE;
}
@@ -509,7 +544,7 @@ struct gl_client_array *_ac_import_color( GLcontext *ctx,
/* Do we need to pull in a copy of the client data:
*/
- if (ac->Raw.Color.Type != type ||
+ if ((type != 0 && ac->Raw.Color.Type != type) ||
(reqstride != 0 && ac->Raw.Color.StrideB != (GLint) reqstride) ||
reqwriteable)
{
@@ -576,7 +611,7 @@ struct gl_client_array *_ac_import_secondarycolor( GLcontext *ctx,
/* Do we need to pull in a copy of the client data:
*/
- if (ac->Raw.SecondaryColor.Type != type ||
+ if ((type != 0 && ac->Raw.SecondaryColor.Type != type) ||
(reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) ||
reqwriteable)
{
diff --git a/src/mesa/drivers/common/t_dd_tritmp.h b/src/mesa/drivers/common/t_dd_tritmp.h
index 963db08826..22eff7f252 100644
--- a/src/mesa/drivers/common/t_dd_tritmp.h
+++ b/src/mesa/drivers/common/t_dd_tritmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_dd_tritmp.h,v 1.8 2001/04/06 16:26:41 alanh Exp $ */
+/* $Id: t_dd_tritmp.h,v 1.9 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -177,23 +177,30 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
}
}
else {
- GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data;
- ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLchan));
+ GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->Ptr;
+ ASSERT(VB->ColorPtr[1]->Type == GL_FLOAT);
+ ASSERT(VB->ColorPtr[1]->StrideB == 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 (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
- GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
+ GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr;
if (!DO_FLAT) {
+ VERT_SAVE_SPEC( 0 );
+ VERT_SAVE_SPEC( 1 );
VERT_SET_SPEC( v[0], vbspec[e0] );
VERT_SET_SPEC( v[1], vbspec[e1] );
}
+ VERT_SAVE_SPEC( 2 );
VERT_SET_SPEC( v[2], vbspec[e2] );
}
}
@@ -288,37 +295,17 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (DO_TWOSIDE && facing == 1)
{
if (HAVE_RGBA) {
- if (HAVE_BACK_COLORS) {
+ if (!DO_FLAT) {
VERT_RESTORE_RGBA( 0 );
VERT_RESTORE_RGBA( 1 );
- VERT_RESTORE_RGBA( 2 );
- if (HAVE_SPEC) {
- VERT_RESTORE_SPEC( 0 );
- VERT_RESTORE_SPEC( 1 );
- VERT_RESTORE_SPEC( 2 );
- }
}
- else {
- GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data;
- ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan));
- (void) vbcolor;
-
+ VERT_RESTORE_RGBA( 2 );
+ if (HAVE_SPEC) {
if (!DO_FLAT) {
- VERT_SET_RGBA( v[0], vbcolor[e0] );
- VERT_SET_RGBA( v[1], vbcolor[e1] );
- }
- VERT_SET_RGBA( v[2], vbcolor[e2] );
-
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
- GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
- ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan));
-
- if (!DO_FLAT) {
- VERT_SET_SPEC( v[0], vbspec[e0] );
- VERT_SET_SPEC( v[1], vbspec[e1] );
- }
- VERT_SET_SPEC( v[2], vbspec[e2] );
+ VERT_RESTORE_SPEC( 0 );
+ VERT_RESTORE_SPEC( 1 );
}
+ VERT_RESTORE_SPEC( 2 );
}
}
else {
@@ -398,7 +385,7 @@ static void TAG(quad)( GLcontext *ctx,
if (DO_TWOSIDE && facing == 1)
{
if (HAVE_RGBA) {
- GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data;
+ GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->Ptr;
(void)vbcolor;
if (!DO_FLAT) {
@@ -409,8 +396,8 @@ static void TAG(quad)( GLcontext *ctx,
VERT_SET_RGBA( v[3], vbcolor[e3] );
if (HAVE_SPEC && VB->SecondaryColorPtr[facing]) {
- GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
- ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLchan));
+ GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr;
+ ASSERT(VB->SecondaryColorPtr[1]->StrideB==4*sizeof(GLfloat));
if (!DO_FLAT) {
VERT_SET_SPEC( v[0], vbspec[e0] );
@@ -521,27 +508,19 @@ static void TAG(quad)( GLcontext *ctx,
if (DO_TWOSIDE && facing == 1)
{
if (HAVE_RGBA) {
- GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data;
- ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan));
- (void) vbcolor;
-
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_RESTORE_RGBA( 0 );
+ VERT_RESTORE_RGBA( 1 );
+ VERT_RESTORE_RGBA( 2 );
}
- VERT_SET_RGBA( v[3], vbcolor[e3] );
-
- if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
- GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
- ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan));
-
+ VERT_RESTORE_RGBA( 3 );
+ if (HAVE_SPEC) {
if (!DO_FLAT) {
- VERT_SET_SPEC( v[0], vbspec[e0] );
- VERT_SET_SPEC( v[1], vbspec[e1] );
- VERT_SET_SPEC( v[2], vbspec[e2] );
+ VERT_RESTORE_SPEC( 0 );
+ VERT_RESTORE_SPEC( 1 );
+ VERT_RESTORE_SPEC( 2 );
}
- VERT_SET_SPEC( v[3], vbspec[e3] );
+ VERT_RESTORE_SPEC( 3 );
}
}
else {
diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h
index d6425f0b96..65e00a13ad 100644
--- a/src/mesa/drivers/common/t_dd_vbtmp.h
+++ b/src/mesa/drivers/common/t_dd_vbtmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_dd_vbtmp.h,v 1.10 2001/04/09 10:16:01 alanh Exp $ */
+/* $Id: t_dd_vbtmp.h,v 1.11 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -175,13 +175,17 @@ static void TAG(emit)( GLcontext *ctx,
}
if (DO_RGBA) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
+ IMPORT_FLOAT_COLORS( ctx );
+ col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr;
+ col_stride = VB->ColorPtr[0]->StrideB;
}
if (DO_SPEC) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
+ if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
+ IMPORT_FLOAT_SPEC_COLORS( ctx );
+ spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr;
+ spec_stride = VB->SecondaryColorPtr[0]->StrideB;
}
if (DO_FOG) {
@@ -389,8 +393,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte (*col)[4] = VB->ColorPtr[0]->data;
- GLuint col_stride = VB->ColorPtr[0]->stride;
+ GLubyte (*col)[4];
+ GLuint col_stride;
GLfloat (*coord)[4] = VB->ProjectedClipPtr->data;
GLuint coord_stride = VB->ProjectedClipPtr->stride;
GLfloat *v = (GLfloat *)dest;
@@ -402,6 +406,16 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
ASSERT(stride == 4);
+ if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
+ IMPORT_FLOAT_COLORS( ctx );
+
+ col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr;
+ col_stride = VB->ColorPtr[0]->StrideB;
+ ASSERT(VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE);
+
+/* fprintf(stderr, "%s stride %d importable %d\n", */
+/* __FUNCTION__, col_stride, VB->importable_data); */
+
/* Pack what's left into a 4-dword vertex. Color is in a different
* place, and there is no 'w' coordinate.
*/
@@ -461,11 +475,17 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte (*col)[4] = VB->ColorPtr[0]->data;
- GLuint col_stride = VB->ColorPtr[0]->stride;
+ GLubyte (*col)[4];
+ GLuint col_stride;
GLfloat *v = (GLfloat *)dest;
int i;
+ if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
+ IMPORT_FLOAT_COLORS( ctx );
+
+ col = VB->ColorPtr[0]->data;
+ col_stride = VB->ColorPtr[0]->stride;
+
if (start)
STRIDE_4UB(col, col_stride * start);
@@ -579,8 +599,8 @@ static void TAG(interp)( GLcontext *ctx,
const GLfloat *s = GET_VIEWPORT_MAT();
VERTEX *dst = (VERTEX *)(ddverts + (edst << shift));
- VERTEX *in = (VERTEX *)(ddverts + (eout << shift));
- VERTEX *out = (VERTEX *)(ddverts + (ein << shift));
+ VERTEX *in = (VERTEX *)(ddverts + (ein << shift));
+ VERTEX *out = (VERTEX *)(ddverts + (eout << shift));
(void)s;
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index b8d191faea..58a6e7d771 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -1,4 +1,4 @@
-/* $Id: api_noop.c,v 1.7 2001/03/20 18:35:23 gareth Exp $ */
+/* $Id: api_noop.c,v 1.8 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -155,85 +155,81 @@ void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- color[0] = UBYTE_TO_CHAN(a);
- color[1] = UBYTE_TO_CHAN(b);
- color[2] = UBYTE_TO_CHAN(c);
- color[3] = UBYTE_TO_CHAN(d);
+ GLfloat *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_FLOAT(a);
+ color[1] = UBYTE_TO_FLOAT(b);
+ color[2] = UBYTE_TO_FLOAT(c);
+ color[3] = UBYTE_TO_FLOAT(d);
}
void _mesa_noop_Color4ubv( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
- COPY_4UBV( color, v );
-#else
- color[0] = UBYTE_TO_CHAN(v[0]);
- color[1] = UBYTE_TO_CHAN(v[1]);
- color[2] = UBYTE_TO_CHAN(v[2]);
- color[3] = UBYTE_TO_CHAN(v[3]);
-#endif
+ GLfloat *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_FLOAT(v[0]);
+ color[1] = UBYTE_TO_FLOAT(v[1]);
+ color[2] = UBYTE_TO_FLOAT(v[2]);
+ color[3] = UBYTE_TO_FLOAT(v[3]);
}
void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- UNCLAMPED_FLOAT_TO_CHAN(color[0], a);
- UNCLAMPED_FLOAT_TO_CHAN(color[1], b);
- UNCLAMPED_FLOAT_TO_CHAN(color[2], c);
- UNCLAMPED_FLOAT_TO_CHAN(color[3], d);
+ GLfloat *color = ctx->Current.Color;
+ color[0] = a;
+ color[1] = b;
+ color[2] = c;
+ color[3] = d;
}
void _mesa_noop_Color4fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- UNCLAMPED_FLOAT_TO_CHAN(color[0], v[0]);
- UNCLAMPED_FLOAT_TO_CHAN(color[1], v[1]);
- UNCLAMPED_FLOAT_TO_CHAN(color[2], v[2]);
- UNCLAMPED_FLOAT_TO_CHAN(color[3], v[3]);
+ GLfloat *color = ctx->Current.Color;
+ color[0] = v[0];
+ color[1] = v[1];
+ color[2] = v[2];
+ color[3] = v[3];
}
void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- color[0] = UBYTE_TO_CHAN(a);
- color[1] = UBYTE_TO_CHAN(b);
- color[2] = UBYTE_TO_CHAN(c);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_FLOAT(a);
+ color[1] = UBYTE_TO_FLOAT(b);
+ color[2] = UBYTE_TO_FLOAT(c);
+ color[3] = 1.0;
}
void _mesa_noop_Color3ubv( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- color[0] = UBYTE_TO_CHAN(v[0]);
- color[1] = UBYTE_TO_CHAN(v[1]);
- color[2] = UBYTE_TO_CHAN(v[2]);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_FLOAT(v[0]);
+ color[1] = UBYTE_TO_FLOAT(v[1]);
+ color[2] = UBYTE_TO_FLOAT(v[2]);
+ color[3] = 1.0;
}
void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- UNCLAMPED_FLOAT_TO_CHAN(color[0], a);
- UNCLAMPED_FLOAT_TO_CHAN(color[1], b);
- UNCLAMPED_FLOAT_TO_CHAN(color[2], c);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.Color;
+ color[0] = a;
+ color[1] = b;
+ color[2] = c;
+ color[3] = 1.0;
}
void _mesa_noop_Color3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.Color;
- UNCLAMPED_FLOAT_TO_CHAN(color[0], v[0]);
- UNCLAMPED_FLOAT_TO_CHAN(color[1], v[1]);
- UNCLAMPED_FLOAT_TO_CHAN(color[2], v[2]);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.Color;
+ color[0] = v[0];
+ color[1] = v[1];
+ color[2] = v[2];
+ color[3] = 1.0;
}
void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
@@ -376,41 +372,41 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v )
void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.SecondaryColor;
- color[0] = UBYTE_TO_CHAN(a);
- color[1] = UBYTE_TO_CHAN(b);
- color[2] = UBYTE_TO_CHAN(c);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.SecondaryColor;
+ color[0] = UBYTE_TO_FLOAT(a);
+ color[1] = UBYTE_TO_FLOAT(b);
+ color[2] = UBYTE_TO_FLOAT(c);
+ color[3] = 1.0;
}
void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.SecondaryColor;
- color[0] = UBYTE_TO_CHAN(v[0]);
- color[1] = UBYTE_TO_CHAN(v[1]);
- color[2] = UBYTE_TO_CHAN(v[2]);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.SecondaryColor;
+ color[0] = UBYTE_TO_FLOAT(v[0]);
+ color[1] = UBYTE_TO_FLOAT(v[1]);
+ color[2] = UBYTE_TO_FLOAT(v[2]);
+ color[3] = 1.0;
}
void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.SecondaryColor;
- UNCLAMPED_FLOAT_TO_CHAN(color[0], a);
- UNCLAMPED_FLOAT_TO_CHAN(color[1], b);
- UNCLAMPED_FLOAT_TO_CHAN(color[2], c);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.SecondaryColor;
+ color[0] = a;
+ color[1] = b;
+ color[2] = c;
+ color[3] = 1.0;
}
void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLchan *color = ctx->Current.SecondaryColor;
- UNCLAMPED_FLOAT_TO_CHAN(color[0], v[0]);
- UNCLAMPED_FLOAT_TO_CHAN(color[1], v[1]);
- UNCLAMPED_FLOAT_TO_CHAN(color[2], v[2]);
- color[3] = CHAN_MAX;
+ GLfloat *color = ctx->Current.SecondaryColor;
+ color[0] = v[0];
+ color[1] = v[1];
+ color[2] = v[2];
+ color[3] = 1.0;
}
void _mesa_noop_TexCoord1f( GLfloat a )
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 87a9749d58..948de1b330 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.134 2001/04/27 21:17:20 brianp Exp $ */
+/* $Id: context.c,v 1.135 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -817,7 +817,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Color.MultiDrawBuffer = GL_FALSE;
/* Current group */
- ASSIGN_4V( ctx->Current.Color, CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX );
+ ASSIGN_4V( ctx->Current.Color, 1.0, 1.0, 1.0, 1.0 );
ctx->Current.Index = 1;
for (i=0; i<MAX_TEXTURE_UNITS; i++)
ASSIGN_4V( ctx->Current.Texcoord[i], 0.0, 0.0, 0.0, 1.0 );
@@ -1156,22 +1156,40 @@ init_attrib_groups( GLcontext *ctx )
ctx->Array.Vertex.StrideB = 0;
ctx->Array.Vertex.Ptr = NULL;
ctx->Array.Vertex.Enabled = GL_FALSE;
+ ctx->Array.Vertex.Flags = CA_CLIENT_DATA;
ctx->Array.Normal.Type = GL_FLOAT;
ctx->Array.Normal.Stride = 0;
ctx->Array.Normal.StrideB = 0;
ctx->Array.Normal.Ptr = NULL;
ctx->Array.Normal.Enabled = GL_FALSE;
+ ctx->Array.Normal.Flags = CA_CLIENT_DATA;
ctx->Array.Color.Size = 4;
ctx->Array.Color.Type = GL_FLOAT;
ctx->Array.Color.Stride = 0;
ctx->Array.Color.StrideB = 0;
ctx->Array.Color.Ptr = NULL;
ctx->Array.Color.Enabled = GL_FALSE;
+ ctx->Array.Color.Flags = CA_CLIENT_DATA;
+ ctx->Array.SecondaryColor.Size = 4;
+ ctx->Array.SecondaryColor.Type = GL_FLOAT;
+ ctx->Array.SecondaryColor.Stride = 0;
+ ctx->Array.SecondaryColor.StrideB = 0;
+ ctx->Array.SecondaryColor.Ptr = NULL;
+ ctx->Array.SecondaryColor.Enabled = GL_FALSE;
+ ctx->Array.SecondaryColor.Flags = CA_CLIENT_DATA;
+ ctx->Array.FogCoord.Size = 1;
+ ctx->Array.FogCoord.Type = GL_FLOAT;
+ ctx->Array.FogCoord.Stride = 0;
+ ctx->Array.FogCoord.StrideB = 0;
+ ctx->Array.FogCoord.Ptr = NULL;
+ ctx->Array.FogCoord.Enabled = GL_FALSE;
+ ctx->Array.FogCoord.Flags = CA_CLIENT_DATA;
ctx->Array.Index.Type = GL_FLOAT;
ctx->Array.Index.Stride = 0;
ctx->Array.Index.StrideB = 0;
ctx->Array.Index.Ptr = NULL;
ctx->Array.Index.Enabled = GL_FALSE;
+ ctx->Array.Index.Flags = CA_CLIENT_DATA;
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
ctx->Array.TexCoord[i].Size = 4;
ctx->Array.TexCoord[i].Type = GL_FLOAT;
@@ -1179,12 +1197,14 @@ init_attrib_groups( GLcontext *ctx )
ctx->Array.TexCoord[i].StrideB = 0;
ctx->Array.TexCoord[i].Ptr = NULL;
ctx->Array.TexCoord[i].Enabled = GL_FALSE;
+ ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA;
}
ctx->Array.TexCoordInterleaveFactor = 1;
ctx->Array.EdgeFlag.Stride = 0;
ctx->Array.EdgeFlag.StrideB = 0;
ctx->Array.EdgeFlag.Ptr = NULL;
ctx->Array.EdgeFlag.Enabled = GL_FALSE;
+ ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA;
ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
/* Pixel transfer */
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index d46ace0a65..e51f8369a1 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.52 2001/04/10 15:25:45 brianp Exp $ */
+/* $Id: drawpix.c,v 1.53 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -73,14 +73,9 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
}
else if (ctx->RenderMode==GL_FEEDBACK) {
if (ctx->Current.RasterPosValid) {
- GLfloat color[4];
GLfloat texcoord[4], invq;
FLUSH_CURRENT(ctx, 0);
- color[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
- color[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
- color[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
- color[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
invq = 1.0F / ctx->Current.Texcoord[0][3];
texcoord[0] = ctx->Current.Texcoord[0][0] * invq;
texcoord[1] = ctx->Current.Texcoord[0][1] * invq;
@@ -88,8 +83,10 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
texcoord[3] = ctx->Current.Texcoord[0][3];
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
_mesa_feedback_vertex( ctx,
- ctx->Current.RasterPos,
- color, ctx->Current.Index, texcoord );
+ ctx->Current.RasterPos,
+ ctx->Current.Color,
+ ctx->Current.Index,
+ texcoord );
}
}
else if (ctx->RenderMode==GL_SELECT) {
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index c721bd4bfd..26a0de03b7 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.57 2001/03/18 08:53:49 gareth Exp $ */
+/* $Id: get.c,v 1.58 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -228,10 +228,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_CURRENT_COLOR:
FLUSH_CURRENT(ctx, 0);
- params[0] = INT_TO_BOOL(ctx->Current.Color[0]);
- params[1] = INT_TO_BOOL(ctx->Current.Color[1]);
- params[2] = INT_TO_BOOL(ctx->Current.Color[2]);
- params[3] = INT_TO_BOOL(ctx->Current.Color[3]);
+ params[0] = FLOAT_TO_BOOL(ctx->Current.Color[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->Current.Color[1]);
+ params[2] = FLOAT_TO_BOOL(ctx->Current.Color[2]);
+ params[3] = FLOAT_TO_BOOL(ctx->Current.Color[3]);
break;
case GL_CURRENT_INDEX:
FLUSH_CURRENT(ctx, 0);
@@ -1427,10 +1427,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
break;
case GL_CURRENT_COLOR:
FLUSH_CURRENT(ctx, 0);
- params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
- params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
- params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
- params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
+ params[0] = (ctx->Current.Color[0]);
+ params[1] = (ctx->Current.Color[1]);
+ params[2] = (ctx->Current.Color[2]);
+ params[3] = (ctx->Current.Color[3]);
break;
case GL_CURRENT_INDEX:
FLUSH_CURRENT(ctx, 0);
@@ -2420,9 +2420,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
FLUSH_CURRENT(ctx, 0);
- params[0] = CHAN_TO_FLOAT(ctx->Current.SecondaryColor[0]);
- params[1] = CHAN_TO_FLOAT(ctx->Current.SecondaryColor[1]);
- params[2] = CHAN_TO_FLOAT(ctx->Current.SecondaryColor[2]);
+ params[0] = (ctx->Current.SecondaryColor[0]);
+ params[1] = (ctx->Current.SecondaryColor[1]);
+ params[2] = (ctx->Current.SecondaryColor[2]);
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
*params = (GLdouble) ctx->Array.SecondaryColor.Enabled;
@@ -2626,10 +2626,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_CURRENT_COLOR:
FLUSH_CURRENT(ctx, 0);
- params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
- params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
- params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
- params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
+ params[0] = (ctx->Current.Color[0]);
+ params[1] = (ctx->Current.Color[1]);
+ params[2] = (ctx->Current.Color[2]);
+ params[3] = (ctx->Current.Color[3]);
break;
case GL_CURRENT_INDEX:
FLUSH_CURRENT(ctx, 0);
@@ -3593,9 +3593,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
FLUSH_CURRENT(ctx, 0);
- params[0] = CHAN_TO_FLOAT(ctx->Current.SecondaryColor[0]);
- params[1] = CHAN_TO_FLOAT(ctx->Current.SecondaryColor[1]);
- params[2] = CHAN_TO_FLOAT(ctx->Current.SecondaryColor[2]);
+ params[0] = (ctx->Current.SecondaryColor[0]);
+ params[1] = (ctx->Current.SecondaryColor[1]);
+ params[2] = (ctx->Current.SecondaryColor[2]);
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
*params = (GLfloat) ctx->Array.SecondaryColor.Enabled;
@@ -3773,10 +3773,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Transform.ClipEnabled[i];
break;
case GL_COLOR_CLEAR_VALUE:
- params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[0]) );
- params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[1]) );
- params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[2]) );
- params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[3]) );
+ params[0] = FLOAT_TO_INT( (ctx->Color.ClearColor[0]) );
+ params[1] = FLOAT_TO_INT( (ctx->Color.ClearColor[1]) );
+ params[2] = FLOAT_TO_INT( (ctx->Color.ClearColor[2]) );
+ params[3] = FLOAT_TO_INT( (ctx->Color.ClearColor[3]) );
break;
case GL_COLOR_MATERIAL:
*params = (GLint) ctx->Light.ColorMaterialEnabled;
@@ -3801,10 +3801,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_CURRENT_COLOR:
FLUSH_CURRENT(ctx, 0);
- params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[0] ) );
- params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[1] ) );
- params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[2] ) );
- params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[3] ) );
+ params[0] = FLOAT_TO_INT( ( ctx->Current.Color[0] ) );
+ params[1] = FLOAT_TO_INT( ( ctx->Current.Color[1] ) );
+ params[2] = FLOAT_TO_INT( ( ctx->Current.Color[2] ) );
+ params[3] = FLOAT_TO_INT( ( ctx->Current.Color[3] ) );
break;
case GL_CURRENT_INDEX:
FLUSH_CURRENT(ctx, 0);
@@ -4795,9 +4795,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
FLUSH_CURRENT(ctx, 0);
- params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Current.SecondaryColor[0]) );
- params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Current.SecondaryColor[1]) );
- params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Current.SecondaryColor[2]) );
+ params[0] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[0]) );
+ params[1] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[1]) );
+ params[2] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[2]) );
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
*params = (GLint) ctx->Array.SecondaryColor.Enabled;
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index ecc6e877cc..0b79afa415 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.42 2001/03/29 16:50:32 brianp Exp $ */
+/* $Id: light.c,v 1.43 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -745,16 +745,10 @@ void _mesa_update_material( GLcontext *ctx,
* set by glColorMaterial().
*/
void _mesa_update_color_material( GLcontext *ctx,
- const GLchan rgba[4] )
+ const GLfloat color[4] )
{
struct gl_light *light, *list = &ctx->Light.EnabledList;
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
- GLfloat color[4];
-
- color[0] = CHAN_TO_FLOAT(rgba[0]);
- color[1] = CHAN_TO_FLOAT(rgba[1]);
- color[2] = CHAN_TO_FLOAT(rgba[2]);
- color[3] = CHAN_TO_FLOAT(rgba[3]);
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
fprintf(stderr, "_mesa_update_color_material, mask 0x%x\n", bitmask);
diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h
index 82b6d74a55..79fad5a98a 100644
--- a/src/mesa/main/light.h
+++ b/src/mesa/main/light.h
@@ -1,4 +1,4 @@
-/* $Id: light.h,v 1.12 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: light.h,v 1.13 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -116,7 +116,7 @@ extern void _mesa_copy_material_pairs( struct gl_material dst[2],
GLuint bitmask );
extern void _mesa_update_color_material( GLcontext *ctx,
- const GLchan rgba[4] );
+ const GLfloat rgba[4] );
#endif
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index cfeadf108a..651b6bb7b9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.40 2001/04/20 16:46:04 brianp Exp $ */
+/* $Id: mtypes.h,v 1.41 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -297,8 +297,8 @@ struct gl_current_attrib {
/* These values valid only when FLUSH_VERTICES has been called.
*/
GLfloat Normal[3]; /* Current vertex normal */
- GLchan Color[4]; /* Current RGBA color */
- GLchan SecondaryColor[4]; /* Current secondary color */
+ GLfloat Color[4]; /* Current RGBA color */
+ GLfloat SecondaryColor[4]; /* Current secondary color */
GLfloat FogCoord; /* Current Fog coord */
GLuint Index; /* Current color index */
GLboolean EdgeFlag; /* Current edge flag */
@@ -489,7 +489,7 @@ struct gl_light_attrib {
GLboolean _NeedVertices; /* Use fast shader? */
GLuint _Flags; /* LIGHT_* flags, see below */
GLfloat _BaseColor[2][3];
- GLchan _BaseAlpha[2];
+ GLfloat _BaseAlpha[2];
};
@@ -970,6 +970,9 @@ struct gl_pixelstore_attrib {
};
+#define CA_CLIENT_DATA 0x1 /* Data not alloced by mesa */
+
+
/*
* Client vertex array attributes
*/
@@ -979,6 +982,7 @@ struct gl_client_array {
GLsizei Stride; /* user-specified stride */
GLsizei StrideB; /* actual stride in bytes */
void *Ptr;
+ GLuint Flags;
GLboolean Enabled;
};
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 09a4ebe8c6..79ec481267 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -1,4 +1,4 @@
-/* $Id: rastpos.c,v 1.22 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: rastpos.c,v 1.23 2001/04/28 08:39:17 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -274,10 +274,10 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
else {
/* use current color or index */
if (ctx->Visual.rgbMode) {
- ctx->Current.RasterColor[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
- ctx->Current.RasterColor[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
- ctx->Current.RasterColor[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
- ctx->Current.RasterColor[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
+ ctx->Current.RasterColor[0] = (ctx->Current.Color[0]);
+ ctx->Current.RasterColor[1] = (ctx->Current.Color[1]);
+ ctx->Current.RasterColor[2] = (ctx->Current.Color[2]);
+ ctx->Current.RasterColor[3] = (ctx->Current.Color[3]);
}
else {
ctx->Current.RasterIndex = ctx->Current.Index;
diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c
index 47f6c61f5f..dd7a59168c 100644
--- a/src/mesa/math/m_translate.c
+++ b/src/mesa/math/m_translate.c
@@ -1,4 +1,4 @@
-/* $Id: m_translate.c,v 1.6 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: m_translate.c,v 1.7 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -167,19 +167,27 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES];
*/
#define SRC GLubyte
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE)
-#define TRX_3F(f,n) /* unused */
-#define TRX_4F(f,n) /* unused */
+#define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
+#define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n))
#define TRX_UB(ub, f,n) ub = PTR_ELT(f,n)
#define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n))
#define TRX_UI(f,n) (GLuint)PTR_ELT(f,n)
/* 4ub->4ub handled in special case below.
*/
+#define SZ 4
+#define INIT init_trans_4_GLubyte_raw
+#define DEST_4F trans_4_GLubyte_4f_raw
+#define DEST_4US trans_4_GLubyte_4us_raw
+#include "m_trans_tmp.h"
+
#define SZ 3
#define INIT init_trans_3_GLubyte_raw
#define DEST_4UB trans_3_GLubyte_4ub_raw
#define DEST_4US trans_3_GLubyte_4us_raw
+#define DEST_3F trans_3_GLubyte_3f_raw
+#define DEST_4F trans_3_GLubyte_4f_raw
#include "m_trans_tmp.h"
@@ -507,14 +515,13 @@ static void init_translate_raw(void)
MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) );
MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) );
- TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw;
-
init_trans_4_GLbyte_raw();
init_trans_3_GLbyte_raw();
init_trans_2_GLbyte_raw();
init_trans_1_GLbyte_raw();
init_trans_1_GLubyte_raw();
init_trans_3_GLubyte_raw();
+ init_trans_4_GLubyte_raw();
init_trans_4_GLshort_raw();
init_trans_3_GLshort_raw();
init_trans_2_GLshort_raw();
@@ -539,6 +546,8 @@ static void init_translate_raw(void)
init_trans_3_GLfloat_raw();
init_trans_2_GLfloat_raw();
init_trans_1_GLfloat_raw();
+
+ TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw;
}
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index 958eae3a29..a12429e26d 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -1,4 +1,4 @@
-/* $Id: ss_triangle.c,v 1.12 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: ss_triangle.c,v 1.13 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -141,8 +141,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
}
}
-#define SS_COLOR(a,b) COPY_CHAN4(a,b)
-#define SS_SPEC(a,b) COPY_CHAN4(a,b)
+#define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b)
+#define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b)
#define SS_IND(a,b) (a = b)
#define IND (0)
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 0c81fb891f..0db792ba2b 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -1,4 +1,4 @@
-/* $Id: ss_tritmp.h,v 1.11 2001/03/21 17:11:32 pesco Exp $ */
+/* $Id: ss_tritmp.h,v 1.12 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -61,8 +61,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (facing == 1) {
if (IND & SS_TWOSIDE_BIT) {
if (IND & SS_RGBA_BIT) {
- GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data;
- GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
+ GLfloat (*vbcolor)[4] = (GLfloat (*)[4])VB->ColorPtr[1]->Ptr;
+ GLfloat (*vbspec)[4] = (GLfloat (*)[4])VB->SecondaryColorPtr[1]->Ptr;
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
@@ -134,8 +134,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & SS_TWOSIDE_BIT) {
if (facing == 1) {
if (IND & SS_RGBA_BIT) {
- GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data;
- GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
+ GLfloat (*vbcolor)[4] = (GLfloat (*)[4])VB->ColorPtr[0]->Ptr;
+ GLfloat (*vbspec)[4] = (GLfloat (*)[4])VB->SecondaryColorPtr[0]->Ptr;
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
diff --git a/src/mesa/swrast_setup/ss_vbtmp.h b/src/mesa/swrast_setup/ss_vbtmp.h
index 0a7c1ded54..7e924b5a7e 100644
--- a/src/mesa/swrast_setup/ss_vbtmp.h
+++ b/src/mesa/swrast_setup/ss_vbtmp.h
@@ -1,4 +1,4 @@
-/* $Id: ss_vbtmp.h,v 1.13 2001/03/29 16:50:33 brianp Exp $ */
+/* $Id: ss_vbtmp.h,v 1.14 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -35,8 +35,8 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
SWvertex *v;
GLfloat (*proj)[4]; /* projected clip coordinates */
GLfloat (*tc[MAX_TEXTURE_UNITS])[4];
- GLchan (*color)[4];
- GLchan (*spec)[4];
+ GLfloat (*color)[4];
+ GLfloat (*spec)[4];
GLuint *index;
GLfloat *fog;
GLfloat *pointSize;
@@ -57,6 +57,10 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
}
/* TODO: Get import_client_data to pad vectors out to 4 cleanly.
+ *
+ * NOTE: This has the effect of converting any remaining ubyte
+ * colors to floats... As they're already there 90% of the
+ * time, this isn't a bad thing.
*/
if (VB->importable_data)
VB->import_data( ctx, VB->importable_data & newinputs,
@@ -92,9 +96,9 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
if (IND & FOG)
fog = VB->FogCoordPtr->data;
if (IND & COLOR)
- color = VB->ColorPtr[0]->data;
+ color = (GLfloat (*)[4])VB->ColorPtr[0]->Ptr;
if (IND & SPEC)
- spec = VB->SecondaryColorPtr[0]->data;
+ spec = (GLfloat (*)[4])VB->SecondaryColorPtr[0]->Ptr;
if (IND & INDEX)
index = VB->IndexPtr[0]->data;
if (IND & POINT)
@@ -120,10 +124,10 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
}
if (IND & COLOR)
- COPY_CHAN4(v->color, color[i]);
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN(v->color, color[i]);
if (IND & SPEC)
- COPY_CHAN4(v->specular, spec[i]);
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN(v->specular, spec[i]);
if (IND & FOG)
v->fog = fog[i];
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index e269773042..95d1f45548 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_array_api.c,v 1.11 2001/04/26 14:51:06 keithw Exp $ */
+/* $Id: t_array_api.c,v 1.12 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -417,9 +417,9 @@ void _tnl_array_init( GLcontext *ctx )
/* 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_vector4chan_init( &tmp->Color, 0, 0 );
- _mesa_vector4chan_init( &tmp->SecondaryColor, 0, 0 );
+ _mesa_vector3f_init( &tmp->Normal, 0, 0 );
+/* _mesa_vector4chan_init( &tmp->Color, 0, 0 ); */
+/* _mesa_vector4chan_init( &tmp->SecondaryColor, 0, 0 ); */
_mesa_vector1f_init( &tmp->FogCoord, 0, 0 );
_mesa_vector1ui_init( &tmp->Index, 0, 0 );
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 );
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index 7bb208cf72..78ba917570 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -1,4 +1,4 @@
-/* $Id: t_array_import.c,v 1.13 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_array_import.c,v 1.14 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -43,8 +43,8 @@
static void _tnl_import_vertex( GLcontext *ctx,
- GLboolean writeable,
- GLboolean stride )
+ GLboolean writeable,
+ GLboolean stride )
{
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
@@ -69,8 +69,8 @@ static void _tnl_import_vertex( GLcontext *ctx,
}
static void _tnl_import_normal( GLcontext *ctx,
- GLboolean writeable,
- GLboolean stride )
+ GLboolean writeable,
+ GLboolean stride )
{
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
@@ -92,6 +92,7 @@ static void _tnl_import_normal( GLcontext *ctx,
static void _tnl_import_color( GLcontext *ctx,
+ GLenum type,
GLboolean writeable,
GLboolean stride )
{
@@ -102,50 +103,38 @@ static void _tnl_import_color( GLcontext *ctx,
/* fprintf(stderr, "%s\n", __FUNCTION__); */
tmp = _ac_import_color(ctx,
- GL_UNSIGNED_BYTE,
- stride ? 4*sizeof(GLubyte) : 0,
+ type,
+ stride ? 4*sizeof(GLfloat) : 0,
4,
writeable,
&is_writeable);
- inputs->Color.data = (GLchan (*)[4]) tmp->Ptr;
- inputs->Color.start = (GLchan *) tmp->Ptr;
- inputs->Color.stride = tmp->StrideB;
- inputs->Color.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
- if (inputs->Color.stride != 4*sizeof(GLchan))
- inputs->Color.flags |= VEC_BAD_STRIDE;
- if (!is_writeable)
- inputs->Color.flags |= VEC_NOT_WRITEABLE;
+ inputs->Color = *tmp;
}
static void _tnl_import_secondarycolor( GLcontext *ctx,
- GLboolean writeable,
- GLboolean stride )
+ GLenum type,
+ GLboolean writeable,
+ GLboolean stride )
{
struct gl_client_array *tmp;
GLboolean is_writeable = 0;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
- tmp = _ac_import_secondarycolor(ctx, GL_UNSIGNED_BYTE,
- stride ? 4*sizeof(GLubyte) : 0,
+ tmp = _ac_import_secondarycolor(ctx,
+ type,
+ stride ? 4*sizeof(GLfloat) : 0,
4,
writeable,
&is_writeable);
- inputs->SecondaryColor.data = (GLchan (*)[4]) tmp->Ptr;
- inputs->SecondaryColor.start = (GLchan *) tmp->Ptr;
- inputs->SecondaryColor.stride = tmp->StrideB;
- inputs->SecondaryColor.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
- if (inputs->SecondaryColor.stride != 4*sizeof(GLubyte))
- inputs->SecondaryColor.flags |= VEC_BAD_STRIDE;
- if (!is_writeable)
- inputs->SecondaryColor.flags |= VEC_NOT_WRITEABLE;
+ inputs->SecondaryColor = *tmp;
}
static void _tnl_import_fogcoord( GLcontext *ctx,
- GLboolean writeable,
- GLboolean stride )
+ GLboolean writeable,
+ GLboolean stride )
{
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
@@ -166,8 +155,8 @@ static void _tnl_import_fogcoord( GLcontext *ctx,
}
static void _tnl_import_index( GLcontext *ctx,
- GLboolean writeable,
- GLboolean stride )
+ GLboolean writeable,
+ GLboolean stride )
{
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
@@ -189,9 +178,9 @@ static void _tnl_import_index( GLcontext *ctx,
static void _tnl_import_texcoord( GLcontext *ctx,
- GLuint i,
- GLboolean writeable,
- GLboolean stride )
+ GLuint i,
+ GLboolean writeable,
+ GLboolean stride )
{
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
@@ -216,8 +205,8 @@ static void _tnl_import_texcoord( GLcontext *ctx,
static void _tnl_import_edgeflag( GLcontext *ctx,
- GLboolean writeable,
- GLboolean stride )
+ GLboolean writeable,
+ GLboolean stride )
{
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
struct gl_client_array *tmp;
@@ -253,8 +242,11 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
GLboolean writeable = (flags & VEC_NOT_WRITEABLE) != 0;
GLboolean stride = (flags & VEC_BAD_STRIDE) != 0;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
+ GLuint ca_flags = 0;
(void) inputs;
+ if (writeable || stride) ca_flags |= CA_CLIENT_DATA;
+
if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr)
required |= VERT_OBJ;
@@ -272,15 +264,16 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
VB->importable_data &= ~VERT_NORM;
}
- if ((required & VERT_RGBA) && (VB->ColorPtr[0]->flags & flags)) {
+ if ((required & VERT_RGBA) && (VB->ColorPtr[0]->Flags & ca_flags)) {
ASSERT(VB->ColorPtr[0] == &inputs->Color);
- _tnl_import_color( ctx, writeable, stride );
+ _tnl_import_color( ctx, GL_FLOAT, writeable, stride );
VB->importable_data &= ~VERT_RGBA;
}
- if ((required & VERT_SPEC_RGB) && (VB->SecondaryColorPtr[0]->flags&flags)) {
+ if ((required & VERT_SPEC_RGB) &&
+ (VB->SecondaryColorPtr[0]->Flags & ca_flags)) {
ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor);
- _tnl_import_secondarycolor( ctx, writeable, stride );
+ _tnl_import_secondarycolor( ctx, GL_FLOAT, writeable, stride );
VB->importable_data &= ~VERT_SPEC_RGB;
}
@@ -308,8 +301,6 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
-
-
void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -360,11 +351,13 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
if (inputs & VERT_RGBA) {
if (imports & VERT_RGBA) {
- _tnl_import_color( ctx, 0, 0 );
- tmp->Color.count = VB->Count;
+ _tnl_import_color( ctx, 0, 0, 0 );
}
VB->ColorPtr[0] = &tmp->Color;
VB->ColorPtr[1] = 0;
+/* fprintf(stderr, "VB->ColorPtr[0]->StrideB %d Type %s\n", */
+/* VB->ColorPtr[0]->StrideB, */
+/* _mesa_lookup_enum_by_nr(VB->ColorPtr[0]->Type)); */
}
if (inputs & VERT_INDEX) {
@@ -392,9 +385,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
if (inputs & VERT_SPEC_RGB) {
if (imports & VERT_SPEC_RGB) {
- _tnl_import_secondarycolor( ctx, 0, 0 );
- tmp->SecondaryColor.count = VB->Count;
+ _tnl_import_secondarycolor( ctx, 0, 0, 0 );
}
+
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
VB->SecondaryColorPtr[1] = 0;
}
@@ -414,9 +407,10 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
VB->Primitive = tnl->tmp_primitive;
VB->PrimitiveLength = tnl->tmp_primitive_length;
VB->import_data = _tnl_upgrade_client_data;
- VB->importable_data = imports & VERT_FIXUP;
-/* _tnl_print_vert_flags("_tnl_vb_bind_arrays: importable", VB->importable_data); */
+ VB->importable_data = inputs & VERT_FIXUP;
+/* _tnl_print_vert_flags("_tnl_vb_bind_arrays: importable", */
+/* VB->importable_data); */
}
@@ -469,21 +463,21 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM,
}
if (required & VERT_RGBA) {
- _math_trans_4chan( IM->Color + IM->Start,
- ctx->Array.Color.Ptr,
- ctx->Array.Color.StrideB,
- ctx->Array.Color.Type,
- ctx->Array.Color.Size,
- start, n );
+ _math_trans_4f( IM->Color + IM->Start,
+ ctx->Array.Color.Ptr,
+ ctx->Array.Color.StrideB,
+ ctx->Array.Color.Type,
+ ctx->Array.Color.Size,
+ start, n );
}
if (required & VERT_SPEC_RGB) {
- _math_trans_4chan( IM->SecondaryColor + IM->Start,
- ctx->Array.SecondaryColor.Ptr,
- ctx->Array.SecondaryColor.StrideB,
- ctx->Array.SecondaryColor.Type,
- ctx->Array.SecondaryColor.Size,
- start, n );
+ _math_trans_4f( IM->SecondaryColor + IM->Start,
+ ctx->Array.SecondaryColor.Ptr,
+ ctx->Array.SecondaryColor.StrideB,
+ ctx->Array.SecondaryColor.Type,
+ ctx->Array.SecondaryColor.Size,
+ start, n );
}
if (required & VERT_FOG_COORD) {
diff --git a/src/mesa/tnl/t_array_import.h b/src/mesa/tnl/t_array_import.h
index 1236850b91..fbcb795d3b 100644
--- a/src/mesa/tnl/t_array_import.h
+++ b/src/mesa/tnl/t_array_import.h
@@ -1,4 +1,4 @@
-/* $Id: t_array_import.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_array_import.h,v 1.3 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,5 +38,4 @@ extern void _tnl_fill_immediate_drawarrays( GLcontext *ctx,
extern void _tnl_array_import_init( GLcontext *ctx );
-
#endif
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 7e5c0de363..5b57fe8635 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.20 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_context.h,v 1.21 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -201,14 +201,14 @@ struct immediate
GLuint Primitive[IMM_SIZE]; /* BEGIN/END */
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
GLuint Flag[IMM_SIZE]; /* VERT_* flags */
- GLchan Color[IMM_SIZE][4];
+ GLfloat Color[IMM_SIZE][4];
GLfloat Obj[IMM_SIZE][4];
GLfloat Normal[IMM_SIZE][3];
GLfloat TexCoord0[IMM_SIZE][4]; /* just VERT_TEX0 */
GLuint Elt[IMM_SIZE];
GLubyte EdgeFlag[IMM_SIZE];
GLuint Index[IMM_SIZE];
- GLchan SecondaryColor[IMM_SIZE][4];
+ GLfloat SecondaryColor[IMM_SIZE][4];
GLfloat FogCoord[IMM_SIZE];
};
@@ -217,8 +217,8 @@ struct vertex_arrays
{
GLvector4f Obj;
GLvector3f Normal;
- GLvector4chan Color;
- GLvector4chan SecondaryColor;
+ struct gl_client_array Color;
+ struct gl_client_array SecondaryColor;
GLvector1ui Index;
GLvector1ub EdgeFlag;
GLvector4f TexCoord[MAX_TEXTURE_UNITS];
@@ -256,8 +256,8 @@ typedef struct vertex_buffer
GLboolean *EdgeFlag; /* VERT_EDGE */
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
GLvector1ui *IndexPtr[2]; /* VERT_INDEX */
- GLvector4chan *ColorPtr[2]; /* VERT_RGBA */
- GLvector4chan *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */
+ struct gl_client_array *ColorPtr[2]; /* VERT_RGBA */
+ struct gl_client_array *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */
GLvector1f *FogCoordPtr; /* VERT_FOG_COORD */
GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */
GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */
diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c
index 375e4b6309..5b4630881b 100644
--- a/src/mesa/tnl/t_imm_api.c
+++ b/src/mesa/tnl/t_imm_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_api.c,v 1.10 2001/04/09 14:47:34 keithw Exp $ */
+/* $Id: t_imm_api.c,v 1.11 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -348,56 +348,29 @@ _tnl_End(void)
IM->Color[count][3] = a; \
}
-#define COLORV( IM, v ) \
-{ \
- GLuint count = IM->Count; \
- IM->Flag[count] |= VERT_RGBA; \
- COPY_CHAN4(IM->Color[count], v); \
-}
-
-
static void
_tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue )
{
- GLchan col[4];
GET_IMMEDIATE;
- UNCLAMPED_FLOAT_TO_CHAN(col[0], red);
- UNCLAMPED_FLOAT_TO_CHAN(col[1], green);
- UNCLAMPED_FLOAT_TO_CHAN(col[2], blue);
- col[3] = CHAN_MAX;
- COLORV( IM, col );
+ COLOR( IM, red, green, blue, 1.0 );
}
-
static void
_tnl_Color3ub( GLubyte red, GLubyte green, GLubyte blue )
{
-#if CHAN_BITS == 8
- GET_IMMEDIATE;
- COLOR( IM, red, green, blue, CHAN_MAX );
-#else
GET_IMMEDIATE;
COLOR(IM,
- UBYTE_TO_CHAN(red),
- UBYTE_TO_CHAN(green),
- UBYTE_TO_CHAN(blue),
- CHAN_MAX);
-#endif
+ 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 )
{
- GLchan col[4];
GET_IMMEDIATE;
- UNCLAMPED_FLOAT_TO_CHAN(col[0], red);
- UNCLAMPED_FLOAT_TO_CHAN(col[1], green);
- UNCLAMPED_FLOAT_TO_CHAN(col[2], blue);
- UNCLAMPED_FLOAT_TO_CHAN(col[3], alpha);
- COLORV( IM, col );
+ COLOR( IM, red, green, blue, alpha );
}
static void
@@ -405,61 +378,46 @@ _tnl_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
{
GET_IMMEDIATE;
COLOR(IM,
- UBYTE_TO_CHAN(red),
- UBYTE_TO_CHAN(green),
- UBYTE_TO_CHAN(blue),
- UBYTE_TO_CHAN(alpha));
+ UBYTE_TO_FLOAT(red),
+ UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue),
+ UBYTE_TO_FLOAT(alpha));
}
-
static void
_tnl_Color3fv( const GLfloat *v )
{
- GLchan col[4];
GET_IMMEDIATE;
- UNCLAMPED_FLOAT_TO_CHAN(col[0], v[0]);
- UNCLAMPED_FLOAT_TO_CHAN(col[1], v[1]);
- UNCLAMPED_FLOAT_TO_CHAN(col[2], v[2]);
- col[3] = CHAN_MAX;
- COLORV( IM, col );
+ COLOR( IM, v[0], v[1], v[2], 1.0 );
}
-
-
static void
_tnl_Color3ubv( const GLubyte *v )
{
GET_IMMEDIATE;
COLOR(IM,
- UBYTE_TO_CHAN(v[0]),
- UBYTE_TO_CHAN(v[1]),
- UBYTE_TO_CHAN(v[2]),
- CHAN_MAX );
+ UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]),
+ 1.0 );
}
static void
_tnl_Color4fv( const GLfloat *v )
{
- GLchan col[4];
GET_IMMEDIATE;
- UNCLAMPED_FLOAT_TO_CHAN(col[0], v[0]);
- UNCLAMPED_FLOAT_TO_CHAN(col[1], v[1]);
- UNCLAMPED_FLOAT_TO_CHAN(col[2], v[2]);
- UNCLAMPED_FLOAT_TO_CHAN(col[3], v[3]);
- COLORV( IM, col );
+ COLOR( IM, v[0], v[1], v[2], v[3] );
}
-
-
static void
_tnl_Color4ubv( const GLubyte *v)
{
GET_IMMEDIATE;
COLOR(IM,
- UBYTE_TO_CHAN(v[0]),
- UBYTE_TO_CHAN(v[1]),
- UBYTE_TO_CHAN(v[2]),
- UBYTE_TO_CHAN(v[3]));
+ UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]),
+ UBYTE_TO_FLOAT(v[3]));
}
@@ -474,65 +432,38 @@ _tnl_Color4ubv( const GLubyte *v)
IM->SecondaryColor[count][2] = b; \
}
-#define SECONDARY_COLORV( IM, v ) \
-{ \
- GLuint count = IM->Count; \
- IM->Flag[count] |= VERT_SPEC_RGB; \
- IM->SecondaryColor[count][0] = v[0]; \
- IM->SecondaryColor[count][1] = v[1]; \
- IM->SecondaryColor[count][2] = v[2]; \
-}
-
-
-
-
static void
_tnl_SecondaryColor3fEXT( GLfloat red, GLfloat green, GLfloat blue )
{
- GLchan col[3];
GET_IMMEDIATE;
- UNCLAMPED_FLOAT_TO_CHAN(col[0], red);
- UNCLAMPED_FLOAT_TO_CHAN(col[1], green);
- UNCLAMPED_FLOAT_TO_CHAN(col[2], blue);
- SECONDARY_COLORV( IM, col );
+ SECONDARY_COLOR( IM, red, green, blue );
}
-
-
static void
_tnl_SecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue )
{
GET_IMMEDIATE;
SECONDARY_COLOR(IM,
- UBYTE_TO_CHAN(red),
- UBYTE_TO_CHAN(green),
- UBYTE_TO_CHAN(blue));
+ UBYTE_TO_FLOAT(red),
+ UBYTE_TO_FLOAT(green),
+ UBYTE_TO_FLOAT(blue));
}
-
-
-
static void
_tnl_SecondaryColor3fvEXT( const GLfloat *v )
{
- GLchan col[3];
GET_IMMEDIATE;
- UNCLAMPED_FLOAT_TO_CHAN(col[0], v[0]);
- UNCLAMPED_FLOAT_TO_CHAN(col[1], v[1]);
- UNCLAMPED_FLOAT_TO_CHAN(col[2], v[2]);
- SECONDARY_COLORV( IM, col );
+ SECONDARY_COLOR( IM, v[0], v[1], v[2] );
}
-
-
static void
_tnl_SecondaryColor3ubvEXT( const GLubyte *v )
{
GET_IMMEDIATE;
SECONDARY_COLOR(IM,
- UBYTE_TO_CHAN(v[0]),
- UBYTE_TO_CHAN(v[1]),
- UBYTE_TO_CHAN(v[2]));
+ UBYTE_TO_FLOAT(v[0]),
+ UBYTE_TO_FLOAT(v[1]),
+ UBYTE_TO_FLOAT(v[2]));
}
diff --git a/src/mesa/tnl/t_imm_debug.c b/src/mesa/tnl/t_imm_debug.c
index ded4ee4d0c..d641ee1049 100644
--- a/src/mesa/tnl/t_imm_debug.c
+++ b/src/mesa/tnl/t_imm_debug.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_debug.c,v 1.2 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_debug.c,v 1.3 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -125,12 +125,12 @@ void _tnl_print_cassette( struct immediate *IM )
}
if (req & flags[i] & VERT_RGBA)
- fprintf(stderr, " Rgba %d %d %d %d ",
+ fprintf(stderr, " Rgba %f %f %f %f ",
IM->Color[i][0], IM->Color[i][1],
IM->Color[i][2], IM->Color[i][3]);
if (req & flags[i] & VERT_SPEC_RGB)
- fprintf(stderr, " Spec %d %d %d ",
+ fprintf(stderr, " Spec %f %f %f ",
IM->SecondaryColor[i][0], IM->SecondaryColor[i][1],
IM->SecondaryColor[i][2]);
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index 1386ef16f7..c339897bc9 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_elt.c,v 1.7 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_imm_elt.c,v 1.8 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -647,6 +647,7 @@ static void _tnl_trans_elt_1ub(GLubyte *to,
}
+#if 0
static void _tnl_trans_elt_4ub(GLubyte (*to)[4],
const struct gl_client_array *from,
GLuint *flags,
@@ -665,7 +666,9 @@ static void _tnl_trans_elt_4ub(GLubyte (*to)[4],
n );
}
+#endif
+#if 0
static void _tnl_trans_elt_4us(GLushort (*to)[4],
const struct gl_client_array *from,
GLuint *flags,
@@ -684,6 +687,7 @@ static void _tnl_trans_elt_4us(GLushort (*to)[4],
n );
}
+#endif
static void _tnl_trans_elt_4f(GLfloat (*to)[4],
const struct gl_client_array *from,
@@ -704,25 +708,6 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4],
}
-static void _tnl_trans_elt_4chan(GLchan (*to)[4],
- const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
- GLuint match,
- GLuint start,
- GLuint n )
-{
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
- _tnl_trans_elt_4ub( to, from, flags, elts, match, start, n );
- (void)_tnl_trans_elt_4us;
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
- _tnl_trans_elt_4us( to, from, flags, elts, match, start, n );
-#elif CHAN_TYPE == GL_FLOAT
- _tnl_trans_elt_4f( to, from, flags, elts, match, start, n );
- (void)_tnl_trans_elt_4us;
-#endif
-}
-
static void _tnl_trans_elt_3f(GLfloat (*to)[3],
@@ -789,17 +774,17 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
start, count);
if (translate & VERT_RGBA) {
- _tnl_trans_elt_4chan( IM->Color,
- &ctx->Array.Color,
- flags, elts, (VERT_ELT|VERT_RGBA),
- start, count);
+ _tnl_trans_elt_4f( IM->Color,
+ &ctx->Array.Color,
+ flags, elts, (VERT_ELT|VERT_RGBA),
+ start, count);
}
if (translate & VERT_SPEC_RGB) {
- _tnl_trans_elt_4chan( IM->SecondaryColor,
- &ctx->Array.SecondaryColor,
- flags, elts, (VERT_ELT|VERT_SPEC_RGB),
- start, count);
+ _tnl_trans_elt_4f( IM->SecondaryColor,
+ &ctx->Array.SecondaryColor,
+ flags, elts, (VERT_ELT|VERT_SPEC_RGB),
+ start, count);
}
if (translate & VERT_FOG_COORD)
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c
index 21529a42b5..d06f702e5b 100644
--- a/src/mesa/tnl/t_imm_eval.c
+++ b/src/mesa/tnl/t_imm_eval.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_eval.c,v 1.7 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_imm_eval.c,v 1.8 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -85,10 +85,10 @@ static const GLubyte dirty_flags[5] = {
static void eval1_4f( GLvector4f *dest,
- GLfloat coord[][4],
- const GLuint *flags,
- GLuint dimension,
- struct gl_1d_map *map )
+ GLfloat coord[][4],
+ const GLuint *flags,
+ GLuint dimension,
+ struct gl_1d_map *map )
{
const GLfloat u1 = map->u1;
const GLfloat du = map->du;
@@ -107,6 +107,31 @@ static void eval1_4f( GLvector4f *dest,
dest->flags |= dirty_flags[dimension];
}
+static void eval1_4f_ca( struct gl_client_array *dest,
+ GLfloat coord[][4],
+ const GLuint *flags,
+ GLuint dimension,
+ struct gl_1d_map *map )
+{
+ const GLfloat u1 = map->u1;
+ const GLfloat du = map->du;
+ GLfloat (*to)[4] = (GLfloat (*)[4])dest->Ptr;
+ GLuint i;
+
+ ASSERT(dest->Type == GL_FLOAT);
+ ASSERT(dest->StrideB == 4 * sizeof(GLfloat));
+
+ for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++)
+ if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
+ GLfloat u = (coord[i][0] - u1) * du;
+ ASSIGN_4V(to[i], 0,0,0,1);
+ _math_horner_bezier_curve(map->Points, to[i], u,
+ dimension, map->Order);
+ }
+
+ dest->Size = MAX2(dest->Size, dimension);
+}
+
static void eval1_1ui( GLvector1ui *dest,
GLfloat coord[][4],
@@ -145,25 +170,6 @@ static void eval1_norm( GLvector3f *dest,
}
}
-static void eval1_color( GLvector4chan *dest,
- GLfloat coord[][4],
- const GLuint *flags,
- struct gl_1d_map *map )
-{
- const GLfloat u1 = map->u1;
- const GLfloat du = map->du;
- GLchan (*to)[4] = dest->data;
- GLuint i;
-
- for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) {
- if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) {
- GLfloat u = (coord[i][0] - u1) * du;
- GLfloat fcolor[4];
- _math_horner_bezier_curve(map->Points, fcolor, u, 4, map->Order);
- UNCLAMPED_FLOAT_TO_RGBA_CHAN(to[i], fcolor);
- }
- }
-}
@@ -227,6 +233,33 @@ static void eval2_4f( GLvector4f *dest,
dest->flags |= dirty_flags[dimension];
}
+static void eval2_4f_ca( struct gl_client_array *dest,
+ GLfloat coord[][4],
+ const GLuint *flags,
+ GLuint dimension,
+ struct gl_2d_map *map )
+{
+ const GLfloat u1 = map->u1;
+ const GLfloat du = map->du;
+ const GLfloat v1 = map->v1;
+ const GLfloat dv = map->dv;
+ GLfloat (*to)[4] = (GLfloat (*)[4])dest->Ptr;
+ GLuint i;
+
+ ASSERT(dest->Type == GL_FLOAT);
+ ASSERT(dest->StrideB == 4 * sizeof(GLfloat));
+
+ 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, dimension,
+ map->Uorder, map->Vorder);
+ }
+
+ dest->Size = MAX2(dest->Size, dimension);
+}
+
static void eval2_norm( GLvector3f *dest,
GLfloat coord[][4],
@@ -277,29 +310,6 @@ static void eval2_1ui( GLvector1ui *dest,
-static void eval2_color( GLvector4chan *dest,
- GLfloat coord[][4],
- GLuint *flags,
- struct gl_2d_map *map )
-{
- const GLfloat u1 = map->u1;
- const GLfloat du = map->du;
- const GLfloat v1 = map->v1;
- const GLfloat dv = map->dv;
- GLchan (*to)[4] = dest->data;
- GLuint 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;
- GLfloat fcolor[4];
- _math_horner_bezier_surf(map->Points, fcolor, u, v, 4,
- map->Uorder, map->Vorder);
- UNCLAMPED_FLOAT_TO_RGBA_CHAN(to[i], fcolor);
- }
- }
-}
@@ -313,10 +323,6 @@ static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count )
MEMCPY( to, from, (count) * sizeof(to[0]));
}
-static void copy_4chan( GLchan to[][4], GLchan from[][4], GLuint count )
-{
- MEMCPY( to, from, (count) * sizeof(to[0]));
-}
static void copy_1ui( GLuint to[], GLuint from[], GLuint count )
{
@@ -496,18 +502,17 @@ void _tnl_eval_vb( GLcontext *ctx,
GLuint generated = 0;
if (!all_eval)
- copy_4chan( store->Color, tmp->Color.data, count );
+ copy_4f( store->Color, (GLfloat (*)[4])tmp->Color.Ptr, count );
- tmp->Color.data = store->Color;
- tmp->Color.start = (GLchan *) store->Color;
+ tmp->Color.Ptr = store->Color;
if (ctx->Eval.Map1Color4 && any_eval1) {
- eval1_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map1Color4 );
+ eval1_4f_ca( &tmp->Color, coord, flags, 4, &ctx->EvalMap.Map1Color4 );
generated |= VERT_EVAL_C1|VERT_EVAL_P1;
}
if (ctx->Eval.Map2Color4 && any_eval2) {
- eval2_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map2Color4 );
+ eval2_4f_ca( &tmp->Color, coord, flags, 4, &ctx->EvalMap.Map2Color4 );
generated |= VERT_EVAL_C2|VERT_EVAL_P2;
}
@@ -515,11 +520,11 @@ void _tnl_eval_vb( GLcontext *ctx,
* maps are disabled.
*/
if (purge_flags & generated)
- _tnl_fixup_4chan( store->Color, flags, 0,
- VERT_RGBA|
- VERT_OBJ|
- generated|
- (VERT_EVAL_ANY&~purge_flags) );
+ _tnl_fixup_4f( store->Color, flags, 0,
+ VERT_RGBA|
+ VERT_OBJ|
+ generated|
+ (VERT_EVAL_ANY&~purge_flags) );
}
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index a575253590..18eaa488a3 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.17 2001/04/09 14:47:34 keithw Exp $ */
+/* $Id: t_imm_exec.c,v 1.18 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -109,7 +109,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
ctx->Current.EdgeFlag = IM->EdgeFlag[count];
if (flag & VERT_RGBA) {
- COPY_CHAN4(ctx->Current.Color, IM->Color[count]);
+ COPY_4FV(ctx->Current.Color, IM->Color[count]);
if (ctx->Light.ColorMaterialEnabled) {
_mesa_update_color_material( ctx, ctx->Current.Color );
_mesa_validate_all_lighting_tables( ctx );
@@ -117,7 +117,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
}
if (flag & VERT_SPEC_RGB)
- COPY_CHAN4(ctx->Current.SecondaryColor, IM->SecondaryColor[count]);
+ COPY_4FV(ctx->Current.SecondaryColor, IM->SecondaryColor[count]);
if (flag & VERT_FOG_COORD)
ctx->Current.FogCoord = IM->FogCoord[count];
@@ -179,6 +179,9 @@ void _tnl_compute_orflag( struct immediate *IM )
+
+
+
/* Note: The 'start' member of the GLvector structs is now redundant
* because we always re-transform copied vertices, and the vectors
* below are set up so that the first copied vertex (if any) appears
@@ -268,9 +271,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
}
if (inputs & VERT_SPEC_RGB) {
- tmp->SecondaryColor.data = IM->SecondaryColor + start;
- tmp->SecondaryColor.start = (GLchan *)(IM->SecondaryColor + start);
- tmp->SecondaryColor.count = count;
+ tmp->SecondaryColor.Ptr = IM->SecondaryColor + start;
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
}
@@ -279,9 +280,17 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
}
if (inputs & VERT_RGBA) {
- tmp->Color.data = IM->Color + start;
- tmp->Color.start = (GLchan *)(IM->Color + start);
- tmp->Color.count = count;
+ if (IM->CopyOrFlag & VERT_RGBA) {
+ tmp->Color.Ptr = IM->Color + start;
+ tmp->Color.StrideB = 4 * sizeof(GLfloat);
+ tmp->Color.Flags = 0;
+ } else {
+ tmp->Color.Ptr = ctx->Current.Color;
+ tmp->Color.StrideB = 0;
+ tmp->Color.Flags = CA_CLIENT_DATA; /* hack */
+ VB->importable_data |= VERT_RGBA;
+ VB->import_data = _tnl_upgrade_current_data;
+ }
VB->ColorPtr[0] = &tmp->Color;
}
@@ -308,6 +317,10 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
VB->MaterialMask = IM->MaterialMask + start;
VB->Material = IM->Material + start;
}
+
+/* _tnl_print_vert_flags("_tnl_vb_bind_immediate: importable", */
+/* VB->importable_data); */
+
}
@@ -477,8 +490,21 @@ void _tnl_imm_init( GLcontext *ctx )
_mesa_vector4f_init( &tmp->Obj, 0, 0 );
_mesa_vector3f_init( &tmp->Normal, 0, 0 );
- _mesa_vector4chan_init( &tmp->Color, 0, 0 );
- _mesa_vector4chan_init( &tmp->SecondaryColor, 0, 0 );
+
+ tmp->Color.Ptr = 0;
+ tmp->Color.Type = GL_FLOAT;
+ tmp->Color.Size = 4;
+ tmp->Color.Stride = 0;
+ tmp->Color.StrideB = 4 * sizeof(GLfloat);
+ tmp->Color.Flags = 0;
+
+ tmp->SecondaryColor.Ptr = 0;
+ tmp->SecondaryColor.Type = GL_FLOAT;
+ tmp->SecondaryColor.Size = 4;
+ tmp->SecondaryColor.Stride = 0;
+ tmp->SecondaryColor.StrideB = 4 * sizeof(GLfloat);
+ tmp->SecondaryColor.Flags = 0;
+
_mesa_vector1f_init( &tmp->FogCoord, 0, 0 );
_mesa_vector1ui_init( &tmp->Index, 0, 0 );
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 );
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index bfb1d30642..53e5dcbdc5 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.11 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_imm_fixup.c,v 1.12 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -126,21 +126,6 @@ _tnl_fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match )
}
-void
-_tnl_fixup_4chan( GLchan data[][4], GLuint flag[], GLuint start, GLuint match )
-{
- GLuint i = start;
-
- for (;;) {
- if ((flag[++i] & match) == 0) {
- COPY_CHAN4(data[i], data[i-1]);
- if (flag[i] & VERT_END_VB) break;
- }
- }
- flag[i] |= match;
-}
-
-
static void
fixup_first_4f( GLfloat data[][4], GLuint flag[], GLuint match,
GLuint start, GLfloat *dflt )
@@ -199,18 +184,6 @@ fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match,
}
-static void
-fixup_first_4chan( GLchan data[][4], GLuint flag[], GLuint match,
- GLuint start, GLchan dflt[4] )
-{
- GLuint i = start-1;
- match |= VERT_END_VB;
-
- while ((flag[++i]&match) == 0)
- COPY_CHAN4(data[i], dflt);
-}
-
-
void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -255,11 +228,11 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
}
if (copy & VERT_RGBA) {
- COPY_CHAN4( IM->Color[start], ctx->Current.Color);
+ COPY_4FV( IM->Color[start], ctx->Current.Color);
}
if (copy & VERT_SPEC_RGB)
- COPY_CHAN4( IM->SecondaryColor[start], ctx->Current.SecondaryColor);
+ COPY_4FV( IM->SecondaryColor[start], ctx->Current.SecondaryColor);
if (copy & VERT_FOG_COORD)
IM->FogCoord[start] = ctx->Current.FogCoord;
@@ -315,19 +288,19 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
if (fixup & VERT_RGBA) {
if (orflag & VERT_RGBA)
- _tnl_fixup_4chan( IM->Color, IM->Flag, start, VERT_RGBA );
- else
- fixup_first_4chan( IM->Color, IM->Flag, VERT_END_VB, start,
- IM->Color[start] );
+ _tnl_fixup_4f( IM->Color, IM->Flag, start, VERT_RGBA );
+/* else */
+/* fixup_first_4f( IM->Color, IM->Flag, VERT_END_VB, start, */
+/* IM->Color[start] ); */
}
if (fixup & VERT_SPEC_RGB) {
if (orflag & VERT_SPEC_RGB)
- _tnl_fixup_4chan( IM->SecondaryColor, IM->Flag, start,
- VERT_SPEC_RGB );
+ _tnl_fixup_4f( IM->SecondaryColor, IM->Flag, start,
+ VERT_SPEC_RGB );
else
- fixup_first_4chan( IM->SecondaryColor, IM->Flag, VERT_END_VB, start,
- IM->SecondaryColor[start] );
+ fixup_first_4f( IM->SecondaryColor, IM->Flag, VERT_END_VB, start,
+ IM->SecondaryColor[start] );
}
if (fixup & VERT_FOG_COORD) {
@@ -422,7 +395,7 @@ static void copy_vertices( GLcontext *ctx,
COPY_4FV( next->Obj[dst], prev->Obj[src] );
COPY_3FV( next->Normal[dst], prev->Normal[src] );
- COPY_CHAN4( next->Color[dst], prev->Color[src] );
+ COPY_4FV( next->Color[dst], prev->Color[src] );
if (prev->OrFlag & VERT_TEX_ANY) {
GLuint i;
@@ -438,7 +411,7 @@ static void copy_vertices( GLcontext *ctx,
next->Elt[dst] = prev->Elt[src];
next->EdgeFlag[dst] = prev->EdgeFlag[src];
next->Index[dst] = prev->Index[src];
- COPY_CHAN4( next->SecondaryColor[dst], prev->SecondaryColor[src] );
+ COPY_4FV( next->SecondaryColor[dst], prev->SecondaryColor[src] );
next->FogCoord[dst] = prev->FogCoord[src];
next->Flag[dst] = (prev->CopyOrFlag & VERT_FIXUP);
next->CopyOrFlag |= prev->Flag[src]; /* redundant for current_im */
@@ -550,12 +523,13 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
ctx->Current.Index );
if (fixup & VERT_RGBA)
- fixup_first_4chan(IM->Color, IM->Flag, VERT_RGBA, start,
- ctx->Current.Color );
+ if (IM->CopyOrFlag & VERT_RGBA)
+ fixup_first_4f(IM->Color, IM->Flag, VERT_RGBA, start,
+ ctx->Current.Color );
if (fixup & VERT_SPEC_RGB)
- fixup_first_4chan(IM->SecondaryColor, IM->Flag, VERT_SPEC_RGB, start,
- ctx->Current.SecondaryColor );
+ fixup_first_4f(IM->SecondaryColor, IM->Flag, VERT_SPEC_RGB, start,
+ ctx->Current.SecondaryColor );
if (fixup & VERT_FOG_COORD)
fixup_first_1f(IM->FogCoord, IM->Flag, VERT_FOG_COORD, start,
@@ -795,7 +769,7 @@ void _tnl_fixup_purged_eval( GLcontext *ctx, struct immediate *IM )
GLenum prim = IM->Primitive[last];
GLuint pincr = increment[prim];
GLuint pintro = intro[prim];
- GLuint ovf, i;
+ GLuint ovf = 0, i;
tnl->ExecCopyCount = 0;
tnl->ExecParity = IM->PrimitiveLength[last] & 1;
@@ -810,3 +784,30 @@ void _tnl_fixup_purged_eval( GLcontext *ctx, struct immediate *IM )
tnl->ExecCopyElts[i] = IM->Elt[tnl->ExecCopyElts[i]];
}
}
+
+
+void _tnl_upgrade_current_data( GLcontext *ctx,
+ GLuint required,
+ GLuint flags )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct immediate *IM = tnl->ExecCopySource;
+ struct vertex_buffer *VB = &tnl->vb;
+
+/* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */
+
+ if ((required & VERT_RGBA) && (VB->ColorPtr[0]->Flags & CA_CLIENT_DATA)) {
+ struct gl_client_array *tmp = &tnl->imm_inputs.Color;
+ GLuint start = IM->CopyStart;
+
+ tmp->Ptr = IM->Color + start;
+ tmp->StrideB = 4 * sizeof(GLfloat);
+ tmp->Flags = 0;
+
+ COPY_4FV( IM->Color[start], ctx->Current.Color);
+ fixup_first_4f( IM->Color, IM->Flag, VERT_END_VB, start,
+ IM->Color[start] );
+
+ VB->importable_data &= ~VERT_RGBA;
+ }
+}
diff --git a/src/mesa/tnl/t_imm_fixup.h b/src/mesa/tnl/t_imm_fixup.h
index 939bba408b..584712167f 100644
--- a/src/mesa/tnl/t_imm_fixup.h
+++ b/src/mesa/tnl/t_imm_fixup.h
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.h,v 1.3 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_imm_fixup.h,v 1.4 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,9 +31,6 @@
#include "mtypes.h"
#include "t_context.h"
-extern void _tnl_fixup_4chan( GLchan data[][4], GLuint flag[],
- GLuint start, GLuint match );
-
extern void _tnl_fixup_1ub( GLubyte *data, GLuint flag[],
GLuint start, GLuint match );
@@ -60,7 +57,12 @@ extern void _tnl_restore_compiled_cassette( GLcontext *ctx,
extern void _tnl_fixup_purged_eval( GLcontext *ctx, struct immediate *IM );
-extern void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *IM );
+extern void _tnl_copy_immediate_vertices( GLcontext *ctx,
+ struct immediate *IM );
+
extern void _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM );
+extern void _tnl_upgrade_current_data( GLcontext *ctx, GLuint required,
+ GLuint flags );
+
#endif
diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h
index 6ecd1c3c60..5c64d96489 100644
--- a/src/mesa/tnl/t_vb_cliptmp.h
+++ b/src/mesa/tnl/t_vb_cliptmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_cliptmp.h,v 1.10 2001/03/19 02:25:37 keithw Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.11 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -58,13 +58,13 @@ do { \
* know dp != dpPrev from DIFFERENT_SIGNS, above. \
*/ \
GLfloat t = dp / (dp - dpPrev); \
- LINTERP_4F( t, coord, newvert, idx, idxPrev, SIZE ); \
+ INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \
interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \
} else { \
/* Coming back in. \
*/ \
GLfloat t = dpPrev / (dpPrev - dp); \
- LINTERP_4F( t, coord, newvert, idxPrev, idx, SIZE ); \
+ INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \
interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \
} \
} \
@@ -86,32 +86,32 @@ do { \
} while (0)
-#define LINE_CLIP(PLANE, A, B, C, D ) \
-do { \
- if (mask & PLANE) { \
- GLfloat dpI = CLIP_DOTPROD( ii, A, B, C, D ); \
- GLfloat dpJ = CLIP_DOTPROD( jj, A, B, C, D ); \
- \
- if (DIFFERENT_SIGNS(dpI, dpJ)) { \
- GLuint newvert = VB->LastClipped++; \
- VB->ClipMask[newvert] = 0; \
- if (NEGATIVE(dpJ)) { \
- GLfloat t = dpI / (dpI - dpJ); \
- VB->ClipMask[jj] |= PLANE; \
- LINTERP_4F( t, coord, newvert, ii, jj, SIZE ); \
- interp( ctx, t, newvert, ii, jj, GL_FALSE ); \
- jj = newvert; \
- } else { \
- GLfloat t = dpJ / (dpJ - dpI); \
- VB->ClipMask[ii] |= PLANE; \
- LINTERP_4F( t, coord, newvert, jj, ii, SIZE ); \
- interp( ctx, t, newvert, jj, ii, GL_FALSE ); \
- ii = newvert; \
- } \
- } \
- else if (NEGATIVE(dpI)) \
- return; \
- } \
+#define LINE_CLIP(PLANE, A, B, C, D ) \
+do { \
+ if (mask & PLANE) { \
+ GLfloat dpI = CLIP_DOTPROD( ii, A, B, C, D ); \
+ GLfloat dpJ = CLIP_DOTPROD( jj, A, B, C, D ); \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ GLuint newvert = VB->LastClipped++; \
+ VB->ClipMask[newvert] = 0; \
+ if (NEGATIVE(dpJ)) { \
+ GLfloat t = dpI / (dpI - dpJ); \
+ VB->ClipMask[jj] |= PLANE; \
+ INTERP_4F( t, coord[newvert], coord[ii], coord[jj] ); \
+ interp( ctx, t, newvert, ii, jj, GL_FALSE ); \
+ jj = newvert; \
+ } else { \
+ GLfloat t = dpJ / (dpJ - dpI); \
+ VB->ClipMask[ii] |= PLANE; \
+ INTERP_4F( t, coord[newvert], coord[jj], coord[ii] ); \
+ interp( ctx, t, newvert, jj, ii, GL_FALSE ); \
+ ii = newvert; \
+ } \
+ } \
+ else if (NEGATIVE(dpI)) \
+ return; \
+ } \
} while (0)
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 209c32f8ab..7b24cbfaa3 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_light.c,v 1.13 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_vb_light.c,v 1.14 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,8 +49,8 @@ typedef void (*light_func)( GLcontext *ctx,
GLvector4f *input );
struct light_stage_data {
- GLvector4chan LitColor[2];
- GLvector4chan LitSecondary[2];
+ struct gl_client_array LitColor[2];
+ struct gl_client_array LitSecondary[2];
GLvector1ui LitIndex[2];
light_func *light_func_tab;
};
@@ -149,8 +149,8 @@ static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage )
else
ind = 0;
- /* The individual tabs know about replaying side-effects vs. full
- * re-execution.
+ /* The individual functions know about replaying side-effects
+ * vs. full re-execution.
*/
store->light_func_tab[ind]( ctx, VB, stage, input );
@@ -201,6 +201,22 @@ static GLboolean run_validate_lighting( GLcontext *ctx,
return stage->run( ctx, stage );
}
+static void alloc_4f( struct gl_client_array *a, GLuint sz )
+{
+ a->Ptr = ALIGN_MALLOC( sz * sizeof(GLfloat) * 4, 32 );
+ a->Size = 4;
+ a->Type = GL_FLOAT;
+ a->Stride = 0;
+ a->StrideB = sizeof(GLfloat) * 4;
+ a->Enabled = 0;
+ a->Flags = 0;
+}
+
+static void free_4f( struct gl_client_array *a )
+{
+ ALIGN_FREE( a->Ptr );
+}
+
/* Called the first time stage->run is called. In effect, don't
* allocate data until the first time the stage is run.
*/
@@ -220,10 +236,11 @@ static GLboolean run_init_lighting( GLcontext *ctx,
*/
init_lighting();
- _mesa_vector4chan_alloc( &store->LitColor[0], 0, size, 32 );
- _mesa_vector4chan_alloc( &store->LitColor[1], 0, size, 32 );
- _mesa_vector4chan_alloc( &store->LitSecondary[0], 0, size, 32 );
- _mesa_vector4chan_alloc( &store->LitSecondary[1], 0, size, 32 );
+ alloc_4f( &store->LitColor[0], size );
+ alloc_4f( &store->LitColor[1], size );
+ alloc_4f( &store->LitSecondary[0], size );
+ alloc_4f( &store->LitSecondary[1], size );
+
_mesa_vector1ui_alloc( &store->LitIndex[0], 0, size, 32 );
_mesa_vector1ui_alloc( &store->LitIndex[1], 0, size, 32 );
@@ -263,10 +280,10 @@ static void dtr( struct gl_pipeline_stage *stage )
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
if (store) {
- _mesa_vector4chan_free( &store->LitColor[0] );
- _mesa_vector4chan_free( &store->LitColor[1] );
- _mesa_vector4chan_free( &store->LitSecondary[0] );
- _mesa_vector4chan_free( &store->LitSecondary[1] );
+ free_4f( &store->LitColor[0] );
+ free_4f( &store->LitColor[1] );
+ free_4f( &store->LitSecondary[0] );
+ free_4f( &store->LitSecondary[1] );
_mesa_vector1ui_free( &store->LitIndex[0] );
_mesa_vector1ui_free( &store->LitIndex[1] );
FREE( store );
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index a9df6de1d5..76d2a8c047 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_lighttmp.h,v 1.11 2001/04/19 12:22:09 keithw Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.12 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,7 @@
# define CHECK_MATERIAL(x) (flags[x] & VERT_MATERIAL)
# define CHECK_END_VB(x) (flags[x] & VERT_END_VB)
# if (IDX & LIGHT_COLORMATERIAL)
-# define CMSTRIDE STRIDE_CHAN(CMcolor, (4 * sizeof(GLchan)))
+# define CMSTRIDE STRIDE_F(CMcolor, (4 * sizeof(GLfloat)))
# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_RGBA)
# define CHECK_VALIDATE(x) (flags[x] & (VERT_RGBA|VERT_MATERIAL))
# define DO_ANOTHER_NORMAL(x) \
@@ -58,7 +58,7 @@
# define CHECK_MATERIAL(x) 0 /* no materials on array paths */
# define CHECK_END_VB(XX) (XX >= nr)
# if (IDX & LIGHT_COLORMATERIAL)
-# define CMSTRIDE STRIDE_CHAN(CMcolor, CMstride)
+# define CMSTRIDE STRIDE_F(CMcolor, CMstride)
# define CHECK_COLOR_MATERIAL(x) (x < nr) /* always have colormaterial */
# define CHECK_VALIDATE(x) (x < nr)
# define DO_ANOTHER_NORMAL(x) 0 /* always stop to recalc colormat */
@@ -88,7 +88,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
{
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
GLfloat (*base)[3] = ctx->Light._BaseColor;
- const GLchan *sumA = ctx->Light._BaseAlpha;
+ const GLfloat *sumA = ctx->Light._BaseAlpha;
GLuint j;
@@ -97,15 +97,16 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
- GLchan *CMcolor;
+ GLfloat *CMcolor;
GLuint CMstride;
- GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data;
- GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data;
- GLchan (*Fspec)[4] = (GLchan (*)[4]) store->LitSecondary[0].data;
- GLchan (*Bspec)[4] = (GLchan (*)[4]) store->LitSecondary[1].data;
- GLuint nr = VB->Count;
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].Ptr;
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].Ptr;
+ GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].Ptr;
+ GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].Ptr;
+ GLfloat (*spec[2])[4];
+ GLuint nr = VB->Count;
GLuint *flags = VB->Flag;
struct gl_material (*new_material)[2] = VB->Material;
GLuint *new_material_mask = VB->MaterialMask;
@@ -114,11 +115,18 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
(void) nstride;
(void) vstride;
+
/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
+ spec[0] = Fspec;
+ spec[1] = Bspec;
+
if (IDX & LIGHT_COLORMATERIAL) {
- CMcolor = (GLchan *) VB->ColorPtr[0]->data;
- CMstride = VB->ColorPtr[0]->stride;
+ if (VB->ColorPtr[0]->Type != GL_FLOAT)
+ VB->import_data( ctx, VERT_RGBA, ~0 );
+
+ CMcolor = (GLfloat *) VB->ColorPtr[0]->Ptr;
+ CMstride = VB->ColorPtr[0]->StrideB;
}
VB->ColorPtr[0] = &store->LitColor[0];
@@ -138,7 +146,6 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
j<nr ;
j++,STRIDE_F(vertex,VSTRIDE),STRIDE_F(normal,NSTRIDE),CMSTRIDE)
{
- GLfloat sum[2][3], spec[2][3];
struct gl_light *light;
if ( CHECK_COLOR_MATERIAL(j) )
@@ -150,12 +157,14 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
if ( CHECK_VALIDATE(j) )
_mesa_validate_all_lighting_tables( ctx );
- COPY_3V(sum[0], base[0]);
- ZERO_3V(spec[0]);
+ COPY_3V(Fcolor[j], base[0]);
+ Fcolor[j][3] = sumA[0];
+ ZERO_3V(Fspec[j]);
if (IDX & LIGHT_TWOSIDE) {
- COPY_3V(sum[1], base[1]);
- ZERO_3V(spec[1]);
+ COPY_3V(Bcolor[j], base[1]);
+ Bcolor[j][3] = sumA[1];
+ ZERO_3V(Bspec[j]);
}
/* Add contribution from each enabled light source */
@@ -217,27 +226,30 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
/* Which side gets the diffuse & specular terms? */
if (n_dot_VP < 0.0F) {
- ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
+ ACC_SCALE_SCALAR_3V(Fcolor[j], attenuation, light->_MatAmbient[0]);
if (!(IDX & LIGHT_TWOSIDE)) {
continue;
}
- side = 1;
+ /* diffuse term */
+ COPY_3V(contrib, light->_MatAmbient[1]);
+ ACC_SCALE_SCALAR_3V(contrib, -n_dot_VP, light->_MatDiffuse[1]);
+ ACC_SCALE_SCALAR_3V(Bcolor[j], attenuation, contrib );
correction = -1;
- n_dot_VP = -n_dot_VP;
+ side = 1;
}
else {
if (IDX & LIGHT_TWOSIDE) {
- ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
+ ACC_SCALE_SCALAR_3V( Bcolor[j], attenuation,
+ light->_MatAmbient[1]);
}
- side = 0;
+ /* diffuse term */
+ COPY_3V(contrib, light->_MatAmbient[0]);
+ ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[0]);
+ ACC_SCALE_SCALAR_3V(Fcolor[j], attenuation, contrib );
correction = 1;
+ side = 0;
}
- /* diffuse term */
- COPY_3V(contrib, light->_MatAmbient[side]);
- ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]);
- ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib );
-
/* specular term - cannibalize VP... */
if (ctx->Light.Model.LocalViewer) {
GLfloat v[3];
@@ -265,21 +277,11 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
if (spec_coef > 1.0e-10) {
spec_coef *= attenuation;
- ACC_SCALE_SCALAR_3V( spec[side], spec_coef,
+ ACC_SCALE_SCALAR_3V( spec[side][j], spec_coef,
light->_MatSpecular[side]);
}
}
} /*loop over lights*/
-
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Fspec[j], spec[0] );
- Fcolor[j][3] = sumA[0];
-
- if (IDX & LIGHT_TWOSIDE) {
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Bspec[j], spec[1] );
- Bcolor[j][3] = sumA[1];
- }
}
}
@@ -293,18 +295,19 @@ static void TAG(light_rgba)( GLcontext *ctx,
GLuint j;
GLfloat (*base)[3] = ctx->Light._BaseColor;
- const GLchan *sumA = ctx->Light._BaseAlpha;
+ const GLfloat *sumA = ctx->Light._BaseAlpha;
GLuint vstride = input->stride;
const GLfloat *vertex = (GLfloat *) input->data;
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
- GLchan *CMcolor;
+ GLfloat *CMcolor;
GLuint CMstride;
- GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data;
- GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data;
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].Ptr;
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].Ptr;
+ GLfloat (*color[2])[4];
GLuint *flags = VB->Flag;
struct gl_material (*new_material)[2] = VB->Material;
@@ -316,9 +319,15 @@ static void TAG(light_rgba)( GLcontext *ctx,
(void) nstride;
(void) vstride;
+ color[0] = Fcolor;
+ color[1] = Bcolor;
+
if (IDX & LIGHT_COLORMATERIAL) {
- CMcolor = (GLchan *)VB->ColorPtr[0]->data;
- CMstride = VB->ColorPtr[0]->stride;
+ if (VB->ColorPtr[0]->Type != GL_FLOAT)
+ VB->import_data( ctx, VERT_RGBA, ~0 );
+
+ CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr;
+ CMstride = VB->ColorPtr[0]->StrideB;
}
VB->ColorPtr[0] = &store->LitColor[0];
@@ -332,7 +341,6 @@ static void TAG(light_rgba)( GLcontext *ctx,
j<nr ;
j++,STRIDE_F(vertex,VSTRIDE), STRIDE_F(normal,NSTRIDE),CMSTRIDE)
{
- GLfloat sum[2][3];
struct gl_light *light;
if ( CHECK_COLOR_MATERIAL(j) )
@@ -344,10 +352,14 @@ static void TAG(light_rgba)( GLcontext *ctx,
if ( CHECK_VALIDATE(j) )
_mesa_validate_all_lighting_tables( ctx );
- COPY_3V(sum[0], base[0]);
+ COPY_3V(Fcolor[j], base[0]);
+ Fcolor[j][3] = sumA[0];
+
+ if (IDX & LIGHT_TWOSIDE) {
+ COPY_3V(Bcolor[j], base[1]);
+ Bcolor[j][3] = sumA[1];
+ }
- if ( IDX & LIGHT_TWOSIDE )
- COPY_3V(sum[1], base[1]);
/* Add contribution from each enabled light source */
foreach (light, &ctx->Light.EnabledList) {
@@ -411,7 +423,7 @@ static void TAG(light_rgba)( GLcontext *ctx,
/* which side are we lighting? */
if (n_dot_VP < 0.0F) {
- ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
+ ACC_SCALE_SCALAR_3V(Fcolor[j], attenuation, light->_MatAmbient[0]);
if (!(IDX & LIGHT_TWOSIDE))
continue;
@@ -422,7 +434,8 @@ static void TAG(light_rgba)( GLcontext *ctx,
}
else {
if (IDX & LIGHT_TWOSIDE) {
- ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
+ ACC_SCALE_SCALAR_3V(Bcolor[j], attenuation,
+ light->_MatAmbient[1]);
}
side = 0;
correction = 1;
@@ -465,16 +478,9 @@ static void TAG(light_rgba)( GLcontext *ctx,
light->_MatSpecular[side]);
}
}
-
- ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib );
- }
-
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] );
- Fcolor[j][3] = sumA[0];
-
- if (IDX & LIGHT_TWOSIDE) {
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] );
- Bcolor[j][3] = sumA[1];
+
+
+ ACC_SCALE_SCALAR_3V( color[side][j], attenuation, contrib );
}
}
}
@@ -493,17 +499,16 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
- GLchan *CMcolor;
+ GLfloat *CMcolor;
GLuint CMstride;
- GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data;
- GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data;
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].Ptr;
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].Ptr;
struct gl_light *light = ctx->Light.EnabledList.next;
GLuint *flags = VB->Flag;
- GLchan baseubyte[2][4];
GLuint j = 0;
struct gl_material (*new_material)[2] = VB->Material;
GLuint *new_material_mask = VB->MaterialMask;
- GLfloat base[2][3];
+ GLfloat base[2][4];
GLuint nr = VB->Count;
/* fprintf(stderr, "%s\n", __FUNCTION__ ); */
@@ -513,8 +518,11 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
(void) nstride;
if (IDX & LIGHT_COLORMATERIAL) {
- CMcolor = (GLchan *)VB->ColorPtr[0]->data;
- CMstride = VB->ColorPtr[0]->stride;
+ if (VB->ColorPtr[0]->Type != GL_FLOAT)
+ VB->import_data( ctx, VERT_RGBA, ~0 );
+
+ CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr;
+ CMstride = VB->ColorPtr[0]->StrideB;
}
VB->ColorPtr[0] = &store->LitColor[0];
@@ -535,54 +543,42 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
if ( CHECK_VALIDATE(j) )
_mesa_validate_all_lighting_tables( ctx );
- baseubyte[0][3] = ctx->Light._BaseAlpha[0];
- baseubyte[1][3] = ctx->Light._BaseAlpha[1];
- /* No attenuation, so incoporate _MatAmbient into base color.
- */
- {
- COPY_3V(base[0], light->_MatAmbient[0]);
- ACC_3V(base[0], ctx->Light._BaseColor[0] );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( baseubyte[0], base[0] );
+ COPY_3V(base[0], light->_MatAmbient[0]);
+ ACC_3V(base[0], ctx->Light._BaseColor[0] );
+ base[0][3] = ctx->Light._BaseAlpha[0];
- if (IDX & LIGHT_TWOSIDE) {
- COPY_3V(base[1], light->_MatAmbient[1]);
- ACC_3V(base[1], ctx->Light._BaseColor[1]);
- UNCLAMPED_FLOAT_TO_RGB_CHAN( baseubyte[1], base[1]);
- }
+ if (IDX & LIGHT_TWOSIDE) {
+ COPY_3V(base[1], light->_MatAmbient[1]);
+ ACC_3V(base[1], ctx->Light._BaseColor[1]);
+ base[1][3] = ctx->Light._BaseAlpha[1];
}
do {
- GLfloat n_dot_VP = DOT3(normal, light->_VP_inf_norm);
+ GLfloat n_dot_VP;
- COPY_CHAN4(Fcolor[j], baseubyte[0]);
- if (IDX & LIGHT_TWOSIDE) COPY_CHAN4(Bcolor[j], baseubyte[1]);
+ COPY_4FV(Fcolor[j], base[0]);
+ if (IDX & LIGHT_TWOSIDE) COPY_4FV(Bcolor[j], base[1]);
- if (n_dot_VP < 0.0F) {
- if (IDX & LIGHT_TWOSIDE) {
- GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
- GLfloat sum[3];
- COPY_3V(sum, base[1]);
- ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
- if (n_dot_h > 0.0F) {
- GLfloat spec;
- GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec );
- ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
- }
- UNCLAMPED_FLOAT_TO_RGB_CHAN(Bcolor[j], sum );
- }
- } else {
+ n_dot_VP = DOT3(normal, light->_VP_inf_norm);
+
+ if (n_dot_VP > 0.0F) {
GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm);
- GLfloat sum[3];
- COPY_3V(sum, base[0]);
- ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]);
+ ACC_SCALE_SCALAR_3V(Fcolor[j], n_dot_VP, light->_MatDiffuse[0]);
if (n_dot_h > 0.0F) {
GLfloat spec;
GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec );
- ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]);
-
+ ACC_SCALE_SCALAR_3V( Fcolor[j], spec, light->_MatSpecular[0]);
+ }
+ }
+ else if (IDX & LIGHT_TWOSIDE) {
+ GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
+ ACC_SCALE_SCALAR_3V(Bcolor[j], -n_dot_VP, light->_MatDiffuse[1]);
+ if (n_dot_h > 0.0F) {
+ GLfloat spec;
+ GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec );
+ ACC_SCALE_SCALAR_3V( Bcolor[j], spec, light->_MatSpecular[1]);
}
- UNCLAMPED_FLOAT_TO_RGB_CHAN(Fcolor[j], sum );
}
j++;
@@ -591,11 +587,11 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
} while (DO_ANOTHER_NORMAL(j));
- for ( ; REUSE_LIGHT_RESULTS(j) ; j++, CMSTRIDE ) {
- COPY_CHAN4(Fcolor[j], Fcolor[j-1]);
+ for ( ; REUSE_LIGHT_RESULTS(j) ; j++, CMSTRIDE, STRIDE_F(normal,NSTRIDE))
+ {
+ COPY_4FV(Fcolor[j], Fcolor[j-1]);
if (IDX & LIGHT_TWOSIDE)
- COPY_CHAN4(Bcolor[j], Bcolor[j-1]);
- STRIDE_F(normal, NSTRIDE);
+ COPY_4FV(Bcolor[j], Bcolor[j-1]);
}
} while (!CHECK_END_VB(j));
@@ -610,13 +606,13 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
GLvector4f *input )
{
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
- const GLchan *sumA = ctx->Light._BaseAlpha;
+ const GLfloat *sumA = ctx->Light._BaseAlpha;
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
- GLchan *CMcolor;
+ GLfloat *CMcolor;
GLuint CMstride;
- GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data;
- GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data;
+ GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].Ptr;
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].Ptr;
GLuint *flags = VB->Flag;
GLuint j = 0;
struct gl_material (*new_material)[2] = VB->Material;
@@ -631,8 +627,11 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
(void) nstride;
if (IDX & LIGHT_COLORMATERIAL) {
- CMcolor = (GLchan *)VB->ColorPtr[0]->data;
- CMstride = VB->ColorPtr[0]->stride;
+ if (VB->ColorPtr[0]->Type != GL_FLOAT)
+ VB->import_data( ctx, VERT_RGBA, ~0 );
+
+ CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr;
+ CMstride = VB->ColorPtr[0]->StrideB;
}
VB->ColorPtr[0] = &store->LitColor[0];
@@ -644,8 +643,6 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
do {
do {
- GLfloat sum[2][3];
-
if ( CHECK_COLOR_MATERIAL(j) )
_mesa_update_color_material( ctx, CMcolor );
@@ -656,49 +653,45 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
_mesa_validate_all_lighting_tables( ctx );
- COPY_3V(sum[0], ctx->Light._BaseColor[0]);
- if (IDX & LIGHT_TWOSIDE)
- COPY_3V(sum[1], ctx->Light._BaseColor[1]);
+ COPY_3V(Fcolor[j], ctx->Light._BaseColor[0]);
+ Fcolor[j][3] = sumA[0];
+
+ if (IDX & LIGHT_TWOSIDE) {
+ COPY_3V(Bcolor[j], ctx->Light._BaseColor[1]);
+ Bcolor[j][3] = sumA[1];
+ }
foreach (light, &ctx->Light.EnabledList) {
GLfloat n_dot_h, n_dot_VP, spec;
- ACC_3V(sum[0], light->_MatAmbient[0]);
+ ACC_3V(Fcolor[j], light->_MatAmbient[0]);
if (IDX & LIGHT_TWOSIDE)
- ACC_3V(sum[1], light->_MatAmbient[1]);
+ ACC_3V(Bcolor[j], light->_MatAmbient[1]);
n_dot_VP = DOT3(normal, light->_VP_inf_norm);
if (n_dot_VP > 0.0F) {
- ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]);
+ ACC_SCALE_SCALAR_3V(Fcolor[j], n_dot_VP, light->_MatDiffuse[0]);
n_dot_h = DOT3(normal, light->_h_inf_norm);
if (n_dot_h > 0.0F) {
struct gl_shine_tab *tab = ctx->_ShineTable[0];
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
- ACC_SCALE_SCALAR_3V( sum[0], spec,
+ ACC_SCALE_SCALAR_3V( Fcolor[j], spec,
light->_MatSpecular[0]);
}
}
else if (IDX & LIGHT_TWOSIDE) {
- ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
+ ACC_SCALE_SCALAR_3V(Bcolor[j], -n_dot_VP, light->_MatDiffuse[1]);
n_dot_h = -DOT3(normal, light->_h_inf_norm);
if (n_dot_h > 0.0F) {
struct gl_shine_tab *tab = ctx->_ShineTable[1];
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec );
- ACC_SCALE_SCALAR_3V( sum[1], spec,
+ ACC_SCALE_SCALAR_3V( Bcolor[j], spec,
light->_MatSpecular[1]);
}
}
}
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] );
- Fcolor[j][3] = sumA[0];
-
- if (IDX & LIGHT_TWOSIDE) {
- UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] );
- Bcolor[j][3] = sumA[1];
- }
-
j++;
CMSTRIDE;
STRIDE_F(normal, NSTRIDE);
@@ -707,11 +700,11 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
/* Reuse the shading results while there is no change to
* normal or material values.
*/
- for ( ; REUSE_LIGHT_RESULTS(j) ; j++, CMSTRIDE ) {
- COPY_CHAN4(Fcolor[j], Fcolor[j-1]);
+ for ( ; REUSE_LIGHT_RESULTS(j) ; j++, CMSTRIDE, STRIDE_F(normal, NSTRIDE))
+ {
+ COPY_4FV(Fcolor[j], Fcolor[j-1]);
if (IDX & LIGHT_TWOSIDE)
- COPY_CHAN4(Bcolor[j], Bcolor[j-1]);
- STRIDE_F(normal, NSTRIDE);
+ COPY_4FV(Bcolor[j], Bcolor[j-1]);
}
} while (!CHECK_END_VB(j));
@@ -741,7 +734,7 @@ static void TAG(light_ci)( GLcontext *ctx,
const GLfloat *vertex = (GLfloat *) input->data;
GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
- GLchan *CMcolor;
+ GLfloat *CMcolor;
GLuint CMstride;
GLuint *flags = VB->Flag;
GLuint *indexResult[2];
@@ -766,8 +759,11 @@ static void TAG(light_ci)( GLcontext *ctx,
indexResult[1] = VB->IndexPtr[1]->data;
if (IDX & LIGHT_COLORMATERIAL) {
- CMcolor = (GLchan *)VB->ColorPtr[0]->data;
- CMstride = VB->ColorPtr[0]->stride;
+ if (VB->ColorPtr[0]->Type != GL_FLOAT)
+ VB->import_data( ctx, VERT_RGBA, ~0 );
+
+ CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr;
+ CMstride = VB->ColorPtr[0]->StrideB;
}
/* loop over vertices */
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index a71ed8d449..fc4fb95852 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.18 2001/04/26 14:53:48 keithw Exp $ */
+/* $Id: t_vb_render.c,v 1.19 2001/04/28 08:39:18 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -79,27 +79,6 @@
*/
#endif
-#define LINTERP_SZ( t, vec, to, a, b, sz ) \
-do { \
- switch (sz) { \
- case 2: vec[to][2] = 0.0; \
- case 3: vec[to][3] = 1.0; \
- } \
- switch (sz) { \
- case 4: vec[to][3] = LINTERP( t, vec[a][3], vec[b][3] ); \
- case 3: vec[to][2] = LINTERP( t, vec[a][2], vec[b][2] ); \
- case 2: vec[to][1] = LINTERP( t, vec[a][1], vec[b][1] ); \
- vec[to][0] = LINTERP( t, vec[a][0], vec[b][0] ); \
- } \
-} while(0)
-
-#define LINTERP_4F( t, vec, to, a, b, sz ) \
-do { \
- vec[to][3] = LINTERP( t, vec[a][3], vec[b][3] ); \
- vec[to][2] = LINTERP( t, vec[a][2], vec[b][2] ); \
- vec[to][1] = LINTERP( t, vec[a][1], vec[b][1] ); \
- vec[to][0] = LINTERP( t, vec[a][0], vec[b][0] ); \
-} while (0)
#define W(i) coord[i][3]
#define Z(i) coord[i][2]