util: simplify PIPE_TEXTURE_CUBE case in util_max_layer()
authorBrian Paul <brianp@vmware.com>
Mon, 29 Sep 2014 22:10:18 +0000 (16:10 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 30 Sep 2014 18:08:49 +0000 (12:08 -0600)
For cube resources, the array_size value should be 6.  So handle
that case as we do for array texture resources.  But assert that
array_size==6 just to be safe.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/util/u_inlines.h

index c80ec487ecef77b2a04acd699d022177f8a4682e..95401621ec36e19ec598e0d541b12975e1863e8e 100644 (file)
@@ -627,10 +627,11 @@ static INLINE unsigned
 util_max_layer(const struct pipe_resource *r, unsigned level)
 {
    switch (r->target) {
-   case PIPE_TEXTURE_CUBE:
-      return 6 - 1;
    case PIPE_TEXTURE_3D:
       return u_minify(r->depth0, level) - 1;
+   case PIPE_TEXTURE_CUBE:
+      assert(r->array_size == 6);
+      /* fall-through */
    case PIPE_TEXTURE_1D_ARRAY:
    case PIPE_TEXTURE_2D_ARRAY:
    case PIPE_TEXTURE_CUBE_ARRAY: