st/mesa: fix opcode translation for ARB_shader_bit_encoding functions
authorMarek Olšák <marek.olsak@amd.com>
Tue, 30 Jul 2013 20:29:25 +0000 (22:29 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 30 Jul 2013 21:31:30 +0000 (23:31 +0200)
We treat the opcodes as MOVs, but we should at least change the type
of the expression, which later affects which TGSI opcode is chosen.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 69c1b412b46d26c1c534d9847e82a1e4266bfe31..3dfd5e5b33456a6ecd203c1a78e9405848535e11 100644 (file)
@@ -1832,10 +1832,17 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
          emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]);
       break;
    case ir_unop_bitcast_f2i:
+      result_src = op[0];
+      result_src.type = GLSL_TYPE_INT;
+      break;
    case ir_unop_bitcast_f2u:
+      result_src = op[0];
+      result_src.type = GLSL_TYPE_UINT;
+      break;
    case ir_unop_bitcast_i2f:
    case ir_unop_bitcast_u2f:
       result_src = op[0];
+      result_src.type = GLSL_TYPE_FLOAT;
       break;
    case ir_unop_f2b:
       emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0));