radv: fix disabling logic op for srgb/float formats when blending is enabled
The Vulkan spec says:
"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. Any attachments
using color formats for which logical operations are not supported
simply pass through the color values unmodified."
When logic op and blending are both enabled, logic op takes precedence
and values should be passed through unmodified. Also RB+ shouldn't
have any effects when blending is disabled.
Fixes new VKCTS coverage dEQP-VK.pipeline.*.logic_op_na_formats.*.
Fixes: 03b037a0e3 ("radv: disable logic op for float/srgb formats")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33235>
This commit is contained in:
committed by
Marge Bot
parent
d857198c87
commit
c172f6ef01
@@ -5218,13 +5218,14 @@ radv_emit_color_blend(struct radv_cmd_buffer *cmd_buffer)
|
||||
if (i > 0 && mrt0_is_dual_src)
|
||||
continue;
|
||||
|
||||
if (!d->vk.cb.attachments[i].blend_enable) {
|
||||
/* Disable logic op for float/srgb formats when blending isn't enabled. Otherwise it's
|
||||
* implicitly disabled.
|
||||
*/
|
||||
if (vk_format_is_float(render->color_att[i].format) || vk_format_is_srgb(render->color_att[i].format))
|
||||
cb_blend_control[i] |= S_028780_DISABLE_ROP3(1);
|
||||
/* Disable logic op for float/srgb formats because it shouldn't be applied. */
|
||||
if (d->vk.cb.logic_op_enable &&
|
||||
(vk_format_is_float(render->color_att[i].format) || vk_format_is_srgb(render->color_att[i].format))) {
|
||||
cb_blend_control[i] |= S_028780_DISABLE_ROP3(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!d->vk.cb.attachments[i].blend_enable) {
|
||||
sx_mrt_blend_opt[i] |= S_028760_COLOR_COMB_FCN(V_028760_OPT_COMB_BLEND_DISABLED) |
|
||||
S_028760_ALPHA_COMB_FCN(V_028760_OPT_COMB_BLEND_DISABLED);
|
||||
continue;
|
||||
@@ -5549,8 +5550,8 @@ radv_cmd_buffer_flush_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const ui
|
||||
if (states & (RADV_DYNAMIC_DEPTH_CLAMP_ENABLE | RADV_DYNAMIC_DEPTH_CLIP_ENABLE))
|
||||
radv_emit_depth_clamp_enable(cmd_buffer);
|
||||
|
||||
if (states &
|
||||
(RADV_DYNAMIC_COLOR_BLEND_ENABLE | RADV_DYNAMIC_COLOR_BLEND_EQUATION | RADV_DYNAMIC_ALPHA_TO_COVERAGE_ENABLE))
|
||||
if (states & (RADV_DYNAMIC_COLOR_BLEND_ENABLE | RADV_DYNAMIC_COLOR_BLEND_EQUATION |
|
||||
RADV_DYNAMIC_ALPHA_TO_COVERAGE_ENABLE | RADV_DYNAMIC_LOGIC_OP_ENABLE))
|
||||
radv_emit_color_blend(cmd_buffer);
|
||||
|
||||
if (states & (RADV_DYNAMIC_RASTERIZATION_SAMPLES | RADV_DYNAMIC_LINE_RASTERIZATION_MODE |
|
||||
|
||||
Reference in New Issue
Block a user