summaryrefslogtreecommitdiff
path: root/builtin_function.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-03-27 13:56:35 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-29 12:48:45 -0700
commit01665262e50162e858c45f92a8a7e12b953e56ad (patch)
treec07b520eed0f37d6d9135e54b68e5634a6f07956 /builtin_function.cpp
parent53afc3609db0afffacb1c40975ec7d87b9e3c7cd (diff)
Implement exp2() and log2(), and make ir_unop_exp and ir_unop_log be base e.
Making the base e functions IR operations is not a clear win. i965 doesn't support it, it doesn't look like r600 supports it, but r500 does. It should be easily supportable as a lowering pass, though.
Diffstat (limited to 'builtin_function.cpp')
-rw-r--r--builtin_function.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/builtin_function.cpp b/builtin_function.cpp
index 7cd08d772f..ef6af2052b 100644
--- a/builtin_function.cpp
+++ b/builtin_function.cpp
@@ -77,6 +77,22 @@ generate_log(exec_list *instructions,
}
static void
+generate_exp2(exec_list *instructions,
+ ir_variable **declarations,
+ const glsl_type *type)
+{
+ generate_unop(instructions, declarations, type, ir_unop_exp2);
+}
+
+static void
+generate_log2(exec_list *instructions,
+ ir_variable **declarations,
+ const glsl_type *type)
+{
+ generate_unop(instructions, declarations, type, ir_unop_log2);
+}
+
+static void
generate_rsq(exec_list *instructions,
ir_variable **declarations,
const glsl_type *type)
@@ -278,8 +294,8 @@ generate_110_functions(glsl_symbol_table *symtab, exec_list *instructions)
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() */
- /* FINISHME: log2() */
+ make_gentype_function(symtab, instructions, "exp2", 1, generate_exp2);
+ make_gentype_function(symtab, instructions, "log2", 1, generate_log2);
make_gentype_function(symtab, instructions, "sqrt", 1, generate_sqrt);
make_gentype_function(symtab, instructions, "inversesqrt", 1, generate_rsq);
make_gentype_function(symtab, instructions, "abs", 1, generate_abs);