st/mesa: rewrite the primitive restart fallback code
authorBrian Paul <brianp@vmware.com>
Fri, 18 Nov 2011 14:39:03 +0000 (07:39 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 18 Nov 2011 14:39:14 +0000 (07:39 -0700)
commita43908fe62c39b84f014ddf2bee15cd07a77fc0d
tree5119d79f2f513d248b657a41c942324f3dc032a5
parent08b288be8e3ac7f2781104bf3ca6557731bcd534
st/mesa: rewrite the primitive restart fallback code

Previously we were mapping/unmapping the index buffer each time we
found the restart index in the buffer.  This is bad when the restart
index is frequently used.  Now just map the index buffer once, scan
it to produce a list of sub-primitives, unmap the buffer, then draw
the sub-primitives.

Also, clean up the logic of testing for indexed primitives and calling
handle_fallback_primitive_restart().  Don't call it for non-indexed
primitives.

v2: per Jose, only map the relevant part of the index buffer with
pipe_buffer_map_range()

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/mesa/state_tracker/st_draw.c