glsl_to_tgsi: emit IABS for absolute value of integers
authorBryan Cain <bryancain3@gmail.com>
Sat, 7 Jan 2012 22:19:39 +0000 (16:19 -0600)
committerBryan Cain <bryancain3@gmail.com>
Sat, 7 Jan 2012 22:20:28 +0000 (16:20 -0600)
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 539701173f8fd4f4fd6230adf93dacabf0329bc7..3b8e2fe3742c116f8a8b08a43a01daea4a5c4c0c 100644 (file)
@@ -1410,8 +1410,10 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
       }
       break;
    case ir_unop_abs:
-      assert(result_dst.type == GLSL_TYPE_FLOAT);
-      emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
+      if (result_dst.type == GLSL_TYPE_INT || result_dst.type == GLSL_TYPE_UINT)
+         emit(ir, TGSI_OPCODE_IABS, result_dst, op[0]);
+      else
+         emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
       break;
    case ir_unop_sign:
       emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);