summaryrefslogtreecommitdiff
path: root/src/glsl/builtins/tools/generate_outerProductGLSL.py
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-06-24 15:32:15 -0700
committerEric Anholt <eric@anholt.net>2010-06-24 15:36:00 -0700
commit29285882676388aacff123e8bdf025904abf8ea9 (patch)
treea830f72e7a5273d8fd1a7781ce7da7ae91b613ab /src/glsl/builtins/tools/generate_outerProductGLSL.py
parent0ee7d80269bfab14683623b0c8fc12da43db8d78 (diff)
glsl2: Move the compiler to the subdirectory it will live in in Mesa.
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 0000000000..48fb72197c
--- /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(x) + " u, vec" + str(y) + " v)\n{"
+ print " " + type + " m;"
+
+ for i in range(x):
+ print " m[" + str(i) + "] = v * u[" + 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)