Add builtin pow() function.
authorEric Anholt <eric@anholt.net>
Sat, 27 Mar 2010 19:59:42 +0000 (12:59 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 29 Mar 2010 19:48:45 +0000 (12:48 -0700)
builtin_function.cpp
ir_print_visitor.cpp

index e59b314a91d68a298eb36a429d51f05407ed9fd2..ec1b54a2dd54d7ed2610ad286225c0e24bd368c3 100644 (file)
@@ -132,6 +132,15 @@ generate_max(exec_list *instructions,
    generate_binop(instructions, declarations, type, ir_binop_max);
 }
 
+
+static void
+generate_pow(exec_list *instructions,
+              ir_variable **declarations,
+              const glsl_type *type)
+{
+   generate_binop(instructions, declarations, type, ir_binop_pow);
+}
+
 void
 generate_function_instance(ir_function *f,
                           const char *name,
@@ -213,7 +222,7 @@ generate_110_functions(glsl_symbol_table *symtab, exec_list *instructions)
    /* FINISHME: acos() */
    /* FINISHME: atan(y,x) */
    /* FINISHME: atan(y/x) */
-   /* FINISHME: pow() */
+   make_gentype_function(symtab, instructions, "pow", 2, generate_pow);
    make_gentype_function(symtab, instructions, "exp", 1, generate_exp);
    make_gentype_function(symtab, instructions, "log", 1, generate_log);
    /* FINISHME: exp2() */
index f055e8f1d8f2e92dd65fccaf628cd8650ebec1fc..ecfdb49c480d2275834d06ad346657ac53b3635e 100644 (file)
@@ -124,6 +124,7 @@ void ir_print_visitor::visit(ir_expression *ir)
       "dot",
       "min",
       "max",
+      "pow",
    };
 
    printf("(expression ");