Jump to content

  • Log In with Google      Sign In   
  • Create Account

Using padding to make vertex structures align?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 jdub   Members   -  Reputation: 419

Like
1Likes
Like

Posted 25 August 2013 - 11:29 PM

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.

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31830

Like
4Likes
Like

Posted 25 August 2013 - 11:43 PM

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.

#3 Krohm   Crossbones+   -  Reputation: 3249

Like
3Likes
Like

Posted 26 August 2013 - 12:08 AM

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.



#4 Jason Z   Crossbones+   -  Reputation: 5344

Like
5Likes
Like

Posted 26 August 2013 - 05:08 AM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS