freedreno/a3xx: use the same layer size for all slices
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 13 Mar 2015 04:53:49 +0000 (00:53 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 13 Mar 2015 20:05:16 +0000 (16:05 -0400)
We only program in one layer size per texture, so that means that all
levels must share one size. This makes the piglit test

bin/texelFetch fs sampler2DArray

have the same breakage as its non-array version instead of being
completely off, and makes

bin/ext_texture_array-gen-mipmap

start passing.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/freedreno_resource.c

index c412407314fe9b8c82cc18a880190d70ef52020d..c7b4e579992df55a6b72edb6eece91116fb24dfb 100644 (file)
@@ -215,7 +215,14 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment)
 
                slice->pitch = align(width, 32);
                slice->offset = size;
-               slice->size0 = align(slice->pitch * height * rsc->cpp, alignment);
+               /* 1d array, 2d array, 3d textures (but not cube!) must all have the
+                * same layer size for each miplevel on a3xx. These are also the
+                * targets that have non-1 alignment.
+                */
+               if (level == 0 || layers_in_level == 1 || alignment == 1)
+                       slice->size0 = align(slice->pitch * height * rsc->cpp, alignment);
+               else
+                       slice->size0 = rsc->slices[0].size0;
 
                size += slice->size0 * depth * layers_in_level;