Why is VAR so slow?

When I use VAR for models that have under n(I don’t know exactly, somewhere around 3,000 maybe) triangles it slows down instead of speeds up. To get any noticeable speed increase I have to have really high triangle counts, so high that it wouldn’t be practical for any game.

What is VAR good for in games? When would you use it?

What are you doing between successive model renders?

What is VAR good for in games? When would you use it?

You answered your own question: “really high triangle counts.” This gives you an incentive to use lots and lots of triangles. After all, you only use VAR when you need fast vertex transfer. And the only time you need fast vertex transfer is when you are doing lots of vertex transfer.

I set the VAR pointers for every model. When all the models are drawn then I call: glDisableClientState(GL_VERTEX_ARRAY_RANGE_NV);

The data is only copied to the VAR memory once at init time. I do however copy vertex data and then normal data into the VAR mem, no interlieving in other words. Is that a bad thing? I did it like that so I could allocate one HUGE chunk of VAR mem and then share the VAR mem among all my models. Doing this alowed me to avoid copying data to VAR memory between differant models.

Does that make sense to you?

I think that diabling VAR between models is a bad idea, especially if the next model you’re going to render is just going to reenable it. Since you are turning off VAR, I’ll bet the driver has to do a glFlush (or finish, or which ever one stalls the CPU until the graphics chip is finished). So, you’re basically losing half of the gain in using VAR by disabling it after every model. Don’t do that.

I turn it off after all the models are drawn. I learned my lesson long ago for disabling it after every model .

Don’t disable it at all for best results.

  • Matt

And if you need to turn it off for some reason, then use glDisableClientState(GL_VERTEX_ARRAY_RANGE_NV_WITHOUT_FLUSH);

Whether you get a speedup by using VAR depends on your memory system and whether you are transfer-bound at all. I have found that interleaving data does give a performance boost in many cases. If you have enough vidmem and only AGP 2x, be sure to store the models in video memory, not in agp (that’s faster in my experience), especially if you write them only once.


If I didn’t turn it off then all the stuff I draw in imediate mode(menus and text) are all screwed up…unless it wasn’t suppose to do that and it was a driver problem(I haven’t updated my drivers for a while )?


Originally posted by WhatEver:

I have to RTFM you… sorry

It’s GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV and you can find it here: http://www.nvidia.com/dev_content/nvopenglspecs/GL_NV_vertex_array_range2.txt

I got it! Thx guys.

VAR being enabled should have zero effect on immediate mode.

  • Matt

You’re right. Now that a think back it wasn’t the imediate mode screwing up, I was drawing models with VAR and without VAR. If I didn’t disable the VAR the non-VAR models would look all screwy.

Forgive me for this was about 8 months ago…

Just want to clarify something, while we’re on the general topic of VAR…
Does using DrawRangeElements rather than just DrawElements speed things up when using VAR?
In other words, does forewarning the driver that the vertices referenced will be in a certain range help at all?

If you look at this thread Matt said “DRE doesn’t help when using VAR”.

It was a rhetorical question