From: Keith Whitwell Date: Thu, 10 May 2001 12:18:38 +0000 (+0000) Subject: Replace PipelineStart, PipelineFinish with RunPipeline. Clean up X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7954a0cafdce545cde193e8ec317afa85be2b736;p=mesa.git Replace PipelineStart, PipelineFinish with RunPipeline. Clean up _tnl_run_pipeline() a little. --- diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 95d1f455485..c11a0ae351d 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.12 2001/04/28 08:39:18 keithw Exp $ */ +/* $Id: t_array_api.c,v 1.13 2001/05/10 12:18:38 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -151,12 +151,12 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, tnl->vb.Elts = (GLuint *)indices; if (ctx->Array.LockCount) - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); else { /* Note that arrays may have changed before/after execution. */ tnl->pipeline.run_input_changes |= ctx->Array._Enabled; - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); tnl->pipeline.run_input_changes |= ctx->Array._Enabled; } } @@ -203,20 +203,20 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->FirstPrimitive = start; VB->Primitive[start] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; VB->PrimitiveLength[start] = count - start; - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); } else { /* 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. + * Invalidate any cached 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; tnl->pipeline.run_input_changes |= ctx->Array._Enabled; - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); tnl->pipeline.run_input_changes |= ctx->Array._Enabled; } } @@ -291,7 +291,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; VB->PrimitiveLength[0] = nr + minimum; tnl->pipeline.run_input_changes |= ctx->Array._Enabled; - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); tnl->pipeline.run_input_changes |= ctx->Array._Enabled; } } @@ -418,8 +418,6 @@ void _tnl_array_init( GLcontext *ctx ) */ _mesa_vector4f_init( &tmp->Obj, 0, 0 ); _mesa_vector3f_init( &tmp->Normal, 0, 0 ); -/* _mesa_vector4chan_init( &tmp->Color, 0, 0 ); */ -/* _mesa_vector4chan_init( &tmp->SecondaryColor, 0, 0 ); */ _mesa_vector1f_init( &tmp->FogCoord, 0, 0 ); _mesa_vector1ui_init( &tmp->Index, 0, 0 ); _mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index d5fc43fe4e2..582356dd378 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -1,4 +1,4 @@ -/* $Id: t_context.h,v 1.22 2001/04/30 21:08:52 keithw Exp $ */ +/* $Id: t_context.h,v 1.23 2001/05/10 12:18:38 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -345,7 +345,7 @@ struct gl_pipeline { GLuint run_state_changes; /* state changes since last run */ GLuint run_input_changes; /* VERT_* changes since last run */ GLuint inputs; /* VERT_* inputs to pipeline */ - struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES]; + struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES+1]; GLuint nr_stages; }; @@ -377,10 +377,10 @@ struct tnl_device_driver { *** TNL Pipeline ***/ - void (*PipelineStart)(GLcontext *ctx); - void (*PipelineFinish)(GLcontext *ctx); - /* Called before and after all pipeline stages. - * These are a suitable place for grabbing/releasing hardware locks. + void (*RunPipeline)(GLcontext *ctx); + /* Replaces PipelineStart/PipelineFinish -- intended to allow + * drivers to wrap _tnl_run_pipeline() with code to validate state + * and grab/release hardware locks. */ /*** diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c index adb79ab7d56..64ea08810be 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.22 2001/05/09 13:53:36 keithw Exp $ */ +/* $Id: t_imm_exec.c,v 1.23 2001/05/10 12:18:38 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -367,7 +367,7 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ) /* Invalidate all stored data before and after run: */ tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; _tnl_copy_to_current( ctx, IM, IM->OrFlag ); @@ -420,7 +420,7 @@ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) /* Run the pipeline. No input changes as a result of this action. */ - _tnl_run_pipeline( ctx ); + tnl->Driver.RunPipeline( ctx ); /* Still need to update current values: (TODO - copy from VB) * TODO: delay this until FlushVertices diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 73fa9c95719..bc2b6682253 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.17 2001/04/30 09:04:00 keithw Exp $ */ +/* $Id: t_pipeline.c,v 1.18 2001/05/10 12:18:38 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -63,6 +63,8 @@ void _tnl_install_pipeline( GLcontext *ctx, pipe->build_state_trigger |= pipe->stages[i].check_state; } + MEMSET( &pipe->stages[i], 0, sizeof( **stages )); + pipe->nr_stages = i; } @@ -86,13 +88,12 @@ void _tnl_validate_pipeline( GLcontext *ctx ) struct gl_pipeline_stage *s = pipe->stages; GLuint newstate = pipe->build_state_changes; GLuint generated = 0; - GLuint i; GLuint changed_inputs = 0; pipe->inputs = 0; pipe->build_state_changes = 0; - for (i = pipe->nr_stages+1 ; --i ; s++) { + for ( ; s->check ; s++) { s->changed_inputs |= s->inputs & changed_inputs; @@ -125,55 +126,40 @@ void _tnl_run_pipeline( GLcontext *ctx ) GLuint changed_state = pipe->run_state_changes; GLuint changed_inputs = pipe->run_input_changes; GLboolean running = GL_TRUE; - GLuint i; unsigned short __tmp; + pipe->run_state_changes = 0; + pipe->run_input_changes = 0; + /* Done elsewhere. */ ASSERT(pipe->build_state_changes == 0); - -/* _tnl_print_vert_flags( "run_pipeline, new inputs", changed_inputs ); */ -/* _mesa_print_state( "run_pipeline, new state", changed_state ); */ START_FAST_MATH(__tmp); - if (tnl->Driver.PipelineStart) - tnl->Driver.PipelineStart( ctx ); /* If something changes in the pipeline, tag all subsequent stages - * using this value for recalculation. - * - * Even inactive stages have their state and inputs examined to try - * to keep cached data alive over state-changes. + * using this value for recalculation. Inactive stages have their + * state and inputs examined to try to keep cached data alive over + * state-changes. */ - for (i = pipe->nr_stages+1 ; --i ; s++) { + for ( ; s->run ; s++) { s->changed_inputs |= s->inputs & changed_inputs; - if (s->run_state & changed_state) { + if (s->run_state & changed_state) s->changed_inputs = s->inputs; - } - if (s->active) { - if (running) { - if (s->changed_inputs) - changed_inputs |= s->outputs; + if (s->active && running) { + if (s->changed_inputs) + changed_inputs |= s->outputs; - if (0) - fprintf(stderr, "run %s inputs %x\n", - s->name, s->changed_inputs); + running = s->run( ctx, s ); - running = s->run( ctx, s ); - s->changed_inputs = 0; /* readded this apr 30 */ - VB->importable_data &= ~s->outputs; - } + s->changed_inputs = 0; + VB->importable_data &= ~s->outputs; } } - if (tnl->Driver.PipelineFinish) - tnl->Driver.PipelineFinish( ctx ); END_FAST_MATH(__tmp); - - pipe->run_state_changes = 0; - pipe->run_input_changes = 0; }