]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/generate.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / glsl / generate.h
index 73b933bfb63b0f04155c80ab2bb7e484f2529f03..aba2c353f827239f7f4aaf3b2d2d73560d680db2 100644 (file)
@@ -63,6 +63,46 @@ private:
        virtual void visit(Passthrough &);
 };
 
+class LayoutDefaulter: private TraversingVisitor
+{
+private:
+       InterfaceLayout *in_iface = 0;
+       bool need_winding = true;
+       bool need_spacing = true;
+
+public:
+       void apply(Stage &);
+
+private:
+       virtual void visit(InterfaceLayout &);
+};
+
+/**
+Assigns sizes to arrays which don't have a size.  Geometry shader inputs are
+sized by topology.  Other arrays are sized by their use with literal indices.
+*/
+class ArraySizer: private TraversingVisitor
+{
+private:
+       std::map<VariableDeclaration *, int> max_indices;
+       unsigned input_size = 0;
+       VariableDeclaration *r_declaration;
+
+public:
+       void apply(Stage &);
+
+private:
+       virtual void visit(VariableReference &);
+       virtual void visit(MemberAccess &);
+       virtual void visit(Swizzle &);
+       virtual void visit(UnaryExpression&);
+       virtual void visit(BinaryExpression &);
+       virtual void visit(TernaryExpression &);
+       virtual void visit(FunctionCall &);
+       virtual void visit(InterfaceLayout &);
+       virtual void visit(VariableDeclaration &);
+};
+
 } // namespace SL
 } // namespace GL
 } // namespace Msp