Mesa (glsl2): glsl2: Fix reversed value of step().

Eric Anholt anholt at kemper.freedesktop.org
Wed Jun 30 17:34:31 PDT 2010


Module: Mesa
Branch: glsl2
Commit: 02d615306eb930bd6de9f1503ddd54ee33d3b930
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=02d615306eb930bd6de9f1503ddd54ee33d3b930

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jun 30 16:22:52 2010 -0700

glsl2: Fix reversed value of step().

It's 0.0 if x < edge, not 1.0.  Partial fix for glsl-fs-step.

---

 src/glsl/builtin_function.cpp |   38 +++++++++++++++++++-------------------
 src/glsl/builtins/110/step    |   38 +++++++++++++++++++-------------------
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index 626ba4e..811c5b2 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -2164,15 +2164,15 @@ static const char *builtins_110_step = {
    "     (parameters\n"
    "       (declare (in) float edge)\n"
    "       (declare (in) float x))\n"
-   "     ((return (expression float b2f (expression bool < (var_ref x) (var_ref edge))))))\n"
+   "     ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))\n"
    "\n"
    "   (signature vec2\n"
    "     (parameters\n"
    "       (declare (in) float edge)\n"
    "       (declare (in) vec2 x))\n"
    "     ((declare () vec2 t)\n"
-   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
    "      (return (var_ref t))))\n"
    "\n"
    "   (signature vec3\n"
@@ -2180,9 +2180,9 @@ static const char *builtins_110_step = {
    "       (declare (in) float edge)\n"
    "       (declare (in) vec3 x))\n"
    "     ((declare () vec3 t)\n"
-   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
    "      (return (var_ref t))))\n"
    "\n"
    "   (signature vec4\n"
@@ -2190,10 +2190,10 @@ static const char *builtins_110_step = {
    "       (declare (in) float edge)\n"
    "       (declare (in) vec4 x))\n"
    "     ((declare () vec4 t)\n"
-   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
+   "      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n"
    "      (return (var_ref t))))\n"
    "\n"
    "   (signature vec2\n"
@@ -2201,8 +2201,8 @@ static const char *builtins_110_step = {
    "       (declare (in) vec2 edge)\n"
    "       (declare (in) vec2 x))\n"
    "     ((declare () vec2 t)\n"
-   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
    "      (return (var_ref t))))\n"
    "\n"
    "   (signature vec3\n"
@@ -2210,9 +2210,9 @@ static const char *builtins_110_step = {
    "       (declare (in) vec3 edge)\n"
    "       (declare (in) vec3 x))\n"
    "     ((declare () vec3 t)\n"
-   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
    "      (return (var_ref t))))\n"
    "\n"
    "   (signature vec4\n"
@@ -2220,10 +2220,10 @@ static const char *builtins_110_step = {
    "       (declare (in) vec4 edge)\n"
    "       (declare (in) vec4 x))\n"
    "     ((declare () vec4 t)\n"
-   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz z (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(swiz w (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))\n"
+   "      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n"
    "      (return (var_ref t))))\n"
    "))\n"
    "\n"
diff --git a/src/glsl/builtins/110/step b/src/glsl/builtins/110/step
index 1cc2b51..ce6f435 100644
--- a/src/glsl/builtins/110/step
+++ b/src/glsl/builtins/110/step
@@ -3,15 +3,15 @@
      (parameters
        (declare (in) float edge)
        (declare (in) float x))
-     ((return (expression float b2f (expression bool < (var_ref x) (var_ref edge))))))
+     ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))
 
    (signature vec2
      (parameters
        (declare (in) float edge)
        (declare (in) vec2 x))
      ((declare () vec2 t)
-      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
       (return (var_ref t))))
 
    (signature vec3
@@ -19,9 +19,9 @@
        (declare (in) float edge)
        (declare (in) vec3 x))
      ((declare () vec3 t)
-      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
       (return (var_ref t))))
 
    (signature vec4
@@ -29,10 +29,10 @@
        (declare (in) float edge)
        (declare (in) vec4 x))
      ((declare () vec4 t)
-      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
+      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))
       (return (var_ref t))))
 
    (signature vec2
@@ -40,8 +40,8 @@
        (declare (in) vec2 edge)
        (declare (in) vec2 x))
      ((declare () vec2 t)
-      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))
-      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))
+      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
       (return (var_ref t))))
 
    (signature vec3
@@ -49,9 +49,9 @@
        (declare (in) vec3 edge)
        (declare (in) vec3 x))
      ((declare () vec3 t)
-      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))
-      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))
-      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(swiz z (var_ref edge)))))
+      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
       (return (var_ref t))))
 
    (signature vec4
@@ -59,10 +59,10 @@
        (declare (in) vec4 edge)
        (declare (in) vec4 x))
      ((declare () vec4 t)
-      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))
-      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))
-      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz z (var_ref edge)))))
-      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(swiz w (var_ref edge)))))
+      (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+      (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+      (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))
+      (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))
       (return (var_ref t))))
 ))
 



More information about the mesa-commit mailing list