From 5e58e541e0419b23b958e32a22c4c7b398e414a3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 May 2010 12:19:54 -0700 Subject: [PATCH] builtins: Add asin(). --- builtin_function.cpp | 93 ++++++++++++++++++++++++++++++++++++++++++++ builtins/110/asin | 89 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 builtins/110/asin diff --git a/builtin_function.cpp b/builtin_function.cpp index 909329c563a..f9fdd485e4b 100644 --- a/builtin_function.cpp +++ b/builtin_function.cpp @@ -107,6 +107,98 @@ static const char *builtins_110_any = { "))\n" }; +static const char *builtins_110_asin = { + "((function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float *\n" + " (expression float -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression float sqrt\n" + " (expression float -\n" + " (constant float (1.0))\n" + " (expression float abs (var_ref x)))))\n" + " (expression float +\n" + " (constant float (1.5707288))\n" + " (expression float *\n" + " (expression float abs (var_ref x))\n" + " (expression float +\n" + " (constant float (-0.2121144))\n" + " (expression float *\n" + " (constant float (0.0742610))\n" + " (expression float abs (var_ref x))))))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 *\n" + " (expression vec2 -\n" + " (expression vec2 *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec2 sqrt\n" + " (expression vec2 -\n" + " (constant float (1.0))\n" + " (expression vec2 abs (var_ref x)))))\n" + " (expression vec2 +\n" + " (constant float (1.5707288))\n" + " (expression vec2 *\n" + " (expression vec2 abs (var_ref x))\n" + " (expression vec2 +\n" + " (constant float (-0.2121144))\n" + " (expression vec2 *\n" + " (constant float (0.0742610))\n" + " (expression vec2 abs (var_ref x))))))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 *\n" + " (expression vec3 -\n" + " (expression vec3 *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec3 sqrt\n" + " (expression vec3 -\n" + " (constant float (1.0))\n" + " (expression vec3 abs (var_ref x)))))\n" + " (expression vec3 +\n" + " (constant float (1.5707288))\n" + " (expression vec3 *\n" + " (expression vec3 abs (var_ref x))\n" + " (expression vec3 +\n" + " (constant float (-0.2121144))\n" + " (expression vec3 *\n" + " (constant float (0.0742610))\n" + " (expression vec3 abs (var_ref x))))))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 *\n" + " (expression vec4 -\n" + " (expression vec4 *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec4 sqrt\n" + " (expression vec4 -\n" + " (constant float (1.0))\n" + " (expression vec4 abs (var_ref x)))))\n" + " (expression vec4 +\n" + " (constant float (1.5707288))\n" + " (expression vec4 *\n" + " (expression vec4 abs (var_ref x))\n" + " (expression vec4 +\n" + " (constant float (-0.2121144))\n" + " (expression vec4 *\n" + " (constant float (0.0742610))\n" + " (expression vec4 abs (var_ref x))))))))))\n" + "))\n" +}; + static const char *builtins_110_ceil = { "((function ceil\n" " (signature float\n" @@ -1470,6 +1562,7 @@ static const char *functions_for_110 [] = { builtins_110_abs, builtins_110_all, builtins_110_any, + builtins_110_asin, builtins_110_ceil, builtins_110_clamp, builtins_110_cos, diff --git a/builtins/110/asin b/builtins/110/asin new file mode 100644 index 00000000000..0c913b6ae7c --- /dev/null +++ b/builtins/110/asin @@ -0,0 +1,89 @@ +((function asin + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * + (expression float - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression float sqrt + (expression float - + (constant float (1.0)) + (expression float abs (var_ref x))))) + (expression float + + (constant float (1.5707288)) + (expression float * + (expression float abs (var_ref x)) + (expression float + + (constant float (-0.2121144)) + (expression float * + (constant float (0.0742610)) + (expression float abs (var_ref x)))))))))) + + (signature float + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * + (expression vec2 - + (expression vec2 * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec2 sqrt + (expression vec2 - + (constant float (1.0)) + (expression vec2 abs (var_ref x))))) + (expression vec2 + + (constant float (1.5707288)) + (expression vec2 * + (expression vec2 abs (var_ref x)) + (expression vec2 + + (constant float (-0.2121144)) + (expression vec2 * + (constant float (0.0742610)) + (expression vec2 abs (var_ref x)))))))))) + + (signature float + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * + (expression vec3 - + (expression vec3 * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec3 sqrt + (expression vec3 - + (constant float (1.0)) + (expression vec3 abs (var_ref x))))) + (expression vec3 + + (constant float (1.5707288)) + (expression vec3 * + (expression vec3 abs (var_ref x)) + (expression vec3 + + (constant float (-0.2121144)) + (expression vec3 * + (constant float (0.0742610)) + (expression vec3 abs (var_ref x)))))))))) + + (signature float + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * + (expression vec4 - + (expression vec4 * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec4 sqrt + (expression vec4 - + (constant float (1.0)) + (expression vec4 abs (var_ref x))))) + (expression vec4 + + (constant float (1.5707288)) + (expression vec4 * + (expression vec4 abs (var_ref x)) + (expression vec4 + + (constant float (-0.2121144)) + (expression vec4 * + (constant float (0.0742610)) + (expression vec4 abs (var_ref x)))))))))) +)) -- 2.30.2