[Mesa-stable] [PATCH] ac: fix texture query LOD for 1D textures on GFX9

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Apr 25 09:58:38 UTC 2018


1D textures are allocated as 2D which means we only need
one coordinate for texture query LOD.

Fixes: 625dcbbc456 ("amd/common: pass address components individually to
ac_build_image_intrinsic")
Cc: 18.1 <mesa-stable at lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/common/ac_llvm_build.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index f21a5d2623c..be7379f72ef 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1533,6 +1533,16 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
 		default:
 			break;
 		}
+
+		/* Fixup for GFX9 which allocates 1D textures as 2D, because at
+		 * this point we don't know the orignal sampler dimension.
+		 */
+		if (ctx->chip_class >= GFX9) {
+			if ((a->dim == ac_image_2darray ||
+			     a->dim == ac_image_2d) && !a->coords[1]) {
+				num_coords = 1;
+			}
+		}
 	}
 
 	if (a->offset)
-- 
2.17.0



More information about the mesa-stable mailing list