From 43ff6fc4ae5f47f1537707b794253929780cafc1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 9 Jun 2010 15:47:09 -0700 Subject: Implement 1.20 'outerProduct' builtin. --- builtins/tools/generate_outerProductGLSL.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 builtins/tools/generate_outerProductGLSL.py (limited to 'builtins/tools/generate_outerProductGLSL.py') diff --git a/builtins/tools/generate_outerProductGLSL.py b/builtins/tools/generate_outerProductGLSL.py new file mode 100755 index 0000000000..48fb72197c --- /dev/null +++ b/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) -- cgit v1.2.3