summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-03-27 09:51:52 -0600
committerBrian <[email protected]>2007-03-27 09:51:52 -0600
commit3e45db67294faaf0a06c42bdd6dbdb96f87c8801 (patch)
treeb8dc873e8449e4f53e0acab6d410f8ad0b60e68c /src/mesa/main
parent3b8ab881312f36a948913653ed3c471017f811f0 (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/main')
-rw-r--r--src/mesa/main/context.c10
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/state.c10
3 files changed, 18 insertions, 4 deletions
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;
+ }
}