Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3853094
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:25:00+00:00 2026-05-19T17:25:00+00:00

I have read that some graphics cards benefit if you align your vertex data

  • 0

I have read that some graphics cards benefit if you align your vertex data to be 32 bytes.

This usually involves adding padding:

typedef struct {
  float x, y, z;
  int padding[5];
} Vertex;

But I have been wondering, does this also mean you should allocate the data to be aligned to 32-bytes (malloc aligns to 1-byte)? Meaning the pointer to the data would divide evenly into 32? Does it matter?

(I am uploading this data to a VBO)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:25:01+00:00Added an answer on May 19, 2026 at 5:25 pm

    Typically, the copy operation from the client memory to the VBO can be faster if the source memory is aligned (the destination typically will be). It somewhat depends on how you do the upload to the VBO.

    That said, the upload will be the only thing that gets boosted by the alignment. Once the memory is in the VBO, it’s the alignment of the VBO server memory (that you don’t control) that matters (GL implementations know this, and they do align the VBO memory).

    Oh, and 32 bytes with 20 bytes padding is just not going to be faster than 16 with 4 bytes of padding. What matters is that you have a power-of-two size, so that a single complete vertex fetch does not straddle cachelines.

    Last, malloc does not align to 1 byte. It aligns at least to the minimum alignment requirement of basic types, which on most platforms is 8.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView that displays some data that is read in at runtime
I have some configuration data in a config file that I read off disk
I have read in some books that the various graphics that make up UIKit
I have read that money_format is not available on windows, and on some Linux
I think I read somewhere that some modules only have object oriented interfaces (
I have read from some article that say's Apple doesn't approve the application which
I am new to ASP.net MVC architecture. I have read in some articles that
I have read that you should keep the number of connections in your database
I have read that for enabling the auto return I have to enable this
I have an app in which I read some gps data and I display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.