diff options
author | Dave Airlie <[email protected]> | 2010-10-21 13:20:14 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-10-21 13:20:14 +1000 |
commit | 206fbd9640f076ada23368edf158b6d40f673ba7 (patch) | |
tree | 6fb0db628ee17850ba13211bb0a1afa3cd1b10e3 | |
parent | 2e5764ccf440e59fc6f8441e329c0747ef4ed57b (diff) |
r600g: all non-0 mipmap levels need to be w/h aligned to POT.
this adds a new minify function to the driver to ensure this.
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 95906a74eb3..b9348baf0db 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -92,6 +92,15 @@ static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex, } } +static unsigned mip_minify(unsigned size, unsigned level) +{ + unsigned val; + val = u_minify(size, level); + if (level > 0) + val = util_next_power_of_two(val); + return val; +} + static unsigned r600_texture_get_stride(struct pipe_screen *screen, struct r600_resource_texture *rtex, unsigned level) @@ -104,7 +113,7 @@ static unsigned r600_texture_get_stride(struct pipe_screen *screen, if (rtex->pitch_override) return rtex->pitch_override; - width = u_minify(ptex->width0, level); + width = mip_minify(ptex->width0, level); stride = util_format_get_stride(ptex->format, align(width, 64)); if (chipc == EVERGREEN) @@ -121,8 +130,7 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen, struct pipe_resource *ptex = &rtex->resource.base.b; unsigned height; - height = u_minify(ptex->height0, level); - height = util_next_power_of_two(height); + height = mip_minify(ptex->height0, level); return util_format_get_nblocksy(ptex->format, height); } @@ -249,8 +257,8 @@ static struct pipe_surface *r600_get_tex_surface(struct pipe_screen *screen, pipe_reference_init(&surface->reference, 1); pipe_resource_reference(&surface->texture, texture); surface->format = texture->format; - surface->width = u_minify(texture->width0, level); - surface->height = u_minify(texture->height0, level); + surface->width = mip_minify(texture->width0, level); + surface->height = mip_minify(texture->height0, level); surface->offset = offset; surface->usage = flags; surface->zslice = zslice; |