draw llvm: fix some silly mistakes
authorZack Rusin <zackr@vmware.com>
Tue, 30 Mar 2010 20:16:36 +0000 (16:16 -0400)
committerZack Rusin <zackr@vmware.com>
Tue, 30 Mar 2010 20:16:36 +0000 (16:16 -0400)
the vs_type selection isn't ideal, but for now both llvmpipe's fs and vs
do the same thing which is operate on 4xfloat vector as the base type

src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm_translate.c

index aa4a310a07d85c45a11359e610d049b2d53a47b7..cd183d5087c25baa11935a703a37ec60bfe85c3b 100644 (file)
@@ -205,14 +205,24 @@ generate_vs(struct draw_llvm *llvm,
             LLVMValueRef io)
 {
    const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens;
-   struct lp_type vs_type = lp_type_float(32);
-   LLVMValueRef vs_consts;
+   struct lp_type vs_type;
+   LLVMValueRef consts_ptr = draw_jit_context_vs_constants(builder, context_ptr);
+
+   memset(&vs_type, 0, sizeof vs_type);
+   vs_type.floating = TRUE; /* floating point values */
+   vs_type.sign = TRUE;     /* values are signed */
+   vs_type.norm = FALSE;    /* values are not limited to [0,1] or [-1,1] */
+   vs_type.width = 32;      /* 32-bit float */
+   vs_type.length = 4;      /* 4 elements per vector */
+#if 0
+   num_vs = 4;              /* number of vertices per block */
+#endif
 
    lp_build_tgsi_soa(builder,
                      tokens,
                      vs_type,
                      NULL /*struct lp_build_mask_context *mask*/,
-                     vs_consts,
+                     consts_ptr,
                      NULL /*pos*/,
                      inputs,
                      outputs,
@@ -312,7 +322,6 @@ convert_to_soa(LLVMBuilderRef builder,
                              LLVMConstInt(LLVMInt32Type(), 2, 0));
       soa[i][3] = aos_to_soa(builder, val0, val1, val2, val3,
                              LLVMConstInt(LLVMInt32Type(), 3, 0));
-
    }
 }
 
@@ -329,7 +338,6 @@ draw_llvm_generate(struct draw_llvm *llvm)
    LLVMValueRef io_ptr, vbuffers_ptr;
    struct draw_context *draw = llvm->draw;
    unsigned i, j;
-   unsigned chan;
    struct lp_build_context bld;
    struct lp_build_loop_state lp_loop;
    struct lp_type vs_type = lp_type_float_vec(32);
@@ -393,12 +401,11 @@ draw_llvm_generate(struct draw_llvm *llvm)
             struct pipe_vertex_element *velem = &draw->pt.vertex_element[j];
             struct pipe_vertex_buffer *vbuf = &draw->pt.vertex_buffer[
                velem->vertex_buffer_index];
-            LLVMDumpValue(function);
             generate_fetch(builder, vbuffers_ptr,
                            &aos_attribs[j][i], velem, vbuf, true_index);
          }
       }
-      convert_to_soa(builder, inputs, aos_attribs,
+      convert_to_soa(builder, aos_attribs, inputs,
                      draw->pt.nr_vertex_elements);
 
       generate_vs(llvm,
@@ -407,6 +414,7 @@ draw_llvm_generate(struct draw_llvm *llvm)
                   inputs,
                   context_ptr,
                   io);
+      LLVMDumpModule(llvm->module);
    }
    lp_build_loop_end(builder, end, step, &lp_loop);
 
index 74830f1b46c1d7f11a80f658512d5f0a9a6450df..260568aaa4a70ee1309912034c7631d334d68602 100644 (file)
@@ -436,7 +436,6 @@ fetch(LLVMBuilderRef builder,
 
       src_tmp = LLVMBuildLoad(builder, src_tmp, "");
 
-      LLVMDumpValue(src_tmp);
       /* convert src_tmp to float */
       component = func(builder, src_tmp);