glsl: Add a new ast_type_qualifier::has_layout() method.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 13 Jul 2013 05:34:19 +0000 (22:34 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 18 Jul 2013 23:57:21 +0000 (16:57 -0700)
This makes it easy to check if any layout qualifiers are set.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/ast.h
src/glsl/ast_type.cpp

index c0350e7358eb13faffee9ec2e646272fefc59b89..441b389a74a97d427c539fc77eff9ff61685b3db 100644 (file)
@@ -457,6 +457,11 @@ struct ast_type_qualifier {
     */
    bool has_interpolation() const;
 
+   /**
+    * Return whether a layout qualifier is present.
+    */
+   bool has_layout() const;
+
    /**
     * \brief Return string representation of interpolation qualifier.
     *
index be84550da78f3a70395140efa018012c3b31f976..4e870a7074213a07b5557bdc80a3e0e8e63490a9 100644 (file)
@@ -56,6 +56,24 @@ bool ast_type_qualifier::has_interpolation() const
           || this->flags.q.noperspective;
 }
 
+bool
+ast_type_qualifier::has_layout() const
+{
+   return this->flags.q.origin_upper_left
+          || this->flags.q.pixel_center_integer
+          || this->flags.q.depth_any
+          || this->flags.q.depth_greater
+          || this->flags.q.depth_less
+          || this->flags.q.depth_unchanged
+          || this->flags.q.std140
+          || this->flags.q.shared
+          || this->flags.q.column_major
+          || this->flags.q.row_major
+          || this->flags.q.packed
+          || this->flags.q.explicit_location
+          || this->flags.q.explicit_index;
+}
+
 const char*
 ast_type_qualifier::interpolation_string() const
 {