VBO performances

I’m wondering which way to render the following VBO will be the fastest. The goal is to render a grid with a equal number of rows and column. The grid is relatively large: 128x128

1- Using gl(Multi)DrawArrays. Each point needs to be in the VBO twice because all vertex are used in sequential order, so it need to be there in each row using this vertex. It has the advantage of not jumping back and forth in memory, but there’s no chance reusing a vertex that was already cached.

2- Using gl(Multi)DrawElements. Because it uses indices, the VBO can be twice as small, but requires the use of vertex in a non sequential order. It also requires to read the indices before the vertex can be processed.

I see advantages and desadvantages on both methods. If we only consider performance, which one would be the fastest, and why?

If it’s a grid, the indexed array is guaranteed to be faster. Especially if the stripping is post-T&L cache-aware.

It’s faster because:

1: You send less information across the bus.
2: The pre-T&L cache can help mitigate some memory accesses for multiply-indexed vertices.
3: The post-T&L cache can help eliminate some transforms for multiply-indexed vertices.

DrawElements is usually faster, because vertex data is cached, which thus results in less vertex processing. But 128x128 are just 16k vertices or 32k triangles… You should have no performance considerations if you render just one such small grid. You will most probably end fill-limited anyway.

Edit: Korval was faster :slight_smile:

That’s cool, that’s pretty much what I thought, but I didn’t know why. But that leads me to another question.

If I want to also use a VBO for the indices and I don’t necessarly want to start at the first index, can that be done? I’m asking because to use indices from a VBO, it’s required to use the adress 0 for gl(Multi)DrawElements. That doesn’t let me choose the starting index. That makes glMultiDrawElements pretty useless when the indices are in the VBO… Or did I missed something?

For Zengar, I have a bunch of those tiles to render. That’s why I car about performances.


well the pointer parameter in gldrawelements is used as an offset value when an ibo is being used, so you can start at whatever offset into the ibo you choose, vincent.
(p.s. remember, the offset is specified in bytes - so if your indices are uint32, you’d go indexOffset*sizeof(uint32) )