Sign in to follow this  

glDrawElements, Performance, vertex reuse

This topic is 4858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

when using Vertex Arrays and glDrawElements to specify a drawing order for the verts if your ordering hits the same vert many times, does that vertex data get copied to the card for each hit? or is it smart enought to cache them for reuse? my big concern is CPU activity, copying data from system to video memory is getting expensive. No, i dont have VBOs im thinking that assuming its caching them a cheap way to do texture tiling is to have the verts in a heightfiled alternate between 0 and 1 tex coords do one DrawElemetns that draws every other quad bind a mirror image of the texture do a second call that draws all the rest of the quads then youd get the texture tiled across the terrain, without having to do more than one tex coord per vertex, no duplicated data of course this only works if it will let me keep vertex data on card across draw calls..... or if it allows texture binding someplace in the middle hmm now that i think of it im pretty sure the answer to this is no, not without VBOs or mabye CVAs

Share this post


Link to post
Share on other sites
Quote:
Original post by haphazardlynamed
when using Vertex Arrays
and glDrawElements to specify a drawing order for the verts
if your ordering hits the same vert many times, does that vertex data get copied to the card for each hit? or is it smart enought to cache them for reuse?


Yes, there is what is called the "vertex cache" on the graphics card. It isn't very large ( about 17 or something on a GF2/3 ), so don't expect too much. Your drawing order will seriously affect how much use you get out of the vertex cache.

Share this post


Link to post
Share on other sites
If you're concerned about CPU load, use VBOs. IF you for some bizarre reason can't use VBOs, at least use glDrawRangeElements to stress the CPU less when doing draw calls.

Share this post


Link to post
Share on other sites
Quote:
Original post by haphazardlynamed
... does that vertex data get copied to the card for each hit? or is it smart enought to cache them for reuse?


Yes, every card since GeForce256 uses a vertex cache, usually fifo with 16-24 slots. I implemented it in my software renderer and the gain wrt non-cached vertices are extremely significative.
However, you should send indices to your gfx card in an order that minimizes cache faults. To do so, nVidia set up a very useful routine.

Give it a try and test again your app.

Share this post


Link to post
Share on other sites

This topic is 4858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this