radv: Disable disabled color buffers in rbplus opts.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 14 Jul 2018 12:28:19 +0000 (14:28 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 19 Jul 2018 00:37:47 +0000 (02:37 +0200)
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_cmd_buffer.c

index cbcd3bc141f836e31792f5d7b64aafe2ed923989..0b57c1a098c408dd3f81c3ff642aab9f4231dbba 100644 (file)
@@ -721,8 +721,11 @@ radv_emit_rbplus_state(struct radv_cmd_buffer *cmd_buffer)
        unsigned sx_blend_opt_control = 0;
 
        for (unsigned i = 0; i < subpass->color_count; ++i) {
-               if (subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED)
+               if (subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED) {
+                       sx_blend_opt_control |= S_02875C_MRT0_COLOR_OPT_DISABLE(1) << (i * 4);
+                       sx_blend_opt_control |= S_02875C_MRT0_ALPHA_OPT_DISABLE(1) << (i * 4);
                        continue;
+               }
 
                int idx = subpass->color_attachments[i].attachment;
                struct radv_color_buffer_info *cb = &framebuffer->attachments[idx].cb;
@@ -836,6 +839,10 @@ radv_emit_rbplus_state(struct radv_cmd_buffer *cmd_buffer)
                }
        }
 
+       for (unsigned i = subpass->color_count; i < 8; ++i) {
+               sx_blend_opt_control |= S_02875C_MRT0_COLOR_OPT_DISABLE(1) << (i * 4);
+               sx_blend_opt_control |= S_02875C_MRT0_ALPHA_OPT_DISABLE(1) << (i * 4);
+       }
        radeon_set_context_reg_seq(cmd_buffer->cs, R_028754_SX_PS_DOWNCONVERT, 3);
        radeon_emit(cmd_buffer->cs, sx_ps_downconvert);
        radeon_emit(cmd_buffer->cs, sx_blend_opt_epsilon);