X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Ftnl%2Ft_array_import.c;h=513e8931fc1ab0258c5d13c200f40ca2ff5b773c;hb=3a825a85f13b86b3a9658aeb7d3793b98fcb48cf;hp=78ba917570538cfe9799cdcd76db75e7cdd356f4;hpb=51c0c71811508b6658e0d5dcff8426b618322a73;p=mesa.git diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 78ba9175705..513e8931fc1 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,4 +1,4 @@ -/* $Id: t_array_import.c,v 1.14 2001/04/28 08:39:18 keithw Exp $ */ +/* $Id: t_array_import.c,v 1.18 2001/08/13 22:15:54 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -40,6 +40,7 @@ #include "t_array_import.h" #include "t_context.h" +#include "t_imm_debug.h" static void _tnl_import_vertex( GLcontext *ctx, @@ -100,8 +101,6 @@ static void _tnl_import_color( GLcontext *ctx, GLboolean is_writeable = 0; struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; -/* fprintf(stderr, "%s\n", __FUNCTION__); */ - tmp = _ac_import_color(ctx, type, stride ? 4*sizeof(GLfloat) : 0, @@ -306,216 +305,86 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLuint inputs = tnl->pipeline.inputs; - GLuint imports; struct vertex_arrays *tmp = &tnl->array_inputs; + GLuint i; -/* fprintf(stderr, "_tnl_vb_bind_arrays %d..%d // %d..%d\n", */ -/* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */ - - if (ctx->Array.LockCount) { - ASSERT(start == (GLint) ctx->Array.LockFirst); - ASSERT(count == (GLint) ctx->Array.LockCount); - } - - imports = tnl->pipeline.inputs; - - _ac_import_range( ctx, start, count ); +/* fprintf(stderr, "%s %d..%d // %d..%d\n", __FUNCTION__, */ +/* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */ +/* _tnl_print_vert_flags(" inputs", inputs); */ +/* _tnl_print_vert_flags(" _Enabled", ctx->Array._Enabled); */ +/* _tnl_print_vert_flags(" importable", inputs & VERT_FIXUP); */ VB->Count = count - start; VB->FirstClipped = VB->Count; - VB->Elts = 0; VB->MaterialMask = 0; VB->Material = 0; VB->Flag = 0; + VB->Primitive = tnl->tmp_primitive; + VB->PrimitiveLength = tnl->tmp_primitive_length; + VB->import_data = _tnl_upgrade_client_data; + VB->importable_data = inputs & VERT_FIXUP; -/* _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 (ctx->Array.LockCount) { + ASSERT(start == (GLint) ctx->Array.LockFirst); + ASSERT(count == (GLint) ctx->Array.LockCount); + } + + _ac_import_range( ctx, start, count ); if (inputs & VERT_OBJ) { - if (imports & VERT_OBJ) { - _tnl_import_vertex( ctx, 0, 0 ); - tmp->Obj.count = VB->Count; - } + _tnl_import_vertex( ctx, 0, 0 ); + tmp->Obj.count = VB->Count; VB->ObjPtr = &tmp->Obj; } if (inputs & VERT_NORM) { - if (imports & VERT_NORM) { - _tnl_import_normal( ctx, 0, 0 ); - tmp->Normal.count = VB->Count; - } + _tnl_import_normal( ctx, 0, 0 ); + tmp->Normal.count = VB->Count; VB->NormalPtr = &tmp->Normal; } if (inputs & VERT_RGBA) { - if (imports & VERT_RGBA) { - _tnl_import_color( ctx, 0, 0, 0 ); - } + _tnl_import_color( ctx, 0, 0, 0 ); VB->ColorPtr[0] = &tmp->Color; VB->ColorPtr[1] = 0; -/* fprintf(stderr, "VB->ColorPtr[0]->StrideB %d Type %s\n", */ -/* VB->ColorPtr[0]->StrideB, */ -/* _mesa_lookup_enum_by_nr(VB->ColorPtr[0]->Type)); */ } - if (inputs & VERT_INDEX) { - if (imports & VERT_INDEX) { - _tnl_import_index( ctx, 0, 0 ); - tmp->Index.count = VB->Count; + if (inputs & VERT_TEX_ANY) { + for (i = 0; i < ctx->Const.MaxTextureUnits ; i++) { + if (inputs & VERT_TEX(i)) { + _tnl_import_texcoord( ctx, i, 0, 0 ); + tmp->TexCoord[i].count = VB->Count; + VB->TexCoordPtr[i] = &tmp->TexCoord[i]; + } } - VB->IndexPtr[0] = &tmp->Index; - VB->IndexPtr[1] = 0; } + if (inputs & (VERT_INDEX|VERT_FOG_COORD|VERT_EDGE|VERT_SPEC_RGB)) { + if (inputs & VERT_INDEX) { + _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) { + if (inputs & VERT_FOG_COORD) { _tnl_import_fogcoord( ctx, 0, 0 ); tmp->FogCoord.count = VB->Count; + VB->FogCoordPtr = &tmp->FogCoord; } - VB->FogCoordPtr = &tmp->FogCoord; - } - if (inputs & VERT_EDGE) { - _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); - VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data; - } + if (inputs & VERT_EDGE) { + _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); + VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data; + } - if (inputs & VERT_SPEC_RGB) { - if (imports & VERT_SPEC_RGB) { + if (inputs & VERT_SPEC_RGB) { _tnl_import_secondarycolor( ctx, 0, 0, 0 ); + VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; + VB->SecondaryColorPtr[1] = 0; } - - 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 ); - tmp->TexCoord[i].count = VB->Count; - } - VB->TexCoordPtr[i] = &tmp->TexCoord[i]; - } } - - VB->Primitive = tnl->tmp_primitive; - VB->PrimitiveLength = tnl->tmp_primitive_length; - VB->import_data = _tnl_upgrade_client_data; - VB->importable_data = inputs & VERT_FIXUP; - -/* _tnl_print_vert_flags("_tnl_vb_bind_arrays: importable", */ -/* VB->importable_data); */ } - - -/* Function to fill an immediate struct with the effects of - * consecutive calls to ArrayElement with consecutive indices. - */ -void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, - GLuint start, GLuint count ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint required = ctx->Array._Enabled; - GLuint n = count - start; - GLuint i; - - if (!ctx->CompileFlag) - required &= tnl->pipeline.inputs; - - if (MESA_VERBOSE&VERBOSE_IMMEDIATE) - fprintf(stderr, "exec_full_array_elements %d .. %d\n", start, count); - - _math_trans_4f( IM->Obj + IM->Start, - ctx->Array.Vertex.Ptr, - ctx->Array.Vertex.StrideB, - ctx->Array.Vertex.Type, - ctx->Array.Vertex.Size, - start, n ); - - if (ctx->Array.Vertex.Size == 4) - required |= VERT_OBJ_234; - 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, - ctx->Array.Normal.StrideB, - ctx->Array.Normal.Type, - start, n ); - } - - if (required & VERT_EDGE) { - _math_trans_1ub( IM->EdgeFlag + IM->Start, - ctx->Array.EdgeFlag.Ptr, - ctx->Array.EdgeFlag.StrideB, - ctx->Array.EdgeFlag.Type, - start, n ); - } - - if (required & VERT_RGBA) { - _math_trans_4f( IM->Color + IM->Start, - ctx->Array.Color.Ptr, - ctx->Array.Color.StrideB, - ctx->Array.Color.Type, - ctx->Array.Color.Size, - start, n ); - } - - if (required & VERT_SPEC_RGB) { - _math_trans_4f( IM->SecondaryColor + IM->Start, - ctx->Array.SecondaryColor.Ptr, - ctx->Array.SecondaryColor.StrideB, - ctx->Array.SecondaryColor.Type, - ctx->Array.SecondaryColor.Size, - start, n ); - } - - if (required & VERT_FOG_COORD) { - _math_trans_1f( IM->FogCoord + IM->Start, - 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, - start, n ); - } - - if (required & VERT_TEX_ANY) { - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (required & VERT_TEX(i)) { - _math_trans_4f( IM->TexCoord[i] + IM->Start, - ctx->Array.TexCoord[i].Ptr, - ctx->Array.TexCoord[i].StrideB, - ctx->Array.TexCoord[i].Type, - ctx->Array.TexCoord[i].Size, - start, n ); - - 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->Count = IM->Start + n; - IM->Flag[IM->Start] |= required; - for (i = IM->Start+1 ; i < IM->Count ; i++) - IM->Flag[i] = required; -}