summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-01-02 20:40:24 +0100
committerMarek Olšák <[email protected]>2013-02-26 01:14:05 +0100
commit3857f450a6d88cf4d0c616a4224bbd5b9cc89388 (patch)
treefa78b80e2a08c33f58a21312601503a644024f02 /src/gallium/auxiliary
parent52c44cee1e6596a8ace104361a470edadbd6a591 (diff)
gallium/util: add helper util_max_layer from r600g
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 2ff90c982d8..ba745ebb5fb 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -582,6 +582,22 @@ util_copy_constant_buffer(struct pipe_constant_buffer *dst,
}
}
+static INLINE unsigned
+util_max_layer(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_1D_ARRAY:
+ case PIPE_TEXTURE_2D_ARRAY:
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ return r->array_size - 1;
+ default:
+ return 0;
+ }
+}
#ifdef __cplusplus
}