summaryrefslogtreecommitdiff
path: root/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-06-07 15:10:14 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-11 13:51:42 -0700
commit7dc2b71a89ac24f2d84f7db6bd8a4d499694cac5 (patch)
tree801f522ec890c6e4722641a9c2a624ee2b6a4645 /ir_constant_expression.cpp
parent00eb466e38733f386794b35ae5b0aab18b60b1d2 (diff)
Add float/bool conversion to ir_constant_expression.cpp.
Diffstat (limited to 'ir_constant_expression.cpp')
-rw-r--r--ir_constant_expression.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp
index 4055a84ff1..96dfc56e31 100644
--- a/ir_constant_expression.cpp
+++ b/ir_constant_expression.cpp
@@ -169,6 +169,20 @@ ir_constant_visitor::visit(ir_expression *ir)
f[c] = op[0]->value.u[c];
}
break;
+ case ir_unop_b2f:
+ assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
+ type = ir->type;
+ for (c = 0; c < ir->operands[0]->type->components(); c++) {
+ f[c] = op[0]->value.b[c] ? 1.0 : 0.0;
+ }
+ break;
+ case ir_unop_f2b:
+ assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
+ type = ir->type;
+ for (c = 0; c < ir->operands[0]->type->components(); c++) {
+ b[c] = bool(op[0]->value.f[c]);
+ }
+ break;
case ir_unop_neg:
type = ir->type;