diff options
author | Marek Olšák <[email protected]> | 2013-01-02 20:40:24 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-02-26 01:14:05 +0100 |
commit | 3857f450a6d88cf4d0c616a4224bbd5b9cc89388 (patch) | |
tree | fa78b80e2a08c33f58a21312601503a644024f02 /src/gallium/drivers/radeonsi | |
parent | 52c44cee1e6596a8ace104361a470edadbd6a591 (diff) |
gallium/util: add helper util_max_layer from r600g
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_blit.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_texture.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_pipe.h | 16 |
3 files changed, 6 insertions, 22 deletions
diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c index 0b0eba3c794..eb69cd54ee0 100644 --- a/src/gallium/drivers/radeonsi/r600_blit.c +++ b/src/gallium/drivers/radeonsi/r600_blit.c @@ -136,7 +136,7 @@ void si_blit_uncompress_depth(struct pipe_context *ctx, /* The smaller the mipmap level, the less layers there are * as far as 3D textures are concerned. */ - max_layer = u_max_layer(&texture->resource.b.b, level); + max_layer = util_max_layer(&texture->resource.b.b, level); checked_last_layer = last_layer < max_layer ? last_layer : max_layer; for (layer = first_layer; layer <= checked_last_layer; layer++) { @@ -187,7 +187,7 @@ static void si_blit_decompress_depth_in_place(struct r600_context *rctx, /* The smaller the mipmap level, the less layers there are * as far as 3D textures are concerned. */ - max_layer = u_max_layer(&texture->resource.b.b, level); + max_layer = util_max_layer(&texture->resource.b.b, level); checked_last_layer = last_layer < max_layer ? last_layer : max_layer; for (layer = first_layer; layer <= checked_last_layer; layer++) { @@ -231,7 +231,7 @@ void si_flush_depth_textures(struct r600_context *rctx, si_blit_decompress_depth_in_place(rctx, tex, view->u.tex.first_level, view->u.tex.last_level, - 0, u_max_layer(&tex->resource.b.b, view->u.tex.first_level)); + 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level)); } } diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index 153df00639f..1b8382fd308 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -312,7 +312,7 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, resource.flags = R600_RESOURCE_FLAG_TRANSFER; /* We must set the correct texture target and dimensions if needed for a 3D transfer. */ - if (box->depth > 1 && u_max_layer(texture, level) > 0) + if (box->depth > 1 && util_max_layer(texture, level) > 0) resource.target = texture->target; else resource.target = PIPE_TEXTURE_2D; @@ -554,8 +554,8 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, struct r600_surface *surface = CALLOC_STRUCT(r600_surface); unsigned level = surf_tmpl->u.tex.level; - assert(surf_tmpl->u.tex.first_layer <= u_max_layer(texture, surf_tmpl->u.tex.level)); - assert(surf_tmpl->u.tex.last_layer <= u_max_layer(texture, surf_tmpl->u.tex.level)); + assert(surf_tmpl->u.tex.first_layer <= util_max_layer(texture, surf_tmpl->u.tex.level)); + assert(surf_tmpl->u.tex.last_layer <= util_max_layer(texture, surf_tmpl->u.tex.level)); assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer); if (surface == NULL) return NULL; diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h index 8c6d9081266..d0f04f40562 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h @@ -277,20 +277,4 @@ 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 |