From ddd2e83db2b6baa062f76f22bb980030144dbcad Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 27 Mar 2010 12:59:42 -0700 Subject: [PATCH] Add builtin pow() function. --- builtin_function.cpp | 11 ++++++++++- ir_print_visitor.cpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/builtin_function.cpp b/builtin_function.cpp index e59b314a91d..ec1b54a2dd5 100644 --- a/builtin_function.cpp +++ b/builtin_function.cpp @@ -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() */ diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp index f055e8f1d8f..ecfdb49c480 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -124,6 +124,7 @@ void ir_print_visitor::visit(ir_expression *ir) "dot", "min", "max", + "pow", }; printf("(expression "); -- 2.30.2