[Mesa-dev] VBO fixes [v2]

Kenneth Graunke kenneth at whitecape.org
Thu Feb 16 11:14:04 PST 2012


Here's a respin of the VBO fixes, incorporating feedback from Roland,
Brian, and Ian.

I'm not entirely happy with this series.  If you look at the resulting
code, we end up marking the range invalid if:

1. (int) start + basevertex < 0
2. (int) end   + basevertex < 0
3. start + basevertex >= _MaxElement
4. end   + basevertex >= _MaxElement

but in two separate blocks.

Mesa master emits a warning about case 4, which this series removes.
This series causes a warning to be emitted for 2 and 3.  No warning
is ever emitted for case 1.

Prior to this series, Mesa didn't do 1 and 2 (the < 0 checks) at all.

I'm tempted to just throw out all of these checks and just do:

   if (all_vbo_rendering) /* all VBOs, no user-space arrays at all */
      index_bounds_valid = false;

since the whole DrawRangeElements optimization is basically irrelevant
for VBOs.  Cases 3 and 4 should only happen for VBOs anyway, as
_MaxElement is set to 2,000,000,000 for user-space arrays.

I don't think we have many (any?) tests for these corner cases, so I'm
a bit hesitant about changing this.



More information about the mesa-dev mailing list