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:
@@ -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)))");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user