Removed optimizations (this code is now seldom used)

This commit is contained in:
Keith Whitwell 2001-08-13 22:15:54 +00:00
parent d922109eb3
commit c8a27838a0
3 changed files with 3 additions and 181 deletions

View File

@ -1,4 +1,4 @@
/* $Id: t_array_api.c,v 1.17 2001/08/02 21:30:10 keithw Exp $ */
/* $Id: t_array_api.c,v 1.18 2001/08/13 22:15:54 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -48,38 +48,6 @@
static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start,
GLsizei count )
{
/* fprintf(stderr, "%s\n", __FUNCTION__); */
/* Need to produce immediate structs, either for compiling or
* because the array range is too large to process in a single
* VB. In GL_EXECUTE mode, this introduces two redundant
* operations: producing the flag array and computing the orflag
* of the flag array.
*/
#if 0
/* Buggy - see sgl testGeoSets.exe polygon mode
*/
if (_tnl_hard_begin( ctx, mode )) {
GLint i;
for (i = 0 ; i < count ; ) {
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint start = IM->Start;
GLuint nr = MIN2( IMM_MAXDATA - start, (GLuint) (count - i) );
_tnl_fill_immediate_drawarrays( ctx, IM, i, i+nr );
IM->Count = start + nr;
i += nr;
if (i == count)
_tnl_end( ctx );
_tnl_flush_immediate( IM );
}
}
#else
/* Simple alternative to above code.
*/
if (_tnl_hard_begin( ctx, mode ))
{
GLuint i;
@ -88,46 +56,12 @@ static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start,
}
_tnl_end( ctx );
}
#endif
}
static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count,
const GLuint *indices)
{
/* fprintf(stderr, "%s\n", __FUNCTION__); */
#if 0
/* Optimized code that fakes the effect of calling
* _tnl_array_element for each index in the list.
*
* Possibly buggy, see above.
*/
if (_tnl_hard_begin( ctx, mode )) {
GLint i, j;
for (i = 0 ; i < count ; ) {
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint start = IM->Start;
GLint end = MIN2( IMM_MAXDATA, (count - i) + start);
GLuint sf = IM->Flag[start];
IM->FlushElt = IM->ArrayEltFlush;
for (j = start ; j < end ; j++) {
IM->Elt[j] = (GLuint) *indices++;
IM->Flag[j] = VERT_ELT;
}
IM->Flag[start] |= (sf & IM->ArrayEltFlags);
IM->Count = end;
i += end - start;
if (i == count)
_tnl_end( ctx );
_tnl_flush_immediate( IM );
}
}
#else
/* Simple version of the above code.
*/
if (_tnl_hard_begin(ctx, mode)) {
@ -136,7 +70,6 @@ static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count,
_tnl_array_element( ctx, indices[i] );
_tnl_end( ctx );
}
#endif
}

View File

@ -1,4 +1,4 @@
/* $Id: t_array_import.c,v 1.17 2001/05/17 11:33:33 keithw Exp $ */
/* $Id: t_array_import.c,v 1.18 2001/08/13 22:15:54 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -388,110 +388,3 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
}
/* Function to fill an immediate struct with the effects of
* consecutive calls to ArrayElement with consecutive indices. Used
* for display lists and very large fan-like primitives only.
*/
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] &= IM->ArrayEltFlags;
IM->Flag[IM->Start] |= required;
for (i = IM->Start+1 ; i < IM->Count ; i++)
IM->Flag[i] = required;
}

View File

@ -1,4 +1,4 @@
/* $Id: t_array_import.h,v 1.3 2001/04/28 08:39:18 keithw Exp $ */
/* $Id: t_array_import.h,v 1.4 2001/08/13 22:15:54 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -32,10 +32,6 @@
extern void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count );
extern void _tnl_fill_immediate_drawarrays( GLcontext *ctx,
struct immediate *IM,
GLuint start, GLuint count ) ;
extern void _tnl_array_import_init( GLcontext *ctx );
#endif