zink: implement i2b1
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 15 May 2020 10:05:11 +0000 (12:05 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 15 May 2020 14:40:07 +0000 (14:40 +0000)
This shuold really have been implemented before starting to use these,
but I guess I missed them.

Fixes a crash when starting a game in Warzone 2100.

Fixes: 7f6a491eec0 ("zink: lower b2b to b2i")
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5053>

src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index aaf722ad3942729219863a5fe14b115c2b306ea0..e609a08caf61dacc45b2733e67dd3da2e940581f 100644 (file)
@@ -1020,6 +1020,13 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
                                             nir_src_bit_size(alu->src[0].src),
                                             num_components, 0));
       break;
+   case nir_op_i2b1:
+      assert(nir_op_infos[alu->op].num_inputs == 1);
+      result = emit_binop(ctx, SpvOpINotEqual, dest_type, src[0],
+                          get_ivec_constant(ctx,
+                                            nir_src_bit_size(alu->src[0].src),
+                                            num_components, 0));
+      break;
 
 
 #define BINOP(nir_op, spirv_op) \