ALLEGRO_PRIM_STORAGE(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ ALLEGRO_PRIM_STORAGE ✨

okay bestie, welcome to the Allegro 5 API</> manual page for ALLEGRO_PRIM_STORAGE πŸ’– this is a glow-up guide to how vertex attribute storage works, and honestly? it's giving very niche but very important πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro5/allegro_primitives.h>

typedef enum ALLEGRO_PRIM_STORAGE

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically this enum lists all the types of storage</> that an attribute of a custom vertex can live in πŸ’Ύ. Heads up though β€” a lot of these can only be used for ALLEGRO_PRIM_USER_ATTR attributes, and you can only get at them through shaders 🧚. And usually, no matter which storage you pick, the attribute gets converted to single precision floating point when the shader runs. lowkey unavoidable.

But here's the tea β˜•: even with that conversion happening, it can still be worth using denser storage formats β€” like ALLEGRO_PRIM_NORMALIZED_UBYTE_4 instead of ALLEGRO_PRIM_FLOAT_4 β€” when bandwidth</> (aka the amount of memory sent to the GPU) is the problem, but precision isn't 🫢. slay.


  • ALLEGRO_PRIM_FLOAT_1 β€” a single float πŸ“

Since: 5.1.6

  • ALLEGRO_PRIM_FLOAT_2 β€” a doublet of floats
  • ALLEGRO_PRIM_FLOAT_3 β€” a triplet of floats
  • ALLEGRO_PRIM_FLOAT_4 β€” a quad of floats πŸ“

Since: 5.1.6

  • ALLEGRO_PRIM_SHORT_2 β€” a doublet of shorts
  • ALLEGRO_PRIM_SHORT_4 β€” a quad of shorts πŸ“

Since: 5.1.6

  • ALLEGRO_PRIM_UBYTE_4 β€” a quad of unsigned bytes πŸ“

Since: 5.1.6

  • ALLEGRO_PRIM_NORMALIZED_SHORT_2 β€” a doublet of shorts. before being sent to the shader, each component gets divided by 32767 ✨. each component of the resultant float doublet ranges between -1.0 and 1.0

Since: 5.1.6

  • ALLEGRO_PRIM_NORMALIZED_SHORT_4 β€” a quad of shorts. before being sent to the shader, each component gets divided by 32767 ✨. each component of the resultant float quad ranges between -1.0 and 1.0

Since: 5.1.6

  • ALLEGRO_PRIM_NORMALIZED_UBYTE_4 β€” a quad of unsigned bytes. before being sent to the shader, each component gets divided by 255 ✨. each component of the resultant float quad ranges between 0.0 and 1.0

Since: 5.1.6

  • ALLEGRO_PRIM_NORMALIZED_USHORT_2 β€” a doublet of unsigned shorts. before being sent to the shader, each component gets divided by 65535 ✨. each component of the resultant float doublet ranges between 0.0 and 1.0

Since: 5.1.6

  • ALLEGRO_PRIM_NORMALIZED_USHORT_4 β€” a quad of unsigned shorts. before being sent to the shader, each component gets divided by 65535 ✨. each component of the resultant float quad ranges between 0.0 and 1.0

Since: 5.1.6

  • ALLEGRO_PRIM_HALF_FLOAT_2 β€” a doublet of half-precision floats. ⚠️ note that this storage format is not supported on all platforms. al_create_vertex_decl(3alleg5) will return NULL if you use it on those platforms 😭

Since: 5.1.6

  • ALLEGRO_PRIM_HALF_FLOAT_4 β€” a quad of half-precision floats. ⚠️ note that this storage format is not supported on all platforms. al_create_vertex_decl(3alleg5) will return NULL if you use it on those platforms 😭

Since: 5.1.6

🫢 reminder bestie: those HALF_FLOAT ones are the risky queens β€” if your platform doesn't fw them, al_create_vertex_decl(3alleg5) hits you with a NULL. no cap.

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie πŸ’œ</> this came straight out of the Allegro reference manual β€” ALLEGRO_PRIM_STORAGE(3alleg5) β€” go forth and declare your vertices with main character energy πŸŒˆβ­πŸ’…

πŸ“¦ where this page comes from