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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Fri Nov 25 21:40:30 2022 -0500

nir/lower_blend: Fix SNORM logic ops

We need to sign extend. Incidentally this means the iand above is useless for
SNORM.

Fixes arb_color_buffer_float-render with GL_RGBA8_SNORM.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

---

 src/compiler/nir/nir_lower_blend.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_lower_blend.c 
b/src/compiler/nir/nir_lower_blend.c
index f9878cad0db..d17d6768435 100644
--- a/src/compiler/nir/nir_lower_blend.c
+++ b/src/compiler/nir/nir_lower_blend.c
@@ -313,6 +313,8 @@ nir_blend_logicop(
    if (util_format_is_unorm(format)) {
       out = nir_format_unorm_to_float(b, out, bits);
    } else if (util_format_is_snorm(format)) {
+      /* Sign extend before converting so the i2f in snorm_to_float works */
+      out = nir_format_sign_extend_ivec(b, out, bits);
       out = nir_format_snorm_to_float(b, out, bits);
    } else {
       assert(util_format_is_pure_integer(format));

Reply via email to