--- /dev/null
+#include <stdexcept>
+#include "datatype.h"
+
+using namespace std;
+
+namespace Msp {
+namespace GL {
+
+unsigned get_type_size(DataType type)
+{
+ switch(type)
+ {
+ case BYTE:
+ case UNSIGNED_BYTE: return 1;
+ case SHORT:
+ case UNSIGNED_SHORT:
+ case HALF_FLOAT: return 2;
+ case INT:
+ case UNSIGNED_INT:
+ case FLOAT: return 4;
+ default: throw invalid_argument("get_type_size");
+ }
+}
+
+} // namespace GL
+} // namespace Msp