Wednesday, April 7, 2010

Using short value in vertex array instead of float

I've been trying to squeeze more FPS from the rendering part of Smart Brick. I came across an article which suggests using GL_SHORT instead of GL_FLOAT in vertex array to boost performance:

The solution quite makes sense. Basically you use short value to replace float values; to compensate the precision loss, a pair of additional glScalef and glTranslatef is required per-model.

A reply attached at the end of the post suggests that on iPhone it would be 30% faster. However, this is not the case for Smart Brick; not because the article is wrong, but I think the performance increment depends on actual scenarios. Here is my guess:

If your model contains large amounts of vertices the solution may help a lot. You get big computational savings for using short instead of float, with the price of only one additional glScale and glTranslate calls respectively.

However, it does not help Smart Brick, because Smart Brick renders large amounts of models, each of them contains only few vertices. This way, the savings on float vertices are probably offset by glScale and glTranslate calls, because they are called once per-model, and they are called a lot when there are a lot of models.

No comments:

Post a Comment