summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2013-06-07 14:52:48 +0800
committerChia-I Wu <olvaffe@gmail.com>2013-06-08 01:37:40 +0800
commitd6c2708e1eb319e577f61ea137471a1966d231ab (patch)
tree84f96eb572e7fa95df8428c3d8aa0e131a2ade11 /src/gallium
parent90fa71b277e9d4be71a1edf5bc2f2caf7eed0b23 (diff)
downloadexternal_mesa3d-d6c2708e1eb319e577f61ea137471a1966d231ab.zip
external_mesa3d-d6c2708e1eb319e577f61ea137471a1966d231ab.tar.gz
external_mesa3d-d6c2708e1eb319e577f61ea137471a1966d231ab.tar.bz2
util: add util_resource_is_array_texture()
Checking if array_size is greater than 1 is not enough for single-layered array textures. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_resource.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_resource.h b/src/gallium/auxiliary/util/u_resource.h
index 977e013..a5e091f 100644
--- a/src/gallium/auxiliary/util/u_resource.h
+++ b/src/gallium/auxiliary/util/u_resource.h
@@ -26,9 +26,27 @@
#ifndef U_RESOURCE_H
#define U_RESOURCE_H
-struct pipe_resource;
+#include "pipe/p_state.h"
unsigned
util_resource_size(const struct pipe_resource *res);
+/**
+ * Return true if the resource is an array texture.
+ *
+ * Note that this function returns true for single-layered array textures.
+ */
+static INLINE boolean
+util_resource_is_array_texture(const struct pipe_resource *res)
+{
+ switch (res->target) {
+ case PIPE_TEXTURE_1D_ARRAY:
+ case PIPE_TEXTURE_2D_ARRAY:
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
#endif