X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foptimize.h;h=ed016ca0b9ddd26dd5e8e871b25a0f15484e2881;hb=30465dd3b9f55ec42c4b19c3c2077eede7237a26;hp=38218966369213c5fbc8ba802d38bbf1e8bda420;hpb=a47639620c40397939ae4d79c08d5d8f460bad5c;p=libs%2Fgl.git diff --git a/source/glsl/optimize.h b/source/glsl/optimize.h index 38218966..ed016ca0 100644 --- a/source/glsl/optimize.h +++ b/source/glsl/optimize.h @@ -10,6 +10,9 @@ namespace Msp { namespace GL { namespace SL { +/** Finds functions which are candidates for inlining. Currently this means +functions which have no parameters, are only called once, and that call occurs +after the definition of the function. */ class InlineableFunctionLocator: private TraversingVisitor { private: @@ -27,6 +30,9 @@ private: virtual void visit(FunctionDeclaration &); }; +/** Inlines functions. Internally uses InlineableFunctionLocator to find +candidate functions. Only functions which consist of a single return statement +are inlined. */ class FunctionInliner: private TraversingVisitor { private: @@ -51,6 +57,8 @@ private: virtual void visit(Return &); }; +/** Removes conditional statements and loops where the condition can be +determined as constant at compile time. */ class ConstantConditionEliminator: private TraversingVisitor { private: @@ -73,6 +81,8 @@ private: virtual void visit(Iteration &); }; +/** Removes variable declarations with no references to them. Assignment +statements where the result is not used are also removed. */ class UnusedVariableRemover: private TraversingVisitor { private: @@ -119,6 +129,7 @@ private: virtual void visit(Iteration &); }; +/** Removes function declarations with no references to them. */ class UnusedFunctionRemover: private TraversingVisitor { private: