summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-11-02 21:43:06 +0000
committerBrian Paul <[email protected]>2006-11-02 21:43:06 +0000
commitd78f65cd6cf04dafcf50b4014de9d28546badcfb (patch)
tree9ef84f1d00410c71ca63aa99f4d2cf61a20f6e3d /src/mesa
parent67a101759ec0b84e4f30fbb329e86ac5031cf7e7 (diff)
Fix fragment program fog problems found with Glean.
1. add PROGRAM_CONSTANT to switch() in src_vector(). 2. use _mesa_append_fog_code() to handle fog options in i915ProgramStringNotify(). 3. Re-enable some vertex attribute emit code that was previously disabled in i915ValidateFragmentProgram().
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c13
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_fragprog.c13
2 files changed, 24 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 7160234bced..ef14f3eef7c 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -39,6 +39,7 @@
#include "program_instruction.h"
#include "program.h"
+#include "programopt.h"
@@ -123,6 +124,7 @@ static GLuint src_vector( struct i915_fragment_program *p,
p, p->ctx->FragmentProgram.Parameters[source->Index]);
break;
+ case PROGRAM_CONSTANT:
case PROGRAM_STATE_VAR:
case PROGRAM_NAMED_PARAM:
src = i915_emit_param4fv(
@@ -937,6 +939,12 @@ static void i915ProgramStringNotify( GLcontext *ctx,
*/
ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
ctx->FragmentProgram.Enabled );
+
+ if (p->FragProg.FogOption) {
+ /* add extra instructions to do fog, then turn off FogOption field */
+ _mesa_append_fog_code(ctx, &p->FragProg);
+ p->FragProg.FogOption = GL_NONE;
+ }
}
_tnl_program_string(ctx, target, prog);
@@ -1010,7 +1018,10 @@ void i915ValidateFragmentProgram( i915ContextPtr i915 )
EMIT_PAD( 1 );
}
-#if 0
+ /* XXX this was disabled, but enabling this code helped fix the Glean
+ * tfragprog1 fog tests.
+ */
+#if 1
if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4 );
}
diff --git a/src/mesa/drivers/dri/i915tex/i915_fragprog.c b/src/mesa/drivers/dri/i915tex/i915_fragprog.c
index 2ddcbc43255..8772e702307 100644
--- a/src/mesa/drivers/dri/i915tex/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915tex/i915_fragprog.c
@@ -39,6 +39,7 @@
#include "program_instruction.h"
#include "program.h"
+#include "programopt.h"
@@ -127,6 +128,7 @@ src_vector(struct i915_fragment_program *p,
Index]);
break;
+ case PROGRAM_CONSTANT:
case PROGRAM_STATE_VAR:
case PROGRAM_NAMED_PARAM:
src =
@@ -928,6 +930,12 @@ i915ProgramStringNotify(GLcontext * ctx,
*/
ctx->Driver.Enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
ctx->FragmentProgram.Enabled);
+
+ if (p->FragProg.FogOption) {
+ /* add extra instructions to do fog, then turn off FogOption field */
+ _mesa_append_fog_code(ctx, &p->FragProg);
+ p->FragProg.FogOption = GL_NONE;
+ }
}
_tnl_program_string(ctx, target, prog);
@@ -1001,7 +1009,10 @@ i915ValidateFragmentProgram(struct i915_context *i915)
EMIT_PAD(1);
}
-#if 0
+ /* XXX this was disabled, but enabling this code helped fix the Glean
+ * tfragprog1 fog tests.
+ */
+#if 1
if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE) {
EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4);
}