gallium: fixup register indexes for fog/frontface/point coord
authorZack Rusin <zackr@vmware.com>
Tue, 7 Jul 2009 19:48:50 +0000 (12:48 -0700)
committerZack Rusin <zackr@vmware.com>
Tue, 7 Jul 2009 19:48:50 +0000 (12:48 -0700)
src/mesa/state_tracker/st_atom_shader.c

index 299aa762c201841743cdbbd37ce89da199235910..5219119c81850bdb3e9dfc553f4c76b575b639d4 100644 (file)
@@ -142,9 +142,18 @@ find_translated_vp(struct st_context *st,
             if ((fragInputsRead & FRAG_BIT_FOGC)) {
                /* leave placeholders for the
                 * extra registers we extract from fog */
-               if (stfp->Base.UsesFrontFacing ||
-                   stfp->Base.UsesPointCoord) {
-                  numIn += 2;
+               if (stfp->Base.UsesFrontFacing) {
+                  if (!stfp->Base.UsesFogFragCoord)
+                     --stfp->input_to_slot[inAttr];
+                  else
+                     ++numIn;
+               }
+               if (stfp->Base.UsesPointCoord) {
+                  if (!stfp->Base.UsesFrontFacing &&
+                      !stfp->Base.UsesFogFragCoord)
+                     stfp->input_to_slot[inAttr] -= 2;
+                  else
+                     ++numIn;
                }
             }
          }