void *start[CELL_MAX_TEXTURE_LEVELS]; /**< Address in main memory */
ushort width[CELL_MAX_TEXTURE_LEVELS];
ushort height[CELL_MAX_TEXTURE_LEVELS];
+ ushort depth[CELL_MAX_TEXTURE_LEVELS];
};
texture->start[level] = cell->texture[i]->tiled_data[level];
texture->width[level] = cell->texture[i]->base.width[level];
texture->height[level] = cell->texture[i]->base.height[level];
+ texture->depth[level] = cell->texture[i]->base.depth[level];
}
texture->target = cell->texture[i]->base.target;
}
texture->start[level] = NULL;
texture->width[level] = 0;
texture->height[level] = 0;
+ texture->depth[level] = 0;
}
texture->target = 0;
}
+static INLINE int
+align(int value, int alignment)
+{
+ return (value + alignment - 1) & ~(alignment - 1);
+}
+
+
+
/**
* Tell the PPU that this SPU has finished copying a buffer to
* local store and that it may be reused by the PPU.
for (i = 0; i < CELL_MAX_TEXTURE_LEVELS; i++) {
uint width = texture->width[i];
uint height = texture->height[i];
+ uint depth = texture->depth[i];
DEBUG_PRINTF(" LEVEL %u: at %p size[0] %u x %u\n", i,
texture->start[i], texture->width[i], texture->height[i]);
spu.texture[unit].level[i].start = texture->start[i];
spu.texture[unit].level[i].width = width;
spu.texture[unit].level[i].height = height;
+ spu.texture[unit].level[i].depth = depth;
spu.texture[unit].level[i].tiles_per_row =
(width + TILE_SIZE - 1) / TILE_SIZE;
spu.texture[unit].level[i].bytes_per_image =
- 4 * ((width + TILE_SIZE - 1) & ~(TILE_SIZE-1))
- * ((height + TILE_SIZE - 1) & ~(TILE_SIZE-1));
+ 4 * align(width, TILE_SIZE) * align(height, TILE_SIZE) * depth;
spu.texture[unit].level[i].max_s = spu_splats((int) width - 1);
spu.texture[unit].level[i].max_t = spu_splats((int) height - 1);
struct spu_texture_level
{
void *start;
- ushort width, height;
+ ushort width, height, depth;
ushort tiles_per_row;
uint bytes_per_image;
/** texcoord scale factors */
- vector float scale_s, scale_t;
+ vector float scale_s, scale_t, scale_r;
/** texcoord masks (if REPEAT then size-1, else ~0) */
- vector signed int mask_s, mask_t;
+ vector signed int mask_s, mask_t, mask_r;
/** texcoord clamp limits */
- vector signed int max_s, max_t;
+ vector signed int max_s, max_t, max_r;
} ALIGN16_ATTRIB;
if (spu.texture[unit].target == PIPE_TEXTURE_CUBE)
bytes *= 6;
+ else if (spu.texture[unit].target == PIPE_TEXTURE_3D)
+ bytes *= spu.texture[unit].level[lvl].depth;
spu_dcache_mark_dirty((unsigned) spu.texture[unit].level[lvl].start, bytes);
}