summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c1
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_vtbl.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_context.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_state.c2
-rw-r--r--src/mesa/main/context.c10
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/state.c10
-rw-r--r--src/mesa/swrast/s_aalinetemp.h2
-rw-r--r--src/mesa/swrast/s_pointtemp.h2
-rw-r--r--src/mesa/tnl/t_context.c2
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 4ab9d2686c..2bc1cae9c3 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 d126208ce0..5e00e6597b 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 c920fc47ea..b0e5f87fc7 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 d4187238f3..4887d80e19 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 c2c2ff366f..1fafadced0 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 72c85de7ba..ae1c576248 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 828b0f2384..4fc98f4628 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 6ed7ae6c7d..9ae71c5738 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 4d33b7dff7..dd741630a1 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 cc6f999b91..1956eeba50 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 fa42a3df98..b7c2c6f9bd 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 );