summaryrefslogtreecommitdiffstats
path: root/src/glsl/lower_instructions.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2011-06-14 22:47:04 -0700
committerKenneth Graunke <kenneth@whitecape.org>2011-06-29 16:07:13 -0700
commited92b912120394f3b19958effaa819d29bc6d059 (patch)
tree08b8feed0458eb2b5d3d3b584f652bed5d7f9087 /src/glsl/lower_instructions.cpp
parent8eb975394478a5c1ebd2bd8a12b5eb61cef808a7 (diff)
downloadexternal_mesa3d-ed92b912120394f3b19958effaa819d29bc6d059.zip
external_mesa3d-ed92b912120394f3b19958effaa819d29bc6d059.tar.gz
external_mesa3d-ed92b912120394f3b19958effaa819d29bc6d059.tar.bz2
glsl: Fix DIV_TO_MUL_RCP lowering for uint result types.
f2i results in an int/ivec; we need i2u to get a uint/uvec. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/glsl/lower_instructions.cpp')
-rw-r--r--src/glsl/lower_instructions.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/glsl/lower_instructions.cpp b/src/glsl/lower_instructions.cpp
index a5f61f2..94b8c4a 100644
--- a/src/glsl/lower_instructions.cpp
+++ b/src/glsl/lower_instructions.cpp
@@ -168,8 +168,13 @@ lower_instructions_visitor::div_to_mul_rcp(ir_expression *ir)
op0 = new(ir) ir_expression(ir_binop_mul, vec_type, op0, op1);
- ir->operation = ir_unop_f2i;
- ir->operands[0] = op0;
+ if (ir->operands[1]->type->base_type == GLSL_TYPE_INT) {
+ ir->operation = ir_unop_f2i;
+ ir->operands[0] = op0;
+ } else {
+ ir->operation = ir_unop_i2u;
+ ir->operands[0] = new(ir) ir_expression(ir_unop_f2i, op0);
+ }
ir->operands[1] = NULL;
}