summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/cell/spu
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/cell/spu')
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.c19
-rw-r--r--src/mesa/pipe/cell/spu/spu_main.h4
-rw-r--r--src/mesa/pipe/cell/spu/spu_tri.c46
3 files changed, 39 insertions, 30 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c
index 1d0de7b1f9..880f8de550 100644
--- a/src/mesa/pipe/cell/spu/spu_main.c
+++ b/src/mesa/pipe/cell/spu/spu_main.c
@@ -391,6 +391,17 @@ cmd_state_sampler(const struct pipe_sampler_state *state)
static void
+cmd_state_vertex_info(const struct vertex_info *vinfo)
+{
+ if (Debug)
+ printf("SPU %u: VERTEX_INFO num_attribs=%u\n", spu.init.id,
+ vinfo->num_attribs);
+ memcpy(&spu.vertex_info, vinfo, sizeof(*vinfo));
+}
+
+
+
+static void
cmd_finish(void)
{
if (Debug)
@@ -472,7 +483,6 @@ cmd_batch(uint opcode)
/* Tell PPU we're done copying the buffer to local store */
release_batch_buffer(buf);
-
for (pos = 0; pos < usize; /* no incr */) {
switch (buffer[pos]) {
case CELL_CMD_FRAMEBUFFER:
@@ -509,10 +519,13 @@ cmd_batch(uint opcode)
pos += (1 + sizeof(struct pipe_depth_stencil_alpha_state) / 4);
break;
case CELL_CMD_STATE_SAMPLER:
- cmd_state_sampler((struct pipe_sampler_state *)
- &buffer[pos+1]);
+ cmd_state_sampler((struct pipe_sampler_state *) &buffer[pos+1]);
pos += (1 + sizeof(struct pipe_sampler_state) / 4);
break;
+ case CELL_CMD_STATE_VERTEX_INFO:
+ cmd_state_vertex_info((struct vertex_info *) &buffer[pos+1]);
+ pos += (1 + sizeof(struct vertex_info) / 4);
+ break;
default:
printf("SPU %u: bad opcode: 0x%x\n", spu.init.id, buffer[pos]);
ASSERT(0);
diff --git a/src/mesa/pipe/cell/spu/spu_main.h b/src/mesa/pipe/cell/spu/spu_main.h
index 3ef73c9473..e4359bf60d 100644
--- a/src/mesa/pipe/cell/spu/spu_main.h
+++ b/src/mesa/pipe/cell/spu/spu_main.h
@@ -30,6 +30,7 @@
#include "pipe/cell/common.h"
+#include "pipe/draw/draw_vertex.h"
#include "pipe/p_state.h"
@@ -59,6 +60,9 @@ struct spu_global
struct pipe_depth_stencil_alpha_state depth_stencil;
struct pipe_blend_state blend;
struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];
+
+ struct vertex_info vertex_info;
+
/* XXX more state to come */
} ALIGN16_ATTRIB;
diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/mesa/pipe/cell/spu/spu_tri.c
index 1d73c5171c..3d0d106c10 100644
--- a/src/mesa/pipe/cell/spu/spu_tri.c
+++ b/src/mesa/pipe/cell/spu/spu_tri.c
@@ -42,7 +42,7 @@
* Simplified types taken from other parts of Gallium
*/
struct vertex_header {
- float data[2][4]; /* pos and color */
+ float data[0][4];
};
struct prim_header {
@@ -727,40 +727,32 @@ static void tri_persp_coeff( struct setup_stage *setup,
*/
static void setup_tri_coefficients( struct setup_stage *setup )
{
-#if 0
- const enum interp_mode *interp = setup->softpipe->vertex_info.interp_mode;
- unsigned slot, j;
-
- /* z and w are done by linear interpolation:
- */
- tri_linear_coeff(setup, 0, 2);
- tri_linear_coeff(setup, 0, 3);
+#if 1
+ uint i;
- /* setup interpolation for all the remaining attributes:
- */
- for (slot = 1; slot < setup->quad.nr_attrs; slot++) {
- switch (interp[slot]) {
+ for (i = 0; i < spu.vertex_info.num_attribs; i++) {
+ switch (spu.vertex_info.interp_mode[i]) {
+ case INTERP_NONE:
+ break;
+ case INTERP_POS:
+ tri_linear_coeff(setup, i, 2, 3); /* slot 0, z */
+ /* XXX interp W if PERSPECTIVE... */
+ break;
case INTERP_CONSTANT:
- for (j = 0; j < NUM_CHANNELS; j++)
- const_coeff(setup, slot, j);
- break;
-
+ /* fall-through */
case INTERP_LINEAR:
- for (j = 0; j < NUM_CHANNELS; j++)
- tri_linear_coeff(setup, slot, j);
- break;
-
+ tri_linear_coeff(setup, i, 0, 4); /* slot 1, color */
+ break;
case INTERP_PERSPECTIVE:
- for (j = 0; j < NUM_CHANNELS; j++)
- tri_persp_coeff(setup, slot, j);
- break;
-
+ break;
default:
- /* invalid interp mode */
- assert(0);
+ ASSERT(0);
}
}
#else
+ ASSERT(spu.vertex_info.interp_mode[0] == INTERP_POS);
+ ASSERT(spu.vertex_info.interp_mode[1] == INTERP_LINEAR ||
+ spu.vertex_info.interp_mode[1] == INTERP_CONSTANT);
tri_linear_coeff(setup, 0, 2, 3); /* slot 0, z */
tri_linear_coeff(setup, 1, 0, 4); /* slot 1, color */
#endif