From c3dea47be8fde9fa791a6228118eaa5c9e81341a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Mon, 27 Jan 2025 12:57:30 -0800 Subject: [PATCH] anv: disable logic op for float/srgb formats Fixes new tests: dEQP-VK.pipeline.*.logic_op_na_formats.* Reviewed-by: Caio Oliveira Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_gfx_state.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 42842fc92f3..1c675f38513 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -1358,10 +1358,21 @@ update_blend_state(struct anv_gfx_dynamic_state *hw_state, * * "Enabling LogicOp and Color Buffer Blending at the same time is * UNDEFINED" + * + * The Vulkan spec also says: + * "Logical operations are not applied to floating-point or sRGB format + * color attachments." + * and + * "Any attachments using color formats for which logical operations + * are not supported simply pass through the color values unmodified." */ + bool ignores_logic_op = + vk_format_is_float(gfx->color_att[att].vk_format) || + vk_format_is_srgb(gfx->color_att[att].vk_format); SET(BLEND_STATE, blend.rts[rt].LogicOpFunction, vk_to_intel_logic_op[dyn->cb.logic_op]); - SET(BLEND_STATE, blend.rts[rt].LogicOpEnable, dyn->cb.logic_op_enable); + SET(BLEND_STATE, blend.rts[rt].LogicOpEnable, + dyn->cb.logic_op_enable && !ignores_logic_op); SET(BLEND_STATE, blend.rts[rt].ColorClampRange, COLORCLAMP_RTFORMAT); SET(BLEND_STATE, blend.rts[rt].PreBlendColorClampEnable, true);