summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/cell/spu
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-14 17:22:40 -0600
committerBrian Paul <[email protected]>2008-10-14 17:22:40 -0600
commit41ccdde767e7aba6e8e6a9a035eacd6338c03a95 (patch)
treef8d4b707305c8c7953a042b99cee975e1df4dfe9 /src/gallium/drivers/cell/spu
parent6c017c2c3c3649650cd0dc89a3b4946eab0e5a8c (diff)
cell: initial bits for 3D texture support
Diffstat (limited to 'src/gallium/drivers/cell/spu')
-rw-r--r--src/gallium/drivers/cell/spu/spu_command.c13
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.h8
-rw-r--r--src/gallium/drivers/cell/spu/spu_texture.c2
3 files changed, 17 insertions, 6 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_command.c b/src/gallium/drivers/cell/spu/spu_command.c
index c951fa6f317..c28677ebf87 100644
--- a/src/gallium/drivers/cell/spu/spu_command.c
+++ b/src/gallium/drivers/cell/spu/spu_command.c
@@ -59,6 +59,14 @@ static unsigned char attribute_fetch_code_buffer[136 * PIPE_MAX_ATTRIBS]
+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.
@@ -404,6 +412,7 @@ cmd_state_texture(const struct cell_command_texture *texture)
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]);
@@ -411,13 +420,13 @@ cmd_state_texture(const struct cell_command_texture *texture)
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);
diff --git a/src/gallium/drivers/cell/spu/spu_main.h b/src/gallium/drivers/cell/spu/spu_main.h
index 8781041bff8..eff43b870ca 100644
--- a/src/gallium/drivers/cell/spu/spu_main.h
+++ b/src/gallium/drivers/cell/spu/spu_main.h
@@ -111,15 +111,15 @@ struct spu_framebuffer
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;
diff --git a/src/gallium/drivers/cell/spu/spu_texture.c b/src/gallium/drivers/cell/spu/spu_texture.c
index 9e25094d13c..42eb06a3625 100644
--- a/src/gallium/drivers/cell/spu/spu_texture.c
+++ b/src/gallium/drivers/cell/spu/spu_texture.c
@@ -50,6 +50,8 @@ invalidate_tex_cache(void)
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);
}