X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foptimize.h;h=92e19c8c9be08a8a649586929c0755607e558fab;hb=eee19f5d5bbf16895fca44090d6491d5c9b504f5;hp=c932767e99807325f159372e626895aafa213c5b;hpb=1cd0ea7f79b2b0dedd8a2a6622e5d2e8b2ea2512;p=libs%2Fgl.git diff --git a/source/glsl/optimize.h b/source/glsl/optimize.h index c932767e..92e19c8c 100644 --- a/source/glsl/optimize.h +++ b/source/glsl/optimize.h @@ -165,6 +165,23 @@ private: virtual void visit(Iteration &); }; +/** Removes types which are not used anywhere. */ +class UnusedTypeRemover: private TraversingVisitor +{ +private: + std::set unused_nodes; + +public: + bool apply(Stage &); + +private: + virtual void visit(BasicTypeDeclaration &); + virtual void visit(ImageTypeDeclaration &); + virtual void visit(StructDeclaration &); + virtual void visit(VariableDeclaration &); + virtual void visit(FunctionDeclaration &); +}; + /** Removes variable declarations with no references to them. Assignment statements where the result is not used are also removed. */ class UnusedVariableRemover: private TraversingVisitor