X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fgenerate.cpp;h=11116b11ecb164cb704fdcf277de380ac882ba82;hb=2e0ed3f7d23f09de7b4b09c2f132c316ce703d9a;hp=2ff751946528f75e2a39f6a512565231ed10ce8c;hpb=6dcf74922f46b086ad394c19fd6ce083a635b290;p=libs%2Fgl.git diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 2ff75194..11116b11 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -619,12 +619,6 @@ void ExpressionResolver::visit(Literal &literal) resolve(literal, find_type(BasicTypeDeclaration::FLOAT, 32), false); } -void ExpressionResolver::visit(ParenthesizedExpression &parexpr) -{ - TraversingVisitor::visit(parexpr); - resolve(parexpr, parexpr.expression->type, parexpr.expression->lvalue); -} - void ExpressionResolver::visit(VariableReference &var) { if(var.declaration) @@ -943,22 +937,28 @@ bool FunctionResolver::apply(Stage &s) void FunctionResolver::visit(FunctionCall &call) { - string arg_types; - bool has_signature = true; - for(NodeArray::const_iterator i=call.arguments.begin(); (has_signature && i!=call.arguments.end()); ++i) - { - if((*i)->type) - append(arg_types, ",", (*i)->type->name); - else - has_signature = false; - } - FunctionDeclaration *declaration = 0; - if(has_signature) + if(stage->types.count(call.name)) + call.constructor = true; + else { - map::iterator i = stage->functions.find(format("%s(%s)", call.name, arg_types)); - declaration = (i!=stage->functions.end() ? i->second : 0); + string arg_types; + bool has_signature = true; + for(NodeArray::const_iterator i=call.arguments.begin(); (has_signature && i!=call.arguments.end()); ++i) + { + if((*i)->type) + append(arg_types, ",", (*i)->type->name); + else + has_signature = false; + } + + if(has_signature) + { + map::iterator i = stage->functions.find(format("%s(%s)", call.name, arg_types)); + declaration = (i!=stage->functions.end() ? i->second : 0); + } } + r_any_resolved |= (declaration!=call.declaration); call.declaration = declaration;