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

  • Home
  • SEARCH
  • 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 read on Stack Overflow some people that have converting to C#2.0 to
I have read in some of the ClickOnce posts that ClickOnce does not allow
I just got Delphi 2009 and have previously read some articles about modifications that
I have an application that displays some graphics based on the properties of an
For some graphics work I need to read in a large amount of data
I have often read that some programming languages are clear than others and I
I have read that using database keys in a URL is a bad thing
I have read that while plug-ins are not supported for SQL Server Management Studio,
I have read that private variables in a base class are technically inherited by
Apparently I can't move files on different volumes using Directory.Move. I have read that

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.