OptimizeResult result = optimize(*i);
if(result==REDO_PREVIOUS)
i = module->stages.begin();
- else
+ else if(result!=REDO_STAGE)
++i;
}
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
stage.required_features.glsl_version = module->shared.required_features.glsl_version;
inject_block(stage.content, module->shared.content);
- DeclarationReorderer().apply(stage);
-
// Initial resolving pass
BlockHierarchyResolver().apply(stage);
FunctionResolver().apply(stage);
InterfaceGenerator().apply(stage);
VariableResolver().apply(stage);
- DeclarationReorderer().apply(stage);
FunctionResolver().apply(stage);
ConstantSpecializer().apply(stage, (mode==PROGRAM && specialized ? &spec_values : 0));
if(mode==PROGRAM)
{
ConstantConditionEliminator().apply(stage);
- FunctionInliner().apply(stage);
+ bool any_inlined = FunctionInliner().apply(stage);
BlockHierarchyResolver().apply(stage);
VariableResolver().apply(stage);
bool any_removed = UnusedVariableRemover().apply(stage);
any_removed |= UnusedFunctionRemover().apply(stage);
- return any_removed ? REDO_PREVIOUS : NEXT_STAGE;
+ return any_removed ? REDO_PREVIOUS : any_inlined ? REDO_STAGE : NEXT_STAGE;
}
void Compiler::finalize(Stage &stage, Mode mode)