lavapipe: fix logic-op support

Lavapipe exposes support for the logicOp feature, but doesn't actually
respect the state. This is easy to fix, so let's plumb it through.

This fixes spec@!opengl 1.0@gl-1.0-logicop When running with Zink on
Lavapipe.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7932>
This commit is contained in:
Erik Faye-Lund 2020-12-04 22:06:35 +01:00 committed by Marge Bot
parent 5bcefcc91a
commit 9a993da0ff
2 changed files with 47 additions and 0 deletions

View file

@ -176,6 +176,47 @@ static inline unsigned vk_conv_blend_func(enum VkBlendOp op)
}
}
static inline unsigned vk_conv_logic_op(enum VkLogicOp op)
{
switch (op) {
case VK_LOGIC_OP_CLEAR:
return PIPE_LOGICOP_CLEAR;
case VK_LOGIC_OP_NOR:
return PIPE_LOGICOP_NOR;
case VK_LOGIC_OP_AND_INVERTED:
return PIPE_LOGICOP_AND_INVERTED;
case VK_LOGIC_OP_COPY_INVERTED:
return PIPE_LOGICOP_COPY_INVERTED;
case VK_LOGIC_OP_AND_REVERSE:
return PIPE_LOGICOP_AND_REVERSE;
case VK_LOGIC_OP_INVERT:
return PIPE_LOGICOP_INVERT;
case VK_LOGIC_OP_XOR:
return PIPE_LOGICOP_XOR;
case VK_LOGIC_OP_NAND:
return PIPE_LOGICOP_NAND;
case VK_LOGIC_OP_AND:
return PIPE_LOGICOP_AND;
case VK_LOGIC_OP_EQUIVALENT:
return PIPE_LOGICOP_EQUIV;
case VK_LOGIC_OP_NO_OP:
return PIPE_LOGICOP_NOOP;
case VK_LOGIC_OP_OR_INVERTED:
return PIPE_LOGICOP_OR_INVERTED;
case VK_LOGIC_OP_COPY:
return PIPE_LOGICOP_COPY;
case VK_LOGIC_OP_OR_REVERSE:
return PIPE_LOGICOP_OR_REVERSE;
case VK_LOGIC_OP_OR:
return PIPE_LOGICOP_OR;
case VK_LOGIC_OP_SET:
return PIPE_LOGICOP_SET;
default:
assert(0);
return 0;
}
}
static inline enum pipe_swizzle vk_conv_swizzle(VkComponentSwizzle swiz)
{
switch (swiz) {

View file

@ -519,6 +519,12 @@ static void handle_graphics_pipeline(struct lvp_cmd_buffer_entry *cmd,
if (pipeline->graphics_create_info.pColorBlendState) {
const VkPipelineColorBlendStateCreateInfo *cb = pipeline->graphics_create_info.pColorBlendState;
int i;
if (cb->logicOpEnable) {
state->blend_state.logicop_enable = VK_TRUE;
state->blend_state.logicop_func = vk_conv_logic_op(cb->logicOp);
}
if (cb->attachmentCount > 1)
state->blend_state.independent_blend_enable = true;
for (i = 0; i < cb->attachmentCount; i++) {