Sign in to follow this  
jdub

Using padding to make vertex structures align?

Recommended Posts

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).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this