]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/output.h
Use default member initializers for simple types
[libs/gl.git] / source / glsl / output.h
index aec63721d080c47ea6e28f5f1d2f0e4dedd8ff5b..dbdd888e5923aa69355c9fe75923bcadf7e12c61 100644 (file)
@@ -9,23 +9,21 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
+/** Formats the syntax tree as GLSL. */
 class Formatter: private TraversingVisitor
 {
 private:
-       Stage *stage;
-       Compiler::Mode mode;
+       Stage *stage = 0;
        std::string formatted;
-       unsigned source_index;
-       unsigned source_line;
-       unsigned indent;
-       bool parameter_list;
-       std::string block_interface;
+       unsigned source_index = 0;
+       unsigned source_line = 1;
+       unsigned indent = 0;
+       bool parameter_list = false;
+       bool omit_builtin = false;
+       bool r_empty_name = false;
 
 public:
-       Formatter();
-
-       const std::string &apply(Stage &, Compiler::Mode);
-       const std::string &apply(Node &n) { n.visit(*this); return formatted; }
+       std::string apply(Stage &);
 
 private:
        void append(const std::string &);
@@ -33,13 +31,16 @@ private:
        void set_source(unsigned, unsigned);
 
        virtual void visit(Block &);
+       void visit_expression(Expression &, const Operator *, bool);
        virtual void visit(Literal &);
-       virtual void visit(ParenthesizedExpression &);
        virtual void visit(VariableReference &);
+       virtual void visit(InterfaceBlockReference &);
        virtual void visit(MemberAccess &);
+       virtual void visit(Swizzle &);
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
        virtual void visit(Assignment &);
+       virtual void visit(TernaryExpression &);
        virtual void visit(FunctionCall &);
        virtual void visit(ExpressionStatement &);
        virtual void visit(Import &);
@@ -52,9 +53,9 @@ private:
        virtual void visit(FunctionDeclaration &);
        virtual void visit(Conditional &);
        virtual void visit(Iteration &);
+       virtual void visit(Passthrough &);
        virtual void visit(Return &);
        virtual void visit(Jump &);
-       using TraversingVisitor::visit;
 };
 
 } // namespace SL