]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/finalize.h
Fix flattening of GLSL interface blocks
[libs/gl.git] / source / glsl / finalize.h
index fd29737a713b3ed331e9ba4b0bddb2e13b9f72a6..4f6ee4193bd869ba61ace5191cc1cd9382b14b4e 100644 (file)
@@ -12,11 +12,9 @@ namespace SL {
 class StructOrganizer: private TraversingVisitor
 {
 private:
-       int offset;
+       int offset = -1;
 
 public:
-       StructOrganizer();
-
        void apply(Stage &s) { s.content.visit(*this); }
 
 private:
@@ -64,14 +62,12 @@ according to the requirements of the target API. */
 class PrecisionConverter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::set<std::string> have_default;
        NodeList<Statement>::iterator insert_point;
        std::set<Node *> nodes_to_remove;
 
 public:
-       PrecisionConverter();
-
        void apply(Stage &);
 
 private:
@@ -85,26 +81,29 @@ features. */
 class LegacyConverter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        Features features;
-       VariableDeclaration *frag_out;
+       VariableDeclaration *frag_out = 0;
        NodeList<Statement>::iterator uniform_insert_point;
        std::set<Node *> nodes_to_remove;
+       RefPtr<Expression> r_replaced_reference;
+       bool r_flattened_interface = false;
 
 public:
-       LegacyConverter();
-
        virtual void apply(Stage &, const Features &);
 
 private:
        void unsupported(const std::string &);
 
        virtual void visit(Block &);
+       virtual void visit(RefPtr<Expression> &);
        bool check_version(const Version &) const;
        bool check_extension(bool Features::*) const;
        bool supports_stage(Stage::Type) const;
        bool supports_unified_interface_syntax() const;
        virtual void visit(VariableReference &);
+       virtual void visit(InterfaceBlockReference &);
+       virtual void visit(MemberAccess &);
        virtual void visit(Assignment &);
        bool supports_unified_sampling_functions() const;
        virtual void visit(FunctionCall &);