Mesa (master): radeonsi: fix GLSL imageSamples()

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


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Sep 16 19:37:36 2019 -0400

radeonsi: fix GLSL imageSamples()

We haven't supported MSAA images, so it doesn't matter much.

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, 13 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 709ada50ea0..a0f66d38c7c 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -1015,6 +1015,19 @@ static void resq_emit(
 
 	emit_data->output[emit_data->chan] =
 		fix_resinfo(ctx, target, ac_build_image_opcode(&ctx->ac, &args));
+
+	if (inst->Instruction.Opcode == TGSI_OPCODE_RESQ &&
+	    (target == TGSI_TEXTURE_2D_MSAA ||
+	     target == TGSI_TEXTURE_2D_ARRAY_MSAA)) {
+		LLVMValueRef samples =
+			ac_build_image_get_sample_count(&ctx->ac, args.resource);
+
+		emit_data->output[emit_data->chan] =
+			LLVMBuildInsertElement(ctx->ac.builder,
+					       emit_data->output[emit_data->chan],
+					       samples,
+					       LLVMConstInt(ctx->i32, 3, 0), "");
+	}
 }
 
 /**




More information about the mesa-commit mailing list