Collada2Pod 4-Byte Aligned Padding with GL_SHORT

This topic contains 1 reply, has 1 voice, and was last updated by  dbh 6 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30636

    dbh
    Member

    I switched several months back to GL_SHORT instead of GL_FLOAT for my vertex attributes. I just now realized in my profiling that I’m getting a warning that my vertex attributes (specifically my Normals) are not 4-byte aligned properly. I’ve checked my settings, and everything seems correct. I’m moments away from writing a run-time resort on load of the vertex data (which stinks, but I need the performance this should give).

    Can someone check my settings to make sure I’m doing this right? Looking at the pInterleaved data, it looks like it’s doing:

    Position coords first (X, Y, Z, each 2 bytes, total of 6 bytes) – No padding (I’d like 2 bytes padding here)

    UV coords second (U, V, each 2 bytes, total of 4 bytes) – No padding (this is correct)

    Normal coords last (X, Y, Z, each 2 bytes, total of 6 bytes) – No padding (again, would like 2 bytes padding here).

    The stride currently is 16 bytes, but in my byte-aligned world I’d expect it to be 20 bytes, right?

    Any thoughts? Am I missing something really simple?

    #35110

    dbh
    Member

    I ended up writing realloc method that takes the pInterleaved vertex attribute data and realigns it on 4-byte boundaries. This did result in a minor performance boost. If this is a bug (or there’s a better way with the exporting tool), please let me know – I’d love to not have to do this for every 3D model I load at load-time.

    Love the tools, by the way – going with PVR’s SDK was the best decision I made for this engine. Great performance and really easy to use.

    Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.