Mesa (master): anv: Stop allowing non-zero clear colors in input attachments

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 28 22:52:24 UTC 2020


Module: Mesa
Branch: master
Commit: 36a74835dfa4e9ae8088d3cb12c3c81964585f12
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=36a74835dfa4e9ae8088d3cb12c3c81964585f12

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Mar 25 15:02:15 2020 -0500

anv: Stop allowing non-zero clear colors in input attachments

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 at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4393>

---

 src/intel/vulkan/anv_private.h     |  1 -
 src/intel/vulkan/genX_cmd_buffer.c | 11 +++--------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index c18430a8043..8e88df7505b 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -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
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index b088d2e3d7d..a0de75ce657 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -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;



More information about the mesa-commit mailing list