diff --git a/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c index b9fbafe0522..8d23cc83506 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c @@ -495,6 +495,7 @@ prepare_blend(struct panvk_cmd_buffer *cmdbuf) { bool dirty = is_dirty(cmdbuf, CB_LOGIC_OP_ENABLE) || is_dirty(cmdbuf, CB_LOGIC_OP) || + is_dirty(cmdbuf, MS_ALPHA_TO_ONE_ENABLE) || is_dirty(cmdbuf, CB_ATTACHMENT_COUNT) || is_dirty(cmdbuf, CB_COLOR_WRITE_ENABLES) || is_dirty(cmdbuf, CB_BLEND_ENABLES) || @@ -522,7 +523,7 @@ prepare_blend(struct panvk_cmd_buffer *cmdbuf) return VK_ERROR_OUT_OF_DEVICE_MEMORY; panvk_per_arch(blend_emit_descs)( - dev, cb, cmdbuf->state.gfx.render.color_attachments.fmts, + dev, dyns, cmdbuf->state.gfx.render.color_attachments.fmts, cmdbuf->state.gfx.render.color_attachments.samples, fs_info, fs_code, bds, &cmdbuf->state.gfx.cb.info); diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c index a8c6c03abcd..98e1ffe6cc7 100644 --- a/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/jm/panvk_vX_cmd_draw.c @@ -375,7 +375,7 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf, if (fs_info != NULL) { panvk_per_arch(blend_emit_descs)( - dev, cb, cmdbuf->state.gfx.render.color_attachments.fmts, + dev, dyns, cmdbuf->state.gfx.render.color_attachments.fmts, cmdbuf->state.gfx.render.color_attachments.samples, fs_info, fs_code, bds, &binfo); } else { diff --git a/src/panfrost/vulkan/panvk_blend.h b/src/panfrost/vulkan/panvk_blend.h index 2a587b0a199..53a3cea664e 100644 --- a/src/panfrost/vulkan/panvk_blend.h +++ b/src/panfrost/vulkan/panvk_blend.h @@ -17,6 +17,7 @@ #include "panvk_mempool.h" struct vk_color_blend_state; +struct vk_dynamic_graphics_state; struct panvk_device; struct panvk_blend_shader { @@ -42,7 +43,7 @@ struct panvk_blend_info { }; VkResult panvk_per_arch(blend_emit_descs)( - struct panvk_device *dev, const struct vk_color_blend_state *cb, + struct panvk_device *dev, const struct vk_dynamic_graphics_state *dy, const VkFormat *color_attachment_formats, uint8_t *color_attachment_samples, const struct pan_shader_info *fs_info, mali_ptr fs_code, struct mali_blend_packed *bds, struct panvk_blend_info *blend_info); diff --git a/src/panfrost/vulkan/panvk_vX_blend.c b/src/panfrost/vulkan/panvk_vX_blend.c index 9eecd46c857..067145b4efc 100644 --- a/src/panfrost/vulkan/panvk_vX_blend.c +++ b/src/panfrost/vulkan/panvk_vX_blend.c @@ -104,9 +104,10 @@ get_blend_shader_locked(struct panvk_device *dev, .logicop_func = state->logicop_func, .nr_samples = state->rts[rt].nr_samples, .equation = state->rts[rt].equation, + .alpha_to_one = state->alpha_to_one, }; - assert(state->logicop_enable || + assert(state->logicop_enable || state->alpha_to_one || !pan_blend_is_opaque(state->rts[rt].equation)); assert(state->rts[rt].equation.color_mask != 0); simple_mtx_assert_locked(&dev->blend_shader_cache.lock); @@ -308,6 +309,10 @@ blend_needs_shader(const struct pan_blend_state *state, unsigned rt_idx, if (state->logicop_enable) return state->logicop_func != PIPE_LOGICOP_NOOP; + /* alpha-to-one always requires a blend shader */ + if (state->alpha_to_one) + return true; + /* If the output is opaque, we don't need a blend shader, no matter the * format. */ @@ -353,12 +358,14 @@ blend_needs_shader(const struct pan_blend_state *state, unsigned rt_idx, VkResult panvk_per_arch(blend_emit_descs)( - struct panvk_device *dev, const struct vk_color_blend_state *cb, + struct panvk_device *dev, const struct vk_dynamic_graphics_state *dyns, const VkFormat *color_attachment_formats, uint8_t *color_attachment_samples, const struct pan_shader_info *fs_info, mali_ptr fs_code, struct mali_blend_packed *bds, struct panvk_blend_info *blend_info) { + const struct vk_color_blend_state *cb = &dyns->cb; struct pan_blend_state bs = { + .alpha_to_one = dyns->ms.alpha_to_one_enable, .logicop_enable = cb->logic_op_enable, .logicop_func = vk_logic_op_to_pipe(cb->logic_op), .rt_count = cb->attachment_count,