]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/optimize.h
Use emplace_back when a new object is being constructed
[libs/gl.git] / source / glsl / optimize.h
index 1eb0464e7daea97d654576c15792a13e764d8c27..75fffa13bb4fcaf6527d56ab676a7b88553cb8c5 100644 (file)
@@ -122,6 +122,7 @@ private:
                Block *assign_scope = 0;
                std::vector<ExpressionUse> uses;
                bool trivial = false;
+               bool blocked = false;
        };
 
        std::list<ExpressionInfo> expressions;
@@ -161,6 +162,7 @@ private:
        struct AggregateMember
        {
                const VariableDeclaration *declaration = 0;
+               unsigned index = 0;
                RefPtr<Expression> initializer;
                std::vector<RefPtr<Expression> *> references;
        };
@@ -194,6 +196,7 @@ private:
        virtual void visit(StructDeclaration &) { }
        virtual void visit(VariableDeclaration &);
        virtual void visit(InterfaceBlock &) { }
+       virtual void visit(FunctionDeclaration &);
 };
 
 /** Replaces expressions consisting entirely of literals with the results of
@@ -259,7 +262,7 @@ private:
        bool r_external_side_effects = false;
 
 public:
-       void apply(Stage &);
+       bool apply(Stage &);
 
 private:
        ConstantStatus check_constant_condition(const Expression &);
@@ -274,6 +277,7 @@ private:
        virtual void visit(Iteration &);
 };
 
+/** Removes code which is never executed due to flow control statements. */
 class UnreachableCodeRemover: private TraversingVisitor
 {
 private:
@@ -326,7 +330,6 @@ private:
 
        struct VariableInfo
        {
-               InterfaceBlock *interface_block = 0;
                std::vector<AssignmentInfo *> assignments;
                bool initialized = false;
                bool output = false;
@@ -338,7 +341,6 @@ private:
        Stage *stage = 0;
        BlockVariableMap variables;
        std::list<AssignmentInfo> assignments;
-       InterfaceBlock *interface_block = 0;
        Assignment *r_assignment = 0;
        bool assignment_target = false;
        bool r_side_effects = false;