]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / glsl / syntax.h
index 8567555a5d342ef6dfadeab58627fa2ccc0e2ef8..ebe188e1f6afa932fe5fd697509c043cfeb5ef23 100644 (file)
@@ -111,7 +111,6 @@ class NodeArray: public NodeContainer<std::vector<RefPtr<T> > >
 
 struct TypeDeclaration;
 struct VariableDeclaration;
-struct InterfaceBlock;
 struct FunctionDeclaration;
 
 struct Statement: Node
@@ -166,19 +165,6 @@ struct VariableReference: Expression
        virtual void visit(NodeVisitor &);
 };
 
-struct InterfaceBlockReference: Expression
-{
-       std::string name;
-
-       InterfaceBlock *declaration = 0;
-
-       InterfaceBlockReference() = default;
-       InterfaceBlockReference(const InterfaceBlockReference &);
-
-       virtual InterfaceBlockReference *clone() const { return new InterfaceBlockReference(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
 struct MemberAccess: Expression
 {
        NodePtr<Expression> left;
@@ -233,11 +219,11 @@ struct Assignment: BinaryExpression
                        ARRAY = 0xC0
                };
 
-               Statement *declaration = 0;
+               VariableDeclaration *declaration = 0;
                std::uint8_t chain_len = 0;
                std::uint8_t chain[7] = { };
 
-               Target(Statement *d = 0): declaration(d) { }
+               Target(VariableDeclaration *d = 0): declaration(d) { }
 
                bool operator<(const Target &) const;
        };
@@ -354,6 +340,7 @@ struct BasicTypeDeclaration: TypeDeclaration
        Kind kind = ALIAS;
        unsigned size = 0;
        bool sign = true;
+       bool extended_alignment = false;
        std::string base;
 
        TypeDeclaration *base_type = 0;
@@ -377,11 +364,14 @@ struct ImageTypeDeclaration: TypeDeclaration
 
        Dimensions dimensions = TWO;
        bool array = false;
-       bool sampled = true;
+       bool sampled = false;
        bool shadow = false;
+       bool multisample = false;
        std::string base;
+       std::string format;
 
        TypeDeclaration *base_type = 0;
+       ImageTypeDeclaration *base_image = 0;
 
        virtual ImageTypeDeclaration *clone() const { return new ImageTypeDeclaration(*this); }
        virtual void visit(NodeVisitor &);
@@ -390,12 +380,13 @@ struct ImageTypeDeclaration: TypeDeclaration
 struct StructDeclaration: TypeDeclaration
 {
        Block members;
+       std::string block_name;
+       bool extended_alignment = false;
 
-       InterfaceBlock *interface_block = 0;
+       VariableDeclaration *block_declaration = 0;
 
        StructDeclaration();
        StructDeclaration(const StructDeclaration &);
-       ~StructDeclaration();
 
        virtual StructDeclaration *clone() const { return new StructDeclaration(*this); }
        virtual void visit(NodeVisitor &);
@@ -416,6 +407,7 @@ struct VariableDeclaration: Statement
        NodePtr<Expression> init_expression;
 
        TypeDeclaration *type_declaration = 0;
+       StructDeclaration *block_declaration = 0;
        VariableDeclaration *linked_declaration = 0;
 
        VariableDeclaration() = default;
@@ -426,29 +418,6 @@ struct VariableDeclaration: Statement
        virtual void visit(NodeVisitor &);
 };
 
-struct InterfaceBlock: Statement
-{
-       NodePtr<Layout> layout;
-       std::string interface;
-       std::string block_name;
-       NodePtr<Block> members;
-       std::string instance_name;
-       bool array = false;
-
-       /* An interface block's ultimate base type is always a struct.  The
-       immediate type may be either that same struct or an array of it. */
-       TypeDeclaration *type_declaration = 0;
-       StructDeclaration *struct_declaration = 0;
-       InterfaceBlock *linked_block = 0;
-
-       InterfaceBlock() = default;
-       InterfaceBlock(const InterfaceBlock &);
-       ~InterfaceBlock();
-
-       virtual InterfaceBlock *clone() const { return new InterfaceBlock(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
 struct FunctionDeclaration: Statement
 {
        std::string return_type;
@@ -520,15 +489,18 @@ struct Stage
        {
                SHARED,
                VERTEX,
+               TESS_CONTROL,
+               TESS_EVAL,
                GEOMETRY,
-               FRAGMENT
+               FRAGMENT,
+               COMPUTE
        };
 
        Type type;
        Stage *previous = 0;
        Block content;
        std::map<std::string, TypeDeclaration *> types;
-       std::map<std::string, InterfaceBlock *> interface_blocks;
+       std::map<std::string, VariableDeclaration *> interface_blocks;
        std::map<std::string, FunctionDeclaration *> functions;
        std::map<std::string, unsigned> locations;
        std::map<std::string, unsigned> texture_bindings;
@@ -552,9 +524,12 @@ struct Module
 };
 
 std::string get_unused_variable_name(const Block &, const std::string &);
-
-int get_layout_value(const Layout &, const std::string &, int = -1);
+TypeDeclaration *get_ultimate_base_type(TypeDeclaration *);
+bool has_layout_qualifier(const Layout *, const std::string &);
+int get_layout_value(const Layout *, const std::string &, int = -1);
+void add_layout_qualifier(RefPtr<Layout> &, const Layout::Qualifier &);
 void add_to_chain(Assignment::Target &, Assignment::Target::ChainType, unsigned);
+bool targets_overlap(const Assignment::Target &, const Assignment::Target &);
 
 } // namespace SL
 } // namespace GL