From: Mike Blumenkrantz Date: Wed, 17 Jun 2020 19:06:27 +0000 (-0400) Subject: zink: use type of src[0] for ntv store and load ops X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4f4546ada7417b0164ceb4f93a652a41438b15b;p=mesa.git zink: use type of src[0] for ntv store and load ops in some cases (e.g., gl_ClipDistance) the nir_variable type doesn't match the needed destination type, so we can simplify this code to just use the destination type fixes spec@glsl-1.10@execution@interpolation@interpolation-none-gl_backcolor-smooth-vertex Reviewed-by: Erik Faye-Lund Part-of: --- 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 b80f09ccccd..af8cb2d68d6 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 @@ -1586,9 +1586,8 @@ emit_load_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr) { SpvId ptr = get_src(ctx, intr->src); - nir_variable *var = nir_intrinsic_get_var(intr, 0); SpvId result = spirv_builder_emit_load(&ctx->builder, - get_glsl_type(ctx, var->type), + get_glsl_type(ctx, nir_src_as_deref(intr->src[0])->type), ptr); unsigned num_components = nir_dest_num_components(intr->dest); unsigned bit_size = nir_dest_bit_size(intr->dest); @@ -1602,8 +1601,7 @@ emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr) SpvId ptr = get_src(ctx, &intr->src[0]); SpvId src = get_src(ctx, &intr->src[1]); - nir_variable *var = nir_intrinsic_get_var(intr, 0); - SpvId type = get_glsl_type(ctx, glsl_without_array(var->type)); + SpvId type = get_glsl_type(ctx, nir_src_as_deref(intr->src[0])->type); SpvId result = emit_bitcast(ctx, type, src); spirv_builder_emit_store(&ctx->builder, ptr, result); }