aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_pipe.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-12-20 00:28:24 +0100
committerMarek Olšák <[email protected]>2012-12-20 17:13:18 +0100
commitef11ed61a0414d0405c3faf7f48fa3f1d083f82e (patch)
tree787d25d8b7c0b7d6898ed0b528d9c759b2e87900 /src/gallium/drivers/r600/r600_pipe.h
parentfefa2112bf02db6908fd3f2603f11d1a2bc10688 (diff)
r600g: add assertions to prevent creation of invalid surfaces
Diffstat (limited to 'src/gallium/drivers/r600/r600_pipe.h')
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index c348c76975b..8df50e9bc83 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -920,4 +920,20 @@ static INLINE uint64_t r600_resource_va(struct pipe_screen *screen, struct pipe_
return rscreen->ws->buffer_get_virtual_address(rresource->cs_buf);
}
+static INLINE unsigned u_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;
+ }
+}
+
#endif