summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-09-12 10:04:56 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-09-12 10:04:56 +0100
commitaf74abab6b9a1e32a1cc5cac7e547b953dcee0ab (patch)
tree4d4e24068cec9a4f2d41a4199986379df7e55beb /src/mesa/main
parent52a9dfd4feae7d5d20519d48e72f3e38de4e2332 (diff)
mesa: get fixed-function program generation working again
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/state.c62
-rw-r--r--src/mesa/main/texenvprogram.c3
2 files changed, 45 insertions, 20 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 5827f2211c..e340cd6686 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -219,23 +219,6 @@ update_program(GLcontext *ctx)
shProg->FragmentProgram);
}
else {
- if (ctx->VertexProgram._Enabled) {
- /* use user-defined vertex program */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- ctx->VertexProgram.Current);
- }
- else if (ctx->VertexProgram._MaintainTnlProgram) {
- /* Use vertex program generated from fixed-function state.
- * The _Current pointer will get set in
- * _tnl_UpdateFixedFunctionProgram() later if appropriate.
- */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
- }
- else {
- /* no vertex program */
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
- }
-
if (ctx->FragmentProgram._Enabled) {
/* use user-defined vertex program */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
@@ -243,15 +226,38 @@ update_program(GLcontext *ctx)
}
else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
/* Use fragment program generated from fixed-function state.
- * The _Current pointer will get set in _mesa_UpdateTexEnvProgram()
- * later if appropriate.
*/
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
+ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
+ _mesa_get_fixed_func_fragment_program(ctx));
+ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ ctx->FragmentProgram._Current);
}
else {
/* no fragment program */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
}
+
+ /* Examine vertex program after fragment program as
+ * _mesa_get_fixed_func_vertex_program() needs to know active
+ * fragprog inputs.
+ */
+ if (ctx->VertexProgram._Enabled) {
+ /* use user-defined vertex program */
+ _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
+ ctx->VertexProgram.Current);
+ }
+ else if (ctx->VertexProgram._MaintainTnlProgram) {
+ /* Use vertex program generated from fixed-function state.
+ */
+ _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
+ _mesa_get_fixed_func_vertex_program(ctx));
+ _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram,
+ ctx->VertexProgram._Current);
+ }
+ else {
+ /* no vertex program */
+ _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
+ }
}
if (ctx->VertexProgram._Current)
@@ -260,12 +266,28 @@ update_program(GLcontext *ctx)
assert(ctx->FragmentProgram._Current->Base.Parameters);
+ /* XXX: get rid of _Active flag.
+ */
+#if 1
ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
if (ctx->FragmentProgram._MaintainTexEnvProgram &&
!ctx->FragmentProgram._Enabled) {
if (ctx->FragmentProgram._UseTexEnvProgram)
ctx->FragmentProgram._Active = GL_TRUE;
}
+#endif
+
+ /* Let the driver know what's happening:
+ */
+ if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
+ (struct gl_program *) ctx->FragmentProgram._Current);
+ }
+
+ if (ctx->VertexProgram._Current != prevVP && ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
+ (struct gl_program *) ctx->VertexProgram._Current);
+ }
}
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 713ff3d256..25e280bc3f 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -1190,6 +1190,9 @@ _mesa_get_fixed_func_fragment_program(GLcontext *ctx)
* If _MaintainTexEnvProgram is set we'll generate a fragment program that
* implements the current texture env/combine mode.
* This function generates that program and puts it into effect.
+ *
+ * XXX: remove this function. currently only called by some drivers,
+ * not by mesa core. We now handle this properly from inside mesa.
*/
void
_mesa_UpdateTexEnvProgram( GLcontext *ctx )