Mesa (glsl2): glsl2: Add a method for querying if an AST type has any qualifiers.

Ian Romanick idr at kemper.freedesktop.org
Tue Jun 29 11:15:11 PDT 2010


Module: Mesa
Branch: glsl2
Commit: 28527ed557923aecff5d3b88e5d7776f04389547
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=28527ed557923aecff5d3b88e5d7776f04389547

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Jun 29 00:47:44 2010 -0700

glsl2: Add a method for querying if an AST type has any qualifiers.

---

 src/glsl/ast.h        |    1 +
 src/glsl/ast_type.cpp |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index de300e7..adb5fb1 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -418,6 +418,7 @@ public:
 class ast_fully_specified_type : public ast_node {
 public:
    virtual void print(void) const;
+   bool has_qualifiers() const;
 
    ast_type_qualifier qualifier;
    ast_type_specifier *specifier;
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 49dfde2..e2510a1 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -110,3 +110,13 @@ ast_type_specifier::ast_type_specifier(int specifier)
 
    type_name = names[specifier];
 }
+
+bool
+ast_fully_specified_type::has_qualifiers() const
+{
+   return qualifier.invariant || qualifier.constant || qualifier.attribute
+			      || qualifier.varying || qualifier.in
+			      || qualifier.out || qualifier.centroid
+			      || qualifier.uniform || qualifier.smooth
+			      || qualifier.flat || qualifier.noperspective;
+}



More information about the mesa-commit mailing list