summaryrefslogtreecommitdiffstats
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.cpp121
1 files changed, 34 insertions, 87 deletions
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index 631aeac12ce..1c6d59d5a21 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -3010,40 +3010,26 @@ static const char builtin_smoothstep[] =
" (declare (in) float edge1)\n"
" (declare (in) float x))\n"
" ((declare () float t)\n"
- "\n"
" (assign (constant bool (1)) (x) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n"
- "\n"
+ " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.0)) (expression float * (constant float (2.0)) (var_ref t))))))))\n"
" (signature vec2\n"
" (parameters\n"
" (declare (in) float edge0)\n"
" (declare (in) float edge1)\n"
" (declare (in) vec2 x))\n"
" ((declare () vec2 t)\n"
- " (declare () vec2 retval)\n"
- "\n"
- " (assign (constant bool (1)) (x) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
- " (constant float (1.0)))\n"
- " (constant float (0.0))))\n"
- " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
- "\n"
- " (assign (constant bool (1)) (y) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
+ " (assign (constant bool (1)) (xy) (var_ref t)\n"
+ " (expression vec2 max\n"
+ " (expression vec2 min\n"
+ " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
- " (return (var_ref retval))\n"
- " ))\n"
+ " (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t))))))))\n"
"\n"
" (signature vec3\n"
" (parameters\n"
@@ -3051,33 +3037,13 @@ static const char builtin_smoothstep[] =
" (declare (in) float edge1)\n"
" (declare (in) vec3 x))\n"
" ((declare () vec3 t)\n"
- " (declare () vec3 retval)\n"
- "\n"
- " (assign (constant bool (1)) (x) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
- " (constant float (1.0)))\n"
- " (constant float (0.0))))\n"
- " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
- "\n"
- " (assign (constant bool (1)) (y) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
- " (constant float (1.0)))\n"
- " (constant float (0.0))))\n"
- " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
- "\n"
- " (assign (constant bool (1)) (z) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
+ " (assign (constant bool (1)) (xyz) (var_ref t)\n"
+ " (expression vec3 max\n"
+ " (expression vec3 min\n"
+ " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
- " (return (var_ref retval))\n"
- " ))\n"
+ " (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t))))))))\n"
"\n"
"\n"
" (signature vec4\n"
@@ -3086,74 +3052,55 @@ static const char builtin_smoothstep[] =
" (declare (in) float edge1)\n"
" (declare (in) vec4 x))\n"
" ((declare () vec4 t)\n"
- " (declare () vec4 retval)\n"
- "\n"
- " (assign (constant bool (1)) (x) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
- " (constant float (1.0)))\n"
- " (constant float (0.0))))\n"
- " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
- "\n"
- " (assign (constant bool (1)) (y) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
- " (constant float (1.0)))\n"
- " (constant float (0.0))))\n"
- " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
- "\n"
- " (assign (constant bool (1)) (z) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
- " (constant float (1.0)))\n"
- " (constant float (0.0))))\n"
- " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
- "\n"
- " (assign (constant bool (1)) (w) (var_ref t)\n"
- " (expression float max\n"
- " (expression float min\n"
- " (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
+ " (assign (constant bool (1)) (xyzw) (var_ref t)\n"
+ " (expression vec4 max\n"
+ " (expression vec4 min\n"
+ " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n"
- " (return (var_ref retval))\n"
- " ))\n"
+ " (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t))))))))\n"
"\n"
" (signature vec2\n"
" (parameters\n"
" (declare (in) vec2 edge0)\n"
" (declare (in) vec2 edge1)\n"
" (declare (in) vec2 x))\n"
- " ((return (expression vec2 max\n"
+ " ((declare () vec2 t)\n"
+ " (assign (constant bool (1)) (xy) (var_ref t)\n"
+ " (expression vec2 max\n"
" (expression vec2 min\n"
" (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n"
- " (constant vec2 (1.0 1.0)))\n"
- " (constant vec2 (0.0 0.0))))))\n"
+ " (constant float (1.0)))\n"
+ " (constant float (0.0))))\n"
+ " (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t))))))))\n"
"\n"
" (signature vec3\n"
" (parameters\n"
" (declare (in) vec3 edge0)\n"
" (declare (in) vec3 edge1)\n"
" (declare (in) vec3 x))\n"
- " ((return (expression vec3 max\n"
+ " ((declare () vec3 t)\n"
+ " (assign (constant bool (1)) (xyz) (var_ref t)\n"
+ " (expression vec3 max\n"
" (expression vec3 min\n"
" (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n"
- " (constant vec3 (1.0 1.0 1.0)))\n"
- " (constant vec3 (0.0 0.0 0.0))))))\n"
+ " (constant float (1.0)))\n"
+ " (constant float (0.0))))\n"
+ " (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t))))))))\n"
"\n"
" (signature vec4\n"
" (parameters\n"
" (declare (in) vec4 edge0)\n"
" (declare (in) vec4 edge1)\n"
" (declare (in) vec4 x))\n"
- " ((return (expression vec4 max\n"
+ " ((declare () vec4 t)\n"
+ " (assign (constant bool (1)) (xyzw) (var_ref t)\n"
+ " (expression vec4 max\n"
" (expression vec4 min\n"
" (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n"
- " (constant vec4 (1.0 1.0 1.0 1.0)))\n"
- " (constant vec4 (0.0 0.0 0.0 0.0))))))\n"
+ " (constant float (1.0)))\n"
+ " (constant float (0.0))))\n"
+ " (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t))))))))\n"
"))\n"
"\n"
""