From: Zack Rusin Date: Tue, 6 Apr 2010 15:00:35 +0000 (-0400) Subject: draw llvm: fix draw arrays X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aeaf2cf18fc74f2d65fcadfad8c19f244ccd4206;p=mesa.git draw llvm: fix draw arrays we don't index within the outputs but only within the inputs --- diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 27df59653c2..eac5e917d5b 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -408,7 +408,7 @@ store_aos(LLVMBuilderRef builder, 0xffff, 0), id_ptr); #if DEBUG_STORE - lp_build_printf(builder, " ---- %p storing at %d (%p)\n", io_ptr, index, data_ptr); + lp_build_printf(builder, " ---- %p storing attribute %d (io = %p)\n", data_ptr, index, io_ptr); #endif #if 0 /*lp_build_printf(builder, " ---- %p storing at %d (%p) ", io_ptr, index, data_ptr); @@ -459,7 +459,6 @@ static void store_aos_array(LLVMBuilderRef builder, LLVMValueRef io_ptr, LLVMValueRef aos[NUM_CHANNELS], - LLVMValueRef start_index, int attrib, int num_outputs) { @@ -482,8 +481,8 @@ store_aos_array(LLVMBuilderRef builder, &ind3, 1, ""); #if DEBUG_STORE - lp_build_printf(builder, "io = %d, indexes[%d, %d, %d, %d]\n", - start_index, ind0, ind1, ind2, ind3); + lp_build_printf(builder, "io = %p, indexes[%d, %d, %d, %d]\n", + io_ptr, ind0, ind1, ind2, ind3); #endif store_aos(builder, io0_ptr, attr_index, aos[0]); @@ -497,8 +496,7 @@ convert_to_aos(LLVMBuilderRef builder, LLVMValueRef io, LLVMValueRef (*outputs)[NUM_CHANNELS], int num_outputs, - int max_vertices, - LLVMValueRef start_index) + int max_vertices) { unsigned chan, attrib; @@ -524,7 +522,6 @@ convert_to_aos(LLVMBuilderRef builder, store_aos_array(builder, io, aos, - start_index, attrib, num_outputs); } @@ -542,7 +539,7 @@ draw_llvm_generate(struct draw_llvm *llvm) LLVMBasicBlockRef block; LLVMBuilderRef builder; LLVMValueRef function; - LLVMValueRef start, end, count, stride, step; + LLVMValueRef start, end, count, stride, step, io_itr; LLVMValueRef io_ptr, vbuffers_ptr; struct draw_context *draw = llvm->draw; unsigned i, j; @@ -595,6 +592,7 @@ 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); @@ -603,7 +601,7 @@ 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, &lp_loop.counter, 1, ""); + LLVMValueRef io = LLVMBuildGEP(builder, io_ptr, &io_itr, 1, ""); const LLVMValueRef (*ptr_aos)[NUM_CHANNELS]; #if DEBUG_STORE lp_build_printf(builder, " --- loop counter %d\n", @@ -634,7 +632,10 @@ draw_llvm_generate(struct draw_llvm *llvm) convert_to_aos(builder, io, outputs, draw->vs.vertex_shader->info.num_outputs, - max_vertices, lp_loop.counter); + max_vertices); + + io_itr = LLVMBuildAdd(builder, io_itr, + LLVMConstInt(LLVMInt32Type(), 1, 0), ""); } lp_build_loop_end_cond(builder, end, step, LLVMIntUGE, &lp_loop); 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 aebfe40a037..307e6cc3a4d 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,6 +245,8 @@ static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle, return; } + debug_printf("#### Pipeline = %p (data = %p)\n", + pipeline_verts, pipeline_verts->data); fpme->llvm->jit_func( &fpme->llvm->jit_context, pipeline_verts, (const char **)draw->pt.user.vbuffer, diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c index 7afbf6fa461..af07926a55c 100644 --- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c +++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c @@ -108,7 +108,7 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs, for (j = 0; j < count; j++) { float *position = out->data[pos]; - debug_printf("%d) %p %p = [%f, %f, %f, %f]\n", + debug_printf("%d) io = %p, data = %p = [%f, %f, %f, %f]\n", j, out, position, position[0], position[1], position[2], position[3]); out->clip[0] = position[0];