PDA

View Full Version : Number of elements in VBO is a multiple of 4 => performance improvement



Cornix
12-17-2013, 03:17 AM
Hi,

I was experiementing recently and I found out that the performance of my rendering improved when I had 4 texcoords instead of 2 and x, y, z, 1 instead of just x, y, z.
My question is, is this just coincidence or maybe my own hardware that has this quirk, or is it a general rule of thumb, that you should always have multiples of 4 as vertex data?

Thank you in advance.

tonyo_au
12-17-2013, 03:37 PM
Current gpu hardware is based on multiples of 4 floats. AFAIK the transfer from system memory to gpu memory is not. So it is possible that you see an improvement but you can also loose performance by transferring unnecessary data along the memory bus.
As you will read time and again here, you have to do a lot of your own performance measurements because your individual data can determine the best options to choose.

My rule of thumb is that I pack data into multiples of 4 whenever I can but I don't transfer empty data. So for example I will look to put something useful into vertex.w like colour specular.

Cornix
12-20-2013, 08:44 AM
Okay, thank you for the information.