X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fgenerate.cpp;h=563609918ae216f28178dca421be4c627175f1b5;hb=d4b8a3f67c1f7184124bf95caee7e36ae8d6c82a;hp=6430f9d8a0e53d630e284f64ef4ab869a2f85925;hpb=3f44e477f81983c66947fe8a6d8640a3b2f9e0b3;p=libs%2Fgl.git diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 6430f9d8..56360991 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -579,8 +579,7 @@ void ExpressionResolver::convert_to(RefPtr &expr, BasicTypeDeclarati RefPtr call = new FunctionCall; call->name = type.name; call->constructor = true; - call->arguments.push_back(0); - call->arguments.back() = expr; + call->arguments.push_back_nocopy(expr); call->type = &type; expr = call; } @@ -908,6 +907,9 @@ void ExpressionResolver::visit(TernaryExpression &ternary) { BasicTypeDeclaration *basic_true = dynamic_cast(ternary.true_expr->type); BasicTypeDeclaration *basic_false = dynamic_cast(ternary.false_expr->type); + if(!basic_true || !basic_false) + return; + Compatibility compat = get_compatibility(*basic_true, *basic_false); if(compat==NOT_COMPATIBLE) return; @@ -1012,7 +1014,7 @@ void ExpressionResolver::visit_constructor(FunctionCall &call) stage inline it if that's reasonable. */ RefPtr temporary = new VariableDeclaration; temporary->type = args.front().type->name; - temporary->name = get_unused_variable_name(*current_block, "_temp", string()); + temporary->name = get_unused_variable_name(*current_block, "_temp"); temporary->init_expression = call.arguments.front(); current_block->body.insert(insert_point, temporary);