nir/lower_blend: Don't do logic ops on pure float

Per the spec.

Fixes arb_color_buffer_float-render on both Panfrost and Asahi (before/after
reproduced on Mali-T860 and AGX G13 respectively). Without that patch, that test
fails the assertion:

arb_color_buffer_float-render: ../src/compiler/nir/nir_lower_blend.c:259: nir_blend_logicop: Assertion `util_format_is_pure_integer(format)' failed.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>
This commit is contained in:
Alyssa Rosenzweig
2022-11-25 21:40:42 -05:00
committed by Marge Bot
parent dbd0615e7a
commit 8b83210ab3

View File

@@ -278,6 +278,17 @@ nir_blend_logicop(
const struct util_format_description *format_desc =
util_format_description(format);
/* From section 17.3.9 ("Logical Operation") of the OpenGL 4.6 core spec:
*
* Logical operation has no effect on a floating-point destination color
* buffer, or when FRAMEBUFFER_SRGB is enabled and the value of
* FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING for the framebuffer attachment
* corresponding to the destination buffer is SRGB (see section 9.2.3).
* However, if logical operation is enabled, blending is still disabled.
*/
if (util_format_is_float(format) || util_format_is_srgb(format))
return src;
if (bit_size != 32) {
src = nir_f2f32(b, src);
dst = nir_f2f32(b, dst);