From 6f973f33679e034b7cb63806f1ddfabdbdd70123 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 22 Apr 2005 12:51:19 +0000 Subject: Simplify the pipeline_stage structure - remove input/output fields, input tracking removed. - remove state fields, the validate function now called on every statechange. - add an explicit 'create' function. Add in code to build vertex program to implement current t&l state. Still disabled, but turn on with a #define in t_vp_build.h. --- src/mesa/tnl/t_vb_arbprogram.c | 43 +++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'src/mesa/tnl/t_vb_arbprogram.c') diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c index af91546f2e..d5412938f7 100644 --- a/src/mesa/tnl/t_vb_arbprogram.c +++ b/src/mesa/tnl/t_vb_arbprogram.c @@ -40,6 +40,7 @@ #include "math/m_translate.h" #include "t_context.h" #include "t_pipeline.h" +#include "t_vp_build.h" @@ -416,7 +417,7 @@ static void do_PAR( struct arb_vp_machine *m, union instruction op ) } -#define RELADDR_MASK MAX_NV_VERTEX_PROGRAM_PARAMS +#define RELADDR_MASK (MAX_NV_VERTEX_PROGRAM_PARAMS-1) static void do_PRL( struct arb_vp_machine *m, union instruction op ) { @@ -1458,17 +1459,25 @@ static void validate_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct arb_vp_machine *m = ARB_VP_MACHINE(stage); - struct vertex_program *program = (ctx->VertexProgram._Enabled ? - ctx->VertexProgram.Current : - &ctx->_TnlProgram); + struct vertex_program *program = + (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : 0); - compile_vertex_program( m, program ); +#if TNL_FIXED_FUNCTION_PROGRAM + if (!program) { + _tnl_UpdateFixedFunctionProgram( ctx ); + program = &ctx->_TnlProgram; + } +#endif - /* Grab the state GL state and put into registers: - */ - m->File[PROGRAM_LOCAL_PARAM] = program->Base.LocalParams; - m->File[PROGRAM_ENV_PARAM] = ctx->VertexProgram.Parameters; - m->File[PROGRAM_STATE_VAR] = 0; + if (program) { + compile_vertex_program( m, program ); + + /* Grab the state GL state and put into registers: + */ + m->File[PROGRAM_LOCAL_PARAM] = program->Base.LocalParams; + m->File[PROGRAM_ENV_PARAM] = ctx->VertexProgram.Parameters; + m->File[PROGRAM_STATE_VAR] = 0; + } } @@ -1481,8 +1490,8 @@ validate_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage ) * Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ -static void init_vertex_program( GLcontext *ctx, - struct tnl_pipeline_stage *stage ) +static GLboolean init_vertex_program( GLcontext *ctx, + struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &(tnl->vb); @@ -1493,7 +1502,7 @@ static void init_vertex_program( GLcontext *ctx, stage->privatePtr = MALLOC(sizeof(*m)); m = ARB_VP_MACHINE(stage); if (!m) - return; + return GL_FALSE; /* arb_vertex_machine struct should subsume the VB: */ @@ -1509,6 +1518,14 @@ static void init_vertex_program( GLcontext *ctx, /* a few other misc allocations */ _mesa_vector4f_alloc( &m->ndcCoords, 0, size, 32 ); m->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + + +#if TNL_FIXED_FUNCTION_PROGRAM + _mesa_allow_light_in_model( ctx, GL_FALSE ); +#endif + + + return GL_TRUE; } -- cgit v1.2.3