summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-07-21 18:26:00 -0700
committerKenneth Graunke <[email protected]>2010-07-28 15:46:28 -0700
commit5489ad086f77e548905c98ccd27cd626d706d5f9 (patch)
tree8f41c1cdb98f453b8eb30c516f5ffcd7b4b9b905 /src
parentffcec135997545b4dc2b3393ccb02558083373a0 (diff)
ir_constant_expression: Add support for the "length" builtin.
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir_constant_expression.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index c4a416aa355..83d1b34bed6 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -925,7 +925,7 @@ ir_call::constant_expression_value()
} else if (strcmp(callee, "inversesqrt") == 0) {
expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL);
} else if (strcmp(callee, "length") == 0) {
- return NULL; /* FINISHME: implement this */
+ return new(mem_ctx) ir_constant(sqrtf(dot(op[0], op[0])));
} else if (strcmp(callee, "lessThan") == 0) {
assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
for (unsigned c = 0; c < op[0]->type->components(); c++) {