]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programcompiler.cpp
Rewrite ProgramData update in a more efficient way
[libs/gl.git] / source / programcompiler.cpp
index 989098d7d0cf6410b4d26faed46f9c400bc06a3c..4c08a0c1e1e34bf84c4e99e0d9f6f33090d6d103 100644 (file)
@@ -209,6 +209,8 @@ void ProgramCompiler::append_stage(Stage &stage)
                target = &*i;
        }
 
+       if(stage.required_version>target->required_version)
+               target->required_version = stage.required_version;
        for(NodeList<Statement>::iterator i=stage.content.body.begin(); i!=stage.content.body.end(); ++i)
                target->content.body.push_back(*i);
        apply<DeclarationCombiner>(*target);
@@ -245,6 +247,8 @@ void ProgramCompiler::import(const string &name)
 
 void ProgramCompiler::generate(Stage &stage)
 {
+       if(module->shared.required_version>stage.required_version)
+               stage.required_version = module->shared.required_version;
        inject_block(stage.content, module->shared.content);
 
        apply<DeclarationReorderer>(stage);
@@ -348,6 +352,7 @@ void ProgramCompiler::BlockModifier::visit(Block &block)
 
 
 ProgramCompiler::Formatter::Formatter():
+       source_index(0),
        source_line(1),
        indent(0),
        parameter_list(false)