From 47b29f511a8e917c65536fde90397d54d2ad23d3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 4 May 2005 11:44:44 +0000 Subject: Add a facility to route all rasterization through a fragment program which is automatically generated to match the current texture environment state. Introduces a new value ctx->FragmentProgram._Active which is true when either _Enabled is true or there is such a fragment program ready to run. To test out on a driver running the software rasterizer, set MESA_TEX_PROG=t in the environment. It goes without saying that performance is lower for the software rasterizer in this mode. --- src/mesa/swrast/s_context.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mesa/swrast/s_context.c') diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index b923f0a673..f6dcdbb964 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -104,7 +104,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */ } - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { rasterMask |= FRAGPROG_BIT; } @@ -161,7 +161,7 @@ _swrast_update_fog_hint( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); swrast->_PreferPixelFog = (!swrast->AllowVertexFog || - ctx->FragmentProgram._Enabled || + ctx->FragmentProgram._Active || (ctx->Hint.Fog == GL_NICEST && swrast->AllowPixelFog)); } @@ -202,10 +202,10 @@ _swrast_update_fog_state( GLcontext *ctx ) /* determine if fog is needed, and if so, which fog mode */ swrast->_FogEnabled = GL_FALSE; - if (ctx->FragmentProgram._Enabled) { - if (ctx->FragmentProgram.Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) { + if (ctx->FragmentProgram._Active) { + if (ctx->FragmentProgram._Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) { const struct fragment_program *p - = (struct fragment_program *) ctx->FragmentProgram.Current; + = (struct fragment_program *) ctx->FragmentProgram._Current; if (p->FogOption != GL_NONE) { swrast->_FogEnabled = GL_TRUE; swrast->_FogMode = p->FogOption; @@ -226,8 +226,8 @@ _swrast_update_fog_state( GLcontext *ctx ) static void _swrast_update_fragment_program( GLcontext *ctx ) { - if (ctx->FragmentProgram._Enabled) { - struct fragment_program *program = ctx->FragmentProgram.Current; + if (ctx->FragmentProgram._Active) { + struct fragment_program *program = ctx->FragmentProgram._Current; _mesa_load_state_parameters(ctx, program->Parameters); } } @@ -295,7 +295,7 @@ _swrast_validate_triangle( GLcontext *ctx, if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Enabled) { + && !ctx->FragmentProgram._Active) { /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; @@ -318,7 +318,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Enabled) { + && !ctx->FragmentProgram._Active) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -341,7 +341,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram._Enabled) { + && !ctx->FragmentProgram._Active) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } -- cgit v1.2.3