From: Ian Romanick Date: Mon, 7 Jun 2010 22:10:14 +0000 (-0700) Subject: Add float/bool conversion to ir_constant_expression.cpp. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dc2b71a89ac24f2d84f7db6bd8a4d499694cac5;p=mesa.git Add float/bool conversion to ir_constant_expression.cpp. --- diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp index 4055a84ff15..96dfc56e31c 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;