X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fgenerate.cpp;h=f3c57a2f0f9190352860bc5f7bc22ff634433123;hb=9a63244c1342337915c4610401a24c09fa72cc3d;hp=55687924ffc1703bfb05fb0dd560f4aff255d885;hpb=696a97bd7411d69953c1a9e4b5f3dfb4c1d848f1;p=libs%2Fgl.git diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 55687924..f3c57a2f 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -78,13 +78,12 @@ VariableResolver::VariableResolver(): self_referencing(false) { } -void VariableResolver::apply(Stage &s) +void VariableResolver::apply(Stage &stage) { - SetForScope set(stage, &s); - Stage *builtins = get_builtins(stage->type); + Stage *builtins = get_builtins(stage.type); if(builtins) blocks.push_back(&builtins->content); - stage->content.visit(*this); + visit(stage.content); if(builtins) blocks.pop_back(); } @@ -240,14 +239,15 @@ void FunctionResolver::visit(FunctionDeclaration &func) InterfaceGenerator::InterfaceGenerator(): + stage(0), scope_level(0) { } -string InterfaceGenerator::get_out_prefix(StageType type) +string InterfaceGenerator::get_out_prefix(Stage::Type type) { - if(type==VERTEX) + if(type==Stage::VERTEX) return "_vs_out_"; - else if(type==GEOMETRY) + else if(type==Stage::GEOMETRY) return "_gs_out_"; else return string(); @@ -259,7 +259,7 @@ void InterfaceGenerator::apply(Stage &s) if(stage->previous) in_prefix = get_out_prefix(stage->previous->type); out_prefix = get_out_prefix(stage->type); - stage->content.visit(*this); + visit(s.content); } void InterfaceGenerator::visit(Block &block) @@ -301,7 +301,7 @@ bool InterfaceGenerator::generate_interface(VariableDeclaration &var, const stri iface_var->type = var.type; iface_var->type_declaration = var.type_declaration; iface_var->name = name; - if(stage->type==GEOMETRY) + if(stage->type==Stage::GEOMETRY) iface_var->array = ((var.array && var.interface!="in") || iface=="in"); else iface_var->array = var.array; @@ -411,7 +411,7 @@ void InterfaceGenerator::visit(Passthrough &pass) } } - if(stage->type==GEOMETRY) + if(stage->type==Stage::GEOMETRY) { VariableReference *ref = new VariableReference; ref->name = "gl_in"; @@ -471,7 +471,7 @@ void DeclarationReorderer::visit(Block &block) { SetForScope set(scope_level, scope_level+1); if(scope_level>1) - return StageVisitor::visit(block); + return TraversingVisitor::visit(block); NodeList::iterator struct_insert_point = block.body.end(); NodeList::iterator variable_insert_point = block.body.end(); @@ -547,7 +547,7 @@ void DeclarationReorderer::visit(Block &block) void DeclarationReorderer::visit(VariableDeclaration &var) { - StageVisitor::visit(var); + TraversingVisitor::visit(var); kind = VARIABLE; }