Quick question for an opengl guru, I'm in the process of building a render queue and can either reduce the number of shader binding or the number of vertex buffer binding. I just want to know which one is more expensive on newer graphics cards (IE)(opengl >= 3.2)?
-
1\$\begingroup\$ How many shaders vs how many vertex buffers? \$\endgroup\$– HouseCommented Nov 22, 2012 at 23:36
-
3\$\begingroup\$ Profile, benchmark, make an informed decision. \$\endgroup\$– Maximus MinimusCommented Nov 22, 2012 at 23:47
-
\$\begingroup\$ I asked a question somewhat similar/related to this on GameDev.net, which I think you may find interesting. It's not so much about binding buffers, but still relevant. \$\endgroup\$– CornstalksCommented Nov 24, 2012 at 8:44
1 Answer
How exactly your system performs state changes is not part of the OpenGL specification, so perfomrances may vary betwen diffrent vendors and implementations. The only real way to answer your question is simply by testing it. Write a simple test program (or use the the thing you´re currently working on if possible), which performs alot of buffer bindings to reduce shader bindings and then the opposite. Use a high precision clock to measure the time of both test cases and compare.