<div class="gmail_quote">2011/2/28 Christian König <span dir="ltr"><<a href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Am Montag, den 28.02.2011, 08:32 -0800 schrieb Brian Paul:<br>
....<br>
<div>>> diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c<br>
</div>....<br>
<div>> > min_index = MIN2(min_index, prims[i].start);<br>
> > max_index = MAX2(max_index, prims[i].start + prims[i].count - 1);<br>
> > + max_index = MAX2(max_index, prims[i].num_instances);<br>
....<br>
<br>
> I don't understand that last bit. If we're doing regular,<br>
> non-instanced drawing, prims[i].num_instances will be 1. So max_index<br>
> will always be one. That doesn't seem right.<br>
</div>The maximum check is additional to the existing calculation, not a<br>
replacement. So max_index only gets increased if the number of instances<br>
to draw is higher than the number of vertices.<br>
<br>
But indeed that's just a workaround to make piglits<br>
draw-instanced-divisor test happy. max_index seems to be used to<br>
calculate the size of the buffer needed to hold the vertex data, but in<br>
the case of instanced drawing this isn't correct.<br>
<br>
@Marek:<br>
Since you are the author of the code maybe you could help here out a<br>
bit. Where is max_index used to calculate the buffer size? I couldn't<br>
find a call to the buffer creation function. The size calculation<br>
somewhere around this call needs to be adopted to the case when we draw<br>
more instances than vertices or indexes.<br></blockquote><div><br>max_index should be for per-vertex data only. We probably need to compute max_index for per-instance data separately (it can be derived from prims[i].num_instances and pipe_vertex_element::instance_divisor). The per-instance data are more like constants than vertices.<br>
<br>max_index is used in parameters of functions pipe_user_buffer_create and redefine_user_buffer in the same file.<br><br>FWIW I'd rather see the "size" variable in u_vbuf_mgr be derived from pipe_draw_info::instance_count.<br>
<br>Marek<br></div></div>