]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.cpp
Store the index of the member in MemberAccess
[libs/gl.git] / source / glsl / syntax.cpp
index 23b8f0301e9bd76196ec15b7388ef74f5ed2887e..c54a82979081cc03e3a2c4bbb66e55cb9b2aa934 100644 (file)
@@ -138,14 +138,16 @@ void InterfaceBlockReference::visit(NodeVisitor &visitor)
 
 
 MemberAccess::MemberAccess():
-       declaration(0)
+       declaration(0),
+       index(-1)
 { }
 
 MemberAccess::MemberAccess(const MemberAccess &other):
        Expression(other),
        left(other.left),
        member(other.member),
-       declaration(0)
+       declaration(0),
+       index(-1)
 { }
 
 void MemberAccess::visit(NodeVisitor &visitor)
@@ -545,6 +547,14 @@ bool is_same_type(const TypeDeclaration &type1, const TypeDeclaration &type2)
                return false;
 }
 
+int get_layout_value(const Layout &layout, const string &name, int def_value)
+{
+       for(vector<Layout::Qualifier>::const_iterator i=layout.qualifiers.begin(); i!=layout.qualifiers.end(); ++i)
+               if(i->name==name)
+                       return i->value;
+       return def_value;
+}
+
 } // namespace SL
 } // namespace GL
 } // namespace Msp