summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-07-21 18:07:09 -0700
committerKenneth Graunke <[email protected]>2010-07-28 15:46:28 -0700
commit319f4949e0a5f1daa3a760fc84096c041e3ce815 (patch)
tree0fa56b761b8fb22196cbf4bc96a9fb51b97c0c2e /src/glsl/ir_constant_expression.cpp
parent6d897f07cf7ed8492ef5f0da90259856fdac5bf6 (diff)
ir_constant_expression: Add support for the "lessThanEqual" builtin.
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r--src/glsl/ir_constant_expression.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 032214eb3c4..9c543d48ed1 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -918,7 +918,22 @@ ir_call::constant_expression_value()
}
}
} else if (strcmp(callee, "lessThanEqual") == 0) {
- return NULL; /* FINISHME: implement this */
+ assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
+ for (unsigned c = 0; c < op[0]->type->components(); c++) {
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_UINT:
+ data.b[c] = op[0]->value.u[c] <= op[1]->value.u[c];
+ break;
+ case GLSL_TYPE_INT:
+ data.b[c] = op[0]->value.i[c] <= op[1]->value.i[c];
+ break;
+ case GLSL_TYPE_FLOAT:
+ data.b[c] = op[0]->value.f[c] <= op[1]->value.f[c];
+ break;
+ default:
+ assert(!"Should not get here.");
+ }
+ }
} else if (strcmp(callee, "log") == 0) {
expr = new(mem_ctx) ir_expression(ir_unop_log, type, op[0], NULL);
} else if (strcmp(callee, "log2") == 0) {