X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fsyntax.h;h=95347e1bbb5831deaf9ffceb58cc1e196df25cde;hp=d3797ac415ecb73c222220c1596a82c7fb2b9fed;hb=HEAD;hpb=f82ef715f0d7e1e7d0b93be4b7b89c8ce6bba40b diff --git a/source/glsl/syntax.h b/source/glsl/syntax.h index d3797ac4..ebe188e1 100644 --- a/source/glsl/syntax.h +++ b/source/glsl/syntax.h @@ -111,7 +111,6 @@ class NodeArray: public NodeContainer > > 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 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 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; - std::string interface; - std::string block_name; - NodePtr 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; + Stage *previous = 0; Block content; std::map types; - std::map interface_blocks; + std::map interface_blocks; std::map functions; std::map locations; std::map 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 &, 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