summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-07-28 11:58:27 -0700
committerKenneth Graunke <[email protected]>2010-07-28 15:46:29 -0700
commit56af4e56e3852363a810174c64650df6f0ae4f53 (patch)
tree8237ded46eef76f88fcdae2ea3fec405e24ac9b1
parent7ddee6a535f7323d7c6131e52e7933130d886ae4 (diff)
glsl2: Fix outerProduct builtin.
The type signatures were completely backwards.
-rw-r--r--src/glsl/builtin_function.cpp98
-rw-r--r--src/glsl/builtins/120/outerProduct98
-rwxr-xr-xsrc/glsl/builtins/tools/generate_outerProductGLSL.py4
3 files changed, 100 insertions, 100 deletions
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index cc957e4b661..3343cf5638b 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -2666,92 +2666,92 @@ static const char *builtins_120_outerProduct = {
" (declare (in) vec2 u)\n"
" (declare (in) vec2 v))\n"
" ((declare () mat2 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat2x3\n"
" (parameters\n"
- " (declare (in) vec2 u)\n"
- " (declare (in) vec3 v))\n"
+ " (declare (in) vec3 u)\n"
+ " (declare (in) vec2 v))\n"
" ((declare () mat2x3 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat2x4\n"
" (parameters\n"
- " (declare (in) vec2 u)\n"
- " (declare (in) vec4 v))\n"
+ " (declare (in) vec4 u)\n"
+ " (declare (in) vec2 v))\n"
" ((declare () mat2x4 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat3x2\n"
" (parameters\n"
- " (declare (in) vec3 u)\n"
- " (declare (in) vec2 v))\n"
+ " (declare (in) vec2 u)\n"
+ " (declare (in) vec3 v))\n"
" ((declare () mat3x2 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (return (var_ref m))\n"
+ " ))\n"
"\n"
" (signature mat3\n"
" (parameters\n"
" (declare (in) vec3 u)\n"
" (declare (in) vec3 v))\n"
" ((declare () mat3 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat3x4\n"
" (parameters\n"
- " (declare (in) vec3 u)\n"
- " (declare (in) vec4 v))\n"
+ " (declare (in) vec4 u)\n"
+ " (declare (in) vec3 v))\n"
" ((declare () mat3x4 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat4x2\n"
" (parameters\n"
- " (declare (in) vec4 u)\n"
- " (declare (in) vec2 v))\n"
+ " (declare (in) vec2 u)\n"
+ " (declare (in) vec4 v))\n"
" ((declare () mat4x2 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref v) (swiz w (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat4x3\n"
" (parameters\n"
- " (declare (in) vec4 u)\n"
- " (declare (in) vec3 v))\n"
+ " (declare (in) vec3 u)\n"
+ " (declare (in) vec4 v))\n"
" ((declare () mat4x3 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref v) (swiz w (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"\n"
" (signature mat4\n"
" (parameters\n"
" (declare (in) vec4 u)\n"
" (declare (in) vec4 v))\n"
" ((declare () mat4 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref v) (swiz w (var_ref u)))) \n"
- "(return (var_ref m))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n"
+ " (return (var_ref m))))\n"
"))\n"
- "\n"
};
static const char *builtins_120_transpose = {
diff --git a/src/glsl/builtins/120/outerProduct b/src/glsl/builtins/120/outerProduct
index b401ba02337..69ae741e176 100644
--- a/src/glsl/builtins/120/outerProduct
+++ b/src/glsl/builtins/120/outerProduct
@@ -4,89 +4,89 @@
(declare (in) vec2 u)
(declare (in) vec2 v))
((declare () mat2 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+ (return (var_ref m))))
(signature mat2x3
(parameters
- (declare (in) vec2 u)
- (declare (in) vec3 v))
+ (declare (in) vec3 u)
+ (declare (in) vec2 v))
((declare () mat2x3 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+ (return (var_ref m))))
(signature mat2x4
(parameters
- (declare (in) vec2 u)
- (declare (in) vec4 v))
+ (declare (in) vec4 u)
+ (declare (in) vec2 v))
((declare () mat2x4 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+ (return (var_ref m))))
(signature mat3x2
(parameters
- (declare (in) vec3 u)
- (declare (in) vec2 v))
+ (declare (in) vec2 u)
+ (declare (in) vec3 v))
((declare () mat3x2 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
+ (return (var_ref m))
+ ))
(signature mat3
(parameters
(declare (in) vec3 u)
(declare (in) vec3 v))
((declare () mat3 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
+ (return (var_ref m))))
(signature mat3x4
(parameters
- (declare (in) vec3 u)
- (declare (in) vec4 v))
+ (declare (in) vec4 u)
+ (declare (in) vec3 v))
((declare () mat3x4 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
+ (return (var_ref m))))
(signature mat4x2
(parameters
- (declare (in) vec4 u)
- (declare (in) vec2 v))
+ (declare (in) vec2 u)
+ (declare (in) vec4 v))
((declare () mat4x2 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref v) (swiz w (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))
+ (return (var_ref m))))
(signature mat4x3
(parameters
- (declare (in) vec4 u)
- (declare (in) vec3 v))
+ (declare (in) vec3 u)
+ (declare (in) vec4 v))
((declare () mat4x3 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref v) (swiz w (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))
+ (return (var_ref m))))
(signature mat4
(parameters
(declare (in) vec4 u)
(declare (in) vec4 v))
((declare () mat4 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref v) (swiz w (var_ref u))))
-(return (var_ref m))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))
+ (return (var_ref m))))
))
-
diff --git a/src/glsl/builtins/tools/generate_outerProductGLSL.py b/src/glsl/builtins/tools/generate_outerProductGLSL.py
index 48fb72197c3..c561cc3ba14 100755
--- a/src/glsl/builtins/tools/generate_outerProductGLSL.py
+++ b/src/glsl/builtins/tools/generate_outerProductGLSL.py
@@ -4,11 +4,11 @@ def gen(x, y):
type = "mat" + str(x)
if x != y:
type = type + "x" + str(y)
- print type + " outerProduct(vec" + str(x) + " u, vec" + str(y) + " v)\n{"
+ print type + " outerProduct(vec" + str(y) + " u, vec" + str(x) + " v)\n{"
print " " + type + " m;"
for i in range(x):
- print " m[" + str(i) + "] = v * u[" + str(i) + "];"
+ print " m[" + str(i) + "] = u * v[" + str(i) + "];"
print " return m;\n}"
print "#version 120"