rsx: Fix logicOp behavior when blending is also active

This commit is contained in:
kd-11 2022-12-27 01:50:40 +03:00 committed by kd-11
parent 908d524631
commit 4def7f143c
2 changed files with 65 additions and 51 deletions

View File

@ -210,6 +210,19 @@ void GLGSRender::update_draw_state()
gl_state.color_maski(index, color_mask_r, color_mask_g, color_mask_b, color_mask_a);
}
// LogicOp and Blend are mutually exclusive. If both are enabled, LogicOp takes precedence.
// In OpenGL, this behavior is enforced in spec, but let's enforce it at renderer level as well.
if (gl_state.enable(rsx::method_registers.logic_op_enabled(), GL_COLOR_LOGIC_OP))
{
gl_state.logic_op(gl::logic_op(rsx::method_registers.logic_operation()));
gl_state.enablei(GL_FALSE, GL_BLEND, 0);
gl_state.enablei(GL_FALSE, GL_BLEND, 1);
gl_state.enablei(GL_FALSE, GL_BLEND, 2);
gl_state.enablei(GL_FALSE, GL_BLEND, 3);
}
else
{
bool mrt_blend_enabled[] =
{
rsx::method_registers.blend_enabled(),
@ -236,10 +249,6 @@ void GLGSRender::update_draw_state()
gl_state.enablei(mrt_blend_enabled[1], GL_BLEND, 1);
gl_state.enablei(mrt_blend_enabled[2], GL_BLEND, 2);
gl_state.enablei(mrt_blend_enabled[3], GL_BLEND, 3);
if (gl_state.enable(rsx::method_registers.logic_op_enabled(), GL_COLOR_LOGIC_OP))
{
gl_state.logic_op(gl::logic_op(rsx::method_registers.logic_operation()));
}
}

View File

@ -1780,9 +1780,6 @@ bool VKGSRender::load_program()
properties.state.enable_depth_test(vk::get_compare_func(rsx::method_registers.depth_func()));
}
if (rsx::method_registers.logic_op_enabled())
properties.state.enable_logic_op(vk::get_logic_op(rsx::method_registers.logic_operation()));
if (rsx::method_registers.cull_face_enabled())
properties.state.enable_cull_face(vk::get_cull_face(rsx::method_registers.cull_face_mode()));
@ -1808,6 +1805,13 @@ bool VKGSRender::load_program()
properties.state.set_color_mask(index, color_mask_r, color_mask_g, color_mask_b, color_mask_a);
}
// LogicOp and Blend are mutually exclusive. If both are enabled, LogicOp takes precedence.
if (rsx::method_registers.logic_op_enabled())
{
properties.state.enable_logic_op(vk::get_logic_op(rsx::method_registers.logic_operation()));
}
else
{
bool mrt_blend_enabled[] =
{
rsx::method_registers.blend_enabled(),
@ -1836,6 +1840,7 @@ bool VKGSRender::load_program()
}
}
}
}
if (rsx::method_registers.stencil_test_enabled())
{