Using padding to make vertex structures align?

Started by
2 comments, last by Jason Z 10 years, 7 months ago

Forgive me if I have things totally wrong here as I'm not too informed on this subject. I was wondering if it makes a performance difference to add extra padding to my vertex structures to make them align along 32bit boundaries?

I'm running a 64bit system so I'm not sure if it would matter (adding enough padding to make my vertex structures align along a 64bit boundary seems like an absurd waste of memory to me).

J.W.
Advertisement

On some GPUs, 32-byte aligned vertices will shave a few cycles off each execution of your vertex shader. On other GPUs, there will be no difference.

Try it out and profile the difference cool.png


I'm running a 64bit system
This kind of "optimisation" is targeted at your GPU's vertex-cache hardware, so the kind of CPU that you're using won't be relevant.

In my experience, padding was irrelevant on most, if not all hardware I tested.

That said, I stopped collecting so accurate data a few years ago as the hardware grown far beyond my necessities. If there's not enough workload then there's nothing to measure. I usually spend 10-15% on vertex transform so I sure wanted to focus on pixel techniques.

Whatever this will be your case it's an open question but I suggest to just move along.

Previously "Krohm"

Why not just try it out? Build a scene that will be super heavy on vertex processing (i.e. one vertex per pixel or something like that) and see if the alignment makes any difference. We can give you our opinions, but unless you try it out for yourself you won't know for sure if it will affect your engine/application or not.

That's just how I would approach it...

This topic is closed to new replies.

Advertisement