radv: do not fast clears if one level can't be fast cleared
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 20 Jun 2019 07:17:36 +0000 (09:17 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 20 Jun 2019 09:03:58 +0000 (11:03 +0200)
And fallback to slow color clears.

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

index b8ca5c2c9b2baa882d9141fc8a583afae2831892..6263b6d6f584bbac28891180d284c63f266d5ba3 100644 (file)
@@ -1522,6 +1522,21 @@ radv_can_fast_clear_color(struct radv_cmd_buffer *cmd_buffer,
                        if (!can_avoid_fast_clear_elim)
                                return false;
                }
+
+               if (iview->image->info.levels > 1 &&
+                   cmd_buffer->device->physical_device->rad_info.chip_class == GFX8) {
+                       for (uint32_t l = 0; l < iview->level_count; l++) {
+                               uint32_t level = iview->base_mip + l;
+                               struct legacy_surf_level *surf_level =
+                                       &iview->image->planes[0].surface.u.legacy.level[level];
+
+                               /* Do not fast clears if one level can't be
+                                * fast cleared.
+                                */
+                               if (!surf_level->dcc_fast_clear_size)
+                                       return false;
+                       }
+               }
        }
 
        return true;