Fix 'make check' in src/mapi/glapi/tests when builddir != srcdir
[mesa.git] / src / glsl / ir.h
index 7859702ed015c7d2d2464048da2500d0f36030bb..b898d619b3eaf9b61490f3db8f0b6e8d516e07df 100644 (file)
@@ -293,6 +293,34 @@ enum ir_variable_mode {
    ir_var_mode_count   /**< Number of variable modes */
 };
 
+/**
+ * Enum keeping track of how a variable was declared.  For error checking of
+ * the gl_PerVertex redeclaration rules.
+ */
+enum ir_var_declaration_type {
+   /**
+    * Normal declaration (for most variables, this means an explicit
+    * declaration.  Exception: temporaries are always implicitly declared, but
+    * they still use ir_var_declared_normally).
+    *
+    * Note: an ir_variable that represents a named interface block uses
+    * ir_var_declared_normally.
+    */
+   ir_var_declared_normally = 0,
+
+   /**
+    * Variable was explicitly declared (or re-declared) in an unnamed
+    * interface block.
+    */
+   ir_var_declared_in_block,
+
+   /**
+    * Variable is an implicitly declared built-in that has not been explicitly
+    * re-declared by the shader.
+    */
+   ir_var_declared_implicitly,
+};
+
 /**
  * \brief Layout qualifiers for gl_FragDepth.
  *
@@ -525,6 +553,14 @@ public:
     */
    unsigned assigned:1;
 
+   /**
+    * Enum indicating how the variable was declared.  See
+    * ir_var_declaration_type.
+    *
+    * This is used to detect certain kinds of illegal variable redeclarations.
+    */
+   unsigned how_declared:2;
+
    /**
     * Storage class of the variable.
     *
@@ -996,13 +1032,33 @@ public:
     * If \c from and \c to are the same value, the loop will execute once.
     */
    /*@{*/
-   ir_rvalue *from;             /** Value of the loop counter on the first
-                                * iteration of the loop.
-                                */
-   ir_rvalue *to;               /** Value of the loop counter on the last
-                                * iteration of the loop.
-                                */
+
+   /**
+    * Value which should be assigned to \c counter before the first iteration
+    * of the loop.  Must be non-null whenever \c counter is non-null, and vice
+    * versa.
+    */
+   ir_rvalue *from;
+
+   /**
+    * Value which \c counter should be compared to in order to determine
+    * whether to exit the loop.  Must be non-null whenever \c counter is
+    * non-null, and vice versa.
+    */
+   ir_rvalue *to;
+
+   /**
+    * Value which should be added to \c counter at the end of each loop
+    * iteration.  Must be non-null whenever \c counter is non-null, and vice
+    * versa.
+    */
    ir_rvalue *increment;
+
+   /**
+    * Variable which counts loop iterations.  This is a brand new ir_variable
+    * declaration (not a reference to a previously declared ir_variable, as in
+    * ir_dereference_variable).
+    */
    ir_variable *counter;
 
    /**
@@ -1011,6 +1067,8 @@ public:
     * If any of the loop control fields are non-\c NULL, this field must be
     * one of \c ir_binop_less, \c ir_binop_greater, \c ir_binop_lequal,
     * \c ir_binop_gequal, \c ir_binop_equal, or \c ir_binop_nequal.
+    *
+    * Ignored if \c counter is NULL.
     */
    int cmp;
    /*@}*/