]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.cpp
Refactor add_to_chain as a common utility function
[libs/gl.git] / source / glsl / syntax.cpp
index d0273909d68db900e0d95e79c08f1d2cf9f140cd..b224763248f26aa20f2d7e537ccbc6aa224acdb7 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)
@@ -553,6 +555,13 @@ int get_layout_value(const Layout &layout, const string &name, int def_value)
        return def_value;
 }
 
+void add_to_chain(Assignment::Target &target, Assignment::Target::ChainType type, unsigned index)
+{
+       if(target.chain_len<7)
+               target.chain[target.chain_len] = type | min<unsigned>(index, 0x3F);
+       ++target.chain_len;
+}
+
 } // namespace SL
 } // namespace GL
 } // namespace Msp