Mesa (master): radeonsi: set the sample index for shader images correctly

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 9 21:14:17 UTC 2019


Module: Mesa
Branch: master
Commit: 1881b35bf6a13905ccbf8b232921677c888eda35
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1881b35bf6a13905ccbf8b232921677c888eda35

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Sep 13 23:58:52 2019 -0400

radeonsi: set the sample index for shader images correctly

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>

---

 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index a0f66d38c7c..243286cc629 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -276,18 +276,19 @@ static void image_fetch_coords(
 	LLVMValueRef tmp;
 	int chan;
 
-	if (target == TGSI_TEXTURE_2D_MSAA ||
-	    target == TGSI_TEXTURE_2D_ARRAY_MSAA) {
-		/* Need the sample index as well. */
-		num_coords++;
-	}
-
 	for (chan = 0; chan < num_coords; ++chan) {
 		tmp = lp_build_emit_fetch(bld_base, inst, src, chan);
 		tmp = ac_to_integer(&ctx->ac, tmp);
 		coords[chan] = tmp;
 	}
 
+	if (target == TGSI_TEXTURE_2D_MSAA ||
+	    target == TGSI_TEXTURE_2D_ARRAY_MSAA) {
+		/* Need the sample index as well. */
+		tmp = lp_build_emit_fetch(bld_base, inst, src, TGSI_SWIZZLE_W);
+		coords[chan] = ac_to_integer(&ctx->ac, tmp);
+	}
+
 	if (ctx->screen->info.chip_class == GFX9) {
 		/* 1D textures are allocated and used as 2D on GFX9. */
 		if (target == TGSI_TEXTURE_1D) {




More information about the mesa-commit mailing list