i965: Prepare slice validator for isl based miptrees
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 25 Apr 2017 10:10:34 +0000 (13:10 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Mon, 19 Jun 2017 19:41:45 +0000 (22:41 +0300)
v2 (Nanley): Minify depth in case of 3D surface. Also moved to
             .c file to get minify() without additional
             header inclusions

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index d589a59104210c2208385ab6bed1f42d26c20ab5..f0d304c3710d523b482e169f7ed3b1d76ae281a7 100644 (file)
@@ -605,6 +605,27 @@ intel_lower_compressed_format(struct brw_context *brw, mesa_format format)
    }
 }
 
+/** \brief Assert that the level and layer are valid for the miptree. */
+void
+intel_miptree_check_level_layer(const struct intel_mipmap_tree *mt,
+                                uint32_t level,
+                                uint32_t layer)
+{
+   (void) mt;
+   (void) level;
+   (void) layer;
+
+   assert(level >= mt->first_level);
+   assert(level <= mt->last_level);
+
+   if (mt->surf.size > 0)
+      assert(layer < (mt->surf.dim == ISL_SURF_DIM_3D ?
+                         minify(mt->surf.phys_level0_sa.depth, level) :
+                         mt->surf.phys_level0_sa.array_len));
+   else
+      assert(layer < mt->level[level].depth);
+}
+
 static enum isl_aux_state **
 create_aux_state_map(struct intel_mipmap_tree *mt,
                      enum isl_aux_state initial)
index 63cedb200bafdcadc500b686e59f6274c1e3557f..8cb06b86066e12f1b108ea9c1a6b733f202826ee 100644 (file)
@@ -737,19 +737,10 @@ mesa_format
 intel_lower_compressed_format(struct brw_context *brw, mesa_format format);
 
 /** \brief Assert that the level and layer are valid for the miptree. */
-static inline void
+void
 intel_miptree_check_level_layer(const struct intel_mipmap_tree *mt,
                                 uint32_t level,
-                                uint32_t layer)
-{
-   (void) mt;
-   (void) level;
-   (void) layer;
-
-   assert(level >= mt->first_level);
-   assert(level <= mt->last_level);
-   assert(layer < mt->level[level].depth);
-}
+                                uint32_t layer);
 
 void intel_miptree_reference(struct intel_mipmap_tree **dst,
                              struct intel_mipmap_tree *src);