diff options
Diffstat (limited to 'src/mesa/tnl')
38 files changed, 797 insertions, 793 deletions
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index cfc5e5debe9..f77fac1b2f6 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.9 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_array_api.c,v 1.10 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -78,7 +78,7 @@ static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start, #else /* Simple alternative to above code. */ - if (_tnl_hard_begin( ctx, mode )) + if (_tnl_hard_begin( ctx, mode )) { GLuint i; for (i=start;i<count;i++) { @@ -90,7 +90,7 @@ static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start, } -static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count, +static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count, const GLuint *indices) { #if 1 @@ -135,10 +135,10 @@ static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count, } -static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, - GLuint start, GLuint end, +static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, + GLuint start, GLuint end, GLsizei count, const GLuint *indices ) - + { TNLcontext *tnl = TNL_CONTEXT(ctx); FLUSH_CURRENT( ctx, 0 ); @@ -150,7 +150,7 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, tnl->vb.PrimitiveLength[0] = count; tnl->vb.Elts = (GLuint *)indices; - if (ctx->Array.LockCount) + if (ctx->Array.LockCount) _tnl_run_pipeline( ctx ); else { /* Note that arrays may have changed before/after execution. @@ -202,18 +202,18 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) /* The arrays are small enough to fit in a single VB; just bind * them and go. Any untransformed data will be copied on * clipping. - * + * * Invalidate any locked data dependent on these arrays. */ _tnl_vb_bind_arrays( ctx, start, count ); VB->FirstPrimitive = 0; VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; - VB->PrimitiveLength[0] = count - start; + VB->PrimitiveLength[0] = count - start; tnl->pipeline.run_input_changes |= ctx->Array._Enabled; _tnl_run_pipeline( ctx ); tnl->pipeline.run_input_changes |= ctx->Array._Enabled; } - } + } else if (!ctx->CompileFlag && mode == GL_TRIANGLE_STRIP) { int bufsz = (ctx->Const.MaxArrayLockSize - 2) & ~1; int j, nr; @@ -226,8 +226,8 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) nr = MIN2( bufsz, count - j ); _tnl_vb_bind_arrays( ctx, j, j + nr ); VB->FirstPrimitive = 0; - VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; - VB->PrimitiveLength[0] = nr; + VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; + VB->PrimitiveLength[0] = nr; tnl->pipeline.run_input_changes |= ctx->Array._Enabled; _tnl_run_pipeline( ctx ); tnl->pipeline.run_input_changes |= ctx->Array._Enabled; @@ -249,30 +249,30 @@ _tnl_DrawRangeElements(GLenum mode, /* Check arguments, etc. */ - if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, + if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) return; if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); - ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, + ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, count, type, indices ); - + if (ctx->Array.LockCount) { /* Are the arrays already locked? If so we currently have to look * at the whole locked range. */ if (start >= ctx->Array.LockFirst && end <= ctx->Array.LockCount) - _tnl_draw_range_elements( ctx, mode, - ctx->Array.LockFirst, + _tnl_draw_range_elements( ctx, mode, + ctx->Array.LockFirst, ctx->Array.LockCount, count, ui_indices ); else { /* The spec says referencing elements outside the locked * range is undefined. I'm going to make it a noop this time - * round, maybe come up with something beter before 3.6. + * round, maybe come up with something beter before 3.6. * * May be able to get away with just setting LockCount==0, * though this raises the problems of dependent state. May @@ -280,7 +280,7 @@ _tnl_DrawRangeElements(GLenum mode, * * Or scan the list and replace bad indices? */ - _mesa_problem( ctx, + _mesa_problem( ctx, "DrawRangeElements references " "elements outside locked range."); } @@ -300,7 +300,7 @@ _tnl_DrawRangeElements(GLenum mode, void -_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, +_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); @@ -315,22 +315,22 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); - ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, + ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, count, type, indices ); if (ctx->Array.LockCount) { - _tnl_draw_range_elements( ctx, mode, + _tnl_draw_range_elements( ctx, mode, ctx->Array.LockFirst, ctx->Array.LockCount, count, ui_indices ); - } + } else { /* Scan the index list and see if we can use the locked path anyway. */ GLuint max_elt = 0; GLint i; - for (i = 0 ; i < count ; i++) + for (i = 0 ; i < count ; i++) if (ui_indices[i] > max_elt) max_elt = ui_indices[i]; @@ -364,7 +364,7 @@ void _tnl_array_init( GLcontext *ctx ) _mesa_vector1ui_init( &tmp->Index, 0, 0 ); _mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) _mesa_vector4f_init( &tmp->TexCoord[i], 0, 0); tnl->tmp_primitive = (GLuint *)MALLOC(sizeof(GLuint)*tnl->vb.Size); diff --git a/src/mesa/tnl/t_array_api.h b/src/mesa/tnl/t_array_api.h index ebb99e78d6b..32a70443f56 100644 --- a/src/mesa/tnl/t_array_api.h +++ b/src/mesa/tnl/t_array_api.h @@ -1,10 +1,10 @@ -/* $Id: t_array_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_array_api.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 90cc0e53840..ecde7b29439 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,10 +1,10 @@ -/* $Id: t_array_import.c,v 1.10 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_array_import.c,v 1.11 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -50,13 +50,13 @@ static void _tnl_import_vertex( GLcontext *ctx, GLboolean is_writeable = 0; struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; - tmp = _ac_import_vertex(ctx, + tmp = _ac_import_vertex(ctx, GL_FLOAT, stride ? 4*sizeof(GLfloat) : 0, 0, - writeable, + writeable, &is_writeable); - + inputs->Obj.data = (GLfloat (*)[4]) tmp->Ptr; inputs->Obj.start = (GLfloat *) tmp->Ptr; inputs->Obj.stride = tmp->StrideB; @@ -76,10 +76,10 @@ static void _tnl_import_normal( GLcontext *ctx, GLboolean is_writeable = 0; struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; - tmp = _ac_import_normal(ctx, GL_FLOAT, - stride ? 3*sizeof(GLfloat) : 0, writeable, + tmp = _ac_import_normal(ctx, GL_FLOAT, + stride ? 3*sizeof(GLfloat) : 0, writeable, &is_writeable); - + inputs->Normal.data = (GLfloat (*)[3]) tmp->Ptr; inputs->Normal.start = (GLfloat *) tmp->Ptr; inputs->Normal.stride = tmp->StrideB; @@ -99,13 +99,13 @@ static void _tnl_import_color( GLcontext *ctx, GLboolean is_writeable = 0; struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; - tmp = _ac_import_color(ctx, - GL_UNSIGNED_BYTE, - stride ? 4*sizeof(GLubyte) : 0, + tmp = _ac_import_color(ctx, + GL_UNSIGNED_BYTE, + stride ? 4*sizeof(GLubyte) : 0, 4, - writeable, + writeable, &is_writeable); - + inputs->Color.data = (GLchan (*)[4]) tmp->Ptr; inputs->Color.start = (GLchan *) tmp->Ptr; inputs->Color.stride = tmp->StrideB; @@ -125,12 +125,12 @@ static void _tnl_import_secondarycolor( GLcontext *ctx, 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, GL_UNSIGNED_BYTE, + stride ? 4*sizeof(GLubyte) : 0, 4, - writeable, + writeable, &is_writeable); - + inputs->SecondaryColor.data = (GLchan (*)[4]) tmp->Ptr; inputs->SecondaryColor.start = (GLchan *) tmp->Ptr; inputs->SecondaryColor.stride = tmp->StrideB; @@ -149,10 +149,10 @@ static void _tnl_import_fogcoord( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; - tmp = _ac_import_fogcoord(ctx, GL_FLOAT, - stride ? sizeof(GLfloat) : 0, writeable, + tmp = _ac_import_fogcoord(ctx, GL_FLOAT, + stride ? sizeof(GLfloat) : 0, writeable, &is_writeable); - + inputs->FogCoord.data = (GLfloat *) tmp->Ptr; inputs->FogCoord.start = (GLfloat *) tmp->Ptr; inputs->FogCoord.stride = tmp->StrideB; @@ -171,10 +171,10 @@ static void _tnl_import_index( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; - tmp = _ac_import_index(ctx, GL_UNSIGNED_INT, - stride ? sizeof(GLuint) : 0, writeable, + tmp = _ac_import_index(ctx, GL_UNSIGNED_INT, + stride ? sizeof(GLuint) : 0, writeable, &is_writeable); - + inputs->Index.data = (GLuint *) tmp->Ptr; inputs->Index.start = (GLuint *) tmp->Ptr; inputs->Index.stride = tmp->StrideB; @@ -185,7 +185,7 @@ static void _tnl_import_index( GLcontext *ctx, inputs->Index.flags |= VEC_NOT_WRITEABLE; } - + static void _tnl_import_texcoord( GLcontext *ctx, GLuint i, GLboolean writeable, @@ -195,12 +195,12 @@ static void _tnl_import_texcoord( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; - tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, - stride ? 4*sizeof(GLfloat) : 0, + tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, + stride ? 4*sizeof(GLfloat) : 0, 0, - writeable, + writeable, &is_writeable); - + inputs->TexCoord[i].data = (GLfloat (*)[4]) tmp->Ptr; inputs->TexCoord[i].start = (GLfloat *) tmp->Ptr; inputs->TexCoord[i].stride = tmp->StrideB; @@ -211,8 +211,8 @@ static void _tnl_import_texcoord( GLcontext *ctx, if (!is_writeable) inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE; } - - + + static void _tnl_import_edgeflag( GLcontext *ctx, GLboolean writeable, GLboolean stride ) @@ -221,11 +221,11 @@ static void _tnl_import_edgeflag( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; - tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, - stride ? sizeof(GLubyte) : 0, - 0, + tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, + stride ? sizeof(GLubyte) : 0, + 0, &is_writeable); - + inputs->EdgeFlag.data = (GLubyte *) tmp->Ptr; inputs->EdgeFlag.start = (GLubyte *) tmp->Ptr; inputs->EdgeFlag.stride = tmp->StrideB; @@ -253,7 +253,7 @@ static void _tnl_upgrade_client_data( GLcontext *ctx, struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; (void) inputs; - if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) + if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) required |= VERT_OBJ; /* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */ @@ -295,13 +295,13 @@ static void _tnl_upgrade_client_data( GLcontext *ctx, } if (required & VERT_TEX_ANY) - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]); _tnl_import_texcoord( ctx, i, writeable, stride ); VB->importable_data &= ~VERT_TEX(i); } - + } @@ -323,11 +323,11 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) ASSERT(start == (GLint) ctx->Array.LockFirst); ASSERT(count == (GLint) ctx->Array.LockCount); } - + imports = tnl->pipeline.inputs; _ac_import_range( ctx, start, count ); - + VB->Count = count - start; VB->FirstClipped = VB->Count; @@ -335,14 +335,14 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) VB->MaterialMask = 0; VB->Material = 0; VB->Flag = 0; - + /* _tnl_print_vert_flags("_tnl_vb_bind_arrays: inputs", inputs); */ /* _tnl_print_vert_flags("_tnl_vb_bind_arrays: imports", imports); */ /* _tnl_print_vert_flags("_tnl_vb_bind_arrays: _Enabled", ctx->Array._Enabled); */ if (inputs & VERT_OBJ) { if (imports & VERT_OBJ) { - _tnl_import_vertex( ctx, 0, 0 ); + _tnl_import_vertex( ctx, 0, 0 ); tmp->Obj.count = VB->Count; } VB->ObjPtr = &tmp->Obj; @@ -350,7 +350,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) if (inputs & VERT_NORM) { if (imports & VERT_NORM) { - _tnl_import_normal( ctx, 0, 0 ); + _tnl_import_normal( ctx, 0, 0 ); tmp->Normal.count = VB->Count; } VB->NormalPtr = &tmp->Normal; @@ -358,7 +358,7 @@ 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 ); + _tnl_import_color( ctx, 0, 0 ); tmp->Color.count = VB->Count; } VB->ColorPtr[0] = &tmp->Color; @@ -367,42 +367,42 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) if (inputs & VERT_INDEX) { if (imports & VERT_INDEX) { - _tnl_import_index( ctx, 0, 0 ); + _tnl_import_index( ctx, 0, 0 ); tmp->Index.count = VB->Count; } VB->IndexPtr[0] = &tmp->Index; VB->IndexPtr[1] = 0; - } + } if (inputs & VERT_FOG_COORD) { if (imports & VERT_FOG_COORD) { - _tnl_import_fogcoord( ctx, 0, 0 ); + _tnl_import_fogcoord( ctx, 0, 0 ); tmp->FogCoord.count = VB->Count; } VB->FogCoordPtr = &tmp->FogCoord; } - + if (inputs & VERT_EDGE) { - _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); + _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data; } - + if (inputs & VERT_SPEC_RGB) { if (imports & VERT_SPEC_RGB) { - _tnl_import_secondarycolor( ctx, 0, 0 ); + _tnl_import_secondarycolor( ctx, 0, 0 ); tmp->SecondaryColor.count = VB->Count; } VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; VB->SecondaryColorPtr[1] = 0; } - + if (inputs & VERT_TEX_ANY) { GLuint i; for (i = 0; i < ctx->Const.MaxTextureUnits ; i++) if (inputs & VERT_TEX(i)) { if (imports & VERT_TEX(i)) { - _tnl_import_texcoord( ctx, i, 0, 0 ); + _tnl_import_texcoord( ctx, i, 0, 0 ); tmp->TexCoord[i].count = VB->Count; } VB->TexCoordPtr[i] = &tmp->TexCoord[i]; @@ -414,7 +414,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) 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); */ - + } @@ -424,7 +424,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) * consecutive calls to ArrayElement with consecutive indices. */ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, - GLuint start, GLuint count ) + GLuint start, GLuint count ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint required = ctx->Array._Enabled; @@ -449,7 +449,7 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, else if (ctx->Array.Vertex.Size == 3) required |= VERT_OBJ_23; - + if (required & VERT_NORM) { _math_trans_3f( IM->Normal + IM->Start, ctx->Array.Normal.Ptr, @@ -457,7 +457,7 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, ctx->Array.Normal.Type, start, n ); } - + if (required & VERT_EDGE) { _math_trans_1ub( IM->EdgeFlag + IM->Start, ctx->Array.EdgeFlag.Ptr, @@ -465,10 +465,10 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, ctx->Array.EdgeFlag.Type, start, n ); } - + if (required & VERT_RGBA) { _math_trans_4chan( IM->Color + IM->Start, - ctx->Array.Color.Ptr, + ctx->Array.Color.Ptr, ctx->Array.Color.StrideB, ctx->Array.Color.Type, ctx->Array.Color.Size, @@ -478,28 +478,28 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, 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, + ctx->Array.SecondaryColor.StrideB, + ctx->Array.SecondaryColor.Type, + ctx->Array.SecondaryColor.Size, start, n ); } if (required & VERT_FOG_COORD) { _math_trans_1f( IM->FogCoord + IM->Start, - ctx->Array.FogCoord.Ptr, + ctx->Array.FogCoord.Ptr, ctx->Array.FogCoord.StrideB, ctx->Array.FogCoord.Type, start, n ); } - + if (required & VERT_INDEX) { _math_trans_1ui( IM->Index + IM->Start, - ctx->Array.Index.Ptr, - ctx->Array.Index.StrideB, - ctx->Array.Index.Type, + ctx->Array.Index.Ptr, + ctx->Array.Index.StrideB, + ctx->Array.Index.Type, start, n ); } - + if (required & VERT_TEX_ANY) { for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { if (required & VERT_TEX(i)) { @@ -513,15 +513,13 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, if (ctx->Array.TexCoord[i].Size == 4) IM->TexSize |= TEX_SIZE_4(i); else if (ctx->Array.TexCoord[i].Size == 3) - IM->TexSize |= TEX_SIZE_3(i); + IM->TexSize |= TEX_SIZE_3(i); } } } - + IM->Count = IM->Start + n; IM->Flag[IM->Start] |= required; - for (i = IM->Start+1 ; i < IM->Count ; i++) + for (i = IM->Start+1 ; i < IM->Count ; i++) IM->Flag[i] = required; } - - diff --git a/src/mesa/tnl/t_array_import.h b/src/mesa/tnl/t_array_import.h index c1b903e24a5..1236850b91d 100644 --- a/src/mesa/tnl/t_array_import.h +++ b/src/mesa/tnl/t_array_import.h @@ -1,10 +1,10 @@ -/* $Id: t_array_import.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_array_import.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index c533e8a7f46..916f14bc57b 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -1,10 +1,10 @@ -/* $Id: t_context.c,v 1.14 2001/03/11 23:49:20 gareth Exp $ */ +/* $Id: t_context.c,v 1.15 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,7 +24,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <[email protected]> + * Keith Whitwell <[email protected]> */ diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index de6e052c0e6..22d0423d162 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -1,10 +1,10 @@ -/* $Id: t_context.h,v 1.16 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_context.h,v 1.17 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -48,7 +48,7 @@ #define IMM_SIZE (IMM_MAXDATA + MAX_CLIPPED_VERTICES) -/* Values for IM->BeginState +/* Values for IM->BeginState */ #define VERT_BEGIN_0 0x1 /* glBegin (if initially inside beg/end) */ #define VERT_BEGIN_1 0x2 /* glBegin (if initially outside beg/end) */ @@ -66,16 +66,16 @@ /* Flags that describe the inputs and outputs of pipeline stages, and - * the contents of a vertex-cassette. + * the contents of a vertex-cassette. * * 5 spare flags, rearrangement of eval flags can secure at least 3 - * more. + * more. */ -#define VERT_OBJ _NEW_ARRAY_VERTEX -#define VERT_RGBA _NEW_ARRAY_COLOR -#define VERT_NORM _NEW_ARRAY_NORMAL -#define VERT_INDEX _NEW_ARRAY_INDEX -#define VERT_EDGE _NEW_ARRAY_EDGEFLAG +#define VERT_OBJ _NEW_ARRAY_VERTEX +#define VERT_RGBA _NEW_ARRAY_COLOR +#define VERT_NORM _NEW_ARRAY_NORMAL +#define VERT_INDEX _NEW_ARRAY_INDEX +#define VERT_EDGE _NEW_ARRAY_EDGEFLAG #define VERT_SPEC_RGB _NEW_ARRAY_SECONDARYCOLOR #define VERT_FOG_COORD _NEW_ARRAY_FOGCOORD #define VERT_TEX0 _NEW_ARRAY_TEXCOORD_0 @@ -161,7 +161,7 @@ */ struct immediate { - struct __GLcontextRec *backref; + struct __GLcontextRec *backref; GLuint id, ref_count; /* This must be saved when immediates are shared in display lists. @@ -171,7 +171,7 @@ struct immediate GLuint AndFlag, OrFlag; GLuint TexSize; /* keep track of texcoord sizes */ GLuint BeginState, SavedBeginState; - GLuint LastPrimitive; + GLuint LastPrimitive; GLuint ArrayEltFlags; /* precalc'ed for glArrayElt */ GLuint ArrayEltIncr; @@ -180,7 +180,7 @@ struct immediate GLuint MaxTextureUnits; /* precalc'ed for glMultiTexCoordARB */ - /* Temporary values created when vertices are copied into the + /* Temporary values created when vertices are copied into the * first 3 slots of the struct: */ GLuint CopyOrFlag; @@ -200,8 +200,8 @@ 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 Obj[IMM_SIZE][4]; + GLchan 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]; @@ -265,27 +265,27 @@ typedef struct vertex_buffer GLuint *Primitive; /* GL_(mode)|PRIM_* flags */ GLuint *PrimitiveLength; /* integers */ - + GLuint importable_data; void (*import_data)( GLcontext *ctx, GLuint flags, GLuint vecflags ); /* Callback to the provider of the untransformed input for the * render stage (or other stages) to call if they need to write into * write-protected arrays, or fixup the stride on input arrays. - * + * * This is currently only necessary for client arrays that make it * as far down the pipeline as the render stage. */ GLuint LastClipped; /* Private data from _tnl_render_stage that has no business being - * in this struct. + * in this struct. */ } TNLvertexbuffer; -/* Describes an individual operation on the pipeline. +/* Describes an individual operation on the pipeline. */ struct gl_pipeline_stage { const char *name; @@ -299,9 +299,9 @@ struct gl_pipeline_stage { */ GLuint run_state; /* All state referenced in run() -- * When is the cached output of the - * stage invalidated? + * stage invalidated? */ - + GLboolean active; /* True if runnable in current state */ GLuint inputs; /* VERT_* inputs to the stage */ GLuint outputs; /* VERT_* outputs of the stage */ @@ -310,7 +310,7 @@ struct gl_pipeline_stage { */ GLuint changed_inputs; /* Generated value -- inputs to the * stage that have changed since last - * call to 'run'. + * call to 'run'. */ /* Private data for the pipeline stage: @@ -322,14 +322,14 @@ struct gl_pipeline_stage { void (*destroy)( struct gl_pipeline_stage * ); /* Called from _tnl_validate_pipeline(). Must update all fields in - * the pipeline_stage struct for the current state. + * the pipeline_stage struct for the current state. */ void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); /* Called from _tnl_run_pipeline(). The stage.changed_inputs value * encodes all inputs to thee struct which have changed. If * non-zero, recompute all affected outputs of the stage, otherwise - * execute any 'sideeffects' of the stage. + * execute any 'sideeffects' of the stage. * * Return value: GL_TRUE - keep going * GL_FALSE - finished pipeline @@ -354,17 +354,17 @@ struct tnl_eval_store { GLuint EvalMap2Flags; GLuint EvalNewState; - GLfloat Coord[IMM_SIZE][4]; - GLfloat Obj[IMM_SIZE][4]; - GLfloat TexCoord[IMM_SIZE][4]; + GLfloat Coord[IMM_SIZE][4]; + GLfloat Obj[IMM_SIZE][4]; + GLfloat TexCoord[IMM_SIZE][4]; GLfloat Normal[IMM_SIZE][3]; - GLchan Color[IMM_SIZE][4]; + GLchan Color[IMM_SIZE][4]; GLuint Index[IMM_SIZE]; GLuint Flag[IMM_SIZE]; GLuint Elts[IMM_SIZE]; }; -typedef struct { +typedef struct { /* Track whether the module is active. */ @@ -388,14 +388,14 @@ typedef struct { /* Set when executing an internally generated immediate. */ - GLboolean ReplayHardBeginEnd; + GLboolean ReplayHardBeginEnd; GLenum CurrentPrimitive; /* Note which vertices need copying over succesive immediates. * Will add save versions to precompute vertex copying where * possible. */ - struct immediate *ExecCopySource; + struct immediate *ExecCopySource; GLuint ExecCopyCount; GLuint ExecCopyElts[IMM_MAX_COPIED_VERTS]; GLuint ExecCopyTexSize; diff --git a/src/mesa/tnl/t_eval_api.c b/src/mesa/tnl/t_eval_api.c index 81a65451fe0..10700e83299 100644 --- a/src/mesa/tnl/t_eval_api.c +++ b/src/mesa/tnl/t_eval_api.c @@ -1,10 +1,10 @@ -/* $Id: t_eval_api.c,v 1.3 2001/03/03 20:33:31 brianp Exp $ */ +/* $Id: t_eval_api.c,v 1.4 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -50,7 +50,7 @@ * Thus we need to have a check in the display list code or * elsewhere for eval(1,2) vertices in the case where * map(1,2)_vertex is disabled, and to purge those vertices from - * the vb. + * the vb. */ void _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) @@ -83,8 +83,8 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) /* Need to turn off compilation -- this is already saved, and the * coordinates generated and the test above depend on state that - * may change before the list is executed. - * + * may change before the list is executed. + * * TODO: Anaylse display lists to determine if this state is * constant. */ @@ -137,7 +137,7 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) /* Need to turn off compilation -- this is already saved, and the * coordinates generated and the test above depend on state that - * may change before the list is executed. + * may change before the list is executed. */ { GLboolean compiling = ctx->CompileFlag; diff --git a/src/mesa/tnl/t_eval_api.h b/src/mesa/tnl/t_eval_api.h index fab6108c8da..49a463b8f71 100644 --- a/src/mesa/tnl/t_eval_api.h +++ b/src/mesa/tnl/t_eval_api.h @@ -1,10 +1,10 @@ -/* $Id: t_eval_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_eval_api.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -36,7 +36,7 @@ */ extern void _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); -extern void _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, +extern void _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); void _tnl_eval_init( GLcontext *ctx ); diff --git a/src/mesa/tnl/t_imm_alloc.c b/src/mesa/tnl/t_imm_alloc.c index 3aa0df72e3c..b624026767c 100644 --- a/src/mesa/tnl/t_imm_alloc.c +++ b/src/mesa/tnl/t_imm_alloc.c @@ -1,10 +1,10 @@ -/* $Id: t_imm_alloc.c,v 1.4 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_imm_alloc.c,v 1.5 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -50,7 +50,7 @@ struct immediate *_tnl_alloc_immediate( GLcontext *ctx ) IM->FlushElt = 0; IM->LastPrimitive = IMM_MAX_COPIED_VERTS; IM->Count = IMM_MAX_COPIED_VERTS; - IM->Start = IMM_MAX_COPIED_VERTS; + IM->Start = IMM_MAX_COPIED_VERTS; IM->Material = 0; IM->MaterialMask = 0; IM->MaxTextureUnits = ctx->Const.MaxTextureUnits; @@ -91,7 +91,7 @@ void _tnl_free_immediate( struct immediate *IM ) IM->MaterialMask = 0; } - for (j = 1; j < IM->MaxTextureUnits; j++) + for (j = 1; j < IM->MaxTextureUnits; j++) ALIGN_FREE( IM->TexCoord[j] ); @@ -99,6 +99,3 @@ void _tnl_free_immediate( struct immediate *IM ) freed++; /* printf("outstanding %d\n", id - freed); */ } - - - diff --git a/src/mesa/tnl/t_imm_alloc.h b/src/mesa/tnl/t_imm_alloc.h index 5640f80ceaa..37512cc2191 100644 --- a/src/mesa/tnl/t_imm_alloc.h +++ b/src/mesa/tnl/t_imm_alloc.h @@ -1,10 +1,10 @@ -/* $Id: t_imm_alloc.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_imm_alloc.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c index 64cf7b82f66..d6cc0ecb09c 100644 --- a/src/mesa/tnl/t_imm_api.c +++ b/src/mesa/tnl/t_imm_api.c @@ -1,9 +1,10 @@ +/* $Id: t_imm_api.c,v 1.8 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,8 +23,8 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: - * Keith Whitwell <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ @@ -45,15 +46,15 @@ #include "t_imm_dlist.h" -/* A cassette is full or flushed on a statechange. +/* A cassette is full or flushed on a statechange. */ void _tnl_flush_immediate( struct immediate *IM ) { GLcontext *ctx = IM->backref; - if (ctx->CompileFlag) + if (ctx->CompileFlag) _tnl_compile_cassette( ctx, IM ); - else + else _tnl_execute_cassette( ctx, IM ); } @@ -76,13 +77,13 @@ _tnl_begin( GLcontext *ctx, GLenum p ) if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glBegin(IM %d) %s\n", IM->id, _mesa_lookup_enum_by_nr(p)); - + if (ctx->NewState) _mesa_update_state(ctx); - + /* if only a very few slots left, might as well flush now */ - if (IM->Count > IMM_MAXDATA-8) { + if (IM->Count > IMM_MAXDATA-8) { _tnl_flush_immediate( IM ); IM = TNL_CURRENT_IM(ctx); } @@ -108,7 +109,7 @@ _tnl_begin( GLcontext *ctx, GLenum p ) ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); state |= (VERT_BEGIN_0|VERT_BEGIN_1); - IM->Flag[count] |= VERT_BEGIN; + IM->Flag[count] |= VERT_BEGIN; IM->Primitive[IM->LastPrimitive] &= ~PRIM_LAST; IM->Primitive[count] = p | PRIM_BEGIN | PRIM_LAST; IM->PrimitiveLength[IM->LastPrimitive] = count - IM->LastPrimitive; @@ -136,12 +137,12 @@ _tnl_Begin( GLenum mode ) if (mode > GL_POLYGON) { _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" ); - return; + return; } _tnl_begin(ctx, mode); - /* If compiling update SavePrimitive now. + /* If compiling update SavePrimitive now. * * In compile_and_exec mode, exec_primitive will be updated when * the cassette is finished. @@ -149,10 +150,10 @@ _tnl_Begin( GLenum mode ) * If not compiling, update exec_primitive now. */ if (ctx->CompileFlag) { - if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) + if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) - ctx->Driver.CurrentSavePrimitive = mode; + ctx->Driver.CurrentSavePrimitive = mode; } else if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) ctx->Driver.CurrentExecPrimitive = mode; @@ -164,10 +165,10 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) { struct immediate *IM = TNL_CURRENT_IM(ctx); GLuint count, last; - + if (ctx->NewState) _mesa_update_state(ctx); - + /* If not compiling, treat as a normal begin(). */ if (!ctx->CompileFlag) { @@ -178,53 +179,53 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) ctx->Driver.CurrentExecPrimitive = p; return GL_TRUE; } - - if (IM->Count > IMM_MAXDATA-8) { + + if (IM->Count > IMM_MAXDATA-8) { _tnl_flush_immediate( IM ); IM = TNL_CURRENT_IM(ctx); } - + switch (IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) { case VERT_BEGIN_0|VERT_BEGIN_1: /* This is an immediate known to be inside a begin/end object. */ IM->BeginState |= (VERT_ERROR_1|VERT_ERROR_0); return GL_FALSE; - + case VERT_BEGIN_0: case VERT_BEGIN_1: /* This is a display-list immediate in an unknown begin/end - * state. Assert it is empty and conviert it to a 'hard' one. + * state. Assert it is empty and conviert it to a 'hard' one. */ ASSERT (IM->SavedBeginState == 0); - + /* ASSERT (ctx->Driver.CurrentSavePrimitive >= GL_POLYGON+1); */ /* Push current beginstate, to be restored later. Don't worry * about raising errors. */ IM->SavedBeginState = IM->BeginState; - + /* FALLTHROUGH */ - case 0: - /* Unless we have fallen through, this is an immediate known to + case 0: + /* Unless we have fallen through, this is an immediate known to * be outside begin/end objects. */ - + IM->BeginState |= VERT_BEGIN_0|VERT_BEGIN_1; - + count = IM->Count; last = IM->LastPrimitive; ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); - IM->Flag[count] |= VERT_BEGIN; + IM->Flag[count] |= VERT_BEGIN; IM->Primitive[last] &= ~PRIM_LAST; IM->Primitive[count] = p | PRIM_BEGIN | PRIM_LAST; IM->PrimitiveLength[last] = count - last; IM->LastPrimitive = count; - + ASSERT (!IM->FlushElt); /* This is necessary as this immediate will not be flushed in @@ -234,10 +235,10 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; return GL_TRUE; - + default: ASSERT (0); - return GL_TRUE; + return GL_TRUE; } } @@ -245,16 +246,16 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) /* Need to do this to get the correct begin/end error behaviour from * functions like ColorPointerEXT which are still active in - * SAVE_AND_EXEC modes. + * SAVE_AND_EXEC modes. */ void _tnl_save_Begin( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - + if (mode > GL_POLYGON) { _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" ); - return; + return; } if (ctx->ExecuteFlag) { @@ -329,11 +330,11 @@ _tnl_end( GLcontext *ctx ) _tnl_translate_array_elts( ctx, IM, last, count ); IM->FlushElt = 0; } - + /* ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; */ } - IM->BeginState = state; + IM->BeginState = state; if (!ctx->CompileFlag) ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; @@ -356,7 +357,7 @@ _tnl_End(void) * COMPILE_AND_EXEC modes, need to keep exec primitive uptodate * otherwise. */ - if (ctx->CompileFlag) + if (ctx->CompileFlag) ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; } @@ -741,7 +742,7 @@ _tnl_TexCoord1f( GLfloat s ) static void _tnl_TexCoord2f( GLfloat s, GLfloat t ) { - TEXCOORD2F(s,t); + TEXCOORD2F(s,t); } @@ -884,7 +885,7 @@ static void _tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) { GET_IMMEDIATE; - VERTEX3F( IM, x, y, z ); + VERTEX3F( IM, x, y, z ); } static void _tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) @@ -1048,9 +1049,9 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v) /* KW: Because the eval values don't become 'current', fixup will flow * through these vertices, and then evaluation will write on top - * of the fixup results. + * of the fixup results. * - * Note: using Obj to hold eval coord data. + * Note: using Obj to hold eval coord data. */ #define EVALCOORD1(IM, x) \ { \ @@ -1078,7 +1079,7 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v) if (count == IMM_MAXDATA-1) \ _tnl_flush_immediate( IM ); \ } - + #define EVALPOINT2(IM, x, y) \ { \ GLuint count = IM->Count++; \ @@ -1157,11 +1158,11 @@ _tnl_ArrayElement( GLint i ) } -/* Internal functions. These are safe to use providing either: - * +/* Internal functions. These are safe to use providing either: + * * - It is determined that a display list is not being compiled, or * if so that these commands won't be compiled into the list (see - * t_eval.c for an example). + * t_eval.c for an example). * * - _tnl_hard_begin() is used instead of _tnl_[bB]egin, and tested * for a GL_TRUE return value. See _tnl_Rectf, below. @@ -1233,10 +1234,10 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) if (!IM->Material) { IM->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) * IMM_SIZE * 2 ); - IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); + IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); } else if (IM->MaterialOrMask & ~bitmask) { - _mesa_copy_material_pairs( IM->Material[count], + _mesa_copy_material_pairs( IM->Material[count], IM->Material[IM->LastMaterial], IM->MaterialOrMask & ~bitmask ); } @@ -1245,7 +1246,7 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) IM->LastMaterial = count; IM->MaterialMask[count] = 0; } - + IM->MaterialOrMask |= bitmask; IM->MaterialMask[count] |= bitmask; mat = IM->Material[count]; @@ -1353,13 +1354,13 @@ void _tnl_imm_vtxfmt_init( GLcontext *ctx ) vfmt->Vertex4f = _tnl_Vertex4f; vfmt->Vertex4fv = _tnl_Vertex4fv; - /* Outside begin/end functions (from t_varray.c, t_eval.c, ...): + /* Outside begin/end functions (from t_varray.c, t_eval.c, ...): */ vfmt->Rectf = _tnl_Rectf; /* Just use the core function: */ - vfmt->CallList = _mesa_CallList; + vfmt->CallList = _mesa_CallList; vfmt->prefer_float_colors = GL_FALSE; } diff --git a/src/mesa/tnl/t_imm_api.h b/src/mesa/tnl/t_imm_api.h index 3c0686403d4..ad1827f1f8a 100644 --- a/src/mesa/tnl/t_imm_api.h +++ b/src/mesa/tnl/t_imm_api.h @@ -1,21 +1,21 @@ -/* $Id: t_imm_api.h,v 1.2 2001/01/08 21:56:00 keithw Exp $ */ +/* $Id: t_imm_api.h,v 1.3 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL diff --git a/src/mesa/tnl/t_imm_debug.c b/src/mesa/tnl/t_imm_debug.c index 192259afcda..ded4ee4d0c1 100644 --- a/src/mesa/tnl/t_imm_debug.c +++ b/src/mesa/tnl/t_imm_debug.c @@ -1,21 +1,21 @@ -/* $Id: t_imm_debug.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_imm_debug.c,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -28,7 +28,7 @@ #include "t_context.h" #include "t_imm_debug.h" -void _tnl_print_vert_flags( const char *name, GLuint flags ) +void _tnl_print_vert_flags( const char *name, GLuint flags ) { fprintf(stderr, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", @@ -61,7 +61,7 @@ void _tnl_print_vert_flags( const char *name, GLuint flags ) ); } -void _tnl_print_cassette( struct immediate *IM ) +void _tnl_print_cassette( struct immediate *IM ) { GLuint i; GLuint *flags = IM->Flag; @@ -70,7 +70,7 @@ void _tnl_print_cassette( struct immediate *IM ) GLuint state = IM->BeginState; GLuint req = ~0; - fprintf(stderr, "Cassette id %d, %u rows.\n", IM->id, + fprintf(stderr, "Cassette id %d, %u rows.\n", IM->id, IM->Count - IM->CopyStart); _tnl_print_vert_flags("Contains at least one", orflag); @@ -78,7 +78,7 @@ void _tnl_print_cassette( struct immediate *IM ) if (IM->Count != IM->CopyStart) { _tnl_print_vert_flags("Contains a full complement of", andflag); - + fprintf(stderr, "Final begin/end state %s/%s, errors %s/%s\n", (state & VERT_BEGIN_0) ? "in" : "out", (state & VERT_BEGIN_1) ? "in" : "out", @@ -115,7 +115,7 @@ void _tnl_print_cassette( struct immediate *IM ) GLuint j; for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { if (req & flags[i] & VERT_TEX(j)) { - fprintf(stderr, + fprintf(stderr, "TC%d %f %f %f %f", j, IM->TexCoord[j][i][0], IM->TexCoord[j][i][1], @@ -145,7 +145,7 @@ void _tnl_print_cassette( struct immediate *IM ) if (req & flags[i] & VERT_MATERIAL) fprintf(stderr, " Material "); - + /* The order of these two is not easily knowable, but this is * the usually correct way to look at them. @@ -154,7 +154,7 @@ void _tnl_print_cassette( struct immediate *IM ) fprintf(stderr, " END "); if (req & flags[i] & VERT_BEGIN) - fprintf(stderr, " BEGIN(%s) (%s%s%s%s)", + fprintf(stderr, " BEGIN(%s) (%s%s%s%s)", _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", @@ -164,6 +164,3 @@ void _tnl_print_cassette( struct immediate *IM ) fprintf(stderr, "\n"); } } - - - diff --git a/src/mesa/tnl/t_imm_debug.h b/src/mesa/tnl/t_imm_debug.h index aaae5c11da3..f735a9ca9f9 100644 --- a/src/mesa/tnl/t_imm_debug.h +++ b/src/mesa/tnl/t_imm_debug.h @@ -1,3 +1,31 @@ +/* $Id: t_imm_debug.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <[email protected]> + */ #ifndef _T_DEBUG_H #define _T_DEBUG_H diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c index 33d3149ed0a..0ce1909c9f0 100644 --- a/src/mesa/tnl/t_imm_dlist.c +++ b/src/mesa/tnl/t_imm_dlist.c @@ -1,21 +1,21 @@ -/* $Id: t_imm_dlist.c,v 1.10 2001/03/03 20:33:31 brianp Exp $ */ +/* $Id: t_imm_dlist.c,v 1.11 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,8 +23,8 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: - * Keith Whitwell <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ @@ -67,7 +67,7 @@ static void execute_compiled_cassette( GLcontext *ctx, void *data ); /* Insert the active immediate struct onto the display list currently * being built. */ -void +void _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) { struct immediate *im = TNL_CURRENT_IM(ctx); @@ -84,7 +84,7 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) GLuint andflag = ~0; GLuint i; GLuint start = IM->FlushElt ? IM->LastPrimitive : IM->CopyStart; - _tnl_translate_array_elts( ctx, IM, start, IM->Count ); + _tnl_translate_array_elts( ctx, IM, start, IM->Count ); /* Need to recompute andflag. */ @@ -104,14 +104,14 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive; ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); - - node = (TNLvertexcassette *) - _mesa_alloc_instruction(ctx, + + node = (TNLvertexcassette *) + _mesa_alloc_instruction(ctx, tnl->opcode_vertex_cassette, sizeof(TNLvertexcassette)); - if (!node) + if (!node) return; - + node->IM = im; im->ref_count++; node->Start = im->Start; node->Count = im->Count; @@ -128,8 +128,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) if (ctx->ExecuteFlag) { execute_compiled_cassette( ctx, (void *)node ); } - - + + /* Discard any errors raised in the last cassette. */ new_beginstate = node->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1); @@ -140,7 +140,7 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) if (im->Count > IMM_MAXDATA - 16) { /* Call it full... */ - struct immediate *new_im = _tnl_alloc_immediate(ctx); + struct immediate *new_im = _tnl_alloc_immediate(ctx); if (!new_im) return; new_im->ref_count++; im->ref_count--; /* remove CURRENT_IM reference */ @@ -153,11 +153,11 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) */ _tnl_reset_input( ctx, im->Count+1+IMM_MAX_COPIED_VERTS, new_beginstate, node->SavedBeginState); - } + } } -static void +static void execute_compiled_cassette( GLcontext *ctx, void *data ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -169,14 +169,14 @@ execute_compiled_cassette( GLcontext *ctx, void *data ) if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); - + IM->Start = node->Start; IM->CopyStart = node->Start; IM->Count = node->Count; IM->BeginState = node->BeginState; - IM->SavedBeginState = node->SavedBeginState; + IM->SavedBeginState = node->SavedBeginState; IM->OrFlag = node->OrFlag; - IM->TexSize = node->TexSize; + IM->TexSize = node->TexSize; IM->AndFlag = node->AndFlag; IM->LastData = node->LastData; IM->LastPrimitive = node->LastPrimitive; @@ -215,7 +215,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data ) _tnl_fixup_compiled_cassette( ctx, IM ); _tnl_get_exec_copy_verts( ctx, IM ); - _tnl_run_cassette( ctx, IM ); + _tnl_run_cassette( ctx, IM ); _tnl_restore_compiled_cassette( ctx, IM ); if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) @@ -232,13 +232,13 @@ destroy_compiled_cassette( GLcontext *ctx, void *data ) } -static void +static void print_compiled_cassette( GLcontext *ctx, void *data ) { TNLvertexcassette *node = (TNLvertexcassette *)data; struct immediate *IM = node->IM; - fprintf(stderr, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n", + fprintf(stderr, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n", node->IM->id, node->Start, node->Count); IM->Start = node->Start; @@ -271,19 +271,19 @@ void _tnl_EndCallList( GLcontext *ctx ) { /* May have to copy vertices from a dangling begin/end inside the - * list to the current immediate. + * list to the current immediate. */ if (ctx->CallDepth == 0) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct immediate *IM = TNL_CURRENT_IM(ctx); - if (tnl->ExecCopySource != IM) + if (tnl->ExecCopySource != IM) _tnl_copy_immediate_vertices( ctx, IM ); } } -void +void _tnl_EndList( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -312,16 +312,16 @@ _tnl_EndList( GLcontext *ctx ) SET_IMMEDIATE( ctx, IM ); IM->ref_count++; - _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); + _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); - /* outside begin/end, even in COMPILE_AND_EXEC, - * so no vertices to copy, right? + /* outside begin/end, even in COMPILE_AND_EXEC, + * so no vertices to copy, right? */ ASSERT(TNL_CONTEXT(ctx)->ExecCopyCount == 0); } -void +void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) { struct immediate *IM = TNL_CURRENT_IM(ctx); @@ -341,16 +341,15 @@ _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) } -void +void _tnl_dlist_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->opcode_vertex_cassette = + tnl->opcode_vertex_cassette = _mesa_alloc_opcode( ctx, sizeof(TNLvertexcassette), execute_compiled_cassette, destroy_compiled_cassette, print_compiled_cassette ); } - diff --git a/src/mesa/tnl/t_imm_dlist.h b/src/mesa/tnl/t_imm_dlist.h index 69c7bdfdbc2..e4080832ed4 100644 --- a/src/mesa/tnl/t_imm_dlist.h +++ b/src/mesa/tnl/t_imm_dlist.h @@ -1,10 +1,10 @@ -/* $Id: t_imm_dlist.h,v 1.2 2001/01/08 21:56:00 keithw Exp $ */ +/* $Id: t_imm_dlist.h,v 1.3 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,8 +23,8 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: - * Keith Whitwell <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ #ifndef _T_DLIST_H diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c index 6fe8f9aa141..1ef6a8c2f20 100644 --- a/src/mesa/tnl/t_imm_elt.c +++ b/src/mesa/tnl/t_imm_elt.c @@ -1,10 +1,10 @@ -/* $Id: t_imm_elt.c,v 1.5 2001/03/08 15:23:47 brianp Exp $ */ +/* $Id: t_imm_elt.c,v 1.6 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -597,7 +597,7 @@ static void _tnl_trans_elt_1f(GLfloat *to, GLuint start, GLuint n ) { - _tnl_trans_elt_1f_tab[TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_1f_tab[TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -605,7 +605,7 @@ static void _tnl_trans_elt_1f(GLfloat *to, match, start, n ); - + } static void _tnl_trans_elt_1ui(GLuint *to, @@ -616,7 +616,7 @@ static void _tnl_trans_elt_1ui(GLuint *to, GLuint start, GLuint n ) { - _tnl_trans_elt_1ui_tab[TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_1ui_tab[TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -624,7 +624,7 @@ static void _tnl_trans_elt_1ui(GLuint *to, match, start, n ); - + } @@ -636,7 +636,7 @@ static void _tnl_trans_elt_1ub(GLubyte *to, GLuint start, GLuint n ) { - _tnl_trans_elt_1ub_tab[TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_1ub_tab[TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -644,7 +644,7 @@ static void _tnl_trans_elt_1ub(GLubyte *to, match, start, n ); - + } @@ -656,7 +656,7 @@ static void _tnl_trans_elt_4ub(GLubyte (*to)[4], GLuint start, GLuint n ) { - _tnl_trans_elt_4ub_tab[from->Size][TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_4ub_tab[from->Size][TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -664,7 +664,7 @@ static void _tnl_trans_elt_4ub(GLubyte (*to)[4], match, start, n ); - + } static void _tnl_trans_elt_4us(GLushort (*to)[4], @@ -675,7 +675,7 @@ static void _tnl_trans_elt_4us(GLushort (*to)[4], GLuint start, GLuint n ) { - _tnl_trans_elt_4us_tab[from->Size][TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_4us_tab[from->Size][TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -683,7 +683,7 @@ static void _tnl_trans_elt_4us(GLushort (*to)[4], match, start, n ); - + } static void _tnl_trans_elt_4f(GLfloat (*to)[4], @@ -694,7 +694,7 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4], GLuint start, GLuint n ) { - _tnl_trans_elt_4f_tab[from->Size][TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_4f_tab[from->Size][TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -702,7 +702,7 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4], match, start, n ); - + } static void _tnl_trans_elt_4chan(GLchan (*to)[4], @@ -734,7 +734,7 @@ static void _tnl_trans_elt_3f(GLfloat (*to)[3], GLuint start, GLuint n ) { - _tnl_trans_elt_3f_tab[TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_3f_tab[TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -749,12 +749,12 @@ static void _tnl_trans_elt_3f(GLfloat (*to)[3], /* Batch function to translate away all the array elements in the * input buffer prior to transform. Done only the first time a vertex - * buffer is executed or compiled. + * buffer is executed or compiled. * - * KW: Have to do this after each glEnd if arrays aren't locked. + * KW: Have to do this after each glEnd if arrays aren't locked. */ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, - GLuint start, GLuint count ) + GLuint start, GLuint count ) { GLuint *flags = IM->Flag; GLuint *elts = IM->Elt; @@ -826,14 +826,12 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, if (ctx->Array.TexCoord[i].Size == 4) IM->TexSize |= TEX_SIZE_4(i); else if (ctx->Array.TexCoord[i].Size == 3) - IM->TexSize |= TEX_SIZE_3(i); + IM->TexSize |= TEX_SIZE_3(i); } } - for (i = start ; i < count ; i++) + for (i = start ; i < count ; i++) if (flags[i] & VERT_ELT) flags[i] |= translate; IM->CopyOrFlag |= translate; } - - diff --git a/src/mesa/tnl/t_imm_elt.h b/src/mesa/tnl/t_imm_elt.h index 180b75fbee8..d2d709d9c0f 100644 --- a/src/mesa/tnl/t_imm_elt.h +++ b/src/mesa/tnl/t_imm_elt.h @@ -1,10 +1,10 @@ -/* $Id: t_imm_elt.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_imm_elt.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -37,7 +37,7 @@ extern void _tnl_imm_elt_init( void ); -extern void _tnl_translate_array_elts( GLcontext *ctx, +extern void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, GLuint start, GLuint end ); diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c index 1207a9ab158..aa1d2f4810c 100644 --- a/src/mesa/tnl/t_imm_eval.c +++ b/src/mesa/tnl/t_imm_eval.c @@ -1,10 +1,10 @@ -/* $Id: t_imm_eval.c,v 1.5 2001/02/20 18:28:52 keithw Exp $ */ +/* $Id: t_imm_eval.c,v 1.6 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -98,7 +98,7 @@ static void eval1_4f( GLvector4f *dest, 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, + _math_horner_bezier_curve(map->Points, to[i], u, dimension, map->Order); } @@ -129,7 +129,7 @@ static void eval1_1ui( GLvector1ui *dest, static void eval1_norm( GLvector3f *dest, GLfloat coord[][4], - const GLuint *flags, + const GLuint *flags, struct gl_1d_map *map ) { const GLfloat u1 = map->u1; @@ -304,22 +304,22 @@ static void eval2_color( GLvector4chan *dest, static void copy_4f( GLfloat to[][4], GLfloat from[][4], GLuint count ) { - MEMCPY( to, from, count * sizeof(to[0])); + MEMCPY( to, from, count * sizeof(to[0])); } static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count ) { - MEMCPY( to, from, (count) * sizeof(to[0])); + 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])); + MEMCPY( to, from, (count) * sizeof(to[0])); } static void copy_1ui( GLuint to[], GLuint from[], GLuint count ) { - MEMCPY( to, from, (count) * sizeof(to[0])); + MEMCPY( to, from, (count) * sizeof(to[0])); } @@ -368,13 +368,13 @@ static void update_eval( GLcontext *ctx ) eval1 |= VERT_OBJ_23; if (ctx->Eval.Map2Vertex4) { - if (ctx->Eval.AutoNormal) + if (ctx->Eval.AutoNormal) eval2 |= VERT_OBJ_234 | VERT_NORM; else eval2 |= VERT_OBJ_234; } else if (ctx->Eval.Map2Vertex3) { - if (ctx->Eval.AutoNormal) + if (ctx->Eval.AutoNormal) eval2 |= VERT_OBJ_23 | VERT_NORM; else eval2 |= VERT_OBJ_23; @@ -388,14 +388,14 @@ static void update_eval( GLcontext *ctx ) /* This looks a lot like a pipeline stage, but for various reasons is * better handled outside the pipeline, and considered the final stage - * of fixing up an immediate struct for execution. + * of fixing up an immediate struct for execution. * * Really want to cache the results of this function in display lists, - * at least for EvalMesh commands. + * at least for EvalMesh commands. */ -void _tnl_eval_vb( GLcontext *ctx, +void _tnl_eval_vb( GLcontext *ctx, GLfloat (*coord)[4], - GLuint orflag, + GLuint orflag, GLuint andflag ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -417,18 +417,18 @@ void _tnl_eval_vb( GLcontext *ctx, if (any_eval1 && !ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3) purge_flags = (VERT_EVAL_P1|VERT_EVAL_C1); - if (any_eval2 && !ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) + if (any_eval2 && !ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) purge_flags |= (VERT_EVAL_P1|VERT_EVAL_C1); - if (any_eval1) + if (any_eval1) req |= tnl->pipeline.inputs & tnl->eval.EvalMap1Flags; - if (any_eval2) + if (any_eval2) req |= tnl->pipeline.inputs & tnl->eval.EvalMap2Flags; - + /* Translate points into coords. Use store->Coord to hold the - * new data. + * new data. */ if (any_eval1 && (orflag & VERT_EVAL_P1)) { @@ -455,13 +455,13 @@ void _tnl_eval_vb( GLcontext *ctx, */ if (req & VERT_INDEX) { - if (!all_eval) + if (!all_eval) copy_1ui( store->Index, tmp->Index.data, count ); tmp->Index.data = store->Index; tmp->Index.start = store->Index; - if (ctx->Eval.Map1Index && any_eval1) + if (ctx->Eval.Map1Index && any_eval1) eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index ); if (ctx->Eval.Map2Index && any_eval2) @@ -487,11 +487,11 @@ void _tnl_eval_vb( GLcontext *ctx, if (req & VERT_TEX(0)) { - if (!all_eval) + if (!all_eval) copy_4f( store->TexCoord, tmp->TexCoord[0].data, count ); - else + else tmp->TexCoord[0].size = 0; - + tmp->TexCoord[0].data = store->TexCoord; tmp->TexCoord[0].start = (GLfloat *)store->TexCoord; @@ -507,7 +507,7 @@ void _tnl_eval_vb( GLcontext *ctx, else if (ctx->Eval.Map1TextureCoord2) { eval1_4f( &tmp->TexCoord[0], coord, flags, 2, &ctx->EvalMap.Map1Texture2 ); - } + } else if (ctx->Eval.Map1TextureCoord1) { eval1_4f( &tmp->TexCoord[0], coord, flags, 1, &ctx->EvalMap.Map1Texture1 ); @@ -520,7 +520,7 @@ void _tnl_eval_vb( GLcontext *ctx, &ctx->EvalMap.Map2Texture4 ); } else if (ctx->Eval.Map2TextureCoord3) { - eval2_4f( &tmp->TexCoord[0], coord, flags, 3, + eval2_4f( &tmp->TexCoord[0], coord, flags, 3, &ctx->EvalMap.Map2Texture3 ); } else if (ctx->Eval.Map2TextureCoord2) { @@ -569,7 +569,7 @@ void _tnl_eval_vb( GLcontext *ctx, if (any_eval1) { if (ctx->Eval.Map1Vertex4) { - eval1_4f( &tmp->Obj, coord, flags, 4, + eval1_4f( &tmp->Obj, coord, flags, 4, &ctx->EvalMap.Map1Vertex4 ); } else if (ctx->Eval.Map1Vertex3) { @@ -581,16 +581,16 @@ void _tnl_eval_vb( GLcontext *ctx, if (any_eval2) { if (ctx->Eval.Map2Vertex4) { - if (ctx->Eval.AutoNormal && (req & VERT_NORM)) - eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, + if (ctx->Eval.AutoNormal && (req & VERT_NORM)) + eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, &ctx->EvalMap.Map2Vertex4 ); else - eval2_4f( &tmp->Obj, coord, flags, 4, + eval2_4f( &tmp->Obj, coord, flags, 4, &ctx->EvalMap.Map2Vertex4 ); } else if (ctx->Eval.Map2Vertex3) { - if (ctx->Eval.AutoNormal && (req & VERT_NORM)) + if (ctx->Eval.AutoNormal && (req & VERT_NORM)) eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3, &ctx->EvalMap.Map2Vertex3 ); else @@ -605,7 +605,7 @@ void _tnl_eval_vb( GLcontext *ctx, GLuint i; copy_1ui( store->Flag, flags, count ); tnl->vb.Flag = store->Flag; - + /* This is overkill, but correct as fixup will have copied the * values to all vertices in the VB - we may be falsely stating * that some repeated values are new, but doing so is fairly @@ -615,10 +615,3 @@ void _tnl_eval_vb( GLcontext *ctx, store->Flag[i] |= req; } } - - - - - - - diff --git a/src/mesa/tnl/t_imm_eval.h b/src/mesa/tnl/t_imm_eval.h index 06a91e0cd5b..951a93d896d 100644 --- a/src/mesa/tnl/t_imm_eval.h +++ b/src/mesa/tnl/t_imm_eval.h @@ -1,10 +1,10 @@ -/* $Id: t_imm_eval.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_imm_eval.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c index ff8cc00989d..888d8c34c33 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.15 2001/03/08 15:23:47 brianp Exp $ */ +/* $Id: t_imm_exec.c,v 1.16 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +24,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <[email protected]> + * Keith Whitwell <[email protected]> */ @@ -59,9 +59,9 @@ /* Called to initialize new buffers, and to recycle old ones. */ -void _tnl_reset_input( GLcontext *ctx, +void _tnl_reset_input( GLcontext *ctx, GLuint start, - GLuint beginstate, + GLuint beginstate, GLuint savedbeginstate ) { struct immediate *IM = TNL_CURRENT_IM(ctx); @@ -74,7 +74,7 @@ void _tnl_reset_input( GLcontext *ctx, IM->CopyStart = IM->Start = IM->Count = start; IM->Primitive[IM->Start] = (ctx->Driver.CurrentExecPrimitive | PRIM_LAST); IM->LastPrimitive = IM->Start; - IM->BeginState = beginstate; + IM->BeginState = beginstate; IM->SavedBeginState = savedbeginstate; IM->TexSize = 0; IM->LastMaterial = 0; @@ -95,9 +95,9 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM, if (MESA_VERBOSE&VERBOSE_IMMEDIATE) _tnl_print_vert_flags("copy to current", flag); - if (flag & VERT_NORM) - COPY_3FV( ctx->Current.Normal, IM->Normal[count]); - + if (flag & VERT_NORM) + COPY_3FV( ctx->Current.Normal, IM->Normal[count]); + if (flag & VERT_INDEX) ctx->Current.Index = IM->Index[count]; @@ -128,10 +128,10 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM, } if (flag & VERT_MATERIAL) { - _mesa_update_material( ctx, - IM->Material[IM->LastMaterial], + _mesa_update_material( ctx, + IM->Material[IM->LastMaterial], IM->MaterialOrMask ); - + _mesa_validate_all_lighting_tables( ctx ); } } @@ -159,7 +159,7 @@ void _tnl_compute_orflag( struct immediate *IM ) * calls like 'glNormal', 'glMaterial' that occur after the final * glVertex, glEval, etc. Additionally, a buffer can consist of * eg. a single glMaterial call, in which case IM->Start == - * IM->Count, but the buffer is definitely not empty. + * IM->Count, but the buffer is definitely not empty. */ if (IM->Flag[i] & VERT_DATA) { IM->LastData++; @@ -178,7 +178,7 @@ 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 - * at position zero. + * at position zero. */ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) { @@ -188,7 +188,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) GLuint inputs = tnl->pipeline.inputs; /* for copy-to-current */ GLuint start = IM->CopyStart; GLuint count = IM->Count - start; - + /* TODO: optimize the case where nothing has changed. (Just bind * tmp to vb). */ @@ -233,10 +233,10 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) tmp->Obj.data = IM->Obj + start; tmp->Obj.start = (GLfloat *)(IM->Obj + start); tmp->Obj.count = count; - VB->ObjPtr = &tmp->Obj; - if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_234) + VB->ObjPtr = &tmp->Obj; + if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_234) tmp->Obj.size = 4; - else if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_23) + else if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_23) tmp->Obj.size = 3; else tmp->Obj.size = 2; @@ -292,7 +292,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) tmp->TexCoord[i].size = 2; if (IM->TexSize & TEX_SIZE_3(i)) { tmp->TexCoord[i].size = 3; - if (IM->TexSize & TEX_SIZE_4(i)) + if (IM->TexSize & TEX_SIZE_4(i)) tmp->TexCoord[i].size = 4; } VB->TexCoordPtr[i] = &tmp->TexCoord[i]; @@ -303,7 +303,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) if ((inputs & VERT_MATERIAL) && IM->Material) { VB->MaterialMask = IM->MaterialMask + start; VB->Material = IM->Material + start; - } + } } @@ -317,27 +317,27 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ) _tnl_vb_bind_immediate( ctx, IM ); - if (IM->CopyOrFlag & VERT_EVAL_ANY) - _tnl_eval_vb( ctx, - IM->Obj + IM->CopyStart, - IM->CopyOrFlag, + if (IM->CopyOrFlag & VERT_EVAL_ANY) + _tnl_eval_vb( ctx, + IM->Obj + IM->CopyStart, + IM->CopyOrFlag, IM->CopyAndFlag ); - + /* Invalidate all stored data before and after run: */ tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; - _tnl_run_pipeline( ctx ); + _tnl_run_pipeline( ctx ); tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; - _tnl_copy_to_current( ctx, IM, IM->OrFlag ); + _tnl_copy_to_current( ctx, IM, IM->OrFlag ); } /* Called for pure, locked VERT_ELT cassettes instead of - * _tnl_run_cassette. + * _tnl_run_cassette. */ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) { @@ -359,14 +359,14 @@ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) * TODO: delay this until FlushVertices */ if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { - _tnl_translate_array_elts( ctx, IM, IM->LastData, IM->LastData ); + _tnl_translate_array_elts( ctx, IM, IM->LastData, IM->LastData ); _tnl_copy_to_current( ctx, IM, ctx->Array._Enabled ); } } -/* Called for regular vertex cassettes. +/* Called for regular vertex cassettes. */ static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) { @@ -374,7 +374,7 @@ static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) GLuint andflag = ~0; GLuint i; GLuint start = IM->FlushElt ? IM->LastPrimitive : IM->CopyStart; - _tnl_translate_array_elts( ctx, IM, start, IM->Count ); + _tnl_translate_array_elts( ctx, IM, start, IM->Count ); /* Need to recompute andflag. */ @@ -389,7 +389,7 @@ static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) _tnl_fixup_input( ctx, IM ); /* _tnl_print_cassette( IM ); */ - _tnl_run_cassette( ctx, IM ); + _tnl_run_cassette( ctx, IM ); } @@ -414,14 +414,14 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) _tnl_validate_pipeline( ctx ); _tnl_get_exec_copy_verts( ctx, IM ); - + if (IM->CopyStart == IM->Count) { - if (IM->OrFlag & VERT_ELT) - _tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->CopyStart ); + if (IM->OrFlag & VERT_ELT) + _tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->CopyStart ); _tnl_copy_to_current( ctx, IM, IM->OrFlag ); } - else if ((IM->OrFlag & VERT_DATA) == VERT_ELT && + else if ((IM->OrFlag & VERT_DATA) == VERT_ELT && ctx->Array.LockCount && ctx->Array.Vertex.Enabled) { exec_elt_cassette( ctx, IM ); @@ -430,13 +430,13 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) exec_vert_cassette( ctx, IM ); } - _tnl_reset_input( ctx, + _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, - IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1), - IM->SavedBeginState ); + IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1), + IM->SavedBeginState ); /* Copy vertices and primitive information to immediate before it - * can be overwritten. + * can be overwritten. */ _tnl_copy_immediate_vertices( ctx, IM ); @@ -479,7 +479,7 @@ void _tnl_imm_init( GLcontext *ctx ) _mesa_vector1ui_init( &tmp->Index, 0, 0 ); _mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) _mesa_vector4f_init( &tmp->TexCoord[i], 0, 0); /* Install the first immediate. Intially outside begin/end. @@ -493,7 +493,7 @@ void _tnl_imm_init( GLcontext *ctx ) void _tnl_imm_destroy( GLcontext *ctx ) { - if (TNL_CURRENT_IM(ctx)) + if (TNL_CURRENT_IM(ctx)) _tnl_free_immediate( TNL_CURRENT_IM(ctx) ); } diff --git a/src/mesa/tnl/t_imm_exec.h b/src/mesa/tnl/t_imm_exec.h index ab5fa292d71..8cdede46f01 100644 --- a/src/mesa/tnl/t_imm_exec.h +++ b/src/mesa/tnl/t_imm_exec.h @@ -1,10 +1,10 @@ -/* $Id: t_imm_exec.h,v 1.3 2001/02/15 01:33:52 keithw Exp $ */ +/* $Id: t_imm_exec.h,v 1.4 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -52,9 +52,9 @@ extern void _tnl_imm_init( GLcontext *ctx ); extern void _tnl_imm_destroy( GLcontext *ctx ); -extern void _tnl_reset_input( GLcontext *ctx, +extern void _tnl_reset_input( GLcontext *ctx, GLuint start, - GLuint beginstate, + GLuint beginstate, GLuint savedbeginstate ); extern void _tnl_compute_orflag( struct immediate *IM ); diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c index 7827941d23d..fd7f4b1231d 100644 --- a/src/mesa/tnl/t_imm_fixup.c +++ b/src/mesa/tnl/t_imm_fixup.c @@ -1,10 +1,10 @@ -/* $Id: t_imm_fixup.c,v 1.8 2001/03/03 20:33:31 brianp Exp $ */ +/* $Id: t_imm_fixup.c,v 1.9 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -26,7 +26,7 @@ /* * Authors: - * Keith Whitwell <[email protected]> + * Keith Whitwell <[email protected]> */ @@ -226,7 +226,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) fixup = ~andflag & VERT_FIXUP; - if (!ctx->CompileFlag) + if (!ctx->CompileFlag) fixup &= tnl->pipeline.inputs; if (!ctx->ExecuteFlag) @@ -238,7 +238,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) if (fixup) { GLuint copy = fixup & ~IM->Flag[start]; - + /* Equivalent to a lazy copy-from-current when setting up the * immediate. */ @@ -261,7 +261,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) if (copy & VERT_INDEX) IM->Index[start] = ctx->Current.Index; - + if (copy & VERT_EDGE) IM->EdgeFlag[start] = ctx->Current.EdgeFlag; @@ -281,7 +281,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) GLuint i; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { if (fixup & VERT_TEX(i)) { - if (orflag & VERT_TEX(i)) + if (orflag & VERT_TEX(i)) fixup_4f( IM->TexCoord[i], IM->Flag, start, VERT_TEX(i) ); else fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_END_VB, start, @@ -356,7 +356,7 @@ static void copy_material( struct immediate *next, IMM_SIZE * 2 ); next->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); } - + next->MaterialMask[dst] = prev->MaterialMask[src]; MEMCPY(next->Material[dst], prev->Material[src], 2*sizeof(GLmaterial)); } @@ -370,7 +370,7 @@ static void copy_material( struct immediate *next, * primitives. * * Have to be careful with the transitions between display list - * replay, compile and normal execute modes. + * replay, compile and normal execute modes. */ static void copy_vertices( GLcontext *ctx, struct immediate *next, @@ -382,7 +382,7 @@ static void copy_vertices( GLcontext *ctx, GLuint offset = IMM_MAX_COPIED_VERTS - count; GLuint i; - next->CopyStart = next->Start - count; + next->CopyStart = next->Start - count; /* Copy the vertices */ @@ -392,7 +392,7 @@ static void copy_vertices( GLcontext *ctx, GLuint dst = next->CopyStart+i; COPY_4FV( next->Obj[dst], prev->Obj[src] ); - COPY_3FV( next->Normal[dst], prev->Normal[src] ); + COPY_3FV( next->Normal[dst], prev->Normal[src] ); COPY_CHAN4( next->Color[dst], prev->Color[src] ); if (prev->OrFlag & VERT_TEX_ANY) { @@ -415,13 +415,13 @@ static void copy_vertices( GLcontext *ctx, next->CopyOrFlag |= prev->Flag[src]; /* redundant for current_im */ next->CopyAndFlag &= prev->Flag[src]; /* redundant for current_im */ } - + ASSERT(prev == tnl->ExecCopySource); if (--tnl->ExecCopySource->ref_count == 0) _tnl_free_immediate( tnl->ExecCopySource ); - + next->ref_count++; tnl->ExecCopySource = next; @@ -442,16 +442,16 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *IM ) /* Need to push this in now as it won't be computed anywhere else/ */ IM->TexSize = tnl->ExecCopyTexSize; - + /* A wrapped primitive. We may be copying into a revived * display list immediate, or onto the front of a new execute-mode * immediate. */ - copy_vertices( ctx, IM, - tnl->ExecCopySource, + copy_vertices( ctx, IM, + tnl->ExecCopySource, tnl->ExecCopyCount, tnl->ExecCopyElts ); - + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { /* Immediates are built by default to be correct in this state, * and copying to the first slots of an immediate doesn't remove @@ -462,14 +462,14 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *IM ) ASSERT(IM->CopyStart == IM->Start); } - /* Copy the primitive information: + /* Copy the primitive information: */ IM->Primitive[IM->CopyStart] = (ctx->Driver.CurrentExecPrimitive | PRIM_LAST); IM->LastPrimitive = IM->CopyStart; if (tnl->ExecParity) IM->Primitive[IM->CopyStart] |= PRIM_PARITY; } - + /* Revive a compiled immediate struct - propogate new 'Current' * values. Often this is redundant because the current values were @@ -489,8 +489,8 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) IM->CopyAndFlag = IM->AndFlag; /* redundant for current_im */ IM->CopyTexSize = IM->TexSize | tnl->ExecCopyTexSize; - copy_vertices( ctx, IM, - tnl->ExecCopySource, + copy_vertices( ctx, IM, + tnl->ExecCopySource, tnl->ExecCopyCount, tnl->ExecCopyElts ); @@ -540,7 +540,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) /* Can potentially overwrite primitive details - need to save the - * first slot: + * first slot: */ tnl->DlistPrimitive = IM->Primitive[IM->Start]; tnl->DlistPrimitiveLength = IM->PrimitiveLength[IM->Start]; @@ -554,15 +554,15 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { GLuint i; - if (IM->BeginState & VERT_ERROR_1) + if (IM->BeginState & VERT_ERROR_1) _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) - if (IM->Flag[i] & (VERT_BEGIN|VERT_END_VB)) + if (IM->Flag[i] & (VERT_BEGIN|VERT_END_VB)) break; /* Would like to just ignore vertices upto this point. Can't - * set copystart because it might skip materials? + * set copystart because it might skip materials? */ ASSERT(IM->Start == IM->CopyStart); if (i > IM->CopyStart) { @@ -578,25 +578,25 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) } else { GLuint i; - if (IM->BeginState & VERT_ERROR_0) + if (IM->BeginState & VERT_ERROR_0) _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); - + if (IM->CopyStart == IM->Start && IM->Flag[IM->Start] & (VERT_END|VERT_END_VB)) { } - else + else { IM->Primitive[IM->CopyStart] = ctx->Driver.CurrentExecPrimitive; - if (tnl->ExecParity) - IM->Primitive[IM->CopyStart] |= PRIM_PARITY; - - + if (tnl->ExecParity) + IM->Primitive[IM->CopyStart] |= PRIM_PARITY; + + for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) if (IM->Flag[i] & (VERT_END|VERT_END_VB)) { IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; if (IM->Flag[i] & VERT_END_VB) { - IM->Primitive[IM->CopyStart] |= PRIM_LAST; + IM->Primitive[IM->CopyStart] |= PRIM_LAST; IM->LastPrimitive = IM->CopyStart; } if (IM->Flag[i] & VERT_END) { @@ -610,7 +610,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) if (IM->Primitive[IM->LastPrimitive] & PRIM_END) ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1; else - ctx->Driver.CurrentExecPrimitive = + ctx->Driver.CurrentExecPrimitive = IM->Primitive[IM->LastPrimitive] & PRIM_MODE_MASK; } @@ -626,9 +626,9 @@ void _tnl_restore_compiled_cassette( GLcontext *ctx, struct immediate *IM ) } - - + + static void copy_none( TNLcontext *tnl, GLuint start, GLuint count, GLuint ovf) { @@ -694,7 +694,7 @@ static copy_func copy_tab[GL_POLYGON+2] = -/* Figure out what vertices need to be copied next time. +/* Figure out what vertices need to be copied next time. */ void _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) @@ -708,7 +708,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) GLuint pincr = increment[prim]; GLuint pintro = intro[prim]; GLuint ovf = 0; - + if (tnl->ExecCopySource != IM) { if (--tnl->ExecCopySource->ref_count == 0) @@ -728,7 +728,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) if (pincr != 1 && (IM->Count - last - pintro)) ovf = (IM->Count - last - pintro) % pincr; - + if (last < IM->Count) copy_tab[prim]( tnl, last, IM->Count, ovf ); } @@ -743,7 +743,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) * etc. * * Generate the index list that will be used to render this immediate - * struct. + * struct. * * Finally, generate a new primitives list for rendering the indices. */ @@ -759,16 +759,16 @@ void _tnl_fixup_purged_eval( GLcontext *ctx, GLuint good_index = (VERT_EVAL_ANY & ~purge)|VERT_OBJ; GLuint prim_length = 0, lastprim = 0, nextprim = 0; - if (fixup & VERT_TEX0) + if (fixup & VERT_TEX0) fixup_4f( store->TexCoord, flags, 0, VERT_TEX0|fixup_fence ); - if (fixup & VERT_INDEX) + if (fixup & VERT_INDEX) fixup_1ui( store->Index, flags, 0, VERT_INDEX|fixup_fence ); - if (fixup & VERT_RGBA) + if (fixup & VERT_RGBA) fixup_4chan( store->Color, flags, 0, VERT_RGBA|fixup_fence ); - if (fixup & VERT_NORM) + if (fixup & VERT_NORM) fixup_3f( store->Normal, flags, 0, VERT_NORM|fixup_fence ); for (i = 0, j = 0 ; i < tnl->vb.Count ; i++) { @@ -784,7 +784,7 @@ void _tnl_fixup_purged_eval( GLcontext *ctx, lastprimlen = VB->PrimitiveLength[i]; } } - + VB->Elts = store->Elts; /* What about copying??? No immediate exists with the right diff --git a/src/mesa/tnl/t_imm_fixup.h b/src/mesa/tnl/t_imm_fixup.h index a6740a2a55b..6cf1e3bfd13 100644 --- a/src/mesa/tnl/t_imm_fixup.h +++ b/src/mesa/tnl/t_imm_fixup.h @@ -1,10 +1,10 @@ -/* $Id: t_imm_fixup.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ +/* $Id: t_imm_fixup.h,v 1.2 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -35,10 +35,10 @@ extern void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ); -extern void _tnl_fixup_compiled_cassette( GLcontext *ctx, +extern void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ); -extern void _tnl_restore_compiled_cassette( GLcontext *ctx, +extern void _tnl_restore_compiled_cassette( GLcontext *ctx, struct immediate *IM ); diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index f1c5a255a5d..0d43a1fbcab 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -1,10 +1,10 @@ -/* $Id: t_pipeline.c,v 1.13 2001/02/16 00:35:35 keithw Exp $ */ +/* $Id: t_pipeline.c,v 1.14 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,8 +23,8 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: - * Keith Whitwell <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ #include "glheader.h" @@ -41,7 +41,7 @@ #include "t_pipeline.h" -void _tnl_install_pipeline( GLcontext *ctx, +void _tnl_install_pipeline( GLcontext *ctx, const struct gl_pipeline_stage **stages ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -71,7 +71,7 @@ void _tnl_destroy_pipeline( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; - for (i = 0 ; i < tnl->pipeline.nr_stages ; i++) + for (i = 0 ; i < tnl->pipeline.nr_stages ; i++) tnl->pipeline.stages[i].destroy( &tnl->pipeline.stages[i] ); tnl->pipeline.nr_stages = 0; @@ -95,22 +95,22 @@ void _tnl_validate_pipeline( GLcontext *ctx ) for (i = pipe->nr_stages+1 ; --i ; s++) { s->changed_inputs |= s->inputs & changed_inputs; - - if (s->check_state & newstate) { + + if (s->check_state & newstate) { if (s->active) { GLuint old_outputs = s->outputs; s->check(ctx, s); if (!s->active) changed_inputs |= old_outputs; } - else + else s->check(ctx, s); } if (s->active) { pipe->inputs |= s->inputs & ~generated; generated |= s->outputs; - } + } } } @@ -136,10 +136,10 @@ void _tnl_run_pipeline( GLcontext *ctx ) ctx->Driver.PipelineStart( ctx ); /* If something changes in the pipeline, tag all subsequent stages - * using this value for recalculation. + * using this value for recalculation. * * Even inactive stages have their state and inputs examined to try - * to keep cached data alive over state-changes. + * to keep cached data alive over state-changes. */ for (i = pipe->nr_stages+1 ; --i ; s++) { s->changed_inputs |= s->inputs & changed_inputs; @@ -151,7 +151,7 @@ void _tnl_run_pipeline( GLcontext *ctx ) if (s->active) { if (running) { - if (s->changed_inputs) + if (s->changed_inputs) changed_inputs |= s->outputs; /* fprintf(stderr, "run %s\n", s->name); */ @@ -174,9 +174,9 @@ void _tnl_run_pipeline( GLcontext *ctx ) * simple hardware rasterizers. For customization, I don't recommend * tampering with the internals of these stages in the way that * drivers did in Mesa 3.4. These stages are basically black boxes, - * and should be left intact. + * and should be left intact. * - * To customize the pipeline, consider: + * To customize the pipeline, consider: * * - removing redundant stages (making sure that the software rasterizer * can cope with this on fallback paths). An example is fog @@ -199,17 +199,16 @@ void _tnl_run_pipeline( GLcontext *ctx ) * pipeline by returning GL_FALSE from run(), or do nothing). * * Some work can be done to lift some of the restrictions in the final - * case, if it becomes necessary to do so. + * case, if it becomes necessary to do so. */ const struct gl_pipeline_stage *_tnl_default_pipeline[] = { - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_point_attenuation_stage, + &_tnl_vertex_transform_stage, + &_tnl_normal_transform_stage, + &_tnl_lighting_stage, + &_tnl_fog_coordinate_stage, + &_tnl_texgen_stage, + &_tnl_texture_transform_stage, + &_tnl_point_attenuation_stage, &_tnl_render_stage, 0 }; - diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h index 8c996da89ef..60b349d0e01 100644 --- a/src/mesa/tnl/t_pipeline.h +++ b/src/mesa/tnl/t_pipeline.h @@ -1,10 +1,10 @@ -/* $Id: t_pipeline.h,v 1.6 2001/02/16 00:35:35 keithw Exp $ */ +/* $Id: t_pipeline.h,v 1.7 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,8 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -42,19 +41,19 @@ extern void _tnl_validate_pipeline( GLcontext *ctx ); extern void _tnl_destroy_pipeline( GLcontext *ctx ); -extern void _tnl_install_pipeline( GLcontext *ctx, +extern void _tnl_install_pipeline( GLcontext *ctx, const struct gl_pipeline_stage **stages ); /* These are implemented in the t_vb_*.c files: */ -extern const struct gl_pipeline_stage _tnl_vertex_transform_stage; -extern const struct gl_pipeline_stage _tnl_normal_transform_stage; -extern const struct gl_pipeline_stage _tnl_lighting_stage; -extern const struct gl_pipeline_stage _tnl_fog_coordinate_stage; -extern const struct gl_pipeline_stage _tnl_texgen_stage; -extern const struct gl_pipeline_stage _tnl_texture_transform_stage; -extern const struct gl_pipeline_stage _tnl_point_attenuation_stage; +extern const struct gl_pipeline_stage _tnl_vertex_transform_stage; +extern const struct gl_pipeline_stage _tnl_normal_transform_stage; +extern const struct gl_pipeline_stage _tnl_lighting_stage; +extern const struct gl_pipeline_stage _tnl_fog_coordinate_stage; +extern const struct gl_pipeline_stage _tnl_texgen_stage; +extern const struct gl_pipeline_stage _tnl_texture_transform_stage; +extern const struct gl_pipeline_stage _tnl_point_attenuation_stage; extern const struct gl_pipeline_stage _tnl_render_stage; /* Shorthand to plug in the default pipeline: diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index 59dc0b2fec1..371563a6b02 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -1,21 +1,21 @@ -/* $Id: t_vb_cliptmp.h,v 1.8 2001/01/29 20:47:39 keithw Exp $ */ +/* $Id: t_vb_cliptmp.h,v 1.9 2001/03/12 00:48:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -159,7 +159,7 @@ static __inline void TAG(clip_line)( GLcontext *ctx, /* Clip a triangle against the viewport and user clip planes. */ -static __inline void TAG(clip_tri)( GLcontext *ctx, +static __inline void TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) { @@ -211,7 +211,7 @@ static __inline void TAG(clip_tri)( GLcontext *ctx, /* Clip a quad against the viewport and user clip planes. */ -static __inline void TAG(clip_quad)( GLcontext *ctx, +static __inline void TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLubyte mask ) { diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index c39806d6af0..0cffbbb0d15 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -1,10 +1,10 @@ -/* $Id: t_vb_fog.c,v 1.7 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_fog.c,v 1.8 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -85,14 +85,14 @@ static void init_static_data( void ) } -static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, +static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, const GLvector1f *in ) { GLfloat end = ctx->Fog.End; GLfloat *v = in->start; GLuint stride = in->stride; GLuint n = in->count; - GLfloat *data = out->data; + GLfloat *data = out->data; GLfloat d; GLuint i; @@ -111,7 +111,7 @@ static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, break; case GL_EXP: d = ctx->Fog.Density; - for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) + for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) NEG_EXP( data[i], d*ABSF(*v) ); break; case GL_EXP2: @@ -128,7 +128,7 @@ static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, } -static GLboolean run_fog_stage( GLcontext *ctx, +static GLboolean run_fog_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -144,7 +144,7 @@ static GLboolean run_fog_stage( GLcontext *ctx, if (!ctx->_NeedEyeCoords) { GLfloat *m = ctx->ModelView.m; GLfloat plane[4]; - + /* Use this to store calculated eye z values: */ input = &store->fogcoord; @@ -194,7 +194,7 @@ static void check_fog_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_fog_data( GLcontext *ctx, +static GLboolean alloc_fog_data( GLcontext *ctx, struct gl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -228,11 +228,11 @@ static void free_fog_data( struct gl_pipeline_stage *stage ) } -const struct gl_pipeline_stage _tnl_fog_coordinate_stage = -{ +const struct gl_pipeline_stage _tnl_fog_coordinate_stage = +{ "build fog coordinates", _NEW_FOG, - _NEW_FOG, + _NEW_FOG, 0, 0, VERT_FOG_COORD, /* active, inputs, outputs */ 0, 0, /* changed_inputs, private_data */ free_fog_data, /* dtr */ diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index d7d1d26ca44..4fbe52fe47e 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.11 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_light.c,v 1.12 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -141,10 +141,10 @@ static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) _mesa_vector4f_clean_elem(input, VB->Count, 2); } } - + if (VB->Flag) ind = LIGHT_FLAGS; - else + else ind = 0; /* The individual tabs know about replaying side-effects vs. full @@ -158,19 +158,19 @@ static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) /* Called in place of do_lighting when the light table may have changed. */ -static GLboolean run_validate_lighting( GLcontext *ctx, +static GLboolean run_validate_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) { GLuint ind = 0; - light_func *tab; - + light_func *tab; + if (ctx->Visual.rgbMode) { if (ctx->Light._NeedVertices) { if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) tab = _tnl_light_spec_tab; else - tab = _tnl_light_tab; - } + tab = _tnl_light_tab; + } else { if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) tab = _tnl_light_fast_single_tab; @@ -183,7 +183,7 @@ static GLboolean run_validate_lighting( GLcontext *ctx, if (ctx->Light.ColorMaterialEnabled) ind |= LIGHT_COLORMATERIAL; - + if (ctx->Light.Model.TwoSide) ind |= LIGHT_TWOSIDE; @@ -202,7 +202,7 @@ static GLboolean run_validate_lighting( GLcontext *ctx, /* Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ -static GLboolean run_init_lighting( GLcontext *ctx, +static GLboolean run_init_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -244,9 +244,9 @@ static void check_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) if (stage->privatePtr) stage->run = run_validate_lighting; stage->inputs = VERT_NORM|VERT_MATERIAL; - if (ctx->Light._NeedVertices) + if (ctx->Light._NeedVertices) stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */ - if (ctx->Light.ColorMaterialEnabled) + if (ctx->Light.ColorMaterialEnabled) stage->inputs |= VERT_RGBA; stage->outputs = VERT_RGBA; @@ -261,19 +261,19 @@ 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] ); - _mesa_vector1ui_free( &store->LitIndex[0] ); - _mesa_vector1ui_free( &store->LitIndex[1] ); + _mesa_vector4chan_free( &store->LitColor[0] ); + _mesa_vector4chan_free( &store->LitColor[1] ); + _mesa_vector4chan_free( &store->LitSecondary[0] ); + _mesa_vector4chan_free( &store->LitSecondary[1] ); + _mesa_vector1ui_free( &store->LitIndex[0] ); + _mesa_vector1ui_free( &store->LitIndex[1] ); FREE( store ); stage->privatePtr = 0; } } -const struct gl_pipeline_stage _tnl_lighting_stage = -{ +const struct gl_pipeline_stage _tnl_lighting_stage = +{ "lighting", _NEW_LIGHT, /* recheck */ _NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency @@ -285,4 +285,3 @@ const struct gl_pipeline_stage _tnl_lighting_stage = check_lighting, /* check */ run_init_lighting /* run -- initially set to ctr */ }; - diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index 370061512f1..7b9a1ba404f 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -1,21 +1,21 @@ -/* $Id: t_vb_lighttmp.h,v 1.9 2001/03/03 20:33:31 brianp Exp $ */ +/* $Id: t_vb_lighttmp.h,v 1.10 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * + * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -56,7 +56,7 @@ # define VSTRIDE vstride # define NSTRIDE nstride # define CHECK_MATERIAL(x) 0 /* no materials on array paths */ -# define CHECK_END_VB(XX) (XX >= nr) +# define CHECK_END_VB(XX) (XX >= nr) # if (IDX & LIGHT_COLORMATERIAL) # define CMSTRIDE STRIDE_4CHAN(CMcolor, CMstride) # define CHECK_COLOR_MATERIAL(x) (x < nr) /* always have colormaterial */ @@ -81,7 +81,7 @@ -static void TAG(light_rgba_spec)( GLcontext *ctx, +static void TAG(light_rgba_spec)( GLcontext *ctx, struct vertex_buffer *VB, struct gl_pipeline_stage *stage, GLvector4f *input ) @@ -94,7 +94,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *)input->data; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLchan (*CMcolor)[4]; @@ -111,7 +111,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, GLuint *new_material_mask = VB->MaterialMask; (void) flags; - (void) nstride; + (void) nstride; (void) vstride; /* fprintf(stderr, "%s\n", __FUNCTION__ ); */ @@ -134,14 +134,14 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, if (stage->changed_inputs == 0) return; - for ( j=0 ; - j<nr ; - j++,STRIDE_F(vertex,VSTRIDE),STRIDE_F(normal,NSTRIDE),CMSTRIDE) + for ( j=0 ; + 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) ) + + if ( CHECK_COLOR_MATERIAL(j) ) _mesa_update_color_material( ctx, CMcolor[j] ); if ( CHECK_MATERIAL(j) ) @@ -157,12 +157,12 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, COPY_3V(sum[1], base[1]); ZERO_3V(spec[1]); } - + /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat correction; - GLint side; + GLint side; GLfloat contrib[3]; GLfloat attenuation; GLfloat VP[3]; /* unit vector from vertex to light */ @@ -186,15 +186,15 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); } - - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); - + if (PV_dot_dir<light->_CosCutoff) { continue; /* this light makes no contribution */ } @@ -209,7 +209,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, } - if (attenuation < 1e-3) + if (attenuation < 1e-3) continue; /* this light makes no contribution */ /* Compute dot product or normal and vector from V to light pos */ @@ -228,10 +228,10 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, else { if (IDX & LIGHT_TWOSIDE) { ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); - } + } side = 0; correction = 1; - } + } /* diffuse term */ COPY_3V(contrib, light->_MatAmbient[side]); @@ -255,7 +255,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, else { h = light->_h_inf_norm; } - + n_dot_h = correction * DOT3(normal, h); if (n_dot_h > 0.0F) { @@ -274,17 +274,17 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, 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]; } - } + } } -static void TAG(light_rgba)( GLcontext *ctx, +static void TAG(light_rgba)( GLcontext *ctx, struct vertex_buffer *VB, struct gl_pipeline_stage *stage, GLvector4f *input ) @@ -297,7 +297,7 @@ static void TAG(light_rgba)( GLcontext *ctx, GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *) input->data; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLchan (*CMcolor)[4]; @@ -313,7 +313,7 @@ static void TAG(light_rgba)( GLcontext *ctx, /* fprintf(stderr, "%s\n", __FUNCTION__ ); */ (void) flags; - (void) nstride; + (void) nstride; (void) vstride; if (IDX & LIGHT_COLORMATERIAL) { @@ -328,16 +328,16 @@ static void TAG(light_rgba)( GLcontext *ctx, if (stage->changed_inputs == 0) return; - for ( j=0 ; - j<nr ; - j++,STRIDE_F(vertex,VSTRIDE), STRIDE_F(normal,NSTRIDE),CMSTRIDE) + for ( j=0 ; + 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) ) + if ( CHECK_COLOR_MATERIAL(j) ) _mesa_update_color_material( ctx, (GLchan *)CMcolor[j] ); - + if ( CHECK_MATERIAL(j) ) _mesa_update_material( ctx, new_material[j], new_material_mask[j] ); @@ -345,16 +345,16 @@ static void TAG(light_rgba)( GLcontext *ctx, _mesa_validate_all_lighting_tables( ctx ); COPY_3V(sum[0], base[0]); - - if ( IDX & LIGHT_TWOSIDE ) + + if ( IDX & LIGHT_TWOSIDE ) COPY_3V(sum[1], base[1]); - + /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat correction; - GLint side; + GLint side; GLfloat contrib[3]; GLfloat attenuation = 1.0; GLfloat VP[3]; /* unit vector from vertex to light */ @@ -380,8 +380,8 @@ static void TAG(light_rgba)( GLcontext *ctx, SELF_SCALE_SCALAR_3V(VP, invd); } - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ @@ -401,8 +401,8 @@ static void TAG(light_rgba)( GLcontext *ctx, } } - - if (attenuation < 1e-3) + + if (attenuation < 1e-3) continue; /* this light makes no contribution */ @@ -414,7 +414,7 @@ static void TAG(light_rgba)( GLcontext *ctx, ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); if (!(IDX & LIGHT_TWOSIDE)) - continue; + continue; side = 1; correction = -1; @@ -423,11 +423,11 @@ static void TAG(light_rgba)( GLcontext *ctx, else { if (IDX & LIGHT_TWOSIDE) { ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); - } + } side = 0; correction = 1; - } - + } + COPY_3V(contrib, light->_MatAmbient[side]); /* diffuse term */ @@ -451,14 +451,14 @@ static void TAG(light_rgba)( GLcontext *ctx, else { h = light->_h_inf_norm; } - + n_dot_h = correction * DOT3(normal, h); - if (n_dot_h > 0.0F) + if (n_dot_h > 0.0F) { GLfloat spec_coef; struct gl_shine_tab *tab = ctx->_ShineTable[side]; - + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); ACC_SCALE_SCALAR_3V( contrib, spec_coef, @@ -467,7 +467,7 @@ static void TAG(light_rgba)( GLcontext *ctx, } ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib ); - } + } UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] ); Fcolor[j][3] = sumA[0]; @@ -476,7 +476,7 @@ static void TAG(light_rgba)( GLcontext *ctx, UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] ); Bcolor[j][3] = sumA[1]; } - } + } } @@ -484,14 +484,14 @@ static void TAG(light_rgba)( GLcontext *ctx, /* As below, but with just a single light. */ -static void TAG(light_fast_rgba_single)( GLcontext *ctx, +static void TAG(light_fast_rgba_single)( GLcontext *ctx, struct vertex_buffer *VB, struct gl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLchan (*CMcolor)[4]; GLuint CMstride; @@ -510,7 +510,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, (void) input; /* doesn't refer to Eye or Obj */ (void) flags; (void) nr; - (void) nstride; + (void) nstride; if (IDX & LIGHT_COLORMATERIAL) { CMcolor = VB->ColorPtr[0]->data; @@ -526,10 +526,10 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, do { - if ( CHECK_COLOR_MATERIAL(j) ) + if ( CHECK_COLOR_MATERIAL(j) ) _mesa_update_color_material( ctx, (GLchan *)CMcolor[j] ); - - if ( CHECK_MATERIAL(j) ) + + if ( CHECK_MATERIAL(j) ) _mesa_update_material( ctx, new_material[j], new_material_mask[j] ); if ( CHECK_VALIDATE(j) ) @@ -544,7 +544,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, COPY_3V(base[0], light->_MatAmbient[0]); ACC_3V(base[0], ctx->Light._BaseColor[0] ); UNCLAMPED_FLOAT_TO_RGB_CHAN( baseubyte[0], base[0] ); - + if (IDX & LIGHT_TWOSIDE) { COPY_3V(base[1], light->_MatAmbient[1]); ACC_3V(base[1], ctx->Light._BaseColor[1]); @@ -552,9 +552,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, } } - do { + do { GLfloat n_dot_VP = DOT3(normal, light->_VP_inf_norm); - + COPY_CHAN4(Fcolor[j], baseubyte[0]); if (IDX & LIGHT_TWOSIDE) COPY_CHAN4(Bcolor[j], baseubyte[1]); @@ -568,7 +568,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, 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 { @@ -577,7 +577,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, COPY_3V(sum, base[0]); ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]); if (n_dot_h > 0.0F) { - GLfloat spec; + GLfloat spec; GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]); @@ -589,28 +589,28 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, STRIDE_F(normal, NSTRIDE); } while (DO_ANOTHER_NORMAL(j)); - + for ( ; REUSE_LIGHT_RESULTS(j) ; j++ ) { COPY_CHAN4(Fcolor[j], Fcolor[j-1]); - if (IDX & LIGHT_TWOSIDE) + if (IDX & LIGHT_TWOSIDE) COPY_CHAN4(Bcolor[j], Bcolor[j-1]); STRIDE_F(normal, NSTRIDE); } } while (!CHECK_END_VB(j)); -} +} /* Light infinite lights */ -static void TAG(light_fast_rgba)( GLcontext *ctx, +static void TAG(light_fast_rgba)( GLcontext *ctx, struct vertex_buffer *VB, struct gl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); const GLchan *sumA = ctx->Light._BaseAlpha; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLchan (*CMcolor)[4]; GLuint CMstride; @@ -627,7 +627,7 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, (void) flags; (void) input; (void) nr; - (void) nstride; + (void) nstride; if (IDX & LIGHT_COLORMATERIAL) { CMcolor = VB->ColorPtr[0]->data; @@ -645,10 +645,10 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, do { GLfloat sum[2][3]; - if ( CHECK_COLOR_MATERIAL(j) ) + if ( CHECK_COLOR_MATERIAL(j) ) _mesa_update_color_material( ctx, CMcolor[j] ); - if ( CHECK_MATERIAL(j) ) + if ( CHECK_MATERIAL(j) ) _mesa_update_material( ctx, new_material[j], new_material_mask[j] ); if ( CHECK_VALIDATE(j) ) @@ -656,14 +656,14 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, COPY_3V(sum[0], ctx->Light._BaseColor[0]); - if (IDX & LIGHT_TWOSIDE) + if (IDX & LIGHT_TWOSIDE) COPY_3V(sum[1], ctx->Light._BaseColor[1]); foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h, n_dot_VP, spec; ACC_3V(sum[0], light->_MatAmbient[0]); - if (IDX & LIGHT_TWOSIDE) + if (IDX & LIGHT_TWOSIDE) ACC_3V(sum[1], light->_MatAmbient[1]); n_dot_VP = DOT3(normal, light->_VP_inf_norm); @@ -674,9 +674,9 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, 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( sum[0], spec, light->_MatSpecular[0]); - } + } } else if (IDX & LIGHT_TWOSIDE) { ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]); @@ -684,15 +684,15 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, 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( sum[1], 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]; @@ -713,7 +713,7 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, } } while (!CHECK_END_VB(j)); -} +} @@ -728,7 +728,7 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, * normal - array of [n] surface normal vector * Output: indexResult - resulting array of [n] color indexes */ -static void TAG(light_ci)( GLcontext *ctx, +static void TAG(light_ci)( GLcontext *ctx, struct vertex_buffer *VB, struct gl_pipeline_stage *stage, GLvector4f *input ) @@ -737,7 +737,7 @@ static void TAG(light_ci)( GLcontext *ctx, GLuint j; GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *) input->data; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLchan (*CMcolor)[4]; GLuint CMstride; @@ -749,7 +749,7 @@ static void TAG(light_ci)( GLcontext *ctx, /* fprintf(stderr, "%s\n", __FUNCTION__ ); */ (void) flags; - (void) nstride; + (void) nstride; (void) vstride; VB->IndexPtr[0] = &store->LitIndex[0]; @@ -769,17 +769,17 @@ static void TAG(light_ci)( GLcontext *ctx, } /* loop over vertices */ - for ( j=0 ; - j<nr ; - j++,STRIDE_F(vertex,VSTRIDE),STRIDE_F(normal, NSTRIDE), CMSTRIDE) + for ( j=0 ; + j<nr ; + j++,STRIDE_F(vertex,VSTRIDE),STRIDE_F(normal, NSTRIDE), CMSTRIDE) { GLfloat diffuse[2], specular[2]; GLuint side = 0; struct gl_light *light; - - if ( CHECK_COLOR_MATERIAL(j) ) + + if ( CHECK_COLOR_MATERIAL(j) ) _mesa_update_color_material( ctx, (GLchan *)CMcolor[j] ); - + if ( CHECK_MATERIAL(j) ) _mesa_update_material( ctx, new_material[j], new_material_mask[j] ); @@ -807,7 +807,7 @@ static void TAG(light_ci)( GLcontext *ctx, } else { GLfloat d; /* distance from vertex to light */ - + SUB_3V(VP, light->_Position, vertex); d = LEN_3FV( VP ); @@ -816,8 +816,8 @@ static void TAG(light_ci)( GLcontext *ctx, SELF_SCALE_SCALAR_3V(VP, invd); } - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ @@ -836,14 +836,14 @@ static void TAG(light_ci)( GLcontext *ctx, } } - if (attenuation < 1e-3) + if (attenuation < 1e-3) continue; /* this light makes no contribution */ n_dot_VP = DOT3( normal, VP ); /* which side are we lighting? */ if (n_dot_VP < 0.0F) { - if (!(IDX & LIGHT_TWOSIDE)) + if (!(IDX & LIGHT_TWOSIDE)) continue; side = 1; correction = -1; @@ -894,7 +894,7 @@ static void TAG(light_ci)( GLcontext *ctx, else { GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex; GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex; - + index = mat->AmbientIndex + diffuse[side] * (1.0F-specular[side]) * d_a + specular[side] * s_a; @@ -921,7 +921,7 @@ static void TAG(init_light_tab)( void ) #undef TAG -#undef IDX +#undef IDX #undef NR_SIDES #undef NSTRIDE #undef VSTRIDE diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c index 4f9503bed3d..93e3908c804 100644 --- a/src/mesa/tnl/t_vb_normals.c +++ b/src/mesa/tnl/t_vb_normals.c @@ -1,10 +1,10 @@ -/* $Id: t_vb_normals.c,v 1.6 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_normals.c,v 1.7 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -44,7 +44,7 @@ struct normal_stage_data { - normal_func *NormalTransform; + normal_func *NormalTransform; GLvector3f normal; }; @@ -53,7 +53,7 @@ struct normal_stage_data { -static GLboolean run_normal_stage( GLcontext *ctx, +static GLboolean run_normal_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); @@ -65,7 +65,7 @@ static GLboolean run_normal_stage( GLcontext *ctx, (store->NormalTransform[0])(&ctx->ModelView, ctx->_ModelViewInvScale, VB->NormalPtr, - 0, + 0, 0, &store->normal); @@ -74,7 +74,7 @@ static GLboolean run_normal_stage( GLcontext *ctx, } -static GLboolean run_validate_normal_stage( GLcontext *ctx, +static GLboolean run_validate_normal_stage( GLcontext *ctx, struct gl_pipeline_stage *stage) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); @@ -89,8 +89,8 @@ static GLboolean run_validate_normal_stage( GLcontext *ctx, MAT_FLAG_GENERAL_3D | MAT_FLAG_PERSPECTIVE)) transform = NORM_TRANSFORM; - - + + if (ctx->Transform.Normalize) { store->NormalTransform = _mesa_normal_tab[transform | NORM_NORMALIZE]; } @@ -131,12 +131,12 @@ static void check_normal_transform( GLcontext *ctx, stage->active = ctx->_NeedNormals; /* Don't clobber the initialize function: */ - if (stage->privatePtr) + if (stage->privatePtr) stage->run = run_validate_normal_stage; } -static GLboolean alloc_normal_data( GLcontext *ctx, +static GLboolean alloc_normal_data( GLcontext *ctx, struct gl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -173,8 +173,8 @@ static void free_normal_data( struct gl_pipeline_stage *stage ) -const struct gl_pipeline_stage _tnl_normal_transform_stage = -{ +const struct gl_pipeline_stage _tnl_normal_transform_stage = +{ "normal transform", _TNL_NEW_NORMAL_TRANSFORM, /* re-check */ _TNL_NEW_NORMAL_TRANSFORM, /* re-run */ @@ -184,4 +184,3 @@ const struct gl_pipeline_stage _tnl_normal_transform_stage = check_normal_transform, /* check */ alloc_normal_data /* run -- initially set to alloc */ }; - diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c index a27e00257c1..2c35d436109 100644 --- a/src/mesa/tnl/t_vb_points.c +++ b/src/mesa/tnl/t_vb_points.c @@ -1,10 +1,10 @@ -/* $Id: t_vb_points.c,v 1.3 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_points.c,v 1.4 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Brian Paul <[email protected]> */ @@ -34,7 +34,7 @@ struct point_stage_data { - GLvector1f PointSize; + GLvector1f PointSize; }; #define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) @@ -43,7 +43,7 @@ struct point_stage_data { /* * Compute attenuated point sizes */ -static GLboolean run_point_stage( GLcontext *ctx, +static GLboolean run_point_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct point_stage_data *store = POINT_STAGE_DATA(stage); @@ -66,7 +66,7 @@ static GLboolean run_point_stage( GLcontext *ctx, } VB->PointSizePtr = &store->PointSize; - + return GL_TRUE; } @@ -108,8 +108,8 @@ static void free_point_data( struct gl_pipeline_stage *stage ) } } -const struct gl_pipeline_stage _tnl_point_attenuation_stage = -{ +const struct gl_pipeline_stage _tnl_point_attenuation_stage = +{ "point size attenuation", /* name */ _NEW_POINT, /* build_state_change */ _NEW_POINT, /* run_state_change */ diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index 25e03a8c4e8..03c8943de19 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.14 2001/02/16 18:14:42 keithw Exp $ */ +/* $Id: t_vb_render.c,v 1.15 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -40,9 +40,9 @@ * context->Driver.PointsFunc() * context->Driver.LineFunc() * context->Driver.TriangleFunc() - * context->Driver.QuadFunc() + * context->Driver.QuadFunc() * - * context->Driver.RenderTabVerts[] + * context->Driver.RenderTabVerts[] * context->Driver.RenderTabElts[] * * None of these may be null. @@ -68,7 +68,7 @@ /**********************************************************************/ -#if defined(USE_IEEE) +#if defined(USE_IEEE) #define NEGATIVE(x) ((*(GLuint *)&x) & (1<<31)) #define DIFFERENT_SIGNS(x,y) (((*(GLuint *)&x)^(*(GLuint *)&y)) & (1<<31)) #else @@ -200,7 +200,7 @@ static void clip_elt_triangles( GLcontext *ctx, const GLuint * const elt = VB->Elts; GLubyte *mask = VB->ClipMask; (void) flags; - + ctx->Driver.RenderPrimitive( ctx, GL_TRIANGLES ); for (j=start; j < last; j+=3 ) { @@ -209,15 +209,15 @@ static void clip_elt_triangles( GLcontext *ctx, GLubyte c3 = mask[elt[j+2]]; GLubyte ormask = c1|c2|c3; if (ormask) { - if (start < j) + if (start < j) render_tris( ctx, start, j, 0 ); - if (!(c1&c2&c3&0x3f)) + if (!(c1&c2&c3&0x3f)) clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); start = j+3; } } - if (start < j) + if (start < j) render_tris( ctx, start, j, 0 ); } @@ -258,7 +258,7 @@ static void clip_elt_triangles( GLcontext *ctx, #define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx ) #define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE #define INIT(x) ctx->Driver.RenderPrimitive( ctx, x ) -#define RENDER_TAB_QUALIFIER +#define RENDER_TAB_QUALIFIER #define PRESERVE_VB_DEFS #include "t_vb_rendertmp.h" @@ -282,7 +282,7 @@ static GLboolean run_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; + struct vertex_buffer *VB = &tnl->vb; GLuint new_inputs = stage->changed_inputs; render_func *tab; GLint pass = 0; @@ -314,7 +314,7 @@ static GLboolean run_render( GLcontext *ctx, } else { tab = VB->Elts ? ctx->Driver.RenderTabElts : ctx->Driver.RenderTabVerts; - } + } do { @@ -322,7 +322,7 @@ static GLboolean run_render( GLcontext *ctx, for (i = 0 ; !(flags & PRIM_LAST) ; i += length) { flags = VB->Primitive[i]; - length= VB->PrimitiveLength[i]; + length= VB->PrimitiveLength[i]; ASSERT(length || (flags & PRIM_LAST)); ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); if (length) @@ -344,7 +344,7 @@ static GLboolean run_render( GLcontext *ctx, /* Quite a bit of work involved in finding out the inputs for the - * render stage. + * render stage. */ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) { @@ -354,7 +354,7 @@ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) if (ctx->Visual.rgbMode) { inputs |= VERT_RGBA; - if (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) + if (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) inputs |= VERT_SPEC_RGB; if (ctx->Texture._ReallyEnabled) { @@ -368,18 +368,18 @@ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) inputs |= VERT_INDEX; } - if (ctx->Point._Attenuated) + if (ctx->Point._Attenuated) inputs |= VERT_POINT_SIZE; /* How do drivers turn this off? */ - if (ctx->Fog.Enabled) + if (ctx->Fog.Enabled) inputs |= VERT_FOG_COORD; - if (ctx->_TriangleCaps & DD_TRI_UNFILLED) + if (ctx->_TriangleCaps & DD_TRI_UNFILLED) inputs |= VERT_EDGE; - if (ctx->RenderMode==GL_FEEDBACK) + if (ctx->RenderMode==GL_FEEDBACK) inputs |= VERT_TEX_ANY; stage->inputs = inputs; @@ -393,8 +393,8 @@ static void dtr( struct gl_pipeline_stage *stage ) } -const struct gl_pipeline_stage _tnl_render_stage = -{ +const struct gl_pipeline_stage _tnl_render_stage = +{ "render", (_NEW_BUFFERS | _DD_NEW_SEPERATE_SPECULAR | diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h index b6c2933ae85..7e9f6842c70 100644 --- a/src/mesa/tnl/t_vb_rendertmp.h +++ b/src/mesa/tnl/t_vb_rendertmp.h @@ -1,21 +1,21 @@ -/* $Id: t_vb_rendertmp.h,v 1.7 2001/01/16 05:29:43 keithw Exp $ */ +/* $Id: t_vb_rendertmp.h,v 1.8 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -33,13 +33,13 @@ #endif #ifndef INIT -#define INIT(x) +#define INIT(x) #endif #ifndef NEED_EDGEFLAG_SETUP #define NEED_EDGEFLAG_SETUP 0 #define EDGEFLAG_GET(a) 0 -#define EDGEFLAG_SET(a,b) (void)b +#define EDGEFLAG_SET(a,b) (void)b #endif #ifndef RESET_STIPPLE @@ -109,7 +109,7 @@ static void TAG(render_line_strip)( GLcontext *ctx, RESET_OCCLUSION; INIT(GL_LINE_STRIP); - for (j=start+1; j<count; j++ ) + for (j=start+1; j<count; j++ ) RENDER_LINE( ELT(j-1), ELT(j) ); if (TEST_PRIM_END(flags)) @@ -124,7 +124,7 @@ static void TAG(render_line_loop)( GLcontext *ctx, GLuint count, GLuint flags ) { - GLuint i; + GLuint i; LOCAL_VARS; (void) flags; @@ -186,10 +186,10 @@ static void TAG(render_tri_strip)( GLcontext *ctx, GLuint j; GLuint parity = 0; LOCAL_VARS; - + if (TEST_PRIM_PARITY(flags)) parity = 1; - + INIT(GL_TRIANGLE_STRIP); if (NEED_EDGEFLAG_SETUP) { for (j=start+2;j<count;j++,parity^=1) { @@ -273,13 +273,13 @@ static void TAG(render_poly)( GLcontext *ctx, /* If the primitive does not begin here, the first edge * is non-boundary. */ - if (!TEST_PRIM_BEGIN(flags)) + if (!TEST_PRIM_BEGIN(flags)) EDGEFLAG_SET( ELT(start), GL_FALSE ); /* If the primitive does not end here, the final edge is * non-boundary. */ - if (!TEST_PRIM_END(flags)) + if (!TEST_PRIM_END(flags)) EDGEFLAG_SET( ELT(count-1), GL_FALSE ); /* Draw the first triangles (possibly zero) @@ -290,7 +290,7 @@ static void TAG(render_poly)( GLcontext *ctx, RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); EDGEFLAG_SET( ELT(j), ef ); j++; - + /* Don't render the first edge again: */ EDGEFLAG_SET( ELT(start), GL_FALSE ); @@ -312,7 +312,7 @@ static void TAG(render_poly)( GLcontext *ctx, */ EDGEFLAG_SET( ELT(count-1), efcount ); EDGEFLAG_SET( ELT(start), efstart ); - + if (TEST_PRIM_END(flags)) { RESET_STIPPLE; } @@ -348,7 +348,7 @@ static void TAG(render_quads)( GLcontext *ctx, } } POSTFIX; -} +} static void TAG(render_quad_strip)( GLcontext *ctx, GLuint start, @@ -399,7 +399,7 @@ static void TAG(render_noop)( GLcontext *ctx, RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, GLuint, GLuint, - GLuint) = + GLuint) = { TAG(render_points), TAG(render_lines), @@ -436,4 +436,3 @@ RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, #undef PRESERVE_VB_DEFS #undef PRESERVE_TAG - diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index daded260d32..cbc7778ea9e 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -1,10 +1,10 @@ -/* $Id: t_vb_texgen.c,v 1.5 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_texgen.c,v 1.6 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -89,10 +89,10 @@ static GLuint all_bits[5] = { #define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) -/* +/* */ static void build_m3(GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector3f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -104,11 +104,11 @@ static void build_m3(GLfloat f[][3], GLfloat m[], /* KW: Had to rearrange this loop to avoid a compiler bug with gcc * 2.7.3.1 at -O3 optimization. Using -fno-strength-reduce - * also fixed the bug - is this generally necessary? + * also fixed the bug - is this generally necessary? */ for (i=0;i<count;i++,STRIDE_F(coord,stride)) { GLfloat u[3], two_nu, fx, fy, fz; - COPY_3V( u, coord ); + COPY_3V( u, coord ); NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(norm,u); fx = f[i][0] = u[0] - norm[0] * two_nu; @@ -126,7 +126,7 @@ static void build_m3(GLfloat f[][3], GLfloat m[], static void build_m2(GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector3f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -139,7 +139,7 @@ static void build_m2(GLfloat f[][3], GLfloat m[], for (i=0;i<count;i++,STRIDE_F(coord,stride)) { GLfloat u[3], two_nu, fx, fy, fz; - COPY_2V( u, coord ); + COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(norm,u); @@ -175,9 +175,9 @@ static build_m_func build_m_tab[5] = { /* This is unusual in that we respect the stride of the output vector * (f). This allows us to pass in either a texcoord vector4f, or a - * temporary vector3f. + * temporary vector3f. */ -static void build_f3( GLfloat *f, +static void build_f3( GLfloat *f, GLuint fstride, const GLvector3f *normal, const GLvector4f *eye ) @@ -191,20 +191,20 @@ static void build_f3( GLfloat *f, for (i=0;i<count;i++) { GLfloat u[3], two_nu; - COPY_3V( u, coord ); + COPY_3V( u, coord ); NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(norm,u); f[0] = u[0] - norm[0] * two_nu; f[1] = u[1] - norm[1] * two_nu; f[2] = u[2] - norm[2] * two_nu; STRIDE_F(coord,stride); - STRIDE_F(f,fstride); + STRIDE_F(f,fstride); STRIDE_F(norm, normal->stride); } } -static void build_f2( GLfloat *f, +static void build_f2( GLfloat *f, GLuint fstride, const GLvector3f *normal, const GLvector4f *eye ) @@ -218,7 +218,7 @@ static void build_f2( GLfloat *f, for (i=0;i<count;i++) { GLfloat u[3], two_nu; - COPY_2V( u, coord ); + COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(norm,u); @@ -239,14 +239,14 @@ typedef void (*build_f_func)( GLfloat *f, -/* Just treat 4-vectors as 3-vectors. +/* Just treat 4-vectors as 3-vectors. */ static build_f_func build_f_tab[5] = { 0, 0, build_f2, build_f3, - build_f3 + build_f3 }; @@ -262,22 +262,22 @@ static void texgen_reflection_map_nv( GLcontext *ctx, build_f_tab[VB->EyePtr->size]( out->start, out->stride, - VB->NormalPtr, - VB->EyePtr ); - + VB->NormalPtr, + VB->EyePtr ); + if (in) { out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; out->count = in->count; out->size = MAX2(in->size, 3); - if (in->size == 4) + if (in->size == 4) _mesa_copy_tab[0][0x8](out, in, 0); - } + } else { out->flags |= VEC_SIZE_3; out->size = 3; out->count = in->count; } - + } @@ -289,7 +289,7 @@ static void texgen_normal_map_nv( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; - GLvector3f *normal = VB->NormalPtr; + GLvector3f *normal = VB->NormalPtr; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; GLuint count = VB->Count; GLuint i; @@ -306,9 +306,9 @@ static void texgen_normal_map_nv( GLcontext *ctx, out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; out->count = in->count; out->size = MAX2(in->size, 3); - if (in->size == 4) + if (in->size == 4) _mesa_copy_tab[0][0x8](out, in, 0); - } + } else { out->flags |= VEC_SIZE_3; out->size = 3; @@ -330,10 +330,10 @@ static void texgen_sphere_map( GLcontext *ctx, GLfloat (*f)[3] = store->tmp_f; GLfloat *m = store->tmp_m; - (build_m_tab[VB->EyePtr->size])( store->tmp_f, - store->tmp_m, - VB->NormalPtr, - VB->EyePtr ); + (build_m_tab[VB->EyePtr->size])( store->tmp_f, + store->tmp_m, + VB->NormalPtr, + VB->EyePtr ); for (i=0;i<count;i++) { texcoord[i][0] = f[i][0] * m[i] + 0.5F; @@ -344,7 +344,7 @@ static void texgen_sphere_map( GLcontext *ctx, out->size = MAX2(in->size,2); out->count = in->count; out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; - if (in->size > 2) + if (in->size > 2) _mesa_copy_tab[0][all_bits[in->size] & ~0x3](out, in, 0); } else { out->size = 2; @@ -355,7 +355,7 @@ static void texgen_sphere_map( GLcontext *ctx, -static void texgen( GLcontext *ctx, +static void texgen( GLcontext *ctx, struct texgen_stage_data *store, GLuint unit ) { @@ -376,9 +376,9 @@ static void texgen( GLcontext *ctx, if (texUnit->_GenFlags & TEXGEN_NEED_M) { - build_m_tab[in->size]( store->tmp_f, store->tmp_m, normal, eye ); + build_m_tab[in->size]( store->tmp_f, store->tmp_m, normal, eye ); } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { - build_f_tab[in->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); + build_f_tab[in->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); } if (!in) { @@ -399,7 +399,7 @@ static void texgen( GLcontext *ctx, out->size = MAX2(in->size, store->TexgenSize[unit]); out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; out->count = in->count; - + holes = ~all_bits[in->size] & store->TexgenHoles[unit]; } @@ -414,20 +414,20 @@ static void texgen( GLcontext *ctx, switch (texUnit->GenModeS) { case GL_OBJECT_LINEAR: (_mesa_dotprod_tab[0][obj->size])((GLfloat *)out->data, - sizeof(out->data[0]), obj, + sizeof(out->data[0]), obj, texUnit->ObjectPlaneS, 0); break; case GL_EYE_LINEAR: - (_mesa_dotprod_tab[0][eye->size])((GLfloat *)out->data, + (_mesa_dotprod_tab[0][eye->size])((GLfloat *)out->data, sizeof(out->data[0]), eye, texUnit->EyePlaneS, 0); break; - case GL_SPHERE_MAP: + case GL_SPHERE_MAP: for (indata=in->start,i=0 ; i<count ;i++, STRIDE_F(indata,in->stride)) texcoord[i][0] = indata[0] * m[i] + 0.5F; break; - case GL_REFLECTION_MAP_NV: - for (i=0;i<count;i++) + case GL_REFLECTION_MAP_NV: + for (i=0;i<count;i++) texcoord[i][0] = f[i][0]; break; case GL_NORMAL_MAP_NV: { @@ -440,27 +440,27 @@ static void texgen( GLcontext *ctx, default: _mesa_problem(ctx, "Bad S texgen"); } - } + } if (texUnit->TexGenEnabled & T_BIT) { GLuint i; switch (texUnit->GenModeT) { case GL_OBJECT_LINEAR: - (_mesa_dotprod_tab[0][obj->size])(&(out->data[0][1]), - sizeof(out->data[0]), obj, + (_mesa_dotprod_tab[0][obj->size])(&(out->data[0][1]), + sizeof(out->data[0]), obj, texUnit->ObjectPlaneT, 0); break; case GL_EYE_LINEAR: - (_mesa_dotprod_tab[0][eye->size])(&(out->data[0][1]), - sizeof(out->data[0]), eye, + (_mesa_dotprod_tab[0][eye->size])(&(out->data[0][1]), + sizeof(out->data[0]), eye, texUnit->EyePlaneT, 0); - break; - case GL_SPHERE_MAP: - for (indata=in->start,i=0; i<count ;i++,STRIDE_F(indata,in->stride)) + break; + case GL_SPHERE_MAP: + for (indata=in->start,i=0; i<count ;i++,STRIDE_F(indata,in->stride)) texcoord[i][1] = indata[1] * m[i] + 0.5F; - break; - case GL_REFLECTION_MAP_NV: - for (i=0;i<count;i++) + break; + case GL_REFLECTION_MAP_NV: + for (i=0;i<count;i++) texcoord[i][0] = f[i][0]; break; case GL_NORMAL_MAP_NV: { @@ -479,17 +479,17 @@ static void texgen( GLcontext *ctx, GLuint i; switch (texUnit->GenModeR) { case GL_OBJECT_LINEAR: - (_mesa_dotprod_tab[0][obj->size])(&(out->data[0][2]), - sizeof(out->data[0]), obj, + (_mesa_dotprod_tab[0][obj->size])(&(out->data[0][2]), + sizeof(out->data[0]), obj, texUnit->ObjectPlaneR, 0); break; case GL_EYE_LINEAR: - (_mesa_dotprod_tab[0][eye->size])(&(out->data[0][2]), + (_mesa_dotprod_tab[0][eye->size])(&(out->data[0][2]), sizeof(out->data[0]), eye, texUnit->EyePlaneR, 0); break; - case GL_REFLECTION_MAP_NV: - for (i=0;i<count;i++) + case GL_REFLECTION_MAP_NV: + for (i=0;i<count;i++) texcoord[i][2] = f[i][2]; break; case GL_NORMAL_MAP_NV: { @@ -507,12 +507,12 @@ static void texgen( GLcontext *ctx, if (texUnit->TexGenEnabled & Q_BIT) { switch (texUnit->GenModeQ) { case GL_OBJECT_LINEAR: - (_mesa_dotprod_tab[0][obj->size])(&(out->data[0][3]), - sizeof(out->data[0]), obj, + (_mesa_dotprod_tab[0][obj->size])(&(out->data[0][3]), + sizeof(out->data[0]), obj, texUnit->ObjectPlaneQ, 0); break; case GL_EYE_LINEAR: - (_mesa_dotprod_tab[0][eye->size])(&(out->data[0][3]), + (_mesa_dotprod_tab[0][eye->size])(&(out->data[0][3]), sizeof(out->data[0]), eye, texUnit->EyePlaneQ, 0); break; @@ -524,14 +524,14 @@ static void texgen( GLcontext *ctx, -static GLboolean run_texgen_stage( GLcontext *ctx, +static GLboolean run_texgen_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texgen_stage_data *store = TEXGEN_STAGE_DATA( stage ); GLuint i; - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->_Enabled & ENABLE_TEXGEN(i)) { if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i))) store->TexgenFunc[i]( ctx, store, i ); @@ -545,7 +545,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx, -static GLboolean run_validate_texgen_stage( GLcontext *ctx, +static GLboolean run_validate_texgen_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); @@ -565,11 +565,11 @@ static GLboolean run_validate_texgen_stage( GLcontext *ctx, sz = 2; else sz = 1; - + store->TexgenSize[i] = sz; store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled); store->TexgenFunc[i] = texgen; - + if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { store->TexgenFunc[i] = texgen_reflection_map_nv; @@ -605,8 +605,8 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage ) if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) inputs |= VERT_NORM; - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) - if (ctx->_Enabled & ENABLE_TEXGEN(i)) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->_Enabled & ENABLE_TEXGEN(i)) { outputs |= VERT_TEX(i); @@ -627,16 +627,16 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage ) stage->outputs = outputs; } } - + /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_texgen_data( GLcontext *ctx, +static GLboolean alloc_texgen_data( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texgen_stage_data *store; GLuint i; @@ -666,10 +666,10 @@ static void free_texgen_data( struct gl_pipeline_stage *stage ) if (store) { for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) - if (store->texcoord[i].data) + if (store->texcoord[i].data) _mesa_vector4f_free( &store->texcoord[i] ); - + if (store->tmp_f) FREE( store->tmp_f ); if (store->tmp_m) FREE( store->tmp_m ); FREE( store ); @@ -678,9 +678,9 @@ static void free_texgen_data( struct gl_pipeline_stage *stage ) } - -const struct gl_pipeline_stage _tnl_texgen_stage = -{ + +const struct gl_pipeline_stage _tnl_texgen_stage = +{ "texgen", _NEW_TEXTURE, /* when to call check() */ _NEW_TEXTURE, /* when to invalidate stored data */ @@ -690,5 +690,3 @@ const struct gl_pipeline_stage _tnl_texgen_stage = check_texgen, /* check */ alloc_texgen_data /* run -- initially set to alloc data */ }; - - diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c index 49fb2e1753e..6fd08d480bc 100644 --- a/src/mesa/tnl/t_vb_texmat.c +++ b/src/mesa/tnl/t_vb_texmat.c @@ -1,10 +1,10 @@ -/* $Id: t_vb_texmat.c,v 1.3 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_texmat.c,v 1.4 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -44,7 +44,7 @@ /* Is there any real benefit seperating texmat from texgen? It means * we need two lots of intermediate storage. Any changes to * _NEW_TEXTURE will invalidate both sets -- it's only on changes to - * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. + * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. * * However, the seperation of this code from the complex texgen stuff * is very appealing. @@ -63,27 +63,27 @@ static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage ) if (ctx->_Enabled & ENABLE_TEXMAT_ANY) { GLuint flags = 0; - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) - if (ctx->_Enabled & ENABLE_TEXMAT(i)) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->_Enabled & ENABLE_TEXMAT(i)) flags |= VERT_TEX(i); - + stage->active = 1; stage->inputs = flags; stage->outputs = flags; } } -static GLboolean run_texmat_stage( GLcontext *ctx, +static GLboolean run_texmat_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint i; /* ENABLE_TEXMAT implies that the texture matrix is not the * identity, so we don't have to check that here. */ - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->_Enabled & ENABLE_TEXMAT(i)) { if (stage->changed_inputs & VERT_TEX(i)) (void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i], @@ -97,10 +97,10 @@ static GLboolean run_texmat_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_texmat_data( GLcontext *ctx, +static GLboolean alloc_texmat_data( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texmat_stage_data *store; GLuint i; @@ -132,11 +132,11 @@ static void free_texmat_data( struct gl_pipeline_stage *stage ) stage->privatePtr = 0; } } - -const struct gl_pipeline_stage _tnl_texture_transform_stage = -{ + +const struct gl_pipeline_stage _tnl_texture_transform_stage = +{ "texture transform", _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index ad8a2a21d6e..ab08ac23c31 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -1,10 +1,10 @@ -/* $Id: t_vb_vertex.c,v 1.6 2001/03/07 05:06:13 brianp Exp $ */ +/* $Id: t_vb_vertex.c,v 1.7 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Author: + * Authors: * Keith Whitwell <[email protected]> */ @@ -46,7 +46,7 @@ struct vertex_stage_data { GLvector4f eye; GLvector4f clip; - GLvector4f proj; + GLvector4f proj; GLubyte *clipmask; GLubyte ormask; GLubyte andmask; @@ -67,7 +67,7 @@ struct vertex_stage_data { /* This function implements cliptesting for user-defined clip planes. * The clipping of primitives to these planes is implemented in - * t_render_clip.h. + * t_render_clip.h. */ #define USER_CLIPTEST(NAME, SZ) \ static void NAME( GLcontext *ctx, \ @@ -113,13 +113,13 @@ static void NAME( GLcontext *ctx, \ } -USER_CLIPTEST(userclip2, 2) -USER_CLIPTEST(userclip3, 3) -USER_CLIPTEST(userclip4, 4) +USER_CLIPTEST(userclip2, 2) +USER_CLIPTEST(userclip3, 3) +USER_CLIPTEST(userclip4, 4) static void (*(usercliptab[5]))( GLcontext *, GLvector4f *, GLubyte *, - GLubyte *, GLubyte * ) = + GLubyte *, GLubyte * ) = { 0, 0, @@ -130,14 +130,14 @@ static void (*(usercliptab[5]))( GLcontext *, -static GLboolean run_vertex_stage( GLcontext *ctx, +static GLboolean run_vertex_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - - if (stage->changed_inputs) + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + if (stage->changed_inputs) { /* VB->ObjPtr->size = 4; */ @@ -147,20 +147,20 @@ static GLboolean run_vertex_stage( GLcontext *ctx, if (ctx->ModelView.type == MATRIX_IDENTITY) VB->EyePtr = VB->ObjPtr; else - VB->EyePtr = TransformRaw( &store->eye, &ctx->ModelView, + VB->EyePtr = TransformRaw( &store->eye, &ctx->ModelView, VB->ObjPtr); if (ctx->ProjectionMatrix.type == MATRIX_IDENTITY) VB->ClipPtr = VB->EyePtr; else - VB->ClipPtr = TransformRaw( &store->clip, &ctx->ProjectionMatrix, + VB->ClipPtr = TransformRaw( &store->clip, &ctx->ProjectionMatrix, VB->EyePtr ); - } - else + } + else { /* Combined modelviewproject transform: */ - if (ctx->_ModelProjectMatrix.type == MATRIX_IDENTITY) + if (ctx->_ModelProjectMatrix.type == MATRIX_IDENTITY) VB->ClipPtr = VB->ObjPtr; else VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix, @@ -175,19 +175,19 @@ static GLboolean run_vertex_stage( GLcontext *ctx, VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); VB->ClipPtr = VB->ObjPtr; } - if (VB->ClipPtr->size == 2) + if (VB->ClipPtr->size == 2) _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); } /* Cliptest and perspective divide. Clip functions must clear - * the clipmask. + * the clipmask. */ store->ormask = 0; store->andmask = CLIP_ALL_BITS; if (tnl->NeedProjCoords) { - VB->ProjectedClipPtr = + VB->ProjectedClipPtr = _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, &store->proj, store->clipmask, @@ -203,7 +203,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, &store->andmask ); } - if (store->andmask) + if (store->andmask) return GL_FALSE; @@ -220,7 +220,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, if (store->andmask) return GL_FALSE; } - + VB->ClipOrMask = store->ormask; VB->ClipMask = store->clipmask; @@ -230,9 +230,9 @@ static GLboolean run_vertex_stage( GLcontext *ctx, store->save_eyeptr = VB->EyePtr; store->save_clipptr = VB->ClipPtr; store->save_projptr = VB->ProjectedClipPtr; - } + } else { - /* Replay the sideeffects. + /* Replay the sideeffects. */ VB->EyePtr = store->save_eyeptr; VB->ClipPtr = store->save_clipptr; @@ -251,14 +251,14 @@ static GLboolean run_vertex_stage( GLcontext *ctx, static void check_vertex( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - (void) ctx; + (void) ctx; (void) stage; } -static GLboolean init_vertex_stage( GLcontext *ctx, +static GLboolean init_vertex_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct vertex_stage_data *store; GLuint size = VB->Size; @@ -266,17 +266,17 @@ static GLboolean init_vertex_stage( GLcontext *ctx, store = VERTEX_STAGE_DATA(stage); if (!store) return GL_FALSE; - + _mesa_vector4f_alloc( &store->eye, 0, size, 32 ); _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); - _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); + _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); if (!store->clipmask || - !store->eye.data || - !store->clip.data || - !store->proj.data) + !store->eye.data || + !store->clip.data || + !store->proj.data) return GL_FALSE; /* Now run the stage. @@ -301,8 +301,8 @@ static void dtr( struct gl_pipeline_stage *stage ) } -const struct gl_pipeline_stage _tnl_vertex_transform_stage = -{ +const struct gl_pipeline_stage _tnl_vertex_transform_stage = +{ "modelview/project/cliptest/divide", 0, /* re-check -- always on */ _NEW_MODELVIEW| @@ -316,5 +316,3 @@ const struct gl_pipeline_stage _tnl_vertex_transform_stage = check_vertex, /* check */ init_vertex_stage /* run -- initially set to init */ }; - - diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index eb8e9054a9c..9ca530797e5 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -1,8 +1,10 @@ +/* $Id: tnl.h,v 1.6 2001/03/12 00:48:44 gareth Exp $ */ + /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), |