ALLEGRO_PRIM_STORAGE(3)
π 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 floatsALLEGRO_PRIM_FLOAT_3β a triplet of floatsALLEGRO_PRIM_FLOAT_4β a quad of floats
Since: 5.1.6
ALLEGRO_PRIM_SHORT_2β a doublet of shortsALLEGRO_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 by32767. Each component of the resultant float doublet ranges between-1.0and1.0
Since: 5.1.6
ALLEGRO_PRIM_NORMALIZED_SHORT_4β a quad of shorts. Before being sent to the shader, each component is divided by32767. Each component of the resultant float quad ranges between-1.0and1.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 by255. Each component of the resultant float quad ranges between0.0and1.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 by65535. Each component of the resultant float doublet ranges between0.0and1.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 by65535. Each component of the resultant float quad ranges between0.0and1.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 returnNULLif 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 returnNULLif 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 backNULL. 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