From fe1a9b3ab32d75299015b38de3bd4c8a3c07ea7f Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 30 Mar 2023 16:54:02 +0200 Subject: [PATCH] radv: add a helper for binding the custom blend mode This re-emits the according state when a new graphics pipeline is bound Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 2e329d448de..e36ad2c6959 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -1933,9 +1933,6 @@ radv_emit_graphics_pipeline(struct radv_cmd_buffer *cmd_buffer) radv_rast_prim_is_points_or_lines(pipeline->rast_prim)) cmd_buffer->state.dirty |= RADV_CMD_DIRTY_GUARDBAND; - if (cmd_buffer->state.emitted_graphics_pipeline->custom_blend_mode != pipeline->custom_blend_mode) - cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_LOGIC_OP | RADV_CMD_DIRTY_DYNAMIC_LOGIC_OP_ENABLE; - if (cmd_buffer->state.emitted_graphics_pipeline->ms.min_sample_shading != pipeline->ms.min_sample_shading || cmd_buffer->state.emitted_graphics_pipeline->uses_out_of_order_rast != pipeline->uses_out_of_order_rast || cmd_buffer->state.emitted_graphics_pipeline->uses_vrs_attachment != pipeline->uses_vrs_attachment || @@ -6345,6 +6342,16 @@ radv_bind_multisample_state(struct radv_cmd_buffer *cmd_buffer, const struct rad } } +static void +radv_bind_custom_blend_mode(struct radv_cmd_buffer *cmd_buffer, unsigned custom_blend_mode) +{ + /* Re-emit CB_COLOR_CONTROL when the custom blending mode changes. */ + if (cmd_buffer->state.custom_blend_mode != custom_blend_mode) + cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_LOGIC_OP | RADV_CMD_DIRTY_DYNAMIC_LOGIC_OP_ENABLE; + + cmd_buffer->state.custom_blend_mode = custom_blend_mode; +} + static void radv_bind_pre_rast_shader(struct radv_cmd_buffer *cmd_buffer, const struct radv_shader *shader) { @@ -6701,7 +6708,8 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipeline radv_bind_multisample_state(cmd_buffer, &graphics_pipeline->ms); - cmd_buffer->state.custom_blend_mode = graphics_pipeline->custom_blend_mode; + radv_bind_custom_blend_mode(cmd_buffer, graphics_pipeline->custom_blend_mode); + cmd_buffer->state.db_render_control = graphics_pipeline->db_render_control; cmd_buffer->state.rast_prim = graphics_pipeline->rast_prim;