PDA

View Full Version : One Buffer Vs. Multiple Buffers...



tmason
09-04-2014, 08:49 AM
Hello,

Consider this a consultation of opinion question:

Is it better to use one interleaved buffer for multiple buffers for vertex/normal/UV data?

Was reading this question and response here: http://stackoverflow.com/questions/12245687/does-using-one-buffer-for-vertices-uvs-and-normals-in-opengl-perform-better-tha

Just seeing what is better; I have implemented both but my framerate was high enough in both cases where I didn't notice a big difference.

Thank you for your time.

Yandersen
09-04-2014, 12:34 PM
Interleaving all in one buffer is always better because it causes sequential access to the memory which is good for caching.
In most cases there might be no difference, or slight difference, but one thing is solid: interleaved arrays will never work slower than separated ones. So always use it this way and have your mind free. :)

Ed Daenar
09-04-2014, 01:40 PM
Interleaving all in one buffer is always better because it causes sequential access to the memory which is good for caching.
In most cases there might be no difference, or slight difference, but one thing is solid: interleaved arrays will never work slower than separated ones. So always use it this way and have your mind free. :)

Non interleaved arrays can potentially save bandwith when rendering geometry with shaders that don't use the complete set of attributes (classic example is depth rendering).

I'm afraid the answer is not as clear.

Since you have implemented both, my only advice is to keep developing to the point where you need to start worrying about performance and then profile, profile and profile more. It might as well be that in your implementation one way beats the other or, if your bottleneck is somewhere else, you may not even notice a difference during profiling.