util/draw: replace assertions with conditionals in util_draw_max_index()
authorBrian Paul <brianp@vmware.com>
Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 15 Nov 2011 14:49:26 +0000 (07:49 -0700)
commit438d7ac146dc89d1c2943610c662c57e11a47382
tree4012cac294434d0238323f80e479f98d832fe41a
parent94780b5ee6dc118e22c29b5543c4db8e0ab1f393
util/draw: replace assertions with conditionals in util_draw_max_index()

Don't assert/die if a VBO is too small.  Return zero instead.  For
debug builds, emit a warning message since this is an unusual situation
that might indicate that there's a bug in the app.

Note that util_draw_max_index() now returns max_index+1 instead of
max_index.  This lets us return zero to indicate that one of the VBOs
is too small to draw anything.

Fixes a failure with the new piglit vbo-too-small test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/util/u_draw.c