diff options
author | Eric Anholt <[email protected]> | 2010-04-02 02:17:08 -1000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-04-02 11:22:41 -0700 |
commit | c2cb84e17b2f7a5db146faa9c9c2a2ffac4b6c19 (patch) | |
tree | b8f09ac3636f438a3fcbd6f3e5d486bfc20249cc | |
parent | dc58b3f8ccd817fdee390a3df5b8e0fb29d5397c (diff) |
Add bool/int conversion as IR operations.
Fixes constructor-09.glsl and CorrectParse2.frag.
-rw-r--r-- | ast_function.cpp | 2 | ||||
-rw-r--r-- | ir.cpp | 2 | ||||
-rw-r--r-- | ir.h | 2 | ||||
-rw-r--r-- | ir_print_visitor.cpp | 2 |
4 files changed, 7 insertions, 1 deletions
diff --git a/ast_function.cpp b/ast_function.cpp index 2ca8976d508..09b7879185b 100644 --- a/ast_function.cpp +++ b/ast_function.cpp @@ -130,7 +130,7 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type) return new ir_expression(ir_unop_f2i, desired_type, src, NULL); else { assert(b == GLSL_TYPE_BOOL); - assert(!"FINISHME: Convert bool to int / uint."); + return new ir_expression(ir_unop_f2b, desired_type, src, NULL); } case GLSL_TYPE_FLOAT: switch (b) { @@ -66,6 +66,8 @@ ir_expression::get_num_operands(void) 1, /* ir_unop_i2f */ 1, /* ir_unop_f2b */ 1, /* ir_unop_b2f */ + 1, /* ir_unop_i2b */ + 1, /* ir_unop_b2i */ 1, /* ir_unop_u2f */ 1, /* ir_unop_trunc */ @@ -318,6 +318,8 @@ enum ir_expression_operation { ir_unop_i2f, /**< Integer-to-float conversion. */ ir_unop_f2b, /**< Float-to-boolean conversion */ ir_unop_b2f, /**< Boolean-to-float conversion */ + ir_unop_i2b, /**< int-to-boolean conversion */ + ir_unop_b2i, /**< Boolean-to-int conversion */ ir_unop_u2f, /**< Unsigned-to-float conversion. */ /** diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp index e3aeb69a1e9..e1fedd78a93 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -102,6 +102,8 @@ void ir_print_visitor::visit(ir_expression *ir) "i2f", "f2b", "b2f", + "i2b", + "b2i", "u2f", "trunc", "ceil", |