ac/nir: Avoid 0/0 when computing texel buffer size on Polaris.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13349
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36571>
This commit is contained in:
Hans-Kristian Arntzen
2025-08-05 14:10:49 +02:00
committed by Marge Bot
parent 7f5d1b1350
commit d7b17d4d9c
+3 -2
View File
@@ -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;
}