[Mesa-dev] VBO fixes [v2]

Roland Scheidegger sroland at vmware.com
Thu Feb 16 12:48:00 PST 2012

Am 16.02.2012 20:14, schrieb Kenneth Graunke:
> 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 think this makes all sense. case 2/3 mean the range can definitely not
be right (as it would be empty), case 1/4 might just mean the app was
sloppy and didn't define the start/end right (but all indices might
still be in the range).

> 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;
Some (rather special) drivers might only want to transfer elements
referenced in the draw range if they keep VBOs in system memory. Not
sure though if it would really make a difference for any (non-hardware)
Some sanity checking can't hurt though imho.

> 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.

For the series:
Reviewed-by: Roland Scheidegger <sroland at vmware.com>

More information about the mesa-dev mailing list