1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::lib::*;

macro_rules! impl_type {
	($t: ty, $for: ty, $f: ident) => {
		impl $t for $for {
			const TYPE: GLenum = gl::$f;
		}
	};
}

pub trait IdxType: TrivialBound {
	const TYPE: GLenum;
}
impl_type!(IdxType, u8, UNSIGNED_BYTE);
impl_type!(IdxType, u16, UNSIGNED_SHORT);
impl_type!(IdxType, u32, UNSIGNED_INT);

pub trait AttrType: TrivialBound {
	const TYPE: GLenum;
}
impl_type!(AttrType, i8, BYTE);
impl_type!(AttrType, u8, UNSIGNED_BYTE);
impl_type!(AttrType, i16, SHORT);
impl_type!(AttrType, u16, UNSIGNED_SHORT);
impl_type!(AttrType, i32, INT);
impl_type!(AttrType, u32, UNSIGNED_INT);
impl_type!(AttrType, f16, HALF_FLOAT);
impl_type!(AttrType, f32, FLOAT);
impl_type!(AttrType, f64, DOUBLE);