anv: Stop allowing non-zero clear colors in input attachments
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 25 Mar 2020 20:02:15 +0000 (15:02 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 22:45:39 +0000 (22:45 +0000)
Previously, we bent over backwards to allow non-zero clear colors input
attachments whenever we could.  However, very few apps use input
attachments and very few use non-zero clear colors.  Getting rid of
support for non-zero clear colors input attachments will allow us to
treat them identically to textures which should help us simplify things
a good bit.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4393>

src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_cmd_buffer.c

index c18430a804303de7ef3fa4ad3ababee19a7974fa..8e88df7505ba5ef4883357bdd25e48f510ead5ce 100644 (file)
@@ -2591,7 +2591,6 @@ struct anv_attachment_state {
    VkImageAspectFlags                           pending_load_aspects;
    bool                                         fast_clear;
    VkClearValue                                 clear_value;
-   bool                                         clear_color_is_zero_one;
    bool                                         clear_color_is_zero;
 
    /* When multiview is active, attachments with a renderpass clear
index b088d2e3d7d70350ed1549f7a1f22f59656a004d..a0de75ce65710feb9b7d5626a9ef198875234015 100644 (file)
@@ -383,7 +383,7 @@ color_attachment_compute_aux_usage(struct anv_device * device,
    union isl_color_value clear_color = {};
    anv_clear_color_from_att_state(&clear_color, att_state, iview);
 
-   att_state->clear_color_is_zero_one =
+   const bool clear_color_is_zero_one =
       isl_color_value_is_zero_one(clear_color, iview->planes[0].isl.format);
    att_state->clear_color_is_zero =
       isl_color_value_is_zero(clear_color, iview->planes[0].isl.format);
@@ -420,7 +420,7 @@ color_attachment_compute_aux_usage(struct anv_device * device,
          att_state->fast_clear = false;
 
       /* On Broadwell and earlier, we can only handle 0/1 clear colors */
-      if (GEN_GEN <= 8 && !att_state->clear_color_is_zero_one)
+      if (GEN_GEN <= 8 && !clear_color_is_zero_one)
          att_state->fast_clear = false;
 
       /* If the clear color is one that would require non-trivial format
@@ -476,11 +476,6 @@ depth_stencil_attachment_compute_aux_usage(struct anv_device *device,
    att_state->aux_usage = ISL_AUX_USAGE_NONE;
    att_state->input_aux_usage = ISL_AUX_USAGE_NONE;
 
-   /* This is unused for depth/stencil but valgrind complains if it
-    * isn't initialized
-    */
-   att_state->clear_color_is_zero_one = false;
-
    if (GEN_GEN == 7) {
       /* We don't do any HiZ or depth fast-clears on gen7 yet */
       att_state->fast_clear = false;
@@ -5044,7 +5039,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
        * color or auxiliary buffer usage isn't supported by the sampler.
        */
       const bool input_needs_resolve =
-            (att_state->fast_clear && !att_state->clear_color_is_zero_one) ||
+            (att_state->fast_clear && !att_state->clear_color_is_zero) ||
             att_state->input_aux_usage != att_state->aux_usage;
 
       VkImageLayout target_layout;