From 49d5fa12f21eda556eb8e7cb99748ef53e7cc492 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 Jul 2022 13:07:01 -0400 Subject: [PATCH] zink: always use 32bit sample ops while some (tg4) sample ops can use different bit sizes in spirv, most cannot, and all the shader variables are always emitted as 32bit, so ensure the 32bit type is always what's being used for sampling cc: mesa-stable Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 6bb996c5aaa..86a7d41a98e 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 @@ -3588,9 +3588,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex) } SpvId actual_dest_type; if (dref && tex->op != nir_texop_tg4) - actual_dest_type = - spirv_builder_type_float(&ctx->builder, - nir_dest_bit_size(tex->dest)); + actual_dest_type = spirv_builder_type_float(&ctx->builder, 32); else { unsigned num_components = nir_dest_num_components(tex->dest); switch (nir_alu_type_get_base_type(tex->dest_type)) { @@ -3624,10 +3622,10 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex) if (tex->op == nir_texop_tg4) { if (const_offset) spirv_builder_emit_cap(&ctx->builder, SpvCapabilityImageGatherExtended); - actual_dest_type = dest_type; - result = spirv_builder_emit_image_gather(&ctx->builder, dest_type, + result = spirv_builder_emit_image_gather(&ctx->builder, actual_dest_type, load, coord, emit_uint_const(ctx, 32, tex->component), lod, sample, const_offset, offset, dref, tex->is_sparse); + actual_dest_type = dest_type; } else result = spirv_builder_emit_image_fetch(&ctx->builder, actual_dest_type, image, coord, lod, sample, const_offset, offset, tex->is_sparse);