Module: Mesa
Branch: main
Commit: 15b5437f8f48e4ba25d305357224a5e9f7186b17
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15b5437f8f48e4ba25d305357224a5e9f7186b17

Author: Alyssa Rosenzweig <[email protected]>
Date:   Wed Dec  6 16:38:48 2023 -0400

gallium: fix util_clamp_color type confusion

fixes arb_color_buffer_float-clear GL_RGBA8_SNORM.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Acked-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26613>

---

 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))

Reply via email to