mesa: Add a flag to indicate whether a program uses gl_ClipDistance.

GLSL 1.30 requires us to use gl_ClipDistance for clipping if the
vertex shader contains a static write to it, and otherwise use
user-defined clipping planes.  Since the driver needs to behave
differently in these two cases, we need a flag to record whether the
shader has written to gl_ClipDistance.

The new flag is called UsesClipDistance.  We initially store it in
gl_shader_program (since that is the data structure that is available
when we check to see whethe gl_ClipDistance was written to), and we
later copy it to a flag with the same name in gl_vertex_program, since
that is a more convenient place for the driver to access it (in i965,
at least).

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ceb49fd..d802a0a 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -244,7 +244,9 @@
 
 
 /**
- * Verify that a vertex shader executable meets all semantic requirements
+ * Verify that a vertex shader executable meets all semantic requirements.
+ *
+ * Also sets prog->Vert.UsesClipDistance as a side effect.
  *
  * \param shader  Vertex shader executable to be verified
  */
@@ -279,6 +281,7 @@
                       "and `gl_ClipDistance'\n");
          return false;
       }
+      prog->Vert.UsesClipDistance = clip_distance.variable_found();
    }
 
    return true;