From 46bbf49607ba41fca5f6be1b9e6bf6717a7017f8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 8 Apr 2022 13:03:25 -0400 Subject: [PATCH] zink: bitcast InterpolateAtOffset offset to fvec required by spec Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 a6a66264641..46556c98429 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 @@ -2444,15 +2444,23 @@ emit_interpolate(struct ntv_context *ctx, nir_intrinsic_instr *intr) { SpvId op; spirv_builder_emit_cap(&ctx->builder, SpvCapabilityInterpolationFunction); + SpvId src1 = 0; switch (intr->intrinsic) { case nir_intrinsic_interp_deref_at_centroid: op = GLSLstd450InterpolateAtCentroid; break; case nir_intrinsic_interp_deref_at_sample: op = GLSLstd450InterpolateAtSample; + src1 = get_src(ctx, &intr->src[1]); break; case nir_intrinsic_interp_deref_at_offset: op = GLSLstd450InterpolateAtOffset; + src1 = get_src(ctx, &intr->src[1]); + /* + The offset operand must be a vector of 2 components of 32-bit floating-point type. + - InterpolateAtOffset spec + */ + src1 = emit_bitcast(ctx, get_fvec_type(ctx, 32, 2), src1); break; default: unreachable("unknown interp op"); @@ -2463,7 +2471,7 @@ emit_interpolate(struct ntv_context *ctx, nir_intrinsic_instr *intr) result = emit_builtin_unop(ctx, op, get_glsl_type(ctx, nir_src_as_deref(intr->src[0])->type), ptr); else result = emit_builtin_binop(ctx, op, get_glsl_type(ctx, nir_src_as_deref(intr->src[0])->type), - ptr, get_src(ctx, &intr->src[1])); + ptr, src1); unsigned num_components = nir_dest_num_components(intr->dest); unsigned bit_size = nir_dest_bit_size(intr->dest); result = bitcast_to_uvec(ctx, result, bit_size, num_components);