From 29285882676388aacff123e8bdf025904abf8ea9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 15:32:15 -0700 Subject: glsl2: Move the compiler to the subdirectory it will live in in Mesa. --- src/glsl/builtins/tools/generate_transposeGLSL.py | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 src/glsl/builtins/tools/generate_transposeGLSL.py (limited to 'src/glsl/builtins/tools/generate_transposeGLSL.py') diff --git a/src/glsl/builtins/tools/generate_transposeGLSL.py b/src/glsl/builtins/tools/generate_transposeGLSL.py new file mode 100755 index 0000000000..8f669ce983 --- /dev/null +++ b/src/glsl/builtins/tools/generate_transposeGLSL.py @@ -0,0 +1,28 @@ +#!/usr/bin/python + +def gen(x, y): + origtype = "mat" + str(x) + trantype = "mat" + str(y) + if x != y: + origtype = origtype + "x" + str(y) + trantype = trantype + "x" + str(x) + print trantype + " transpose(" + origtype + " m)\n{" + print " " + trantype + " t;" + + # The obvious implementation of transpose + for i in range(x): + for j in range(y): + print " t[" + str(j) + "][" + str(i) + "] =", + print "m[" + str(i) + "][" + str(j) + "];" + print " return t;\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) -- cgit v1.2.3