only set InputsRead bit if input is really used
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index e385b9d..9e5169e 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -1576,9 +1576,6 @@
    if (err) {
       program_error(ctx, Program->Position, "Bad attribute binding");
    }
-   else {
-      Program->Base.InputsRead |= (1 << *inputReg);
-   }
 
    return err;
 }
@@ -2557,6 +2554,11 @@
          return 1;
    }
 
+   /* Add attributes to InputsRead only if they are used the program.
+    * This avoids the handling of unused ATTRIB declarations in the drivers. */
+   if (*File == PROGRAM_INPUT)
+      Program->Base.InputsRead |= (1 << *Index);
+
    return 0;
 }