anv/blorp/clear_subpass: Only set surface clear color for fast clears
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 22 Feb 2017 02:28:38 +0000 (18:28 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 23 Feb 2017 20:10:42 +0000 (12:10 -0800)
Not all clear colors are valid.  In particular, on Broadwell and
earlier, only 0/1 colors are allowed in surface state.  No CTS tests are
affected outright by this because, apparently, the CTS coverage for
different clear colors is pretty terrible.  However, when multisample
compression is enabled, we do hit it with CTS tests and this commit
prevents regressions when enabling MCS on Broadwell and earlier.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_blorp.c

index 4e7078bbfb343b541d321f4b158eb125fd0beee2..8db03e4cef07ed2a14420dfeed3fa36153e1d14c 100644 (file)
@@ -1198,9 +1198,10 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
       struct blorp_surf surf;
       get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
                                    att_state->aux_usage, &surf);
-      surf.clear_color = vk_to_isl_color(att_state->clear_value.color);
 
       if (att_state->fast_clear) {
+         surf.clear_color = vk_to_isl_color(att_state->clear_value.color);
+
          blorp_fast_clear(&batch, &surf, iview->isl.format,
                           iview->isl.base_level,
                           iview->isl.base_array_layer, fb->layers,
@@ -1224,7 +1225,7 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
                      render_area.offset.x, render_area.offset.y,
                      render_area.offset.x + render_area.extent.width,
                      render_area.offset.y + render_area.extent.height,
-                     surf.clear_color, NULL);
+                     vk_to_isl_color(att_state->clear_value.color), NULL);
       }
 
       att_state->pending_clear_aspects = 0;