summaryrefslogtreecommitdiff
path: root/src/glsl/builtins/tools/generate_outerProductGLSL.py
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-08-16 19:08:53 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-08-16 19:08:53 -0700
commit6c03c576cc49bbb008de66d374f4302ff0fe0390 (patch)
tree7ddeb3ee88532d9aef8728b9aa256edf7c125247 /src/glsl/builtins/tools/generate_outerProductGLSL.py
parent15a3b42e135a3a2cb463ec3cff80a55dd8528051 (diff)
parenta433cd286c60eb9d4c2114f042709eda0f3de676 (diff)
Merge branch 'glsl2'
Conflicts: src/mesa/program/prog_optimize.c
Diffstat (limited to 'src/glsl/builtins/tools/generate_outerProductGLSL.py')
-rwxr-xr-xsrc/glsl/builtins/tools/generate_outerProductGLSL.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/glsl/builtins/tools/generate_outerProductGLSL.py b/src/glsl/builtins/tools/generate_outerProductGLSL.py
new file mode 100755
index 00000000000..c561cc3ba14
--- /dev/null
+++ b/src/glsl/builtins/tools/generate_outerProductGLSL.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+def gen(x, y):
+ type = "mat" + str(x)
+ if x != y:
+ type = type + "x" + str(y)
+ print type + " outerProduct(vec" + str(y) + " u, vec" + str(x) + " v)\n{"
+ print " " + type + " m;"
+
+ for i in range(x):
+ print " m[" + str(i) + "] = u * v[" + str(i) + "];"
+ print " return m;\n}"
+
+print "#version 120"
+gen(2,2)
+gen(2,3) # mat2x3 means 2 columns, 3 rows
+gen(2,4)
+gen(3,2)
+gen(3,3)
+gen(3,4)
+gen(4,2)
+gen(4,3)
+gen(4,4)