Mesa (master): r300g: fix blitting NPOT compressed textures
Marek Olšák
mareko at kemper.freedesktop.org
Wed Feb 16 20:55:18 UTC 2011
Module: Mesa
Branch: master
Commit: 2d1cc27729bd1808a39b226ae3eda5663328ba74
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d1cc27729bd1808a39b226ae3eda5663328ba74
Author: Marek Olšák <maraeo at gmail.com>
Date: Wed Feb 16 20:09:06 2011 +0100
r300g: fix blitting NPOT compressed textures
---
src/gallium/drivers/r300/r300_blit.c | 6 +++---
src/gallium/drivers/r300/r300_texture_desc.c | 16 ++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 14c9794..4f86db3 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -480,12 +480,12 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
/* Since the pixels are 4 times larger, we must decrease
* the image size and the coordinates 4 times. */
new_src.format = new_dst.format;
- new_dst.height0 /= 4;
- new_src.height0 /= 4;
+ new_dst.height0 = (new_dst.height0 + 3) / 4;
+ new_src.height0 = (new_src.height0 + 3) / 4;
dsty /= 4;
box = *src_box;
box.y /= 4;
- box.height /= 4;
+ box.height = (box.height + 3) / 4;
src_box = &box;
}
diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index 221e5a3..2cfeec7 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -162,6 +162,14 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex,
height = u_minify(tex->tex.height0, level);
+ /* Mipmapped and 3D textures must have their height aligned to POT. */
+ if ((tex->b.b.b.target != PIPE_TEXTURE_1D &&
+ tex->b.b.b.target != PIPE_TEXTURE_2D &&
+ tex->b.b.b.target != PIPE_TEXTURE_RECT) ||
+ tex->b.b.b.last_level != 0) {
+ height = util_next_power_of_two(height);
+ }
+
if (util_format_is_plain(tex->b.b.b.format)) {
tile_height = r300_get_pixel_alignment(tex->b.b.b.format,
tex->b.b.b.nr_samples,
@@ -170,14 +178,6 @@ static unsigned r300_texture_get_nblocksy(struct r300_resource *tex,
DIM_HEIGHT, 0);
height = align(height, tile_height);
- /* This is needed for the kernel checker, unfortunately. */
- if ((tex->b.b.b.target != PIPE_TEXTURE_1D &&
- tex->b.b.b.target != PIPE_TEXTURE_2D &&
- tex->b.b.b.target != PIPE_TEXTURE_RECT) ||
- tex->b.b.b.last_level != 0) {
- height = util_next_power_of_two(height);
- }
-
/* See if the CBZB clear can be used on the buffer,
* taking the texture size into account. */
if (out_aligned_for_cbzb) {
More information about the mesa-commit
mailing list