Merge branch '7.8'
[mesa.git] / src / gallium / drivers / cell / ppu / cell_vertex_shader.c
index 6a1d3bc20a16a6301d28da836b11dc32de814783..3d389d6ea36c930440c5b6b923fc2e7f534fa872 100644 (file)
 
 #include "pipe/p_defines.h"
 #include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "util/u_math.h"
 
 #include "cell_context.h"
 #include "cell_draw_arrays.h"
+#include "cell_flush.h"
 #include "cell_spu.h"
 #include "cell_batch.h"
 
@@ -49,6 +50,7 @@
 void
 cell_vertex_shader_queue_flush(struct draw_context *draw)
 {
+#if 0
    struct cell_context *const cell =
        (struct cell_context *) draw->driver_private;
    struct cell_command_vs *const vs = &cell_global.command[0].vs;
@@ -68,7 +70,7 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
    batch = cell_batch_alloc(cell, sizeof(batch[0]) + sizeof(*cf));
    batch[0] = CELL_CMD_STATE_ATTRIB_FETCH;
    cf = (struct cell_attribute_fetch_code *) (&batch[1]);
-   cf->base = cell->attrib_fetch.store;
+   cf->base = (uint64_t) cell->attrib_fetch.store;
    cf->size = ROUNDUP16((unsigned)((void *) cell->attrib_fetch.csr 
                                   - (void *) cell->attrib_fetch.store));
 
@@ -100,17 +102,17 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
    (void) memcpy(&batch[1], &draw->viewport,
                  sizeof(struct pipe_viewport_state));
 
+   {
+      uint64_t uniforms = (uintptr_t) draw->user.constants;
+
+      batch = cell_batch_alloc(cell, 2 *sizeof(batch[0]));
+      batch[0] = CELL_CMD_STATE_UNIFORMS;
+      batch[1] = uniforms;
+   }
+
    cell_batch_flush(cell);
 
    vs->opcode = CELL_CMD_VS_EXECUTE;
-   vs->shader.num_outputs = draw->num_vs_outputs;
-   vs->shader.declarations = (uintptr_t) draw->machine.Declarations;
-   vs->shader.num_declarations = draw->machine.NumDeclarations;
-   vs->shader.instructions = (uintptr_t) draw->machine.Instructions;
-   vs->shader.num_instructions = draw->machine.NumInstructions;
-   vs->shader.uniforms = (uintptr_t) draw->user.constants;
-   vs->shader.immediates = (uintptr_t) draw->machine.Imms;
-   vs->shader.num_immediates = draw->machine.ImmLimit / 4;
    vs->nr_attrs = draw->vertex_fetch.nr_attrs;
 
    (void) memcpy(vs->plane, draw->plane, sizeof(draw->plane));
@@ -121,19 +123,23 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
 
       for (j = 0; j < n; j++) {
          vs->elts[j] = draw->vs.queue[i + j].elt;
-         vs->vOut[j] = (uintptr_t) draw->vs.queue[i + j].dest;
+         vs->vOut[j] = (uintptr_t) draw->vs.queue[i + j].vertex;
       }
 
       for (/* empty */; j < SPU_VERTS_PER_BATCH; j++) {
          vs->elts[j] = vs->elts[0];
-         vs->vOut[j] = vs->vOut[0];
+         vs->vOut[j] = (uintptr_t) draw->vs.queue[i + j].vertex;
       }
 
       vs->num_elts = n;
       send_mbox_message(cell_global.spe_contexts[0], CELL_CMD_VS_EXECUTE);
 
-      cell_flush_int(& cell->pipe, PIPE_FLUSH_WAIT);
+      cell_flush_int(cell, CELL_FLUSH_WAIT);
    }
 
+   draw->vs.post_nr = draw->vs.queue_nr;
    draw->vs.queue_nr = 0;
+#else
+   assert(0);
+#endif
 }