nir/spirv: Wrap borrow/carry ops in b2i
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 7 Jan 2016 01:13:04 +0000 (17:13 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 7 Jan 2016 01:13:06 +0000 (17:13 -0800)
NIR specifies them as booleans but SPIR-V wants ints.

src/glsl/nir/spirv/spirv_to_nir.c

index 875b18cebdda3db49848dde5ee64be1a914b58cb..8acfc4b392eb2ddd121e68f21aed46c60c38e880 100644 (file)
@@ -2718,13 +2718,15 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
    case SpvOpIAddCarry:
       assert(glsl_type_is_struct(val->ssa->type));
       val->ssa->elems[0]->def = nir_iadd(&b->nb, src[0], src[1]);
-      val->ssa->elems[1]->def = nir_uadd_carry(&b->nb, src[0], src[1]);
+      val->ssa->elems[1]->def =
+         nir_b2i(&b->nb, nir_uadd_carry(&b->nb, src[0], src[1]));
       return;
 
    case SpvOpISubBorrow:
       assert(glsl_type_is_struct(val->ssa->type));
       val->ssa->elems[0]->def = nir_isub(&b->nb, src[0], src[1]);
-      val->ssa->elems[1]->def = nir_usub_borrow(&b->nb, src[0], src[1]);
+      val->ssa->elems[1]->def =
+         nir_b2i(&b->nb, nir_usub_borrow(&b->nb, src[0], src[1]));
       return;
 
    case SpvOpUMulExtended: