Thursday, November 27, 2008

(More) Triangle Optimizations

Yesterday I described how triangles and meshes can be optimized and hypothesized that building OBJs carefully could improve vertex throughput.  Having looked at some numbers today, I think the potential for framerate improvement isn't that great...an improvement would come from cache utilization (post vertex shader), and our cache usage seems to be pretty good already.

Simulating a FIFO vertex cache with 16 vertices (an average number - very old hardware might have 8 or 12, and newer hardware has at least 24 slots) I found that we miss the cache preventably around 15% of the time (using a random set of OBJs from LOWI to test) - sometimes we really missed bad (20-25%) but a lot of the time the miss rate might be as low as 5%.  

What these numbers mean is that at the very best, index optimizations in OBJs to improve vertex throughput might only improve vertex processing by about 15% (with the FPS improvement being less, since vertex throughput isn't the only thing that slows us down).

In other words, if I solve the cache problem perfectly (which may be impossible) we get at best 15%.

So this could be a nice optimization (every 5% win counts, and they matter if you can improve fps by 5% over and over) but cache utilization isn't going to change the nature of what you can model with an OBJ, because our cache utilization is already pretty good.

Have a Happy Thanksgiving!

No comments: