anv: Stop filling out the clear color in compute_aux_usage
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 24 Mar 2020 23:08:03 +0000 (18:08 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 22:45:39 +0000 (22:45 +0000)
It's a pointless micro-optimization that just makes compute_aux_usage
unnecessarily entangled with setting up surface states.

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

src/intel/vulkan/genX_cmd_buffer.c

index 28c375cb1b8b01c7edf70e6b53363b0fa686610d..ea5696bfd849f2195138e73d514e525a6d8d457b 100644 (file)
@@ -293,8 +293,7 @@ add_surface_state_relocs(struct anv_cmd_buffer *cmd_buffer,
 static void
 color_attachment_compute_aux_usage(struct anv_device * device,
                                    struct anv_cmd_state * cmd_state,
-                                   uint32_t att, VkRect2D render_area,
-                                   union isl_color_value *fast_clear_color)
+                                   uint32_t att, VkRect2D render_area)
 {
    struct anv_attachment_state *att_state = &cmd_state->attachments[att];
    struct anv_image_view *iview = cmd_state->attachments[att].image_view;
@@ -425,9 +424,6 @@ color_attachment_compute_aux_usage(struct anv_device * device,
                        "Rendering to a multi-layer framebuffer with "
                        "LOAD_OP_CLEAR.  Only fast-clearing the first slice");
       }
-
-      if (att_state->fast_clear)
-         *fast_clear_color = clear_color;
    } else {
       att_state->fast_clear = false;
    }
@@ -1510,8 +1506,11 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
             anv_assert(iview->n_planes == 1);
             assert(att_aspects == VK_IMAGE_ASPECT_COLOR_BIT);
             color_attachment_compute_aux_usage(cmd_buffer->device,
-                                               state, i, begin->renderArea,
-                                               &clear_color);
+                                               state, i, begin->renderArea);
+            if (state->attachments[i].fast_clear) {
+               anv_clear_color_from_att_state(&clear_color,
+                                              &state->attachments[i], iview);
+            }
 
             anv_image_fill_surface_state(cmd_buffer->device,
                                          iview->image,