From d7b17d4d9c11c86e221588f356480f9f902e9937 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 5 Aug 2025 14:10:49 +0200 Subject: [PATCH] ac/nir: Avoid 0/0 when computing texel buffer size on Polaris. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hans-Kristian Arntzen Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13349 Reviewed-by: Samuel Pitoiset Reviewed-by: Georg Lehmann Reviewed-by: Marek Olšák Part-of: --- src/amd/common/nir/ac_nir_lower_resinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/common/nir/ac_nir_lower_resinfo.c b/src/amd/common/nir/ac_nir_lower_resinfo.c index e236e17bda9..ef39ba12bd8 100644 --- a/src/amd/common/nir/ac_nir_lower_resinfo.c +++ b/src/amd/common/nir/ac_nir_lower_resinfo.c @@ -69,10 +69,11 @@ lower_query_size(nir_builder *b, nir_def *desc, nir_src *lod, if (gfx_level == GFX8) { /* On GFX8, the descriptor contains the size in bytes, * but TXQ must return the size in elements. - * The stride is always non-zero for resources using TXQ. + * The stride is always non-zero for resources using TXQ, except when + * using null descriptors in Vulkan, so apply trivial fixup. * Divide the size by the stride. */ - size = nir_udiv(b, size, get_field(b, desc, 1, ~C_008F04_STRIDE)); + size = nir_udiv(b, size, nir_umax_imm(b, get_field(b, desc, 1, ~C_008F04_STRIDE), 1)); } return size; }