summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-07-21 17:42:23 -0700
committerKenneth Graunke <[email protected]>2010-07-28 15:46:27 -0700
commit13f8758e9c3babdee3fc0b8b8e1d4a7e13ef9694 (patch)
treeb290ff7b65272f5b6082eaf466ea158ce1a9ea0a /src
parentf6ea9dfe473ccb0b5121461653696fe07ee4f328 (diff)
ir_constant_expression: Add support for "atan" builtins.
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir_constant_expression.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 301bfa80251..a6ce339e3e0 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -826,7 +826,15 @@ ir_call::constant_expression_value()
for (unsigned c = 0; c < op[0]->type->components(); c++)
data.f[c] = asinf(op[0]->value.f[c]);
} else if (strcmp(callee, "atan") == 0) {
- return NULL; /* FINISHME: implement this */
+ assert(op[0]->type->is_float());
+ if (num_parameters == 2) {
+ assert(op[1]->type->is_float());
+ for (unsigned c = 0; c < op[0]->type->components(); c++)
+ data.f[c] = atan2f(op[0]->value.f[c], op[1]->value.f[c]);
+ } else {
+ for (unsigned c = 0; c < op[0]->type->components(); c++)
+ data.f[c] = atanf(op[0]->value.f[c]);
+ }
} else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) {
return ir_constant::zero(mem_ctx, this->type);
} else if (strcmp(callee, "ceil") == 0) {