summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/cell/spu/spu_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/cell/spu/spu_main.c')
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c
index 80fa5f7859..7f0473d198 100644
--- a/src/gallium/drivers/cell/spu/spu_main.c
+++ b/src/gallium/drivers/cell/spu/spu_main.c
@@ -312,13 +312,13 @@ cmd_state_depth_stencil(const struct cell_command_depth_stencil_alpha_test *stat
static void
-cmd_state_sampler(const struct pipe_sampler_state *state)
+cmd_state_sampler(const struct cell_command_sampler *sampler)
{
if (Debug)
- printf("SPU %u: SAMPLER\n",
- spu.init.id);
+ printf("SPU %u: SAMPLER [%u]\n",
+ spu.init.id, sampler->unit);
- memcpy(&spu.sampler[0], state, sizeof(*state));
+ spu.sampler[sampler->unit] = sampler->state;
if (spu.sampler[0].min_img_filter == PIPE_TEX_FILTER_LINEAR)
spu.sample_texture = sample_texture_bilinear;
else
@@ -329,26 +329,25 @@ cmd_state_sampler(const struct pipe_sampler_state *state)
static void
cmd_state_texture(const struct cell_command_texture *texture)
{
- uint i;
+ const uint unit = texture->unit;
+ const uint width = texture->width;
+ const uint height = texture->height;
- if (1||Debug) {
- printf("SPU %u: TEXTURE\n", spu.init.id);
- for (i = 0; i < CELL_MAX_SAMPLERS; i++) {
- printf(" %d: at %p size %u x %u\n", i, texture->texture[i].start,
- texture->texture[i].width, texture->texture[i].height);
- }
+ if (Debug) {
+ printf("SPU %u: TEXTURE [%u] at %p size %u x %u\n", spu.init.id,
+ texture->unit, texture->start,
+ texture->width, texture->height);
}
- memcpy(&spu.texture, texture, sizeof(*texture));
- for (i = 0; i < CELL_MAX_SAMPLERS; i++) {
- const uint width = texture->texture[i].width;
- const uint height = texture->texture[i].height;
- spu.tex_size[i] = (vector float) { width, height, 0.0, 0.0};
- spu.tex_size_mask[i] = (vector unsigned int)
+ spu.texture[unit].start = texture->start;
+ spu.texture[unit].width = width;
+ spu.texture[unit].height = height;
+
+ spu.texture[unit].tex_size = (vector float) { width, height, 0.0, 0.0};
+ spu.texture[unit].tex_size_mask = (vector unsigned int)
{ width - 1, height - 1, 0, 0 };
- spu.tex_size_x_mask[i] = spu_splats(width - 1);
- spu.tex_size_y_mask[i] = spu_splats(height - 1);
- }
+ spu.texture[unit].tex_size_x_mask = spu_splats(width - 1);
+ spu.texture[unit].tex_size_y_mask = spu_splats(height - 1);
}
@@ -480,12 +479,20 @@ cmd_batch(uint opcode)
pos += (1 + ROUNDUP8(sizeof(struct cell_command_depth_stencil_alpha_test)) / 8);
break;
case CELL_CMD_STATE_SAMPLER:
- cmd_state_sampler((struct pipe_sampler_state *) &buffer[pos+1]);
- pos += (1 + ROUNDUP8(sizeof(struct pipe_sampler_state)) / 8);
+ {
+ struct cell_command_sampler *sampler
+ = (struct cell_command_sampler *) &buffer[pos];
+ cmd_state_sampler(sampler);
+ pos += sizeof(*sampler) / 8;
+ }
break;
case CELL_CMD_STATE_TEXTURE:
- cmd_state_texture((struct cell_command_texture *) &buffer[pos+1]);
- pos += (1 + ROUNDUP8(sizeof(struct cell_command_texture)) / 8);
+ {
+ struct cell_command_texture *texture
+ = (struct cell_command_texture *) &buffer[pos];
+ cmd_state_texture(texture);
+ pos += sizeof(*texture) / 8;
+ }
break;
case CELL_CMD_STATE_VERTEX_INFO:
cmd_state_vertex_info((struct vertex_info *) &buffer[pos+1]);