radv: decompress FMASK before performing a MSAA decompress using FMASK
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 16 May 2019 07:24:58 +0000 (09:24 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 20 May 2019 10:41:47 +0000 (12:41 +0200)
This fixes some CTS failures related to VK_EXT_sample_locations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index ec1fcf4fd64658b16bc538c928226486e9c76ceb..e4e5966da54e9c30cdba9462a8eb3225c5f95dc6 100644 (file)
@@ -4585,17 +4585,28 @@ static void radv_handle_color_image_transition(struct radv_cmd_buffer *cmd_buffe
                        radv_fast_clear_flush_image_inplace(cmd_buffer, image, range);
                }
        } else if (radv_image_has_cmask(image) || radv_image_has_fmask(image)) {
+               bool fce_eliminate = false, fmask_expand = false;
+
                if (radv_layout_can_fast_clear(image, src_layout, src_queue_mask) &&
                    !radv_layout_can_fast_clear(image, dst_layout, dst_queue_mask)) {
-                       radv_fast_clear_flush_image_inplace(cmd_buffer, image, range);
+                       fce_eliminate = true;
                }
 
                if (radv_image_has_fmask(image)) {
                        if (src_layout != VK_IMAGE_LAYOUT_GENERAL &&
                            dst_layout == VK_IMAGE_LAYOUT_GENERAL) {
-                               radv_expand_fmask_image_inplace(cmd_buffer, image, range);
+                               /* A FMASK decompress is required before doing
+                                * a MSAA decompress using FMASK.
+                                */
+                               fmask_expand = true;
                        }
                }
+
+               if (fce_eliminate || fmask_expand)
+                       radv_fast_clear_flush_image_inplace(cmd_buffer, image, range);
+
+               if (fmask_expand)
+                       radv_expand_fmask_image_inplace(cmd_buffer, image, range);
        }
 }