Mesa (glsl2): glsl2: Use i2b and f2b IR opcodes for casting int or float to bool
Ian Romanick
idr at kemper.freedesktop.org
Mon Jun 28 17:09:03 UTC 2010
Module: Mesa
Branch: glsl2
Commit: 26b5d33dce37755a6a4a799a9edfcdff8c5ce3e5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=26b5d33dce37755a6a4a799a9edfcdff8c5ce3e5
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Fri Jun 25 16:19:45 2010 -0700
glsl2: Use i2b and f2b IR opcodes for casting int or float to bool
---
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 761af00..f431d1d 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);
More information about the mesa-commit
mailing list