diff options
author | Kenneth Graunke <[email protected]> | 2010-07-21 18:06:18 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2010-07-28 15:46:27 -0700 |
commit | 6d897f07cf7ed8492ef5f0da90259856fdac5bf6 (patch) | |
tree | 30c6e9055507f4b3686b1853d64157797e1429ef /src/glsl | |
parent | 48a69ba05794f3d253114b452174710a15eefadf (diff) |
ir_constant_expression: Add support for the "lessThan" builtin.
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 4a5eb7540a4..032214eb3c4 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -901,7 +901,22 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "length") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "lessThan") == 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, "lessThanEqual") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "log") == 0) { |