summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/cell
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-14 14:02:07 -0600
committerBrian Paul <[email protected]>2008-10-14 14:02:07 -0600
commit38d396e15aceaca299c5de571c4dd5b3d9b27242 (patch)
tree8404a8bb44dec5959b23e221fe5db4478978e789 /src/gallium/drivers/cell
parent4f56d5bbf2e52c815c820138eaad6c0fb93d47ba (diff)
cell: fix npot texture tiling bugs
Diffstat (limited to 'src/gallium/drivers/cell')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index 87f1598dae6..4fd66bdea08 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -172,9 +172,17 @@ twiddle_image_uint(uint w, uint h, uint tile_size, uint *dst,
for (jt = 0; jt < w_t; jt++) {
/* start of dest tile: */
uint *tdst = dst + (it * w_t + jt) * tile_size2;
+
+ /* compute size of this tile (may be smaller than tile_size) */
+ /* XXX note: a compiler bug was found here. That's why the code
+ * looks as it does.
+ */
+ uint tile_width = w - jt * tile_size;
+ tile_width = MIN2(tile_width, tile_size);
+ uint tile_height = h - it * tile_size;
+ tile_height = MIN2(tile_height, tile_size);
+
/* loop over texels in the tile */
- uint tile_width = MIN2(tile_size, w);
- uint tile_height = MIN2(tile_size, h);
for (i = 0; i < tile_height; i++) {
for (j = 0; j < tile_width; j++) {
const uint srci = it * tile_size + i;
@@ -200,8 +208,8 @@ cell_twiddle_texture(struct pipe_screen *screen,
const uint level = surface->level;
const uint texWidth = texture->base.width[level];
const uint texHeight = texture->base.height[level];
- const uint bufWidth = MAX2(texWidth, TILE_SIZE);
- const uint bufHeight = MAX2(texHeight, TILE_SIZE);
+ const uint bufWidth = align(texWidth, TILE_SIZE);
+ const uint bufHeight = align(texHeight, TILE_SIZE);
const void *map = pipe_buffer_map(screen, surface->buffer,
PIPE_BUFFER_USAGE_CPU_READ);
const uint *src = (const uint *) ((const ubyte *) map + surface->offset);