]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compiler.cpp
Add some documentation to the GLSL compiler
[libs/gl.git] / source / glsl / compiler.cpp
index a18b8e8c2c3df57e0f26c2d126719edbaced8fb5..5bec9c8b1b8f475163b50a35b57b0a92e5bec84b 100644 (file)
@@ -214,11 +214,17 @@ void Compiler::generate(Stage &stage, Mode mode)
        inject_block(stage.content, module->shared.content);
 
        DeclarationReorderer().apply(stage);
-       BlockResolver().apply(stage);
+
+       // Initial resolving pass
+       BlockHierarchyResolver().apply(stage);
        FunctionResolver().apply(stage);
        VariableResolver().apply(stage);
+
+       /* All variables local to a stage have been resolved.  Resolve non-local
+       variables through interfaces. */
        InterfaceGenerator().apply(stage);
        VariableResolver().apply(stage);
+
        DeclarationReorderer().apply(stage);
        FunctionResolver().apply(stage);
        ConstantSpecializer().apply(stage, (mode==PROGRAM && specialized ? &spec_values : 0));
@@ -231,9 +237,11 @@ bool Compiler::optimize(Stage &stage)
        ConstantConditionEliminator().apply(stage);
 
        FunctionInliner().apply(stage);
-       BlockResolver().apply(stage);
+       BlockHierarchyResolver().apply(stage);
        VariableResolver().apply(stage);
 
+       /* Removing variables or functions may cause things from the previous stage
+       to become unused. */
        bool result = UnusedVariableRemover().apply(stage);
        result |= UnusedFunctionRemover().apply(stage);