zink/spirv: add support for nir_op_flrp
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 6 Nov 2019 14:13:58 +0000 (15:13 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 11 Nov 2019 13:25:30 +0000 (14:25 +0100)
This fixes the following piglit:

spec@ati_fragment_shader@ati_fragment_shader-render-fog

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index ccbf49efb27df20b348c1500fa677a13d876e62f..6c0177dd7e1e2b89e6f49cd071b990945fed4599 100644 (file)
@@ -710,6 +710,15 @@ emit_builtin_binop(struct ntv_context *ctx, enum GLSLstd450 op, SpvId type,
                                       op, args, ARRAY_SIZE(args));
 }
 
+static SpvId
+emit_builtin_triop(struct ntv_context *ctx, enum GLSLstd450 op, SpvId type,
+                   SpvId src0, SpvId src1, SpvId src2)
+{
+   SpvId args[] = { src0, src1, src2 };
+   return spirv_builder_emit_ext_inst(&ctx->builder, type, ctx->GLSL_std_450,
+                                      op, args, ARRAY_SIZE(args));
+}
+
 static SpvId
 get_fvec_constant(struct ntv_context *ctx, unsigned bit_size,
                   unsigned num_components, float value)
@@ -1013,6 +1022,12 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
       }
       break;
 
+   case nir_op_flrp:
+      assert(nir_op_infos[alu->op].num_inputs == 3);
+      result = emit_builtin_triop(ctx, GLSLstd450FMix, dest_type,
+                                  src[0], src[1], src[2]);
+      break;
+
    case nir_op_fcsel:
       result = emit_binop(ctx, SpvOpFOrdGreaterThan,
                           get_bvec_type(ctx, num_components),