zink: bitcast InterpolateAtOffset offset to fvec

required by spec

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15827>
This commit is contained in:
Mike Blumenkrantz
2022-04-08 13:03:25 -04:00
committed by Marge Bot
parent ac8337041c
commit 46bbf49607

View File

@@ -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);