ALLEGRO_PRIM_STORAGE(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’… ALLEGRO_PRIM_STORAGE πŸ’…

okay so this is the Allegro 5 API page for ALLEGRO_PRIM_STORAGE, and bestie, it's genuinely iconic β€” it's the enum that tells you how each attribute of a custom vertex gets stored. πŸŽ€

#include <allegro5/allegro_primitives.h>

typedef enum ALLEGRO_PRIM_STORAGE

✨ DESCRIPTION ✨

So ALLEGRO_PRIM_STORAGE enumerates all the types of storage an attribute of a custom vertex can be stored in. πŸ¦‹

Heads up though β€” many of these can only be used for ALLEGRO_PRIM_USER_ATTR attributes, and they can only be accessed via shaders. No cap.

Also usually, no matter what storage you specify, the attribute gets converted to single precision floating point when the shader is run. Literally always. πŸ’« But even so, it can still be advantageous to use more dense storage formats (e.g. ALLEGRO_PRIM_NORMALIZED_UBYTE_4 instead of ALLEGRO_PRIM_FLOAT_4) when bandwidth β€” like, the amount of memory sent to the GPU β€” is an issue but precision is not. iykyk 🌸


πŸŽ€ The Storage Types πŸŽ€

  • 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 is 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 is 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 is 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 is 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 is 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(3) 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(3) will return NULL if you use it on those platforms.

Since: 5.1.6

🫢 bestie pls remember: those two half-float ones are not universal. If your platform doesn't vibe with them, al_create_vertex_decl(3) hands you back NULL. That's your vibe check failing, not a bug. πŸ’€

🌈 SEE ALSO 🌈


okay that's the whole page, mwah πŸ’‹ β€” this was the Allegro reference manual, version/date line: Allegro reference manual, ALLEGRO_PRIM_STORAGE(3). slay, go write some vertices πŸ‘‘βœ¨

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms