From: Samuel Pitoiset Date: Wed, 16 Oct 2019 20:51:08 +0000 (+0200) Subject: radv: fix DCC fast clear code for intensity formats (correctly) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c644644c651b5e852a2d7da3a89fbef1fa09669b;p=mesa.git radv: fix DCC fast clear code for intensity formats (correctly) Previous fix was pretty bogus. This fixes a rendering regression with Nier (minimap too large). Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1943 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1952 Fixes: ea92273cea8 ("radv: fix DCC fast clear code for intensity formats") Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 6002fc87a61..0a967fc177a 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -1461,6 +1461,8 @@ static void vi_get_fast_clear_parameters(struct radv_device *device, int extra_channel; bool main_value = false; bool extra_value = false; + bool has_color = false; + bool has_alpha = false; int i; *can_avoid_fast_clear_elim = false; @@ -1479,9 +1481,6 @@ static void vi_get_fast_clear_parameters(struct radv_device *device, } else return; - bool image_alpha_is_on_msb = vi_alpha_is_on_msb(device, image_format); - bool view_alpha_is_on_msb = vi_alpha_is_on_msb(device, view_format); - for (i = 0; i < 4; i++) { int index = desc->swizzle[i] - VK_SWIZZLE_X; if (desc->swizzle[i] < VK_SWIZZLE_X || @@ -1510,23 +1509,21 @@ static void vi_get_fast_clear_parameters(struct radv_device *device, return; } - if (index == extra_channel) + if (index == extra_channel) { extra_value = values[i]; - else + has_alpha = true; + } else { main_value = values[i]; + has_color = true; + } } /* If alpha isn't present, make it the same as color, and vice versa. */ - if (!extra_value) + if (!has_alpha) extra_value = main_value; - else if (!main_value) + else if (!has_color) main_value = extra_value; - if (main_value != extra_value) { - assert(image_alpha_is_on_msb == view_alpha_is_on_msb); - return; /* require ELIMINATE_FAST_CLEAR */ - } - for (int i = 0; i < 4; ++i) if (values[i] != main_value && desc->swizzle[i] - VK_SWIZZLE_X != extra_channel &&