From 87f7c7bd6566dbd95214df9b058bca5e6573374e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 17 Sep 2017 16:00:38 +0200 Subject: [PATCH] radeonsi: fix array textures layer coordinate MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Like for cube map (array) gather, we need to round to nearest on <= VI. Fixes tests in dEQP-GLES3.functional.shaders.texture_functions.texture.* Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c index d0969a7dd02..0f65984db07 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c @@ -1478,13 +1478,22 @@ static void tex_fetch_args( if (target == TGSI_TEXTURE_CUBE || target == TGSI_TEXTURE_CUBE_ARRAY || target == TGSI_TEXTURE_SHADOWCUBE || - target == TGSI_TEXTURE_SHADOWCUBE_ARRAY) + target == TGSI_TEXTURE_SHADOWCUBE_ARRAY) { ac_prepare_cube_coords(&ctx->ac, opcode == TGSI_OPCODE_TXD, target == TGSI_TEXTURE_CUBE_ARRAY || target == TGSI_TEXTURE_SHADOWCUBE_ARRAY, opcode == TGSI_OPCODE_LODQ, coords, derivs); + } else if (tgsi_is_array_sampler(target) && + opcode != TGSI_OPCODE_TXF && + opcode != TGSI_OPCODE_TXF_LZ && + ctx->screen->b.chip_class <= VI) { + unsigned array_coord = target == TGSI_TEXTURE_1D_ARRAY ? 1 : 2; + coords[array_coord] = + ac_build_intrinsic(&ctx->ac, "llvm.rint.f32", ctx->f32, + &coords[array_coord], 1, 0); + } if (opcode == TGSI_OPCODE_TXD) for (int i = 0; i < num_deriv_channels * 2; i++) -- 2.30.2