From a8031d0f78315ff62af2459f7482bbe75bc92b3b Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 25 Jan 2021 13:23:08 +0200 Subject: [PATCH] anv: fix invalid programming of BLEND_STATE We can't enable Logic Op & Color Buffer Blend. The Vulkan spec seems to say Logic Op discards blending. Signed-off-by: Lionel Landwerlin Cc: mesa-stable@lists.freedesktop.org Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3767 Reviewed-by: Sagar Ghuge Part-of: (cherry picked from commit 998f38bd9934e9eff156505244032c28df9fba31) --- .pick_status.json | 2 +- src/intel/vulkan/genX_pipeline.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9b33219dab8..355e03a5f4d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -346,7 +346,7 @@ "description": "anv: fix invalid programming of BLEND_STATE", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 205e8677f19..33f071019b7 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -1180,7 +1180,22 @@ emit_cb_state(struct anv_graphics_pipeline *pipeline, #endif .LogicOpEnable = info->logicOpEnable, .LogicOpFunction = vk_to_gen_logic_op[info->logicOp], - .ColorBufferBlendEnable = a->blendEnable, + /* Vulkan specification 1.2.168, VkLogicOp: + * + * "Logical operations are controlled by the logicOpEnable and + * logicOp members of VkPipelineColorBlendStateCreateInfo. If + * logicOpEnable is VK_TRUE, then a logical operation selected by + * logicOp is applied between each color attachment and the + * fragment’s corresponding output value, and blending of all + * attachments is treated as if it were disabled." + * + * From the Broadwell PRM Volume 2d: Command Reference: Structures: + * BLEND_STATE_ENTRY: + * + * "Enabling LogicOp and Color Buffer Blending at the same time is + * UNDEFINED" + */ + .ColorBufferBlendEnable = !info->logicOpEnable && a->blendEnable, .ColorClampRange = COLORCLAMP_RTFORMAT, .PreBlendColorClampEnable = true, .PostBlendColorClampEnable = true,