aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_inlines.h
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_inlines.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index 2ff90c982..ba745ebb5 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/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
}