From 3ecb89c35bbe2f7436adb7a4fb4aa0a58d4569f1 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Wed, 7 May 2025 22:37:43 +0200 Subject: [PATCH] gallium: Handle 64bit textures in the SW clear fallback path 64bit clears only work with <=2 component formats because the two integer clear values are interpreted as one 64bit integer. Reviewed-by: Mike Blumenkrantz Part-of: --- src/gallium/auxiliary/util/u_surface.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 11b16e6f229..7801b933584 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -767,10 +767,14 @@ util_clear_texture_sw(struct pipe_context *pipe, level, box->x, box->y, box->z, box->width, box->height, box->depth); } else { - union pipe_color_union color; - util_format_unpack_rgba(tex->format, color.ui, data, 1); + enum pipe_format format = tex->format; + if (util_format_is_int64(desc)) + format = util_format_get_array(desc->channel[0].type, 32, desc->nr_channels * 2, false, true); - util_clear_color_texture(pipe, tex, tex->format, &color, level, + union pipe_color_union color; + util_format_unpack_rgba(format, color.ui, data, 1); + + util_clear_color_texture(pipe, tex, format, &color, level, box->x, box->y, box->z, box->width, box->height, box->depth); }