radv: use SPI_SHADER_ZERO for non-written color attachments
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 11 Jun 2020 19:51:42 +0000 (21:51 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 29 Jun 2020 08:43:14 +0000 (08:43 +0000)
When colorWriteMask is 0 we can assume that this color attachment
is unused.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5434>

src/amd/vulkan/radv_pipeline.c

index ea9418e7a5f63caaf93d4acfd6dd056690e1da37..e5c0723c707f8d7bdb0b65425fa649452f33aaba 100644 (file)
@@ -517,7 +517,8 @@ radv_pipeline_compute_spi_color_formats(struct radv_pipeline *pipeline,
        for (unsigned i = 0; i < (blend->single_cb_enable ? 1 : subpass->color_count); ++i) {
                unsigned cf;
 
-               if (subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED) {
+               if (subpass->color_attachments[i].attachment == VK_ATTACHMENT_UNUSED ||
+                   !(blend->cb_target_mask & (0xfu << (i * 4)))) {
                        cf = V_028714_SPI_SHADER_ZERO;
                } else {
                        struct radv_render_pass_attachment *attachment = pass->attachments + subpass->color_attachments[i].attachment;