summaryrefslogtreecommitdiff
path: root/src/glsl/builtins/tools/generate_outerProductGLSL.py
diff options
context:
space:
mode:
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)