From ee127f03e45f4100f1109e222a5c4ba42d5dd1d9 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 25 Nov 2022 21:40:30 -0500 Subject: [PATCH] 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 Reviewed-by: Gert Wollny Part-of: --- 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));