Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In D3D11, they still have the ability to make 16 bit and 32 bit index buffers.

Few models will use more than the max (20k tri) that a USHORT index buffer can handle, but will I really pay a bad performance cost for always using an INT (32 bit) format?

Memory savings aren't that much (2 bytes per index!). For a 20k tri model, that's only 40 kB of memory we're saving for using the USHORT (compared with probably a lot more for just the vertex data for that same model).

Is it really worth ever using USHORT index buffers then, or is this just a holdover from when computers had less memory in the 90's?

share|improve this question
3  
If you're loading 100 such models, that's a savings of 40 mB of memory saved. In certain situations, it's worth it to save as much memory as possible (though it's all game dependent, and for 90% of projects, not really worth it) –  thedaian Aug 30 '11 at 18:36
2  
@thedaian: That is an answer. –  user744 Aug 30 '11 at 18:52
3  
@thedaian, as far as I can tell, your figure is off by a factor of 10^8. 100 * 40 kB makes 4 MB. In any case, I'd be more worried about dealing with 2 million triangles in general. 20k is a lot for most models, you can get very far with 1k and a good bump map. –  eBusiness Aug 30 '11 at 19:44
2  
Bandwidth is important too. 4mb saved is 4mb less to upload to GPU memory. How often you actually do this is up to you. –  Justicle Aug 31 '11 at 0:12
1  
You can have 64k triangles with a 16-bit index buffer - just use a triangle strip instead of a triangle list. –  Adam Sep 1 '11 at 0:21
show 1 more comment

3 Answers 3

up vote 8 down vote accepted

You have to consider that GPUs when fetching the data for feeding into the vertex shaders requires a lot of small calls because they can only cache a few triangles at the same time, and fetching data from the VRAM is a very slow operation. So I suppose that if you use half the bytes for the indices, the GPU will be able to fetch twice the indices for the cache to render triangles.

4MB Can be a small amount of memory for storage space, but if you have to make a complex call to only process a few bytes from them it may affect performance in a noticeable way. Nowadays video cards are powerful enough to make it irrelevant in games which don't have to process a lot of geometry, you... could do some benchmarks rendering a model with both index sizes if you really want to know.

Loading times are also faster with 16 bit indices, and actually every write or read, unless you can effectively control memory alignment and proper paging. So it's not just about the memory it requires but how much it takes to handle it. If you are working with dynamic buffers that need to be moved over the bus to the GPU at some point between Frames, then you should use 16 bit indices when possible. If you are rendering even smaller geometries, you can batch many indices in a single 16 bit index buffer for them all to get copied to the GPU in a single call.

Here you may find some information about how the newer ATI GPUs work:

ATI Stream Developer Training Resources (sorry I couldn't find the exact document) I didn't read much about the NVidia ones, but I think they work more or less with a similar approach.

share|improve this answer
add comment

While memory and CPU speeds have improved over the years, games are still often pushing the limits of hardware and software. If you're loading 100 such models, that's a savings of 4 megabytes of memory saved. In certain situations, it's worth it to save as much memory as possible. That might be enough for you to load another model, or enough to cram in a few more sound effects, or another song. For most AAA games, this sort of savings is vital to making things better than the competition.

Of course, it's all game dependent, and for plenty of projects, not really worth it. But if you want to push the hardware as far as it'll go, you'll want to find ways to save as much memory as possible, so you have room to add more cool stuff.

share|improve this answer
add comment

It's not just about memory; some hardware just flat-out cannot support 32-bit indexes and must run the vertex pipeline in software if you use them. It's getting rarer, but you can still get the occasional nasty surprise when you come across one. 16-bit indexes can also run faster in general, which can be important if you're under performance pressure, but you'll need to benchmark and weigh the benefit of extra perf from 16-bit indexes vs the tradeoff of possibly needing to split a model because there isn't one single answer to that one that's correct in all situations.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.