]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compiler.cpp
Check for existence of required version in Formatter
[libs/gl.git] / source / glsl / compiler.cpp
index 9c1238c029eec1155957b105748ae078767a4437..3516048ca7e62ae9fa83dc52c0f14a7fb0329745 100644 (file)
@@ -108,7 +108,7 @@ string Compiler::get_combined_glsl() const
        for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
        {
                glsl += format("#pragma MSP stage(%s)\n", Stage::get_stage_name(i->type));
-               glsl += Formatter().apply(*i, MODULE);
+               glsl += Formatter().apply(*i);
                glsl += '\n';
        }
 
@@ -128,7 +128,7 @@ string Compiler::get_stage_glsl(Stage::Type stage_type) const
 {
        for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
                if(i->type==stage_type)
-                       return Formatter().apply(*i, PROGRAM);
+                       return Formatter().apply(*i);
        throw key_error(Stage::get_stage_name(stage_type));
 }
 
@@ -282,7 +282,7 @@ void Compiler::resolve(Stage &stage, unsigned flags)
                else if(resolve<FunctionResolver>(stage, flags, RESOLVE_FUNCTIONS))
                        flags |= RESOLVE_EXPRESSIONS;
                else if(resolve<ExpressionResolver>(stage, flags, RESOLVE_EXPRESSIONS))
-                       flags |= RESOLVE_VARIABLES;
+                       flags |= RESOLVE_VARIABLES|RESOLVE_FUNCTIONS;
        }
 }
 
@@ -324,7 +324,7 @@ Compiler::OptimizeResult Compiler::optimize(Stage &stage)
        bool any_inlined = false;
        if(FunctionInliner().apply(stage))
        {
-               resolve(stage, RESOLVE_TYPES|RESOLVE_VARIABLES|RESOLVE_EXPRESSIONS);
+               resolve(stage, RESOLVE_TYPES|RESOLVE_VARIABLES|RESOLVE_FUNCTIONS|RESOLVE_EXPRESSIONS);
                any_inlined = true;
        }
        if(ExpressionInliner().apply(stage))