summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_llvm.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2010-04-06 12:37:31 -0400
committerZack Rusin <[email protected]>2010-04-06 12:37:31 -0400
commit1e0bf24139f6047f505b138392fc0f1d6584d6bc (patch)
treeb5c7216c764c684b81e10f25b56f36414e70e5eb /src/gallium/auxiliary/draw/draw_llvm.c
parentde0647dbad96db222b5643d03b3f61b093e7ef76 (diff)
draw llvm: fix iteration for larger vertex arrays
we were trying to store the outputs starting at the same offset we were using for the input arrays, which was writing beyond the end of the output array.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 021662e75e0..a09e2a9f0c2 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -17,7 +17,7 @@
#include <llvm-c/Transforms/Scalar.h>
-#define DEBUG_STORE 0
+#define DEBUG_STORE 1
static void
init_globals(struct draw_llvm *llvm)
@@ -481,7 +481,7 @@ store_aos_array(LLVMBuilderRef builder,
&ind3, 1, "");
#if DEBUG_STORE
- lp_build_printf(builder, "io = %p, indexes[%d, %d, %d, %d]\n",
+ lp_build_printf(builder, " io = %p, indexes[%d, %d, %d, %d]\n",
io_ptr, ind0, ind1, ind2, ind3);
#endif
@@ -592,7 +592,6 @@ draw_llvm_generate(struct draw_llvm *llvm)
step = LLVMConstInt(LLVMInt32Type(), max_vertices, 0);
- io_itr = LLVMConstInt(LLVMInt32Type(), 0, 0);
#if DEBUG_STORE
lp_build_printf(builder, "start = %d, end = %d, step = %d\n",
start, end, step);
@@ -601,11 +600,14 @@ draw_llvm_generate(struct draw_llvm *llvm)
{
LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
- LLVMValueRef io = LLVMBuildGEP(builder, io_ptr, &io_itr, 1, "");
+ LLVMValueRef io;
const LLVMValueRef (*ptr_aos)[NUM_CHANNELS];
+
+ io_itr = LLVMBuildSub(builder, lp_loop.counter, start, "");
+ io = LLVMBuildGEP(builder, io_ptr, &io_itr, 1, "");
#if DEBUG_STORE
- lp_build_printf(builder, " --- loop counter %d\n",
- lp_loop.counter);
+ lp_build_printf(builder, " --- io %d = %p, loop counter %d\n",
+ io_itr, io, lp_loop.counter);
#endif
for (i = 0; i < NUM_CHANNELS; ++i) {
LLVMValueRef true_index = LLVMBuildAdd(
@@ -633,8 +635,6 @@ draw_llvm_generate(struct draw_llvm *llvm)
convert_to_aos(builder, io, outputs,
draw->vs.vertex_shader->info.num_outputs,
max_vertices);
-
- io_itr = LLVMBuildAdd(builder, io_itr, step, "");
}
lp_build_loop_end_cond(builder, end, step, LLVMIntUGE, &lp_loop);