anv/blorp: multisample resolve all attachment layers
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 14 Feb 2018 10:48:05 +0000 (11:48 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 22 Feb 2018 07:23:39 +0000 (08:23 +0100)
We were only resolving the first.

v2:
  - Do not require that the number of layers on dst and src are an
    exact match, it is okay if the dst has more layers so long as
    it has at least the same that we are going to resolve.
  - Do not always resolve array_len layers, we should resolve
    only from base_array_layer to array_len.

v3:
  - v2 was assuming that array_len represented the total number of
    layers in the image, but it represents the number of layers
    starting at the base array ayer.

v4:
 - The number of layers to resolve should be taken from the
   framebuffer (Nanley).

Fixes new CTS tests for multisampled layered rendering:
dEQP-VK.renderpass.multisample_resolve.layers_*

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/intel/vulkan/anv_blorp.c

index bee51e0..efa2ced 100644 (file)
@@ -1329,25 +1329,34 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer)
                                       VK_IMAGE_ASPECT_COLOR_BIT,
                                       ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
                                       dst_aux_usage, &dst_surf);
+
+         uint32_t base_src_layer = src_iview->planes[0].isl.base_array_layer;
+         uint32_t base_dst_layer = dst_iview->planes[0].isl.base_array_layer;
+
+         assert(src_iview->planes[0].isl.array_len >= fb->layers);
+         assert(dst_iview->planes[0].isl.array_len >= fb->layers);
+
          anv_cmd_buffer_mark_image_written(cmd_buffer, dst_iview->image,
                                            VK_IMAGE_ASPECT_COLOR_BIT,
                                            dst_surf.aux_usage,
                                            dst_iview->planes[0].isl.base_level,
-                                           dst_iview->planes[0].isl.base_array_layer, 1);
+                                           base_dst_layer, fb->layers);
 
          assert(!src_iview->image->format->can_ycbcr);
          assert(!dst_iview->image->format->can_ycbcr);
 
-         resolve_surface(&batch,
-                         &src_surf,
-                         src_iview->planes[0].isl.base_level,
-                         src_iview->planes[0].isl.base_array_layer,
-                         &dst_surf,
-                         dst_iview->planes[0].isl.base_level,
-                         dst_iview->planes[0].isl.base_array_layer,
-                         render_area.offset.x, render_area.offset.y,
-                         render_area.offset.x, render_area.offset.y,
-                         render_area.extent.width, render_area.extent.height);
+         for (uint32_t i = 0; i < fb->layers; i++) {
+            resolve_surface(&batch,
+                            &src_surf,
+                            src_iview->planes[0].isl.base_level,
+                            base_src_layer + i,
+                            &dst_surf,
+                            dst_iview->planes[0].isl.base_level,
+                            base_dst_layer + i,
+                            render_area.offset.x, render_area.offset.y,
+                            render_area.offset.x, render_area.offset.y,
+                            render_area.extent.width, render_area.extent.height);
+         }
       }
 
       blorp_batch_finish(&batch);