Cell: emit blend state to SPUs
authorBrian <brian.paul@tungstengraphics.com>
Mon, 4 Feb 2008 22:06:10 +0000 (15:06 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 4 Feb 2008 22:06:10 +0000 (15:06 -0700)
src/mesa/pipe/cell/common.h
src/mesa/pipe/cell/ppu/cell_state_emit.c
src/mesa/pipe/cell/spu/spu_main.c
src/mesa/pipe/cell/spu/spu_main.h

index 7e193f31be6cb69b2d184d376e9a97d2679fbac9..d861e82d332a16f5080451e10fe244b41e917b62 100644 (file)
@@ -85,7 +85,8 @@
 #define CELL_CMD_STATE_VERTEX_INFO   14
 #define CELL_CMD_STATE_VIEWPORT      15
 #define CELL_CMD_STATE_VS_ARRAY_INFO 16
-#define CELL_CMD_VS_EXECUTE          17
+#define CELL_CMD_STATE_BLEND         17
+#define CELL_CMD_VS_EXECUTE          18
 
 
 #define CELL_NUM_BUFFERS 4
index 702184416bfe5e7d7d1eccad6a7fa2b3ea533f06..3b2670f786b50676711bcc329d3e2a05c43dfc55 100644 (file)
@@ -61,6 +61,12 @@ cell_emit_state(struct cell_context *cell)
       fb->height = cell->framebuffer.cbufs[0]->height;
    }
 
+   if (cell->dirty & CELL_NEW_BLEND) {
+      emit_state_cmd(cell, CELL_CMD_STATE_BLEND,
+                     cell->blend,
+                     sizeof(struct pipe_blend_state));
+   }
+
    if (cell->dirty & CELL_NEW_DEPTH_STENCIL) {
       emit_state_cmd(cell, CELL_CMD_STATE_DEPTH_STENCIL,
                      cell->depth_stencil,
index 48e016fc8b4184a8e653a6cbd32622646232b6a1..9d8e6df0e308400c2f1269cfa834022aaa28fe73 100644 (file)
@@ -232,6 +232,18 @@ cmd_state_framebuffer(const struct cell_command_framebuffer *cmd)
 }
 
 
+static void
+cmd_state_blend(const struct pipe_blend_state *state)
+{
+   if (Debug)
+      printf("SPU %u: BLEND: ztest %d\n",
+             spu.init.id,
+             state->blend_enable);
+
+   memcpy(&spu.blend, state, sizeof(*state));
+}
+
+
 static void
 cmd_state_depth_stencil(const struct pipe_depth_stencil_alpha_state *state)
 {
@@ -398,6 +410,11 @@ cmd_batch(uint opcode)
          cmd_finish();
          pos += 1;
          break;
+      case CELL_CMD_STATE_BLEND:
+         cmd_state_blend((struct pipe_blend_state *)
+                                 &buffer[pos+1]);
+         pos += (1 + sizeof(struct pipe_blend_state) / 4);
+         break;
       case CELL_CMD_STATE_DEPTH_STENCIL:
          cmd_state_depth_stencil((struct pipe_depth_stencil_alpha_state *)
                                  &buffer[pos+1]);
index fb98b0d88978c1a51e8c6d6d7fc2dd7e4e79baed..b22d56355186365a5bcfb90f271eb4cef01cbdbd 100644 (file)
@@ -86,6 +86,7 @@ struct spu_global
    struct cell_init_info init;
 
    struct spu_framebuffer fb;
+   struct pipe_blend_state blend_stencil;
    struct pipe_depth_stencil_alpha_state depth_stencil;
    struct pipe_blend_state blend;
    struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];