From 15b5437f8f48e4ba25d305357224a5e9f7186b17 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 6 Dec 2023 16:38:48 -0400 Subject: [PATCH] gallium: fix util_clamp_color type confusion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes arb_color_buffer_float-clear GL_RGBA8_SNORM. Signed-off-by: Alyssa Rosenzweig Acked-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c index 0dc28d0896b..881a84e7840 100644 --- a/src/gallium/auxiliary/util/u_helpers.c +++ b/src/gallium/auxiliary/util/u_helpers.c @@ -553,9 +553,9 @@ util_clamp_color(enum pipe_format format, continue; if (util_format_is_unorm(format)) - clamp_color.ui[i] = _mesa_unorm_to_unorm(clamp_color.ui[i], bits, bits); + clamp_color.f[i] = SATURATE(clamp_color.f[i]); else if (util_format_is_snorm(format)) - clamp_color.i[i] = _mesa_snorm_to_snorm(clamp_color.i[i], bits, bits); + clamp_color.f[i] = CLAMP(clamp_color.f[i], -1.0, 1.0); else if (util_format_is_pure_uint(format)) clamp_color.ui[i] = _mesa_unsigned_to_unsigned(clamp_color.ui[i], bits); else if (util_format_is_pure_sint(format))