summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-08-22 13:31:18 -0700
committerMatt Turner <[email protected]>2013-09-17 16:59:05 -0700
commitb2ab840130677bbe7b67de4727fcd91ee6506bb8 (patch)
tree5160561da43809a9c7df2b2c40c6e6cb73d6fa93 /src/glsl/builtin_functions.cpp
parent4b0488ef4e3e4562c8e383282e0d2db183dfc5c1 (diff)
glsl: Add support for ldexp.
v2: Drop frexp. Rebase on builtins rewrite. Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl/builtin_functions.cpp')
-rw-r--r--src/glsl/builtin_functions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 528af0dc65d..ffabf8a8710 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -510,6 +510,7 @@ private:
B1(findLSB)
B1(findMSB)
B1(fma)
+ B2(ldexp)
#undef B0
#undef B1
#undef B2
@@ -1822,6 +1823,13 @@ builtin_builder::create_builtins()
IU(findLSB)
IU(findMSB)
F(fma)
+
+ add_function("ldexp",
+ _ldexp(glsl_type::float_type, glsl_type::int_type),
+ _ldexp(glsl_type::vec2_type, glsl_type::ivec2_type),
+ _ldexp(glsl_type::vec3_type, glsl_type::ivec3_type),
+ _ldexp(glsl_type::vec4_type, glsl_type::ivec4_type),
+ NULL);
#undef F
#undef FI
#undef FIU
@@ -3514,6 +3522,12 @@ builtin_builder::_fma(const glsl_type *type)
return sig;
}
+
+ir_function_signature *
+builtin_builder::_ldexp(const glsl_type *x_type, const glsl_type *exp_type)
+{
+ return binop(ir_binop_ldexp, gpu_shader5, x_type, x_type, exp_type);
+}
/** @} */
/******************************************************************************/