kk: Clamp negative array indices to 0

Required so that uint array formats don't incorrectly wrap to last array
slice instead of the first one. For some reason this only happens with
uint texture formats while int and float formats work as expected.

Acked-by: Arcady Goldmints-Orlov <arcady@lunarg.com>
Signed-off-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38713>
This commit is contained in:
Aitor Camacho
2025-11-28 23:54:16 +09:00
committed by Marge Bot
parent 5527b71bce
commit 60f6bd4761
+2 -2
View File
@@ -614,12 +614,12 @@ round_src_component_to_uint(struct nir_to_msl_ctx *ctx, nir_src *src,
{
bool is_float = msl_src_is_float(ctx, src);
if (is_float) {
P(ctx, "uint(rint(");
P(ctx, "uint(max(int(rint(");
}
src_to_msl(ctx, src);
P(ctx, ".%c", component);
if (is_float) {
P(ctx, "))");
P(ctx, ")), int(0)))");
}
}