Elts are always ints, pass vOut pointers in-line in command
authorIan Romanick <idr@us.ibm.com>
Thu, 31 Jan 2008 03:24:40 +0000 (19:24 -0800)
committerBen Skeggs <skeggsb@gmail.com>
Fri, 15 Feb 2008 02:50:26 +0000 (13:50 +1100)
src/mesa/pipe/cell/common.h
src/mesa/pipe/cell/spu/spu_vertex_shader.c

index 80a1425ec7e4f2104e5eef802349465cbbe779cf..fbbdf728a12851b153948662c293d1c5d4407993 100644 (file)
@@ -144,13 +144,13 @@ struct cell_shader_info
 } ALIGN16_ATTRIB;
 
 
+#define SPU_VERTS_PER_BATCH 64
 struct cell_command_vs
 {
    struct cell_shader_info   shader;
-   void *elts;
    unsigned num_elts;
-   unsigned bytes_per_elt;
-   void *vOut;
+   unsigned elts[SPU_VERTS_PER_BATCH];
+   uint64_t vOut[SPU_VERTS_PER_BATCH];
 } ALIGN16_ATTRIB;
 
 
index 595f54b0ebd465a0e5e8731589881e1b8626f4b5..82165501c5cdf83ce2313f59babd2c747a3436c4 100644 (file)
@@ -81,7 +81,7 @@ compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr)
 static void
 run_vertex_program(struct spu_vs_context *draw,
                    unsigned elts[4], unsigned count,
-                   struct vertex_header *vOut[])
+                   const uint64_t *vOut)
 {
    struct spu_exec_machine *machine = &draw->machine;
    unsigned int j;
@@ -206,17 +206,7 @@ spu_execute_vertex_shader(struct spu_vs_context *draw,
    
    for (i = 0; i < vs->num_elts; i += 4) {
       const unsigned batch_size = MIN2(vs->num_elts - i, 4);
-      unsigned elts[4];
-
-      for (j = 0; j < batch_size; j++) {
-        switch (vs->bytes_per_elt) {
-        case 1: elts[j] = ((unsigned char *) vs->elts)[i + j]; break;
-        case 2: elts[j] = ((unsigned short *)vs->elts)[i + j]; break;
-        case 4: elts[j] = ((unsigned int *)  vs->elts)[i + j]; break;
-        }
-      }
 
-      run_vertex_program(draw, elts, batch_size,
-                        (struct vertex_header (*)[]) vs->vOut);
+      run_vertex_program(draw, & vs->elts[i], batch_size, &vs->vOut[i]);
    }
 }