diff options
author | Kenneth Graunke <[email protected]> | 2010-07-22 15:34:49 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2010-07-28 15:46:29 -0700 |
commit | b09ae5dd3f9b8e380e2608f4ee3a7902f5ecc15e (patch) | |
tree | ee137f99772cf79f36e3feebd3ad022acbd498d3 /src/glsl | |
parent | 546f3a27540c408c9d83368c5f6144e13167dcb3 (diff) |
ir_constant_expression: Add support for the "transpose" builtin.
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index b6cb2d86726..c4e6d837b02 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1096,7 +1096,14 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = tanhf(op[0]->value.f[c]); } else if (strcmp(callee, "transpose") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_matrix()); + const unsigned n = op[0]->type->vector_elements; + const unsigned m = op[0]->type->matrix_columns; + for (unsigned j = 0; j < m; j++) { + for (unsigned i = 0; i < n; i++) { + data.f[m*i+j] += op[0]->value.f[i+n*j]; + } + } } else { /* Unsupported builtin - some are not allowed in constant expressions. */ return NULL; |