vbo: Rework checking of 'end' against _MaxElement.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 8 Feb 2012 13:08:23 +0000 (05:08 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 17 Feb 2012 22:56:55 +0000 (14:56 -0800)
commit112b02c32402d96fd7d526ab84877bb66dc12de4
tree384a74100a59f0bda1deff227077993752a312cb
parentf00c97b23f78f3ccd1ea554ceebe7a33de7f81cf
vbo: Rework checking of 'end' against _MaxElement.

This failed to take basevertex into account:

If basevertex < 0:
   (end + basevertex) might actually be in-bounds while 'end' is not.
   We would have clamped in this case when we probably shouldn't.
   This could break application drawing.

If basevertex > 0:
   'end' might be in-bounds while (end + basevertex) might not.
   We would have failed to clamp in this place.  There's a comment
   indicating the TNL module depends on max_index being in-bounds;
   if so, it would likely break horribly.

Rather than trying to clamp correctly in the face of basevertex, simply
delete the clamping code and indicate that we don't have a valid range.
This causes _tnl_vbo_draw_prims to use vbo_get_minmax_indices() to
compute the actual bounds, which is much safer.

NOTE: This is a candidate for release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/mesa/vbo/vbo_exec_array.c