llvmpipe: remove special case for PIPE_TEXTURE_CUBE in llvmpipe_texture_layout()
authorBrian Paul <brianp@vmware.com>
Mon, 29 Sep 2014 16:15:28 +0000 (10:15 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 30 Sep 2014 18:08:49 +0000 (12:08 -0600)
layers (aka array_size) should be 6 for cube textures so we don't need
to special-case it.  But add an assertion just to be safe.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/llvmpipe/lp_texture.c

index ba0e7f8b5b87c81683081e0e37945d98ff25a2ca..a7d7ad48619656dcfcb5e5186129d6e1921e1667 100644 (file)
@@ -132,12 +132,15 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
       lpr->img_stride[level] = lpr->row_stride[level] * nblocksy;
 
       /* Number of 3D image slices, cube faces or texture array layers */
-      if (lpr->base.target == PIPE_TEXTURE_CUBE)
-         num_slices = 6;
-      else if (lpr->base.target == PIPE_TEXTURE_3D)
+      if (lpr->base.target == PIPE_TEXTURE_CUBE) {
+         assert(layers == 6);
+      }
+
+      if (lpr->base.target == PIPE_TEXTURE_3D)
          num_slices = depth;
       else if (lpr->base.target == PIPE_TEXTURE_1D_ARRAY ||
                lpr->base.target == PIPE_TEXTURE_2D_ARRAY ||
+               lpr->base.target == PIPE_TEXTURE_CUBE ||
                lpr->base.target == PIPE_TEXTURE_CUBE_ARRAY)
          num_slices = layers;
       else