aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2010-04-06 00:13:20 -0400
committerZack Rusin <[email protected]>2010-04-06 00:13:20 -0400
commit9dd70e7b85ddbc73bd976c4dab81476aa36c557e (patch)
tree6fa7b12033f424c346d4db26eec1b7ad9a201d29 /src/gallium/auxiliary/draw
parent1b0bab167cd541f70c32249ca3e70da88b8c93c5 (diff)
draw llvm: fix loop iteration and vertex header offsets
the loop was doing a NE comparison which we could have skipped if the prim was triangles (3 verts) and our step was 4 verts. also fix offsets in conversion to aos.
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c44
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c2
2 files changed, 30 insertions, 16 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 382f765e16c..27df59653c2 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -17,6 +17,8 @@
#include <llvm-c/Transforms/Scalar.h>
+#define DEBUG_STORE 0
+
static void
init_globals(struct draw_llvm *llvm)
{
@@ -235,7 +237,7 @@ generate_vs(struct draw_llvm *llvm,
NULL/*sampler*/);
}
-
+#if DEBUG_STORE
static void print_vectorf(LLVMBuilderRef builder,
LLVMValueRef vec)
{
@@ -251,6 +253,7 @@ static void print_vectorf(LLVMBuilderRef builder,
lp_build_printf(builder, "vector = [%f, %f, %f, %f]\n",
val[0], val[1], val[2], val[3]);
}
+#endif
static void
generate_fetch(LLVMBuilderRef builder,
@@ -404,6 +407,9 @@ store_aos(LLVMBuilderRef builder,
LLVMBuildStore(builder, LLVMConstInt(LLVMInt32Type(),
0xffff, 0), id_ptr);
+#if DEBUG_STORE
+ lp_build_printf(builder, " ---- %p storing at %d (%p)\n", io_ptr, index, data_ptr);
+#endif
#if 0
/*lp_build_printf(builder, " ---- %p storing at %d (%p) ", io_ptr, index, data_ptr);
print_vectorf(builder, value);*/
@@ -458,16 +464,10 @@ store_aos_array(LLVMBuilderRef builder,
int num_outputs)
{
LLVMValueRef attr_index = LLVMConstInt(LLVMInt32Type(), attrib, 0);
- LLVMValueRef ind0 = start_index;
- LLVMValueRef ind1 =
- LLVMBuildAdd(builder, start_index,
- LLVMConstInt(LLVMInt32Type(), 1, 0), "");
- LLVMValueRef ind2 =
- LLVMBuildAdd(builder, start_index,
- LLVMConstInt(LLVMInt32Type(), 2, 0), "");
- LLVMValueRef ind3 =
- LLVMBuildAdd(builder, start_index,
- LLVMConstInt(LLVMInt32Type(), 3, 0), "");
+ LLVMValueRef ind0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ LLVMValueRef ind1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
+ LLVMValueRef ind2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
+ LLVMValueRef ind3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
LLVMValueRef io0_ptr, io1_ptr, io2_ptr, io3_ptr;
debug_assert(NUM_CHANNELS == 4);
@@ -481,7 +481,10 @@ store_aos_array(LLVMBuilderRef builder,
io3_ptr = LLVMBuildGEP(builder, io_ptr,
&ind3, 1, "");
- /*lp_build_printf(builder, "io = %d\n", start_index);*/
+#if DEBUG_STORE
+ lp_build_printf(builder, "io = %d, indexes[%d, %d, %d, %d]\n",
+ start_index, ind0, ind1, ind2, ind3);
+#endif
store_aos(builder, io0_ptr, attr_index, aos[0]);
store_aos(builder, io1_ptr, attr_index, aos[1]);
@@ -499,6 +502,9 @@ convert_to_aos(LLVMBuilderRef builder,
{
unsigned chan, attrib;
+#if DEBUG_STORE
+ lp_build_printf(builder, " # storing begin\n");
+#endif
for (attrib = 0; attrib < num_outputs; ++attrib) {
LLVMValueRef soa[4];
LLVMValueRef aos[4];
@@ -522,6 +528,9 @@ convert_to_aos(LLVMBuilderRef builder,
attrib,
num_outputs);
}
+#if DEBUG_STORE
+ lp_build_printf(builder, " # storing end\n");
+#endif
}
void
@@ -586,13 +595,20 @@ draw_llvm_generate(struct draw_llvm *llvm)
step = LLVMConstInt(LLVMInt32Type(), max_vertices, 0);
+#if DEBUG_STORE
+ lp_build_printf(builder, "start = %d, end = %d, step = %d\n",
+ start, end, step);
+#endif
lp_build_loop_begin(builder, start, &lp_loop);
{
LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
LLVMValueRef io = LLVMBuildGEP(builder, io_ptr, &lp_loop.counter, 1, "");
const LLVMValueRef (*ptr_aos)[NUM_CHANNELS];
-
+#if DEBUG_STORE
+ lp_build_printf(builder, " --- loop counter %d\n",
+ lp_loop.counter);
+#endif
for (i = 0; i < NUM_CHANNELS; ++i) {
LLVMValueRef true_index = LLVMBuildAdd(
builder,
@@ -620,7 +636,7 @@ draw_llvm_generate(struct draw_llvm *llvm)
draw->vs.vertex_shader->info.num_outputs,
max_vertices, lp_loop.counter);
}
- lp_build_loop_end(builder, end, step, &lp_loop);
+ lp_build_loop_end_cond(builder, end, step, LLVMIntUGE, &lp_loop);
LLVMBuildRetVoid(builder);
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index f65cf3822c4..aebfe40a037 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -245,8 +245,6 @@ static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle,
return;
}
- debug_printf("--- pipe verts data[0] = %p, data[1] = %p\n",
- pipeline_verts->data[0], pipeline_verts->data[1]);
fpme->llvm->jit_func( &fpme->llvm->jit_context,
pipeline_verts,
(const char **)draw->pt.user.vbuffer,