summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_vb_program.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-04-22 12:51:19 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-04-22 12:51:19 +0000
commit6f973f33679e034b7cb63806f1ddfabdbdd70123 (patch)
tree31580bc32d1b87a3dddd8f7c8bc5f404b407c637 /src/mesa/tnl/t_vb_program.c
parent6a13c7da4c79f7e811fbddc68f59441070ff0cc8 (diff)
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.
Diffstat (limited to 'src/mesa/tnl/t_vb_program.c')
-rw-r--r--src/mesa/tnl/t_vb_program.c107
1 files changed, 10 insertions, 97 deletions
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 614d537c30..9cf5df7cae 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -51,26 +51,6 @@
#include "t_pipeline.h"
-/**
- * \warning These values _MUST_ match the values in the OutputRegisters[]
- * array in vpparse.c!!!
- */
-#define VERT_RESULT_HPOS 0
-#define VERT_RESULT_COL0 1
-#define VERT_RESULT_COL1 2
-#define VERT_RESULT_BFC0 3
-#define VERT_RESULT_BFC1 4
-#define VERT_RESULT_FOGC 5
-#define VERT_RESULT_PSIZ 6
-#define VERT_RESULT_TEX0 7
-#define VERT_RESULT_TEX1 8
-#define VERT_RESULT_TEX2 9
-#define VERT_RESULT_TEX3 10
-#define VERT_RESULT_TEX4 11
-#define VERT_RESULT_TEX5 12
-#define VERT_RESULT_TEX6 13
-#define VERT_RESULT_TEX7 14
-
/*!
* Private storage for the vertex program pipeline stage.
@@ -100,6 +80,9 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
struct vertex_program *program = ctx->VertexProgram.Current;
GLuint i;
+ if (!ctx->VertexProgram._Enabled)
+ return GL_TRUE;
+
/* load program parameter registers (they're read-only) */
_mesa_init_vp_per_primitive_registers(ctx);
@@ -223,61 +206,14 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
}
-/**
- * This function validates stuff.
- */
-static GLboolean run_validate_program( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
-#if 000
- /* XXX do we need any validation for vertex programs? */
- GLuint ind = 0;
- light_func *tab;
-
- if (ctx->Visual.rgbMode) {
- if (ctx->Light._NeedVertices) {
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- tab = _tnl_light_spec_tab;
- else
- tab = _tnl_light_tab;
- }
- else {
- if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev)
- tab = _tnl_light_fast_single_tab;
- else
- tab = _tnl_light_fast_tab;
- }
- }
- else
- tab = _tnl_light_ci_tab;
-
- if (ctx->Light.ColorMaterialEnabled)
- ind |= LIGHT_COLORMATERIAL;
-
- if (ctx->Light.Model.TwoSide)
- ind |= LIGHT_TWOSIDE;
-
- VP_STAGE_DATA(stage)->light_func_tab = &tab[ind];
-
- /* This and the above should only be done on _NEW_LIGHT:
- */
- _mesa_validate_all_lighting_tables( ctx );
-#endif
-
- /* Now run the stage...
- */
- stage->run = run_vp;
- return stage->run( ctx, stage );
-}
-
/**
* Called the first time stage->run is called. In effect, don't
* allocate data until the first time the stage is run.
*/
-static GLboolean run_init_vp( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
+static GLboolean init_vp( GLcontext *ctx,
+ struct tnl_pipeline_stage *stage )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &(tnl->vb);
@@ -300,29 +236,11 @@ static GLboolean run_init_vp( GLcontext *ctx,
_mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 );
store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 );
- /* Now validate the stage derived data...
- */
- stage->run = run_validate_program;
- return stage->run( ctx, stage );
+ return GL_TRUE;
}
-/**
- * Check if vertex program mode is enabled.
- * If so, configure the pipeline stage's type, inputs, and outputs.
- */
-static void check_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
-{
- stage->active = ctx->VertexProgram._Enabled;
-
- if (stage->active) {
- /* Set stage->inputs equal to the bitmask of vertex attributes
- * which the program needs for inputs.
- */
- stage->inputs = ctx->VertexProgram.Current->InputsRead;
- }
-}
/**
@@ -336,7 +254,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
GLuint i;
/* free the vertex program result arrays */
- for (i = 0; i < 15; i++)
+ for (i = 0; i < VERT_RESULT_MAX; i++)
_mesa_vector4f_free( &store->attribs[i] );
/* free misc arrays */
@@ -354,14 +272,9 @@ static void dtr( struct tnl_pipeline_stage *stage )
const struct tnl_pipeline_stage _tnl_vertex_program_stage =
{
"vertex-program",
- _NEW_ALL, /*XXX FIX */ /* recheck */
- _NEW_ALL, /*XXX FIX */ /* recalc */
- GL_FALSE, /* active */
- 0, /* inputs - calculated on the fly */
- _TNL_BITS_PROG_ANY, /* outputs -- could calculate */
- 0, /* changed_inputs */
NULL, /* private_data */
+ init_vp, /* create */
dtr, /* destroy */
- check_vp, /* check */
- run_init_vp /* run -- initially set to ctr */
+ NULL, /* validate */
+ run_vp /* run -- initially set to ctr */
};