]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/generate.cpp
Adjust naming of generated variables
[libs/gl.git] / source / glsl / generate.cpp
index 6430f9d8a0e53d630e284f64ef4ab869a2f85925..42b24a9caa949655c6f2a475187aa573d4376447 100644 (file)
@@ -908,6 +908,9 @@ void ExpressionResolver::visit(TernaryExpression &ternary)
        {
                BasicTypeDeclaration *basic_true = dynamic_cast<BasicTypeDeclaration *>(ternary.true_expr->type);
                BasicTypeDeclaration *basic_false = dynamic_cast<BasicTypeDeclaration *>(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 +1015,7 @@ void ExpressionResolver::visit_constructor(FunctionCall &call)
                                        stage inline it if that's reasonable. */
                                        RefPtr<VariableDeclaration> 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);