From 6e9f8b7cdbe5daf1767d192faef1cbe98ada1324 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 4 Feb 2001 00:44:36 +0000 Subject: Fast no-copy drawarrays for large tristrips --- src/mesa/tnl/t_array_api.c | 96 ++++++++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index b3ef1dbeed..0c61dee780 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.4 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: t_array_api.c,v 1.5 2001/02/04 00:44:36 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -45,7 +45,49 @@ #include "t_context.h" #include "t_pipeline.h" +static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start, + GLsizei count ) +{ + /* 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 1 + if (_tnl_hard_begin( ctx, mode )) { + GLuint j; + for (j = 0 ; j < count ; ) { + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint nr = MIN2( IMM_MAXDATA - IM->Start, count - j ); + GLuint sf = IM->Flag[IM->Start]; + _tnl_fill_immediate_drawarrays( ctx, IM, j, j+nr ); + + if (j == 0) IM->Flag[IM->Start] |= sf; + + IM->Count = IM->Start + nr; + j += nr; + + if (j == count) + _tnl_end( ctx ); + + _tnl_flush_immediate( IM ); + } + } +#else + /* Simple alternative to above code. + */ + if (_tnl_hard_begin( ctx, mode )) + { + GLuint i; + for (i=start;ipipeline.run_input_changes |= ctx->Array._Enabled; } } - else { - /* 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 1 - if (_tnl_hard_begin( ctx, mode )) { - GLuint j; - for (j = 0 ; j < count ; ) { - struct immediate *IM = TNL_CURRENT_IM(ctx); - GLuint nr = MIN2( IMM_MAXDATA - IM->Start, count - j ); - GLuint sf = IM->Flag[IM->Start]; + else if (!ctx->CompileFlag && mode == GL_TRIANGLE_STRIP) { + int bufsz = (ctx->Const.MaxArrayLockSize - 2) & ~1; + int j, nr; - _tnl_fill_immediate_drawarrays( ctx, IM, j, j+nr ); - - if (j == 0) IM->Flag[IM->Start] |= sf; - - IM->Count = IM->Start + nr; - j += nr; - - if (j == count) - _tnl_end( ctx ); + FLUSH_CURRENT( ctx, 0 ); - _tnl_flush_immediate( IM ); - } - } -#else - /* Simple alternative to above code. + /* TODO: other non-fan primitives. */ - if (_tnl_hard_begin( ctx, mode )) - { - GLuint i; - for (i=start;iFirstPrimitive = 0; + 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; } -#endif + } else { + fallback_drawarrays( ctx, mode, start, count ); } } -- cgit v1.2.3