radv: rewrite the condition that checks allowed depth/stencil values
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 12 Nov 2018 16:57:11 +0000 (17:57 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 19 Nov 2018 15:32:16 +0000 (16:32 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta_clear.c

index 4d8a6a9160293aeab0fb6a7362ce543059aa2c23..9f74936e98892d2e14a8de23103293d59b52c53b 100644 (file)
@@ -826,8 +826,10 @@ emit_fast_htile_clear(struct radv_cmd_buffer *cmd_buffer,
             !(aspects & VK_IMAGE_ASPECT_STENCIL_BIT)))
                return false;
 
-       if (!radv_is_fast_clear_depth_allowed(clear_value) ||
-           !(aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
+       if (((aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
+           !radv_is_fast_clear_depth_allowed(clear_value)) ||
+           ((aspects & VK_IMAGE_ASPECT_STENCIL_BIT) &&
+            !radv_is_fast_clear_stencil_allowed(clear_value)))
                return false;
 
        /* GFX8 only supports 32-bit depth surfaces but we can enable TC-compat
@@ -838,12 +840,6 @@ emit_fast_htile_clear(struct radv_cmd_buffer *cmd_buffer,
            iview->image->vk_format == VK_FORMAT_D16_UNORM)
                return false;
 
-       if (vk_format_aspects(iview->image->vk_format) & VK_IMAGE_ASPECT_STENCIL_BIT) {
-               if (!radv_is_fast_clear_stencil_allowed(clear_value) ||
-                   !(aspects & VK_IMAGE_ASPECT_STENCIL_BIT))
-                       return false;
-       }
-
        clear_word = radv_get_htile_fast_clear_value(iview->image, clear_value);
 
        if (pre_flush) {