Sign in to follow this  
Mercenarey

Swapping indexbuffers of different formats - performance hit?

Recommended Posts

My system finds out itself whether an IndexBuffer should be of 16- or 32-bit integers (D3DFMT_INDEX16 / D3DFMT_INDEX32), depending on the number of entries. However, after implementing this, I have noticed a performance dip on my terrain, where the performance should be (more or less) the same. My basic layer is now using 32 bit, where it formerly used only 16 bit. It renders just slightly more triangles per iteration (some 80.000 indices instead of 60.000). The following layers usually use 16-bit indexbuffers, and therefore some swapping of 16- to 32-bit buffers (and back) happens. Is there a known performance hit when I swap between 16- and 32- bit indexbuffers? [Edited by - Mercenarey on February 21, 2008 10:50:18 AM]

Share this post


Link to post
Share on other sites
There shouldn't be a performance hit from swapping buffer formats, but there will be from swapping index buffers or from going up to 32-bit IBs (Since the data is larger meaning there's more to transfer).

How much of a dip are we talking here? And have you tried it with just 32-bit IBs?

Share this post


Link to post
Share on other sites
I forget the details, but I'm sure I've seen some slidedecks from GDC/SIGGRAPH (etc..) by Nvidia and ATI advising against 32bit IB's. I'm pretty sure Nvidia have never supported more than 24bits, but that's not too important.

Depending on your hardware, run up something like NVPerfHUD and see where it says your bottleneck is. It could be as simple as extra bandwidth choking the GPU.

hth
Jack

Share this post


Link to post
Share on other sites
One possible solution is to use triangle strips. That should cut the index count down by a factor of around 2. There's various free programs about that will do the conversion for you.

Also are the indices arranged in a cache friendly manner (i.e. roughly in ascending order)? If not reordering the vertices should help performance somewhat.

You could also split the model into two and render them separately.

You may also find that when the model has more complex material / lighting applied that the performance difference between the two methods isn't so noticeable, so I wouldn't worry too much about it for now.

Share this post


Link to post
Share on other sites

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