]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/optimize.h
Add some documentation to the GLSL compiler
[libs/gl.git] / source / glsl / optimize.h
index 38218966369213c5fbc8ba802d38bbf1e8bda420..ed016ca0b9ddd26dd5e8e871b25a0f15484e2881 100644 (file)
@@ -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: