summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/builtin_function.cpp72
1 files changed, 47 insertions, 25 deletions
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index ae0eabcf778..cc957e4b661 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -1368,40 +1368,19 @@ static const char *builtins_110_mod = {
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) float arg1))\n"
- " ((declare () vec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature vec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) float arg1))\n"
- " ((declare () vec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression float % (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature vec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) float arg1))\n"
- " ((declare () vec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression float % (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression float % (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
};
@@ -3406,6 +3385,48 @@ static const char *builtins_130_min = {
"))\n"
};
+static const char *builtins_130_mix = {
+ "((function mix\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float v1)\n"
+ " (declare (in) float v2)\n"
+ " (declare (in) bool a))\n"
+ " ((assign (var_ref a) (var_ref v1) (var_ref v2))\n"
+ " (return (var_ref v1))))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 v1)\n"
+ " (declare (in) vec2 v2)\n"
+ " (declare (in) bvec2 a))\n"
+ " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n"
+ " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n"
+ " (return (var_ref v1))))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 v1)\n"
+ " (declare (in) vec3 v2)\n"
+ " (declare (in) bvec3 a))\n"
+ " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n"
+ " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n"
+ " (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))\n"
+ " (return (var_ref v1))))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 v1)\n"
+ " (declare (in) vec4 v2)\n"
+ " (declare (in) bvec4 a))\n"
+ " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n"
+ " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n"
+ " (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))\n"
+ " (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2)))\n"
+ " (return (var_ref v1))))\n"
+ "))\n"
+};
+
static const char *builtins_130_notEqual = {
"((function notEqual\n"
" (signature bvec2\n"
@@ -3445,7 +3466,7 @@ static const char *builtins_130_sign = {
" (signature int\n"
" (parameters\n"
" (declare (in) int x))\n"
- " ((return (expression int / (var_ref x) (expression int abs (var_ref x))))))\n"
+ " ((return (expression int sign (var_ref x)))))\n"
"\n"
" (signature ivec2\n"
" (parameters\n"
@@ -4387,6 +4408,7 @@ static const char *functions_for_130 [] = {
builtins_130_lessThanEqual,
builtins_130_max,
builtins_130_min,
+ builtins_130_mix,
builtins_130_notEqual,
builtins_130_sign,
builtins_130_sinh,