diff options
author | Brian <[email protected]> | 2007-03-27 09:51:52 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-03-27 09:51:52 -0600 |
commit | 3e45db67294faaf0a06c42bdd6dbdb96f87c8801 (patch) | |
tree | b8dc873e8449e4f53e0acab6d410f8ad0b60e68c /src/mesa | |
parent | 3b8ab881312f36a948913653ed3c471017f811f0 (diff) |
Restore the UseTexEnvProgram logic.
Was removed during glsl-compiler work. Still need to go back and revisit this
because of the interaction with fragment shaders...
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_vtbl.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_state.c | 2 | ||||
-rw-r--r-- | src/mesa/main/context.c | 10 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/state.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_aalinetemp.h | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_pointtemp.h | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_context.c | 2 |
11 files changed, 26 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 4ab9d2686cb..2bc1cae9c31 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -168,6 +168,7 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis, ctx->Const.FragmentProgram.MaxNativeTexIndirections = I915_MAX_TEX_INDIRECT; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; + ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE; driInitExtensions( ctx, i915_extensions, GL_FALSE ); diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index d126208ce05..5e00e6597b0 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -531,7 +531,7 @@ void i915_update_fog( GLcontext *ctx ) GLboolean enabled; GLboolean try_pixel_fog; - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { /* Pull in static fog state from program */ mode = ctx->FragmentProgram._Current->FogOption; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index c920fc47ea0..b0e5f87fc75 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -46,7 +46,7 @@ static void i915_render_start( intelContextPtr intel ) GLcontext *ctx = &intel->ctx; i915ContextPtr i915 = I915_CONTEXT(intel); - if (ctx->FragmentProgram._Current) + if (ctx->FragmentProgram._Active) i915ValidateFragmentProgram( i915 ); else { assert(!ctx->FragmentProgram._MaintainTexEnvProgram); diff --git a/src/mesa/drivers/dri/i915tex/i915_context.c b/src/mesa/drivers/dri/i915tex/i915_context.c index d4187238f3c..4887d80e191 100644 --- a/src/mesa/drivers/dri/i915tex/i915_context.c +++ b/src/mesa/drivers/dri/i915tex/i915_context.c @@ -158,7 +158,7 @@ i915CreateContext(const __GLcontextModes * mesaVis, ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - /*ctx->_UseTexEnvProgram = 1;*/ + ctx->_UseTexEnvProgram = GL_TRUE; driInitExtensions(ctx, i915_extensions, GL_FALSE); diff --git a/src/mesa/drivers/dri/i915tex/i915_state.c b/src/mesa/drivers/dri/i915tex/i915_state.c index c2c2ff366f1..1fafadced02 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state.c +++ b/src/mesa/drivers/dri/i915tex/i915_state.c @@ -561,7 +561,7 @@ i915_update_fog(GLcontext * ctx) GLboolean enabled; GLboolean try_pixel_fog; - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { /* Pull in static fog state from program */ mode = ctx->FragmentProgram._Current->FogOption; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 72c85de7ba2..ae1c576248e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1355,14 +1355,16 @@ _mesa_initialize_context(GLcontext *ctx, ctx->TnlModule.SwapCount = 0; #endif + ctx->FragmentProgram._MaintainTexEnvProgram + = (_mesa_getenv("MESA_TEX_PROG") != NULL); + ctx->FragmentProgram._UseTexEnvProgram = ctx->FragmentProgram._MaintainTexEnvProgram; + ctx->VertexProgram._MaintainTnlProgram = (_mesa_getenv("MESA_TNL_PROG") != NULL); - if (ctx->VertexProgram._MaintainTnlProgram) + if (ctx->VertexProgram._MaintainTnlProgram) { /* this is required... */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - else - ctx->FragmentProgram._MaintainTexEnvProgram - = (_mesa_getenv("MESA_TEX_PROG") != NULL); + } ctx->FirstTimeCurrent = GL_TRUE; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 828b0f2384e..4fc98f4628a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1987,6 +1987,7 @@ struct gl_fragment_program_state { GLboolean Enabled; /**< User-set fragment program enable flag */ GLboolean _Enabled; /**< Fragment program enabled and valid? */ + GLboolean _Active; struct gl_fragment_program *Current; /**< User-bound fragment program */ /** Currently enabled and valid program (including internal programs @@ -1998,6 +1999,7 @@ struct gl_fragment_program_state /** Should fixed-function texturing be implemented with a fragment prog? */ GLboolean _MaintainTexEnvProgram; + GLboolean _UseTexEnvProgram; /** Program to emulate fixed-function texture env/combine (see above) */ struct gl_fragment_program *_TexEnvProgram; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 6ed7ae6c7dd..9ae71c57383 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -964,6 +964,9 @@ update_program(GLcontext *ctx) if (shProg && shProg->LinkStatus) { /* Use shader programs */ + /* XXX this isn't quite right, since we may have either a vertex + * _or_ fragment shader (not always both). + */ ctx->VertexProgram._Current = shProg->VertexProgram; ctx->FragmentProgram._Current = shProg->FragmentProgram; } @@ -1000,6 +1003,13 @@ update_program(GLcontext *ctx) ctx->FragmentProgram._Current = NULL; } } + + ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; + if (ctx->FragmentProgram._MaintainTexEnvProgram && + !ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._UseTexEnvProgram) + ctx->FragmentProgram._Active = GL_TRUE; + } } diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 4d33b7dff7e..dd741630a1d 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -87,7 +87,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) if (swrast->_FragmentAttribs & (1 << attr)) { GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; GLfloat invQ; - if (ctx->FragmentProgram._Current) { + if (ctx->FragmentProgram._Active) { invQ = 1.0F; } else { diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h index cc6f999b91b..1956eeba50b 100644 --- a/src/mesa/swrast/s_pointtemp.h +++ b/src/mesa/swrast/s_pointtemp.h @@ -121,7 +121,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) #endif #if FLAGS & TEXTURE span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); - if (ctx->FragmentProgram._Current) { + if (ctx->FragmentProgram._Active) { /* Don't divide texture s,t,r by q (use TXP to do that) */ for (attr = swrast->_MinFragmentAttrib; attr < swrast->_MaxFragmentAttrib; attr++) { if (swrast->_FragmentAttribs & (1 << attr)) { diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index fa42a3df988..b7c2c6f9bdb 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -138,7 +138,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) } if (ctx->Fog.Enabled || - (ctx->FragmentProgram._Current && + (ctx->FragmentProgram._Active && (ctx->FragmentProgram._Current->FogOption != GL_NONE || ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_FOGC))) RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); |