checking if its already binded?

Started by
0 comments, last by samoth 15 years, 11 months ago
sometimes when ur rendering alot of stuff u usually do a unnecessary bind for a texture or some buffer... since its already binded... how large of a performance penalty is it to "rebind" something thats all ready binded to the renderdevice? is it a good idea to keep track of what texture/buffer is currently binded and only bind if the one u want to bind differs from the currently binded?
Advertisement
Binding a texture (or buffer) that's already bound has the same call overhead as every other command. DirectX calls as such have been known to be quite expensive for a long time, although I'm told that DX10 is a lot more efficient (haven't seen, can't tell). In OpenGL, it's not an issue.
Apart from that, it should have no measurable overhead, unless the driver writer was high.

If you only use only a small set of textures/buffers/whatever and the driver is reasonably smart, it is even possible that binding a different texture is a free (or almost free) operation. Graphic cards have a certain number of render state sets. If you don't exceed that limit, binding is (more or less) free.
The bad news is that there is no way of knowing if-when-what-how-many. The APIs doesn't have provisions to query such information.
Therefore, it's a good idea to assume that needless binding may always be expensive and avoid it when you can (you won't be able to avoid all of them anyway).

This topic is closed to new replies.

Advertisement