<meta http-equiv="content-type" content="text/html; charset=utf-8">Indeed. This was copied from the indices version of the function, altough that version seems to do some more work to find out the true_index. The patch as it is fixes a crash when selecting objects in blender though.<div>
Please verify to make sure it's doing everything correctly since I'm still far from being comfortable with the codebase.</div><br><div class="gmail_quote">On Fri, Jul 1, 2011 at 1:57 PM, Jose Fonseca <span dir="ltr"><<a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I recall seeing this issue before, and I though we had fixed it by ensure the vertices are always padded to be multiple of four.. but I suspect it may have been for fetching indices, and not actual vertices.<br>
<br>
So it looks good, but let me investigate a bit more.<br>
<font color="#888888"><br>
Jose<br>
</font><div><div></div><div class="h5"><br>
----- Original Message -----<br>
> This looks good to me -- Jose?<br>
><br>
> Keith<br>
><br>
> On Thu, 2011-06-30 at 03:33 +0100, Micael Dias wrote:<br>
> > ---<br>
> > src/gallium/auxiliary/draw/draw_llvm.c | 12 ++++++++++++<br>
> > 1 files changed, 12 insertions(+), 0 deletions(-)<br>
> ><br>
> > diff --git a/src/gallium/auxiliary/draw/draw_llvm.c<br>
> > b/src/gallium/auxiliary/draw/draw_llvm.c<br>
> > index 56c26f5..19134f3 100644<br>
> > --- a/src/gallium/auxiliary/draw/draw_llvm.c<br>
> > +++ b/src/gallium/auxiliary/draw/draw_llvm.c<br>
> > @@ -1163,6 +1163,7 @@ draw_llvm_generate(struct draw_llvm *llvm,<br>
> > struct draw_llvm_variant *variant)<br>
> > struct lp_build_loop_state lp_loop;<br>
> > const int max_vertices = 4;<br>
> > LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];<br>
> > + LLVMValueRef fetch_max;<br>
> > void *code;<br>
> > struct lp_build_sampler_soa *sampler = 0;<br>
> > LLVMValueRef ret, ret_ptr;<br>
> > @@ -1234,6 +1235,10 @@ draw_llvm_generate(struct draw_llvm *llvm,<br>
> > struct draw_llvm_variant *variant)<br>
> > draw_llvm_variant_key_samplers(&variant->key),<br>
> > context_ptr);<br>
> ><br>
> > + fetch_max = LLVMBuildSub(builder, count,<br>
> > + lp_build_const_int32(gallivm, 1),<br>
> > + "fetch_max");<br>
> > +<br>
> > #if DEBUG_STORE<br>
> > lp_build_printf(builder, "start = %d, end = %d, step = %d\n",<br>
> > start, end, step);<br>
> > @@ -1257,6 +1262,13 @@ draw_llvm_generate(struct draw_llvm *llvm,<br>
> > struct draw_llvm_variant *variant)<br>
> > builder,<br>
> > lp_loop.counter,<br>
> > lp_build_const_int32(gallivm, i), "");<br>
> > + LLVMValueRef fetch_ptr;<br>
> > +<br>
> > + /* make sure we're not out of bounds which can happen<br>
> > + * if fetch_count % 4 != 0, because on the last iteration<br>
> > + * a few of the 4 vertex fetches will be out of bounds */<br>
> > + true_index = lp_build_min(&bld, true_index, fetch_max);<br>
> > +<br>
> > for (j = 0; j < draw->pt.nr_vertex_elements; ++j) {<br>
> > struct pipe_vertex_element *velem =<br>
> > &draw->pt.vertex_element[j];<br>
> > LLVMValueRef vb_index = lp_build_const_int32(gallivm,<br>
> > velem->vertex_buffer_index);<br>
><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Micael Dias<br>