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>
This commit is contained in:
Chia-I Wu 2013-06-07 14:52:48 +08:00
parent 90fa71b277
commit d6c2708e1e
1 changed files with 19 additions and 1 deletions

View File

@ -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