]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/output.h
Transform interface block contents into structs
[libs/gl.git] / source / glsl / output.h
index 5b03420223c3f70fb57f7f900f6708e2da5efe39..f720606eadbda1eeef757a39a7bb75bfbd4696d1 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_GL_SL_OUTPUT_H_
 #define MSP_GL_SL_OUTPUT_H_
 
+#include "compiler.h"
 #include "syntax.h"
 #include "visitor.h"
 
@@ -8,21 +9,23 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
+/** Formats the syntax tree as GLSL. */
 class Formatter: private TraversingVisitor
 {
 private:
        Stage *stage;
+       Compiler::Mode mode;
        std::string formatted;
        unsigned source_index;
        unsigned source_line;
        unsigned indent;
        bool parameter_list;
-       std::string block_interface;
 
 public:
        Formatter();
 
-       const std::string &apply(Stage &);
+       const std::string &apply(Stage &, Compiler::Mode);
+       const std::string &apply(Node &n) { n.visit(*this); return formatted; }
 
 private:
        void append(const std::string &);
@@ -33,6 +36,7 @@ private:
        virtual void visit(Literal &);
        virtual void visit(ParenthesizedExpression &);
        virtual void visit(VariableReference &);
+       virtual void visit(InterfaceBlockReference &);
        virtual void visit(MemberAccess &);
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
@@ -49,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