diff options
author | Marek Olšák <[email protected]> | 2017-12-11 19:27:39 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-12-25 14:23:02 +0100 |
commit | 986e467e4c5c9610a01b0176c02c2310ed019ae8 (patch) | |
tree | c608a5876e4cb8b17319bfba760ebfb7cd622c16 /src/gallium/auxiliary | |
parent | 70b5e85fc3a79214b4f25db0e6d8fcc32d62a2f1 (diff) |
gallium/util: add util_num_layers helper
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_gen_mipmap.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 8 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 824213b4e30..057411fb3fa 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -2077,8 +2077,8 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter, srcbox.height = u_minify(tex->height0, src_level); if (target == PIPE_TEXTURE_3D) { - dstbox.depth = util_max_layer(tex, dst_level) + 1; - srcbox.depth = util_max_layer(tex, src_level) + 1; + dstbox.depth = util_num_layers(tex, dst_level); + srcbox.depth = util_num_layers(tex, src_level); } else { dstbox.z = srcbox.z = first_layer; dstbox.depth = srcbox.depth = last_layer - first_layer + 1; diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index aa8eaebb679..3c55d9f385c 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -113,8 +113,8 @@ util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt, if (pt->target == PIPE_TEXTURE_3D) { /* generate all layers/slices at once */ blit.src.box.z = blit.dst.box.z = 0; - blit.src.box.depth = util_max_layer(pt, blit.src.level)+1; - blit.dst.box.depth = util_max_layer(pt, blit.dst.level)+1; + blit.src.box.depth = util_num_layers(pt, blit.src.level); + blit.dst.box.depth = util_num_layers(pt, blit.dst.level); } else { blit.src.box.z = blit.dst.box.z = first_layer; diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 790352d7800..4ba6ad72b62 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -666,6 +666,12 @@ util_max_layer(const struct pipe_resource *r, unsigned level) } } +static inline unsigned +util_num_layers(const struct pipe_resource *r, unsigned level) +{ + return util_max_layer(r, level) + 1; +} + static inline bool util_texrange_covers_whole_level(const struct pipe_resource *tex, unsigned level, unsigned x, unsigned y, @@ -675,7 +681,7 @@ util_texrange_covers_whole_level(const struct pipe_resource *tex, return x == 0 && y == 0 && z == 0 && width == u_minify(tex->width0, level) && height == u_minify(tex->height0, level) && - depth == util_max_layer(tex, level) + 1; + depth == util_num_layers(tex, level); } #ifdef __cplusplus |