diff options
author | Omniscient <omniscient.oce@gmail.com> | 2024-05-20 10:43:32 +1000 |
---|---|---|
committer | Omniscient <omniscient.oce@gmail.com> | 2024-05-20 10:43:32 +1000 |
commit | af65a3d6c3b5ed750af5bf08e04a4c7e4d0da239 (patch) | |
tree | 6d0ada237b9350ce6ed16beccba2ac5a8895a20f /src/renderer/ral.c | |
parent | 142d34d679e29d434fdd5ff369ed88240bbe8083 (diff) |
cleanup ral.h
Diffstat (limited to 'src/renderer/ral.c')
-rw-r--r-- | src/renderer/ral.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/renderer/ral.c b/src/renderer/ral.c index 304017d..2ae7c23 100644 --- a/src/renderer/ral.c +++ b/src/renderer/ral.c @@ -1 +1,34 @@ #include "ral.h" + +size_t vertex_attrib_size(vertex_attrib_type attr) { + switch (attr) { + case ATTR_F32: + case ATTR_U32: + case ATTR_I32: + return 4; + case ATTR_F32x2: + case ATTR_U32x2: + case ATTR_I32x2: + return 8; + case ATTR_F32x3: + case ATTR_U32x3: + case ATTR_I32x3: + return 12; + case ATTR_F32x4: + case ATTR_U32x4: + case ATTR_I32x4: + return 16; + break; + } +} + +void vertex_desc_add(vertex_description* builder, const char* name, vertex_attrib_type type) { + u32 i = builder->attributes_count; + + size_t size = vertex_attrib_size(type); + builder->attributes[i] = type; + builder->stride += size; + builder->attr_names[i] = name; + + builder->attributes_count++; +} |