From d7a6cc8f4afef694d1aa95d1bb8f5ac459cb5559 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 6 Nov 2019 15:13:58 +0100 Subject: [PATCH] zink/spirv: add support for nir_op_flrp This fixes the following piglit: spec@ati_fragment_shader@ati_fragment_shader-render-fog Signed-off-by: Erik Faye-Lund --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index ccbf49efb27..6c0177dd7e1 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -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), -- 2.30.2