r300: clean fog_attr/wpos_attr if code accessing these attributes has been removed...
authorMaciej Cencora <m.cencora@gmail.com>
Sun, 21 Mar 2010 10:19:02 +0000 (11:19 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Wed, 24 Mar 2010 19:07:37 +0000 (20:07 +0100)
src/mesa/drivers/dri/r300/r300_fragprog_common.c

index 61ea5e4d9a35fb5c88fefe56ca20a9279996db0c..0646da46249ea9b5fe36714f0031ff838b03bdb9 100644 (file)
@@ -256,6 +256,19 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
 
        fp->InputsRead = compiler.Base.Program.InputsRead;
 
+       /* Clear the fog/wpos_attr if code accessing these
+        * attributes has been removed during compilation
+        */
+       if (fp->fog_attr != FRAG_ATTRIB_MAX) {
+               if (!(fp->InputsRead & (1 << fp->fog_attr)))
+                       fp->fog_attr = FRAG_ATTRIB_MAX;
+       }
+
+       if (fp->wpos_attr != FRAG_ATTRIB_MAX) {
+               if (!(fp->InputsRead & (1 << fp->wpos_attr)))
+                       fp->wpos_attr = FRAG_ATTRIB_MAX;
+       }
+
        rc_destroy(&compiler.Base);
 }