diff options
author | Ian Romanick <[email protected]> | 2010-06-25 16:19:45 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-06-28 10:04:18 -0700 |
commit | 26b5d33dce37755a6a4a799a9edfcdff8c5ce3e5 (patch) | |
tree | 937610cb045afbac5a6056f007edf731b5cbb7a2 /src/glsl/ast_function.cpp | |
parent | 0bef5b97a9eccebc4b59dff42b2863770da770fe (diff) |
glsl2: Use i2b and f2b IR opcodes for casting int or float to bool
Diffstat (limited to 'src/glsl/ast_function.cpp')
-rw-r--r-- | src/glsl/ast_function.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 761af00b95e..f431d1d0156 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -172,17 +172,17 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type) break; } break; - case GLSL_TYPE_BOOL: { - ir_constant *zero = NULL; - + case GLSL_TYPE_BOOL: switch (b) { - case GLSL_TYPE_UINT: zero = new(ctx) ir_constant(unsigned(0)); break; - case GLSL_TYPE_INT: zero = new(ctx) ir_constant(int(0)); break; - case GLSL_TYPE_FLOAT: zero = new(ctx) ir_constant(0.0f); break; + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + result = new(ctx) ir_expression(ir_unop_i2b, desired_type, src, NULL); + break; + case GLSL_TYPE_FLOAT: + result = new(ctx) ir_expression(ir_unop_f2b, desired_type, src, NULL); + break; } - - result = new(ctx) ir_expression(ir_binop_nequal, desired_type, src, zero); - } + break; } assert(result != NULL); |