From c525849d95a47182e81450e2285b58abf222fd3f Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 18 Mar 2020 11:58:12 +0100 Subject: [PATCH] v3dv: only emit blend state if the pipeline is dirty Except for blend constants, which can be dynamic state. Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index b245ff555dd..33294761ec0 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -2051,9 +2051,20 @@ emit_blend(struct v3dv_cmd_buffer *cmd_buffer) v3dv_cl_ensure_space_with_branch(&job->bcl, blend_packets_size); - if (pipeline->blend.enables) { - cl_emit(&job->bcl, BLEND_ENABLES, enables) { - enables.mask = pipeline->blend.enables; + if (cmd_buffer->state.dirty & V3DV_CMD_DIRTY_PIPELINE) { + if (pipeline->blend.enables) { + cl_emit(&job->bcl, BLEND_ENABLES, enables) { + enables.mask = pipeline->blend.enables; + } + } + + for (uint32_t i = 0; i < V3D_MAX_DRAW_BUFFERS; i++) { + if (pipeline->blend.enables & (1 << i)) + cl_emit_prepacked(&job->bcl, &pipeline->blend.cfg[i]); + } + + cl_emit(&job->bcl, COLOR_WRITE_MASKS, mask) { + mask.mask = pipeline->blend.color_write_masks; } } @@ -2061,15 +2072,6 @@ emit_blend(struct v3dv_cmd_buffer *cmd_buffer) (cmd_buffer->state.dirty & V3DV_CMD_DIRTY_BLEND_CONSTANTS)) { cl_emit_prepacked(&job->bcl, &pipeline->blend.constant_color); } - - for (uint32_t i = 0; i < V3D_MAX_DRAW_BUFFERS; i++) { - if (pipeline->blend.enables & (1 << i)) - cl_emit_prepacked(&job->bcl, &pipeline->blend.cfg[i]); - } - - cl_emit(&job->bcl, COLOR_WRITE_MASKS, mask) { - mask.mask = pipeline->blend.color_write_masks; - } } static void