diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 16 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 16 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 6 | ||||
-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 |
7 files changed, 31 insertions, 47 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 2ff90c982d8..ba745ebb5fb 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/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 } diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 046eab54c42..3e0d89c06f0 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -150,7 +150,7 @@ void r600_blit_decompress_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++) { @@ -222,7 +222,7 @@ static void r600_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++) { @@ -273,11 +273,11 @@ void r600_decompress_depth_textures(struct r600_context *rctx, r600_can_read_depth(tex)) { r600_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)); } else { r600_blit_decompress_depth(&rctx->context, tex, NULL, 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), 0, u_max_sample(&tex->resource.b.b)); } } @@ -319,7 +319,7 @@ static void r600_blit_decompress_color(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(&rtex->resource.b.b, level); + max_layer = util_max_layer(&rtex->resource.b.b, level); checked_last_layer = last_layer < max_layer ? last_layer : max_layer; for (layer = first_layer; layer <= checked_last_layer; layer++) { @@ -366,7 +366,7 @@ void r600_decompress_color_textures(struct r600_context *rctx, r600_blit_decompress_color(&rctx->context, 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/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index de9c205cf7b..88b587e50a7 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -988,22 +988,6 @@ 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; - } -} - static INLINE void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r) { struct r600_context *rctx = (struct r600_context *)ctx; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 7f5752d81e6..acea19d7744 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -609,8 +609,8 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe, { struct r600_surface *surface = CALLOC_STRUCT(r600_surface); - assert(templ->u.tex.first_layer <= u_max_layer(texture, templ->u.tex.level)); - assert(templ->u.tex.last_layer <= u_max_layer(texture, templ->u.tex.level)); + assert(templ->u.tex.first_layer <= util_max_layer(texture, templ->u.tex.level)); + assert(templ->u.tex.last_layer <= util_max_layer(texture, templ->u.tex.level)); assert(templ->u.tex.first_layer == templ->u.tex.last_layer); if (surface == NULL) return NULL; @@ -821,7 +821,7 @@ static void *r600_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; 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 |