summaryrefslogtreecommitdiff
path: root/src/glsl/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-07-23 13:24:09 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-07-28 15:46:29 -0700
commit7ddee6a535f7323d7c6131e52e7933130d886ae4 (patch)
tree5cdcd18c9a97cc903e8fcc55e0001266130b9a88 /src/glsl/ir_constant_expression.cpp
parent5d255e24b29930e78321c1ba807df71fea12174a (diff)
ir_constant_expression: Add support for the "outerProduct" builtin.
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r--src/glsl/ir_constant_expression.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 9fc37b3777..f02cd3127e 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -1043,7 +1043,14 @@ ir_call::constant_expression_value()
}
}
} else if (strcmp(callee, "outerProduct") == 0) {
- return NULL; /* FINISHME: implement this */
+ assert(op[0]->type->is_vector() && op[1]->type->is_vector());
+ const unsigned m = op[0]->type->vector_elements;
+ const unsigned n = op[1]->type->vector_elements;
+ for (unsigned j = 0; j < n; j++) {
+ for (unsigned i = 0; i < m; i++) {
+ data.f[i+m*j] = op[0]->value.f[i] * op[1]->value.f[j];
+ }
+ }
} else if (strcmp(callee, "pow") == 0) {
expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]);
} else if (strcmp(callee, "radians") == 0) {