[Mesa-dev] Mesa (master): st/mesa & v_bug_mgr: two small instanced drawing fixes

Christian König deathsimple at vodafone.de
Mon Feb 28 09:42:10 PST 2011


Am Montag, den 28.02.2011, 08:32 -0800 schrieb Brian Paul:
....
>> diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
....
> >            min_index = MIN2(min_index, prims[i].start);
> >            max_index = MAX2(max_index, prims[i].start + prims[i].count - 1);
> > +         max_index = MAX2(max_index, prims[i].num_instances);
....

> I don't understand that last bit.  If we're doing regular, 
> non-instanced drawing, prims[i].num_instances will be 1.  So max_index 
> will always be one.  That doesn't seem right.
The maximum check is additional to the existing calculation, not a
replacement. So max_index only gets increased if the number of instances
to draw is higher than the number of vertices.

But indeed that's just a workaround to make piglits
draw-instanced-divisor test happy. max_index seems to be used to
calculate the size of the buffer needed to hold the vertex data, but in
the case of instanced drawing this isn't correct.

@Marek:
Since you are the author of the code maybe you could help here out a
bit. Where is max_index used to calculate the buffer size? I couldn't
find a call to the buffer creation function. The size calculation
somewhere around this call needs to be adopted to the case when we draw
more instances than vertices or indexes.

Christian.



More information about the mesa-dev mailing list