Mesa (staging/18.2): ac/nir: fix getting GLSL type of array of samplers for TG4

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 24 12:45:34 UTC 2018


Module: Mesa
Branch: staging/18.2
Commit: 9798626fc0f8402176f93dac1f5e9c1478f599ba
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9798626fc0f8402176f93dac1f5e9c1478f599ba

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Aug 22 14:42:51 2018 +0200

ac/nir: fix getting GLSL type of array of samplers for TG4

This fixes a crash in build_tex_intrinsic() when trying to
launch the Basemark GPU benchmark on GFX8. It looks like
there is still something wrong because some frames are black.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106980
CC: 18.2 <mesa-stable at lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
(cherry picked from commit 4c43ec461de4f122d5d6566361d064c816e4ef69)

---

 src/amd/common/ac_nir_to_llvm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index cffc980e51..d552d032df 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1171,7 +1171,8 @@ static LLVMValueRef lower_gather4_integer(struct ac_llvm_context *ctx,
 					  struct ac_image_args *args,
 					  const nir_tex_instr *instr)
 {
-	enum glsl_base_type stype = glsl_get_sampler_result_type(var->type);
+	const struct glsl_type *type = glsl_without_array(var->type);
+	enum glsl_base_type stype = glsl_get_sampler_result_type(type);
 	LLVMValueRef half_texel[2];
 	LLVMValueRef compare_cube_wa = NULL;
 	LLVMValueRef result;
@@ -1356,7 +1357,8 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
 	if (instr->op == nir_texop_tg4 && ctx->ac.chip_class <= VI) {
 		nir_deref_instr *texture_deref_instr = get_tex_texture_deref(instr);
 		nir_variable *var = nir_deref_instr_get_variable(texture_deref_instr);
-		enum glsl_base_type stype = glsl_get_sampler_result_type(var->type);
+		const struct glsl_type *type = glsl_without_array(var->type);
+		enum glsl_base_type stype = glsl_get_sampler_result_type(type);
 		if (stype == GLSL_TYPE_UINT || stype == GLSL_TYPE_INT) {
 			return lower_gather4_integer(&ctx->ac, var, args, instr);
 		}




More information about the mesa-commit mailing list