i965: Don't forget the cube map padding on gen5+.
authorEric Anholt <eric@anholt.net>
Tue, 8 Oct 2013 07:20:04 +0000 (00:20 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 9 Oct 2013 18:28:19 +0000 (11:28 -0700)
We had a fixup for gen4's 3d-layout cubemaps (which, iirc, we'd
experimentally found to be necessary!), but while the spec still requires
it on gen5, we'd been missing it in the array-layout cubemaps.

Cc: "9.1 9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_tex_layout.c

index e4e66b4219c2128fa343ad6d4f38987f33b32135..e9128a38244cabc98c742059e67e4c60d401ef45 100644 (file)
@@ -196,6 +196,18 @@ brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
    }
 }
 
+static void
+align_cube(struct intel_mipmap_tree *mt)
+{
+   /* The 965's sampler lays cachelines out according to how accesses
+    * in the texture surfaces run, so they may be "vertical" through
+    * memory.  As a result, the docs say in Surface Padding Requirements:
+    * Sampling Engine Surfaces that two extra rows of padding are required.
+    */
+   if (mt->target == GL_TEXTURE_CUBE_MAP)
+      mt->total_height += 2;
+}
+
 static void
 brw_miptree_layout_texture_array(struct brw_context *brw,
                                 struct intel_mipmap_tree *mt)
@@ -220,6 +232,8 @@ brw_miptree_layout_texture_array(struct brw_context *brw,
       }
    }
    mt->total_height = qpitch * mt->physical_depth0;
+
+   align_cube(mt);
 }
 
 static void
@@ -291,13 +305,7 @@ brw_miptree_layout_texture_3d(struct brw_context *brw,
       }
    }
 
-   /* The 965's sampler lays cachelines out according to how accesses
-    * in the texture surfaces run, so they may be "vertical" through
-    * memory.  As a result, the docs say in Surface Padding Requirements:
-    * Sampling Engine Surfaces that two extra rows of padding are required.
-    */
-   if (mt->target == GL_TEXTURE_CUBE_MAP)
-      mt->total_height += 2;
+   align_cube(mt);
 }
 
 void