<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&#39;s doing everything correctly since I&#39;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">&lt;<a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>&gt;</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>
&gt; This looks good to me -- Jose?<br>
&gt;<br>
&gt; Keith<br>
&gt;<br>
&gt; On Thu, 2011-06-30 at 03:33 +0100, Micael Dias wrote:<br>
&gt; &gt; ---<br>
&gt; &gt;  src/gallium/auxiliary/draw/draw_llvm.c |   12 ++++++++++++<br>
&gt; &gt;  1 files changed, 12 insertions(+), 0 deletions(-)<br>
&gt; &gt;<br>
&gt; &gt; diff --git a/src/gallium/auxiliary/draw/draw_llvm.c<br>
&gt; &gt; b/src/gallium/auxiliary/draw/draw_llvm.c<br>
&gt; &gt; index 56c26f5..19134f3 100644<br>
&gt; &gt; --- a/src/gallium/auxiliary/draw/draw_llvm.c<br>
&gt; &gt; +++ b/src/gallium/auxiliary/draw/draw_llvm.c<br>
&gt; &gt; @@ -1163,6 +1163,7 @@ draw_llvm_generate(struct draw_llvm *llvm,<br>
&gt; &gt; struct draw_llvm_variant *variant)<br>
&gt; &gt;     struct lp_build_loop_state lp_loop;<br>
&gt; &gt;     const int max_vertices = 4;<br>
&gt; &gt;     LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];<br>
&gt; &gt; +   LLVMValueRef fetch_max;<br>
&gt; &gt;     void *code;<br>
&gt; &gt;     struct lp_build_sampler_soa *sampler = 0;<br>
&gt; &gt;     LLVMValueRef ret, ret_ptr;<br>
&gt; &gt; @@ -1234,6 +1235,10 @@ draw_llvm_generate(struct draw_llvm *llvm,<br>
&gt; &gt; struct draw_llvm_variant *variant)<br>
&gt; &gt;        draw_llvm_variant_key_samplers(&amp;variant-&gt;key),<br>
&gt; &gt;        context_ptr);<br>
&gt; &gt;<br>
&gt; &gt; +   fetch_max = LLVMBuildSub(builder, count,<br>
&gt; &gt; +                            lp_build_const_int32(gallivm, 1),<br>
&gt; &gt; +                            &quot;fetch_max&quot;);<br>
&gt; &gt; +<br>
&gt; &gt;  #if DEBUG_STORE<br>
&gt; &gt;     lp_build_printf(builder, &quot;start = %d, end = %d, step = %d\n&quot;,<br>
&gt; &gt;                     start, end, step);<br>
&gt; &gt; @@ -1257,6 +1262,13 @@ draw_llvm_generate(struct draw_llvm *llvm,<br>
&gt; &gt; struct draw_llvm_variant *variant)<br>
&gt; &gt;              builder,<br>
&gt; &gt;              lp_loop.counter,<br>
&gt; &gt;              lp_build_const_int32(gallivm, i), &quot;&quot;);<br>
&gt; &gt; +         LLVMValueRef fetch_ptr;<br>
&gt; &gt; +<br>
&gt; &gt; +         /* make sure we&#39;re not out of bounds which can happen<br>
&gt; &gt; +          * if fetch_count % 4 != 0, because on the last iteration<br>
&gt; &gt; +          * a few of the 4 vertex fetches will be out of bounds */<br>
&gt; &gt; +         true_index = lp_build_min(&amp;bld, true_index, fetch_max);<br>
&gt; &gt; +<br>
&gt; &gt;           for (j = 0; j &lt; draw-&gt;pt.nr_vertex_elements; ++j) {<br>
&gt; &gt;              struct pipe_vertex_element *velem =<br>
&gt; &gt;              &amp;draw-&gt;pt.vertex_element[j];<br>
&gt; &gt;              LLVMValueRef vb_index = lp_build_const_int32(gallivm,<br>
&gt; &gt;              velem-&gt;vertex_buffer_index);<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Micael Dias<br>