st/mesa: fix incorrect RowStride computation
[mesa.git] / src / gallium / auxiliary / draw / draw_vs_llvm.c
index 171da51dd5646558af02516c19dcddf1ec3bc01e..5f7a645f5d8496a8cc99868b64fdde4e93429560 100644 (file)
   *   Brian Paul
   */
 
-#include "pipe/p_util.h"
+#include "util/u_memory.h"
 #include "pipe/p_shader_tokens.h"
 #include "draw_private.h"
 #include "draw_context.h"
 #include "draw_vs.h"
 
-#include "tgsi/util/tgsi_parse.h"
+#include "tgsi/tgsi_parse.h"
 
 #ifdef MESA_LLVM
 
-#include "gallivm/gallivm.h"
-
 struct draw_llvm_vertex_shader {
    struct draw_vertex_shader base;
-   struct gallivm_prog *llvm_prog;
    struct tgsi_exec_machine *machine;
 };
 
@@ -58,23 +55,17 @@ vs_llvm_prepare( struct draw_vertex_shader *base,
 }
 
 
-
-
 static void
 vs_llvm_run_linear( struct draw_vertex_shader *base,
                   const float (*input)[4],
                   float (*output)[4],
-                  const float (*constants)[4],
+                   const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
                   unsigned count,
                   unsigned input_stride,
                   unsigned output_stride )
 {
    struct draw_llvm_vertex_shader *shader =
       (struct draw_llvm_vertex_shader *)base;
-
-   gallivm_cpu_vs_exec(shader->llvm_prog, shader->machine,
-                       input, base->info.num_inputs, output, base->info.num_outputs,
-                       constants, count, input_stride, output_stride);
 }
 
 
@@ -114,31 +105,12 @@ draw_create_vs_llvm(struct draw_context *draw,
 
    tgsi_scan_shader(vs->base.state.tokens, &vs->base.info);
 
+   vs->base.draw = draw;
    vs->base.prepare = vs_llvm_prepare;
+   vs->base.create_varient = draw_vs_varient_generic;
    vs->base.run_linear = vs_llvm_run_linear;
    vs->base.delete = vs_llvm_delete;
-   vs->machine = &draw->machine;
-
-   {
-      struct gallivm_ir *ir = gallivm_ir_new(GALLIVM_VS);
-      gallivm_ir_set_layout(ir, GALLIVM_SOA);
-      gallivm_ir_set_components(ir, 4);
-      gallivm_ir_fill_from_tgsi(ir, vs->base.state.tokens);
-      vs->llvm_prog = gallivm_ir_compile(ir);
-      gallivm_ir_delete(ir);
-   }
-
-   draw->engine = gallivm_global_cpu_engine();
-
-   /* XXX: Why are there two versions of this?  Shouldn't creating the
-    *      engine be a separate operation to compiling a shader?
-    */
-   if (!draw->engine) {
-      draw->engine = gallivm_cpu_engine_create(vs->llvm_prog);
-   }
-   else {
-      gallivm_cpu_jit_compile(draw->engine, vs->llvm_prog);
-   }
+   vs->machine = draw->vs.machine;
 
    return &vs->base;
 }