grafix_toolbox/kit/opengl/buffer/
format.rs1use crate::lib::*;
2
3macro_rules! impl_type {
4 ($t: ty, $for: ty, $f: ident) => {
5 impl $t for $for {
6 const TYPE: GLenum = gl::$f;
7 }
8 };
9}
10
11pub trait IdxType: TrivialBound {
12 const TYPE: GLenum;
13}
14impl_type!(IdxType, u8, UNSIGNED_BYTE);
15impl_type!(IdxType, u16, UNSIGNED_SHORT);
16impl_type!(IdxType, u32, UNSIGNED_INT);
17
18pub trait AttrType: TrivialBound {
19 const TYPE: GLenum;
20}
21impl_type!(AttrType, i8, BYTE);
22impl_type!(AttrType, u8, UNSIGNED_BYTE);
23impl_type!(AttrType, i16, SHORT);
24impl_type!(AttrType, u16, UNSIGNED_SHORT);
25impl_type!(AttrType, i32, INT);
26impl_type!(AttrType, u32, UNSIGNED_INT);
27impl_type!(AttrType, f16, HALF_FLOAT);
28impl_type!(AttrType, f32, FLOAT);
29impl_type!(AttrType, f64, DOUBLE);