panvk: Fix unsupported LogicOp NOOP blending
For formats that do not support LogicOps, NOOP should be treated as
COPY. This was implemented in nir/lower_blend, but an optimization in
PanVK would trigger for all NOOP that stopped this from happening.
This commit limits the NOOP optimization to supported formats.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35367>
diff --git a/src/panfrost/vulkan/panvk_vX_blend.c b/src/panfrost/vulkan/panvk_vX_blend.c
index 28e9739..8d29abb 100644
--- a/src/panfrost/vulkan/panvk_vX_blend.c
+++ b/src/panfrost/vulkan/panvk_vX_blend.c
@@ -240,11 +240,9 @@
{
const struct pan_blend_rt_state *rt = &state->rts[rt_idx];
- /* LogicOp requires a blend shader, unless it's a NOOP, in which case we just
- * disable blending.
- */
+ /* LogicOp requires a blend shader */
if (state->logicop_enable)
- return state->logicop_func != PIPE_LOGICOP_NOOP;
+ return true;
/* alpha-to-one always requires a blend shader */
if (state->alpha_to_one)
@@ -357,11 +355,6 @@
continue;
}
- if (bs.logicop_enable && bs.logicop_func == PIPE_LOGICOP_NOOP) {
- rt->equation.color_mask = 0;
- continue;
- }
-
if (color_attachment_formats[i] == VK_FORMAT_UNDEFINED) {
rt->equation.color_mask = 0;
continue;
@@ -374,6 +367,14 @@
rt->format = vk_format_to_pipe_format(color_attachment_formats[i]);
+ /* Disable blending for LOGICOP_NOOP unless the format is float/srgb */
+ if (bs.logicop_enable && bs.logicop_func == PIPE_LOGICOP_NOOP &&
+ !(util_format_is_float(rt->format) ||
+ util_format_is_srgb(rt->format))) {
+ rt->equation.color_mask = 0;
+ continue;
+ }
+
rt->nr_samples = color_attachment_samples[i];
rt->equation.blend_enable = cb->attachments[i].blend_enable;
rt->equation.color_mask = cb->attachments[i].write_mask;