From 5fd0649c015c0c4f13347f1ea3147b35e559a49d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 22 Aug 2025 16:40:11 +0200 Subject: [PATCH] radv: add radv_cmd_set_color_write_enable() Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 6c429b05022..e489fdeba74 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -388,6 +388,16 @@ radv_cmd_set_logic_op(struct radv_cmd_buffer *cmd_buffer, uint32_t logic_op) state->dirty_dynamic |= RADV_DYNAMIC_LOGIC_OP; } +ALWAYS_INLINE static void +radv_cmd_set_color_write_enable(struct radv_cmd_buffer *cmd_buffer, uint32_t color_write_enable) +{ + struct radv_cmd_state *state = &cmd_buffer->state; + + state->dynamic.color_write_enable = color_write_enable; + + state->dirty_dynamic |= RADV_DYNAMIC_COLOR_WRITE_ENABLE; +} + static void radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dynamic_state *src) { @@ -717,7 +727,12 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dy } } - RADV_CMP_COPY(color_write_enable, RADV_DYNAMIC_COLOR_WRITE_ENABLE); + if (copy_mask & RADV_DYNAMIC_COLOR_WRITE_ENABLE) { + if (dest->color_write_enable != src->color_write_enable) { + radv_cmd_set_color_write_enable(cmd_buffer, src->color_write_enable); + } + } + RADV_CMP_COPY(color_write_mask, RADV_DYNAMIC_COLOR_WRITE_MASK); RADV_CMP_COPY(vk.cb.logic_op_enable, RADV_DYNAMIC_LOGIC_OP_ENABLE); @@ -8628,7 +8643,6 @@ radv_CmdSetColorWriteEnableEXT(VkCommandBuffer commandBuffer, uint32_t attachmen const VkBool32 *pColorWriteEnables) { VK_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer); - struct radv_cmd_state *state = &cmd_buffer->state; uint32_t color_write_enable = 0; assert(attachmentCount <= MAX_RTS); @@ -8639,9 +8653,7 @@ radv_CmdSetColorWriteEnableEXT(VkCommandBuffer commandBuffer, uint32_t attachmen } } - state->dynamic.color_write_enable = color_write_enable; - - state->dirty_dynamic |= RADV_DYNAMIC_COLOR_WRITE_ENABLE; + radv_cmd_set_color_write_enable(cmd_buffer, color_write_enable); } VKAPI_ATTR void VKAPI_CALL