summaryrefslogtreecommitdiff
path: root/src/glsl/builtin_function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/builtin_function.cpp')
-rw-r--r--src/glsl/builtin_function.cpp216
1 files changed, 27 insertions, 189 deletions
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index 5b3b49d310..1cf88ada16 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -438,33 +438,21 @@ static const char *builtins_110_clamp = {
" (declare (in) vec2 arg0)\n"
" (declare (in) float arg1)\n"
" (declare (in) float arg2))\n"
- " ((declare () vec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature vec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) float arg1)\n"
" (declare (in) float arg2))\n"
- " ((declare () vec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature vec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) float arg1)\n"
" (declare (in) float arg2))\n"
- " ((declare () vec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result)) (expression vec4 max (expression vec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"))\n"
};
@@ -1218,40 +1206,19 @@ static const char *builtins_110_max = {
" (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 max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec2 max (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 max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression float max (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec3 max (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 max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression float max (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression float max (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
};
@@ -1285,40 +1252,19 @@ static const char *builtins_110_min = {
" (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 min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec2 min (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 min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression float min (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec3 min (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 min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression float min (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression float min (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
};
@@ -2995,33 +2941,21 @@ static const char *builtins_130_clamp = {
" (declare (in) ivec2 arg0)\n"
" (declare (in) int arg1)\n"
" (declare (in) int arg2))\n"
- " ((declare () ivec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature ivec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) int arg1)\n"
" (declare (in) int arg2))\n"
- " ((declare () ivec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature ivec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) int arg1)\n"
" (declare (in) int arg2))\n"
- " ((declare () ivec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature uint\n"
" (parameters\n"
@@ -3056,33 +2990,21 @@ static const char *builtins_130_clamp = {
" (declare (in) uvec2 arg0)\n"
" (declare (in) uint arg1)\n"
" (declare (in) uint arg2))\n"
- " ((declare () uvec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature uvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uint arg1)\n"
" (declare (in) uint arg2))\n"
- " ((declare () uvec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"\n"
" (signature uvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uint arg1)\n"
" (declare (in) uint arg2))\n"
- " ((declare () uvec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
"))\n"
};
@@ -3319,40 +3241,19 @@ static const char *builtins_130_max = {
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) int arg1))\n"
- " ((declare () ivec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature ivec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) int arg1))\n"
- " ((declare () ivec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression int max (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature ivec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) int arg1))\n"
- " ((declare () ivec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression int max (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression int max (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature uint\n"
" (parameters\n"
@@ -3382,40 +3283,19 @@ static const char *builtins_130_max = {
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uint arg1))\n"
- " ((declare () uvec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature uvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uint arg1))\n"
- " ((declare () uvec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression uint max (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature uvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uint arg1))\n"
- " ((declare () uvec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression uint max (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression uint max (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
};
@@ -3449,40 +3329,19 @@ static const char *builtins_130_min = {
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) int arg1))\n"
- " ((declare () ivec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature ivec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) int arg1))\n"
- " ((declare () ivec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression int min (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature ivec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) int arg1))\n"
- " ((declare () ivec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression int min (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression int min (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature uint\n"
" (parameters\n"
@@ -3512,40 +3371,19 @@ static const char *builtins_130_min = {
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uint arg1))\n"
- " ((declare () uvec2 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature uvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uint arg1))\n"
- " ((declare () uvec3 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression uint min (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature uvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uint arg1))\n"
- " ((declare () uvec4 result)\n"
- " (assign (constant bool (1)) (swiz x (var_ref result))\n"
- " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz y (var_ref result))\n"
- " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz z (var_ref result))\n"
- " (expression uint min (swiz z (var_ref arg0)) (var_ref arg1)))\n"
- " (assign (constant bool (1)) (swiz w (var_ref result))\n"
- " (expression uint min (swiz w (var_ref arg0)) (var_ref arg1)))\n"
- " (return (var_ref result))))\n"
+ " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
};