From ce656b6a0a103ae9cb41d509be353f0e661e3574 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 8 Jan 2001 21:55:59 +0000 Subject: Fixed 'IRound' to 'IROUND' in mmath.h Fixed fallback path for drawarrays/_tnl_hard_begin. Removed disabled debug code. --- src/mesa/tnl/t_array_api.c | 9 +++---- src/mesa/tnl/t_array_import.c | 8 +----- src/mesa/tnl/t_context.c | 5 ++-- src/mesa/tnl/t_eval_api.c | 12 ++++----- src/mesa/tnl/t_imm_api.c | 62 ++++++++++++++++++++++++++++++++++--------- src/mesa/tnl/t_imm_api.h | 5 ++-- src/mesa/tnl/t_imm_dlist.c | 46 +------------------------------- src/mesa/tnl/t_imm_dlist.h | 3 +-- src/mesa/tnl/t_imm_exec.c | 7 ++--- src/mesa/tnl/t_imm_fixup.c | 12 ++------- src/mesa/tnl/t_pipeline.c | 3 +-- src/mesa/tnl/t_vb_render.c | 4 ++- 12 files changed, 77 insertions(+), 99 deletions(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 83d10337be..587f1b43d7 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.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_array_api.c,v 1.2 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -101,9 +101,9 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) * 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. + * of the flag array. */ -#if 0 +#if 1 if (_tnl_hard_begin( ctx, mode )) { GLuint j; for (j = 0 ; j < count ; ) { @@ -127,8 +127,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) #else /* Simple alternative to above code. */ -/* if (_tnl_hard_begin( ctx, mode )) */ - _tnl_begin(ctx,mode); + if (_tnl_hard_begin( ctx, mode )) { GLuint i; for (i=start;iTexCoord[i].data); */ - tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, stride ? 4*sizeof(GLfloat) : 0, 0, @@ -213,9 +210,6 @@ static void _tnl_import_texcoord( GLcontext *ctx, inputs->TexCoord[i].flags |= VEC_BAD_STRIDE; if (!is_writeable) inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE; - -/* fprintf(stderr, "%s %d before wr %d ptr %p\n", __FUNCTION__, i, is_writeable, */ -/* inputs->TexCoord[i].data); */ } diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 7d04210eb6..93886b7110 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -1,4 +1,4 @@ -/* $Id: t_context.c,v 1.8 2001/01/05 02:26:49 keithw Exp $ */ +/* $Id: t_context.c,v 1.9 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -39,6 +39,7 @@ #include "t_array_api.h" #include "t_eval_api.h" #include "t_imm_alloc.h" +#include "t_imm_api.h" #include "t_imm_exec.h" #include "t_imm_dlist.h" #include "t_pipeline.h" @@ -84,6 +85,7 @@ _tnl_CreateContext( GLcontext *ctx ) /* Create the TNLcontext structure */ ctx->swtnl_context = tnl = CALLOC( sizeof(TNLcontext) ); + if (!tnl) { return GL_FALSE; } @@ -117,7 +119,6 @@ _tnl_CreateContext( GLcontext *ctx ) ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT; ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; - return GL_TRUE; } diff --git a/src/mesa/tnl/t_eval_api.c b/src/mesa/tnl/t_eval_api.c index efe7876333..0a351eed89 100644 --- a/src/mesa/tnl/t_eval_api.c +++ b/src/mesa/tnl/t_eval_api.c @@ -1,4 +1,4 @@ -/* $Id: t_eval_api.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_eval_api.c,v 1.2 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -98,7 +98,7 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) ctx->CompileFlag = GL_FALSE; } - _tnl_begin( ctx, prim ); + _tnl_hard_begin( ctx, prim ); for (i=i1;i<=i2;i++,u+=du) { _tnl_eval_coord1f( ctx, u ); } @@ -151,7 +151,7 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) switch (mode) { case GL_POINT: - _tnl_begin( ctx, GL_POINTS ); + _tnl_hard_begin( ctx, GL_POINTS ); for (v=v1,j=j1;j<=j2;j++,v+=dv) { for (u=u1,i=i1;i<=i2;i++,u+=du) { _tnl_eval_coord2f( ctx, u, v ); @@ -161,14 +161,14 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) break; case GL_LINE: for (v=v1,j=j1;j<=j2;j++,v+=dv) { - _tnl_begin( ctx, GL_LINE_STRIP ); + _tnl_hard_begin( ctx, GL_LINE_STRIP ); for (u=u1,i=i1;i<=i2;i++,u+=du) { _tnl_eval_coord2f( ctx, u, v ); } _tnl_end(ctx); } for (u=u1,i=i1;i<=i2;i++,u+=du) { - _tnl_begin( ctx, GL_LINE_STRIP ); + _tnl_hard_begin( ctx, GL_LINE_STRIP ); for (v=v1,j=j1;j<=j2;j++,v+=dv) { _tnl_eval_coord2f( ctx, u, v ); } @@ -177,7 +177,7 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) break; case GL_FILL: for (v=v1,j=j1;jCompileFlag) { _tnl_begin( ctx, p ); + + /* Set this for the duration: + */ + ctx->Driver.CurrentExecPrimitive = p; return GL_TRUE; } @@ -182,19 +186,15 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) switch (IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) { case VERT_BEGIN_0|VERT_BEGIN_1: - /* In this case we know for sure that the list is going to be - * inside a begin/end object at this point when run. Rather - * than saving the redundant data, compile in an error and - * return. + /* 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 normal (non-hard) immediate, in an unknown - * begin/end state. Assert it is empty and conviert it to a - * 'hard' one. + /* This is a display-list immediate in an unknown begin/end + * state. Assert it is empty and conviert it to a 'hard' one. */ ASSERT (IM->SavedBeginState == 0); @@ -207,6 +207,9 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) /* FALLTHROUGH */ 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; @@ -229,6 +232,7 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) * vertices before the next state change. */ ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; + return GL_TRUE; default: @@ -237,6 +241,40 @@ _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. + */ +void +_tnl_save_Begin( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (mode > GL_POLYGON) { + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" ); + return; + } + + if (ctx->ExecuteFlag) { + /* Preserve vtxfmt invarient: + */ + if (ctx->NewState) + gl_update_state( ctx ); + + /* Slot in geomexec: No need to call setdispatch as we know + * CurrentDispatch is Save. + */ + ASSERT(ctx->CurrentDispatch == ctx->Save); + } + + _tnl_begin( ctx, mode ); +} + + + + /* Note the continuation of a partially completed primitive. For * driver t&l fallbacks between begin/end primitives. Has basically * the same effects as a primitive wrapping onto a second immediate @@ -297,6 +335,10 @@ _tnl_end( GLcontext *ctx ) IM->BeginState = state; + if (!ctx->CompileFlag) + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + + /* You can set this flag to get the old 'flush_vb on glEnd()' * behaviour. */ @@ -316,10 +358,6 @@ _tnl_End(void) */ if (ctx->CompileFlag) ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; - else - ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; - - } diff --git a/src/mesa/tnl/t_imm_api.h b/src/mesa/tnl/t_imm_api.h index 8e4c9943d2..3c0686403d 100644 --- a/src/mesa/tnl/t_imm_api.h +++ b/src/mesa/tnl/t_imm_api.h @@ -1,4 +1,4 @@ -/* $Id: t_imm_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_imm_api.h,v 1.2 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -32,9 +32,10 @@ #include "t_context.h" +extern void _tnl_save_Begin( GLenum mode ); + /* TNL-private internal functions for building higher-level operations: */ -extern void _tnl_begin( GLcontext *ctx, GLenum p ); extern GLboolean _tnl_hard_begin( GLcontext *ctx, GLenum p ); extern void _tnl_end( GLcontext *ctx ); extern void _tnl_vertex2f( GLcontext *ctx, GLfloat x, GLfloat y ); diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c index e22661e7ea..b77344a7ac 100644 --- a/src/mesa/tnl/t_imm_dlist.c +++ b/src/mesa/tnl/t_imm_dlist.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_dlist.c,v 1.4 2000/12/28 22:11:05 keithw Exp $ */ +/* $Id: t_imm_dlist.c,v 1.5 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -112,8 +112,6 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) return; node->IM = im; im->ref_count++; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* im->id, im->ref_count); */ node->Start = im->Start; node->Count = im->Count; node->BeginState = im->BeginState; @@ -144,10 +142,6 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) if (!new_im) return; new_im->ref_count++; im->ref_count--; /* remove CURRENT_IM reference */ -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* im->id, im->ref_count); */ -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* new_im->id, new_im->ref_count); */ ASSERT(im->ref_count > 0); SET_IMMEDIATE( ctx, new_im ); _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, @@ -343,15 +337,9 @@ _tnl_EndList( GLcontext *ctx ) ctx->swtnl_im = 0; IM->ref_count--; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* IM->id, IM->ref_count); */ if (IM == tnl->ExecCopySource) { IM->ref_count--; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* IM->id, IM->ref_count); */ } else { -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */ if ( --tnl->ExecCopySource->ref_count == 0 ) _tnl_free_immediate( tnl->ExecCopySource ); } @@ -366,14 +354,10 @@ _tnl_EndList( GLcontext *ctx ) tnl->ExecCopySource = IM; IM->ref_count++; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* IM->id, IM->ref_count); */ SET_IMMEDIATE( ctx, IM ); IM->ref_count++; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* IM->id, IM->ref_count); */ _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); @@ -417,31 +401,3 @@ _tnl_dlist_init( GLcontext *ctx ) print_compiled_cassette ); } -/* 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. - */ -void -_tnl_save_Begin( GLenum mode ) -{ - GET_CURRENT_CONTEXT(ctx); - - if (mode > GL_POLYGON) { - _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" ); - return; - } - - if (ctx->ExecuteFlag) { - /* Preserve vtxfmt invarient: - */ - if (ctx->NewState) - gl_update_state( ctx ); - - /* Slot in geomexec: No need to call setdispatch as we know - * CurrentDispatch is Save. - */ - ASSERT(ctx->CurrentDispatch == ctx->Save); - } - - _tnl_begin( ctx, mode ); -} diff --git a/src/mesa/tnl/t_imm_dlist.h b/src/mesa/tnl/t_imm_dlist.h index 1b6c4a778a..69c7bdfdbc 100644 --- a/src/mesa/tnl/t_imm_dlist.h +++ b/src/mesa/tnl/t_imm_dlist.h @@ -1,4 +1,4 @@ -/* $Id: t_imm_dlist.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: t_imm_dlist.h,v 1.2 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -38,7 +38,6 @@ extern void _tnl_dlist_init( GLcontext *ctx ); extern void _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ); extern void _tnl_EndList( GLcontext *ctx ); extern void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ); -extern void _tnl_save_Begin( GLenum mode ); extern void _tnl_EndCallList( GLcontext *ctx ); extern void _tnl_BeginCallList( GLcontext *ctx, GLuint list ); diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c index 4bdce0d18d..e8904dfd1e 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.5 2001/01/05 02:26:49 keithw Exp $ */ +/* $Id: t_imm_exec.c,v 1.6 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -471,15 +471,12 @@ void _tnl_imm_init( GLcontext *ctx ) ctx->swtnl_im = _tnl_alloc_immediate( ctx ); TNL_CURRENT_IM(ctx)->ref_count++; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* TNL_CURRENT_IM(ctx)->id, TNL_CURRENT_IM(ctx)->ref_count); */ tnl->ExecCopyTexSize = 0; tnl->ExecCopyCount = 0; tnl->ExecCopySource = TNL_CURRENT_IM(ctx); TNL_CURRENT_IM(ctx)->ref_count++; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* TNL_CURRENT_IM(ctx)->id, TNL_CURRENT_IM(ctx)->ref_count); */ + TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS; gl_vector4f_init( &tmp->Obj, 0, 0 ); diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c index 5da75db53b..d4489160dd 100644 --- a/src/mesa/tnl/t_imm_fixup.c +++ b/src/mesa/tnl/t_imm_fixup.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_fixup.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */ +/* $Id: t_imm_fixup.c,v 1.3 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -433,16 +433,12 @@ static void copy_vertices( GLcontext *ctx, ASSERT(prev == tnl->ExecCopySource); -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */ - if (--tnl->ExecCopySource->ref_count == 0) _tnl_free_immediate( tnl->ExecCopySource ); next->ref_count++; tnl->ExecCopySource = next; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* next->id, next->ref_count); */ + tnl->ExecCopyElts[0] = next->Start-3; tnl->ExecCopyElts[1] = next->Start-2; tnl->ExecCopyElts[2] = next->Start-1; @@ -732,14 +728,10 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) if (tnl->ExecCopySource != IM) { -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */ if (--tnl->ExecCopySource->ref_count == 0) _tnl_free_immediate( tnl->ExecCopySource ); IM->ref_count++; tnl->ExecCopySource = IM; -/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */ -/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count); */ } if (prim == GL_POLYGON+1) { diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 457b160eb9..8ee814841b 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -1,4 +1,4 @@ -/* $Id: t_pipeline.c,v 1.7 2000/12/26 05:09:33 keithw Exp $ */ +/* $Id: t_pipeline.c,v 1.8 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -115,7 +115,6 @@ void _tnl_run_pipeline( GLcontext *ctx ) GLuint changed_inputs = pipe->run_input_changes; GLboolean running = GL_TRUE; GLuint i; - unsigned short __tmp; /* Done elsewhere. diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index 462ebbda05..684cb0212e 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.8 2001/01/08 17:41:15 keithw Exp $ */ +/* $Id: t_vb_render.c,v 1.9 2001/01/08 21:56:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -603,6 +603,8 @@ static GLboolean run_render( GLcontext *ctx, length= VB->PrimitiveLength[i]; ASSERT(length || (flags & PRIM_LAST)); ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); +/* fprintf(stderr, "Render %s %d..%d\n", */ +/* _mesa_prim_name[flags&PRIM_MODE_MASK], i, i+length); */ if (length) tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); } -- cgit v1.2.3