intel/blorp: Allow multiple layers
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 26 Aug 2016 15:37:09 +0000 (18:37 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Mon, 12 Sep 2016 08:48:29 +0000 (11:48 +0300)
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/blorp/blorp.c

index 4dbba0174891bb99836e6bfdaaaeaf287622b28a..17c1ff4c134c5138daf637105e0326b28082732a 100644 (file)
@@ -119,6 +119,9 @@ brw_blorp_surface_info_init(struct blorp_context *blorp,
       },
    };
 
+   info->view.array_len = MAX2(info->surf.logical_level0_px.depth,
+                               info->surf.logical_level0_px.array_len);
+
    if (!is_render_target &&
        (info->surf.dim == ISL_SURF_DIM_3D ||
         info->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY)) {
@@ -128,12 +131,12 @@ brw_blorp_surface_info_init(struct blorp_context *blorp,
        * guaranteed that we won't be doing any funny surface hacks.
        */
       info->view.base_array_layer = 0;
-      info->view.array_len = MAX2(info->surf.logical_level0_px.depth,
-                                  info->surf.logical_level0_px.array_len);
       info->z_offset = layer / layer_multiplier;
    } else {
       info->view.base_array_layer = layer / layer_multiplier;
-      info->view.array_len = 1;
+
+      assert(info->view.array_len >= info->view.base_array_layer);
+      info->view.array_len -= info->view.base_array_layer;
       info->z_offset = 0;
    }
 }