diff options
| author | Eric Anholt <eric@anholt.net> | 2010-06-24 15:47:38 -0700 |
|---|---|---|
| committer | Eric Anholt <eric@anholt.net> | 2010-06-24 15:47:40 -0700 |
| commit | bcc13b74443137043e8a34f8cb64a5add0d8af93 (patch) | |
| tree | 5f4e003dceb61c091ce0fcb8c5cf9d91bec033c0 /src/glsl/builtins/tools/generate_transposeGLSL.py | |
| parent | 84341f4b2014810b2964230384fe76338be1d78e (diff) | |
| parent | e5cf3aadb8d57dcc70b597092ecac276042f73cb (diff) | |
Merge branch 'glsl2-head' into glsl2
This brings in the standalone GLSL compiler that we are planning on
replacing the existing Mesa GLSL compiler. It currently targets GLSL
1.20 and the Mesa IR.
Diffstat (limited to 'src/glsl/builtins/tools/generate_transposeGLSL.py')
| -rwxr-xr-x | src/glsl/builtins/tools/generate_transposeGLSL.py | 28 |
1 files changed, 28 insertions, 0 deletions
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) |
