radv: do not allocate CMASK for non-MSSA images with 128 bit formats
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 12 Oct 2017 20:55:32 +0000 (22:55 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 14 Oct 2017 10:25:48 +0000 (12:25 +0200)
This saves some useless CMASK initializations/eliminations in
the Vulkan SSAO demo.

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

index 39dfffc3762479abcada72da13e7a6b3c5d893bc..397f0db26c0b1241b0ebba9f5df34d46f7565442 100644 (file)
@@ -3530,7 +3530,7 @@ static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer,
                                                   dst_queue_mask, range,
                                                   pending_clears);
 
-       if (image->cmask.size)
+       if (image->cmask.size || image->fmask.size)
                radv_handle_cmask_image_transition(cmd_buffer, image, src_layout,
                                                   dst_layout, src_queue_mask,
                                                   dst_queue_mask, range);
index 7c3e55b1b855cf7967827801c32f390820089d1f..0564454c776877b6ea218fa2900ba23f930a52e7 100644 (file)
@@ -819,6 +819,14 @@ radv_image_can_enable_dcc(struct radv_image *image)
 static inline bool
 radv_image_can_enable_cmask(struct radv_image *image)
 {
+       if (image->surface.bpe > 8 && image->info.samples == 1) {
+               /* Do not enable CMASK for non-MSAA images (fast color clear)
+                * because 128 bit formats are not supported, but FMASK might
+                * still be used.
+                */
+               return false;
+       }
+
        return radv_image_can_enable_dcc_or_cmask(image) &&
               image->info.levels == 1 &&
               image->info.depth == 1 &&
index 476a5913ae487ad041b7fb32972f14cd993997a9..dd0c1a01d32971eb379e694b6b559f3f00d931d6 100644 (file)
@@ -1027,11 +1027,6 @@ emit_fast_color_clear(struct radv_cmd_buffer *cmd_buffer,
                radv_set_dcc_need_cmask_elim_pred(cmd_buffer, iview->image,
                                                  !can_avoid_fast_clear_elim);
        } else {
-
-               if (iview->image->surface.bpe > 8) {
-                       /* 128 bit formats not supported */
-                       return false;
-               }
                radv_fill_buffer(cmd_buffer, iview->image->bo,
                                 iview->image->offset + iview->image->cmask.offset,
                                 iview->image->cmask.size, 0);