zink/spirv: fixup b2i32 and implement b2f32
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 19 Jul 2019 14:53:04 +0000 (16:53 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:47 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index 8f0e61d06e95537a3083c5c93f7028958917ceb4..5fd403dd28c8f164b226f0191c52ba08e5b25537 100644 (file)
@@ -828,7 +828,16 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
 
    case nir_op_b2i32:
       assert(nir_op_infos[alu->op].num_inputs == 1);
-      result = bvec_to_uvec(ctx, src[0], num_components);
+      result = emit_select(ctx, dest_type, src[0],
+                           get_uvec_constant(ctx, 32, num_components, 1),
+                           get_uvec_constant(ctx, 32, num_components, 0));
+      break;
+
+   case nir_op_b2f32:
+      assert(nir_op_infos[alu->op].num_inputs == 1);
+      result = emit_select(ctx, dest_type, src[0],
+                           get_fvec_constant(ctx, 32, num_components, 1),
+                           get_fvec_constant(ctx, 32, num_components, 0));
       break;
 
 #define BUILTIN_UNOP(nir_op, spirv_op) \