#[cfg(not(feature="webgl"))]
macro_rules! from_c_str{
($c_string: expr) => (
{
use std::ffi::CStr;
use std::str;
str::from_utf8(CStr::from_ptr($c_string).to_bytes()).unwrap()
}
);
}
#[cfg(not(feature="webgl"))]
macro_rules! to_c_str{
($string: expr) => (
{
use std::ffi::CString;
CString::new($string).unwrap().as_ptr()
}
);
}
#[cfg(feature="webgl")]
macro_rules! to_c_str{
($string: expr) => (
{
$string
}
);
}
#[macro_export]
macro_rules! impl_to_attribute_format{
($struct_name:ty, $($field_name:ident),+) => (
impl $crate::ToAttributesFormats for $struct_name{
#[allow(unused_assignments)]
fn attributes_formats(bindings: &$crate::attributes::Bindings) -> Vec<$crate::attributes::Format>{
use $crate::attributes::Type as AttrType;
use std::convert::AsRef;
trait TypeToAttrType{
fn to_attr_type(&self) -> AttrType;
fn num_coords(&self) -> usize;
}
impl<'a> TypeToAttrType for &'a [u8]{
fn to_attr_type(&self) -> AttrType{
AttrType::U8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i8]{
fn to_attr_type(&self) -> AttrType{
AttrType::I8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u16]{
fn to_attr_type(&self) -> AttrType{
AttrType::U16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i16]{
fn to_attr_type(&self) -> AttrType{
AttrType::I16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u32]{
fn to_attr_type(&self) -> AttrType{
AttrType::U32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i32]{
fn to_attr_type(&self) -> AttrType{
AttrType::I32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f32]{
fn to_attr_type(&self) -> AttrType{
AttrType::Float
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f64]{
fn to_attr_type(&self) -> AttrType{
AttrType::Double
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u8;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::U8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i8;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::I8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u16;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::U16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i16;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::I16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u32;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::U32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i32;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::I32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f32;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::Float
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f64;1]{
fn to_attr_type(&self) -> AttrType{
AttrType::Double
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u8;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::U8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i8;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::I8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u16;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::U16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i16;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::I16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u32;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::U32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i32;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::I32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f32;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::Float
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f64;2]{
fn to_attr_type(&self) -> AttrType{
AttrType::Double
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u8;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::U8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i8;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::I8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u16;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::U16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i16;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::I16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u32;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::U32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i32;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::I32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f32;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::Float
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f64;3]{
fn to_attr_type(&self) -> AttrType{
AttrType::Double
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u8;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::U8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i8;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::I8
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u16;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::U16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i16;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::I16
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [u32;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::U32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [i32;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::I32
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f32;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::Float
}
fn num_coords(&self) -> usize{
self.len()
}
}
impl<'a> TypeToAttrType for &'a [f64;4]{
fn to_attr_type(&self) -> AttrType{
AttrType::Double
}
fn num_coords(&self) -> usize{
self.len()
}
}
trait MatTypeToAttrType{
fn to_attr_type(&self) -> AttrType;
fn cols(&self) -> usize;
fn rows(&self) -> usize;
}
impl<'a> MatTypeToAttrType for &'a [[f32;4];4]{
fn to_attr_type(&self) -> AttrType{
AttrType::Float
}
fn cols(&self) -> usize{
4
}
fn rows(&self) -> usize{
4
}
}
trait AutoRef<T: ?Sized>{
fn reference(&self) -> &T;
}
impl AutoRef<[u8;1]> for u8{
fn reference(&self) -> &[u8;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[u8;2]>> AutoRef<[u8;2]> for T{
fn reference(&self) -> &[u8;2]{
self.as_ref()
}
}
impl<T: AsRef<[u8;3]>> AutoRef<[u8;3]> for T{
fn reference(&self) -> &[u8;3]{
self.as_ref()
}
}
impl<T: AsRef<[u8;4]>> AutoRef<[u8;4]> for T{
fn reference(&self) -> &[u8;4]{
self.as_ref()
}
}
impl<T: AsRef<[u8]>> AutoRef<[u8]> for T{
fn reference(&self) -> &[u8]{
self.as_ref()
}
}
impl AutoRef<[i8;1]> for i8{
fn reference(&self) -> &[i8;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[i8;2]>> AutoRef<[i8;2]> for T{
fn reference(&self) -> &[i8;2]{
self.as_ref()
}
}
impl<T: AsRef<[i8;3]>> AutoRef<[i8;3]> for T{
fn reference(&self) -> &[i8;3]{
self.as_ref()
}
}
impl<T: AsRef<[i8;4]>> AutoRef<[i8;4]> for T{
fn reference(&self) -> &[i8;4]{
self.as_ref()
}
}
impl<T: AsRef<[i8]>> AutoRef<[i8]> for T{
fn reference(&self) -> &[i8]{
self.as_ref()
}
}
impl AutoRef<[u16;1]> for u16{
fn reference(&self) -> &[u16;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[u16;2]>> AutoRef<[u16;2]> for T{
fn reference(&self) -> &[u16;2]{
self.as_ref()
}
}
impl<T: AsRef<[u16;3]>> AutoRef<[u16;3]> for T{
fn reference(&self) -> &[u16;3]{
self.as_ref()
}
}
impl<T: AsRef<[u16;4]>> AutoRef<[u16;4]> for T{
fn reference(&self) -> &[u16;4]{
self.as_ref()
}
}
impl<T: AsRef<[u16]>> AutoRef<[u16]> for T{
fn reference(&self) -> &[u16]{
self.as_ref()
}
}
impl AutoRef<[i16;1]> for i16{
fn reference(&self) -> &[i16;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[i16;2]>> AutoRef<[i16;2]> for T{
fn reference(&self) -> &[i16;2]{
self.as_ref()
}
}
impl<T: AsRef<[i16;3]>> AutoRef<[i16;3]> for T{
fn reference(&self) -> &[i16;3]{
self.as_ref()
}
}
impl<T: AsRef<[i16;4]>> AutoRef<[i16;4]> for T{
fn reference(&self) -> &[i16;4]{
self.as_ref()
}
}
impl<T: AsRef<[i16]>> AutoRef<[i16]> for T{
fn reference(&self) -> &[i16]{
self.as_ref()
}
}
impl AutoRef<[u32;1]> for u32{
fn reference(&self) -> &[u32;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[u32;2]>> AutoRef<[u32;2]> for T{
fn reference(&self) -> &[u32;2]{
self.as_ref()
}
}
impl<T: AsRef<[u32;3]>> AutoRef<[u32;3]> for T{
fn reference(&self) -> &[u32;3]{
self.as_ref()
}
}
impl<T: AsRef<[u32;4]>> AutoRef<[u32;4]> for T{
fn reference(&self) -> &[u32;4]{
self.as_ref()
}
}
impl<T: AsRef<[u32]>> AutoRef<[u32]> for T{
fn reference(&self) -> &[u32]{
self.as_ref()
}
}
impl AutoRef<[i32;1]> for i32{
fn reference(&self) -> &[i32;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[i32;2]>> AutoRef<[i32;2]> for T{
fn reference(&self) -> &[i32;2]{
self.as_ref()
}
}
impl<T: AsRef<[i32;3]>> AutoRef<[i32;3]> for T{
fn reference(&self) -> &[i32;3]{
self.as_ref()
}
}
impl<T: AsRef<[i32;4]>> AutoRef<[i32;4]> for T{
fn reference(&self) -> &[i32;4]{
self.as_ref()
}
}
impl<T: AsRef<[i32]>> AutoRef<[i32]> for T{
fn reference(&self) -> &[i32]{
self.as_ref()
}
}
impl AutoRef<[f32;1]> for f32{
fn reference(&self) -> &[f32;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[f32;2]>> AutoRef<[f32;2]> for T{
fn reference(&self) -> &[f32;2]{
self.as_ref()
}
}
impl<T: AsRef<[f32;3]>> AutoRef<[f32;3]> for T{
fn reference(&self) -> &[f32;3]{
self.as_ref()
}
}
impl<T: AsRef<[f32;4]>> AutoRef<[f32;4]> for T{
fn reference(&self) -> &[f32;4]{
self.as_ref()
}
}
impl<T: AsRef<[f32]>> AutoRef<[f32]> for T{
fn reference(&self) -> &[f32]{
self.as_ref()
}
}
impl AutoRef<[f64;1]> for f64{
fn reference(&self) -> &[f64;1]{
unsafe{
::std::mem::transmute(self)
}
}
}
impl<T: AsRef<[f64;2]>> AutoRef<[f64;2]> for T{
fn reference(&self) -> &[f64;2]{
self.as_ref()
}
}
impl<T: AsRef<[f64;3]>> AutoRef<[f64;3]> for T{
fn reference(&self) -> &[f64;3]{
self.as_ref()
}
}
impl<T: AsRef<[f64;4]>> AutoRef<[f64;4]> for T{
fn reference(&self) -> &[f64;4]{
self.as_ref()
}
}
impl<T: AsRef<[f64]>> AutoRef<[f64]> for T{
fn reference(&self) -> &[f64]{
self.as_ref()
}
}
impl<T: AsRef<[[f32;4];4]>> AutoRef<[[f32;4];4]> for T{
fn reference(&self) -> &[[f32;4];4]{
self.as_ref()
}
}
trait ToFormats<T: ?Sized>{
fn to_formats(&self, name: &str, offset: usize, location: Option<u32>) -> Vec<$crate::attributes::Format>;
}
impl<T: TypeToAttrType> ToFormats<TypeToAttrType> for T{
fn to_formats(&self, name: &str, offset: usize, location: Option<u32>) -> Vec<$crate::attributes::Format>{
location.map(|location|{
let ty = self.to_attr_type();
$crate::attributes::Format{
name: name.to_string(),
location: location,
src_type: ty,
dst_type: ty,
num_coords: self.num_coords(),
offset_in_vertex: offset,
normalize: false,
}
})
.into_iter()
.collect()
}
}
impl<T: MatTypeToAttrType> ToFormats<MatTypeToAttrType> for T{
fn to_formats(&self, name: &str, offset: usize, location: Option<u32>) -> Vec<$crate::attributes::Format>{
location.map(|location|{
$crate::attributes::MatFormat{
name: name.to_string(),
location: location,
cols: self.cols(),
rows: self.rows(),
offset_in_vertex: offset,
}.to_row_formats()
})
.into_iter()
.flat_map(|row_formats| row_formats)
.collect()
}
}
let dummy: &$struct_name = unsafe { ::std::mem::transmute(0usize) };
let mut offset = 0;
let mut field_offset = 0;
let vec_of_vec = vec![$(
{
let autoattr = dummy.$field_name.reference();
let name = stringify!($field_name);
let location = bindings.attribute_location(name);
offset += field_offset;
field_offset = ::std::mem::size_of_val(&dummy.$field_name);
autoattr.to_formats(name, offset, location)
},
)+];
vec_of_vec
.into_iter()
.flat_map(|vec| vec.into_iter())
.collect()
}
}
);
($struct_name:ty, $($field_name:ident),+,) => (
impl_to_attribute_format!($struct_name, $($field_name),+);
);
}
#[macro_export]
macro_rules! attribute_format_by_name{
($struct_name:ty, $field_name:ident, $bindings:expr) => (
{
struct AuxStruct{
$field_name: $struct_name,
}
impl_to_attribute_format!(AuxStruct, $field_name);
AuxStruct::attributes_formats($bindings)
}
)
}
#[derive(Copy,Clone,Debug,PartialEq,Eq,Ord,PartialOrd)]
pub struct Rect{
pub left: u32,
pub bottom: u32,
pub width: u32,
pub height: u32,
}
pub trait Color<T: ?Sized>{
fn as_slice(&self) -> &[f32;4];
}
impl<T: AsRef<[f32;4]> + ?Sized> Color<dyn AsRef<[f32;4]>> for T{
fn as_slice(&self) -> &[f32;4]{
self.as_ref()
}
}
impl Color<[f32;4]> for [f32;4]{
fn as_slice(&self) -> &[f32;4]{
self
}
}
use gl::{self, types::*};
#[cfg(all(not(feature = "gles"), not(feature="webgl")))]
pub fn gl_format_from_internal(internal: GLenum) -> Option<GLenum>{
match internal {
gl::RGBA | gl::RGBA8 | gl::RGBA16 | gl::RGBA16F |
gl::RGBA16I | gl::RGBA16UI | gl::RGBA32F | gl::RGBA32I | gl::RGBA32UI => Some(gl::RGBA),
gl::RGB | gl::RGB8 | gl::RGB16 | gl::RGB16F |
gl::RGB16I | gl::RGB16UI | gl::RGB32F | gl::RGB32I | gl::RGB32UI => Some(gl::RGB),
gl::DEPTH_STENCIL => Some(gl::DEPTH_STENCIL),
gl::DEPTH_COMPONENT | gl::DEPTH_COMPONENT16 |
gl::DEPTH_COMPONENT24 | gl::DEPTH_COMPONENT32 => Some(gl::DEPTH_COMPONENT),
gl::STENCIL_INDEX => Some(gl::STENCIL_INDEX),
gl::R8 | gl::R16 | gl::R16I | gl::R16UI |
gl::R16F | gl::R32F | gl::R32I | gl::R32UI => Some(gl::RED),
gl::RG8 | gl::RG16 | gl::RG16I | gl::RG16UI |
gl::RG16F | gl::RG32F | gl::RG32I | gl::RG32UI => Some(gl::RG),
_ => None
}
}
#[cfg(any(feature = "gles", feature="webgl"))]
pub fn gl_format_from_internal(internal: GLenum) -> Option<GLenum>{
use gl::*;
let format = match internal{
RGB => RGB,
RGBA => RGBA,
LUMINANCE_ALPHA => LUMINANCE_ALPHA,
LUMINANCE => LUMINANCE,
ALPHA => ALPHA,
R8 => RED,
R16F => RED,
R32F => RED,
R8UI | R16I | R16UI | R32I | R32UI => RED_INTEGER,
RG8 => RG,
RG16F => RG,
RG32F => RG,
RG8UI | RG16I | RG16UI | RG32I | RG32UI => RG_INTEGER,
RGB8 => RGB,
SRGB8 => RGB,
RGB565 => RGB,
R11F_G11F_B10F => RGB,
RGB9_E5 => RGB,
RGB16F => RGB,
RGB32F => RGB,
RGB8UI | RGB16I | RGB16UI | RGB32I | RGB32UI => RGB_INTEGER,
RGBA8 => RGBA,
SRGB8_ALPHA8 => RGBA,
RGB5_A1 => RGBA,
RGB10_A2 => RGBA,
RGBA4 => RGBA,
RGBA16F => RGBA,
RGBA32F => RGBA,
RGBA8UI | RGBA16I | RGBA16UI | RGBA32I | RGBA32UI => RGBA_INTEGER,
DEPTH_STENCIL => DEPTH_STENCIL,
DEPTH_COMPONENT | DEPTH_COMPONENT16 | DEPTH_COMPONENT24 | DEPTH_COMPONENT32F => DEPTH_COMPONENT,
_ => panic!("format unsupported"),
};
Some(format)
}
#[cfg(all(not(feature = "gles"), not(feature="webgl")))]
pub fn gl_type_from_internal(internal: GLenum) -> Option<GLenum>{
match internal {
gl::RGB | gl::RGBA | gl::R8 | gl::RG8 | gl::RGB8 | gl::RGBA8 => Some(gl::UNSIGNED_BYTE),
gl::R16F | gl::RG16F | gl::RGB16F | gl::RGBA16F | gl::R32F | gl::RG32F | gl::RGB32F |
gl::RGBA32F | gl::R16 | gl::RG16 | gl::RGB16 | gl::RGBA16 => Some(gl::FLOAT),
gl::DEPTH_STENCIL => Some(gl::UNSIGNED_INT_24_8),
gl::DEPTH_COMPONENT | gl::DEPTH_COMPONENT16 | gl::R16UI | gl::RG16UI |
gl::RGB16UI | gl::RGBA16UI => Some(gl::UNSIGNED_SHORT),
gl::R16I | gl::RG16I | gl::RGB16I | gl::RGBA16I => Some(gl::SHORT),
gl::DEPTH_COMPONENT24 | gl::DEPTH_COMPONENT32 | gl::R32UI | gl::RG32UI |
gl::RGB32UI | gl::RGBA32UI => Some(gl::UNSIGNED_INT),
gl::R32I | gl::RG32I | gl::RGB32I | gl::RGBA32I => Some(gl::INT),
gl::STENCIL_INDEX => Some(gl::UNSIGNED_BYTE),
_ => None
}
}
#[cfg(feature = "gles")]
pub fn gl_type_from_internal(internal: GLenum) -> Option<GLenum>{
match internal {
gl::RGB | gl::RGBA | gl::R8 | gl::RG8 | gl::RGB8 | gl::RGBA8 | gl::LUMINANCE | gl::LUMINANCE_ALPHA => Some(gl::UNSIGNED_BYTE),
gl::R16F | gl::RG16F | gl::RGB16F | gl::RGBA16F | gl::R32F | gl::RG32F | gl::RGB32F |
gl::RGBA32F | gl::DEPTH_COMPONENT32F => Some(gl::FLOAT),
gl::DEPTH_STENCIL => Some(gl::UNSIGNED_INT_24_8),
gl::DEPTH_COMPONENT | gl::DEPTH_COMPONENT16 | gl::R16UI | gl::RG16UI |
gl::RGB16UI | gl::RGBA16UI => Some(gl::UNSIGNED_SHORT),
gl::R16I | gl::RG16I | gl::RGB16I | gl::RGBA16I => Some(gl::SHORT),
gl::DEPTH_COMPONENT24 | gl::R32UI | gl::RG32UI |
gl::RGB32UI | gl::RGBA32UI => Some(gl::UNSIGNED_INT),
gl::R32I | gl::RG32I | gl::RGB32I | gl::RGBA32I => Some(gl::INT),
gl::STENCIL_INDEX => Some(gl::UNSIGNED_BYTE),
_ => None
}
}
#[cfg(feature="webgl")]
pub fn gl_type_from_internal(internal: GLenum) -> Option<GLenum>{
match internal {
gl::RGB | gl::RGBA | gl::R8 | gl::RG8 | gl::RGB8 | gl::RGBA8 | gl::LUMINANCE | gl::LUMINANCE_ALPHA => Some(gl::UNSIGNED_BYTE),
gl::R16F | gl::RG16F | gl::RGB16F | gl::RGBA16F | gl::R32F | gl::RG32F | gl::RGB32F |
gl::RGBA32F | gl::DEPTH_COMPONENT32F => Some(gl::FLOAT),
gl::DEPTH_STENCIL => Some(gl::UNSIGNED_INT_24_8),
gl::DEPTH_COMPONENT | gl::DEPTH_COMPONENT16 | gl::R16UI | gl::RG16UI |
gl::RGB16UI | gl::RGBA16UI => Some(gl::UNSIGNED_SHORT),
gl::R16I | gl::RG16I | gl::RGB16I | gl::RGBA16I => Some(gl::SHORT),
gl::DEPTH_COMPONENT24 | gl::R32UI | gl::RG32UI |
gl::RGB32UI | gl::RGBA32UI => Some(gl::UNSIGNED_INT),
gl::R32I | gl::RG32I | gl::RGB32I | gl::RGBA32I => Some(gl::INT),
gl::STENCIL_INDEX8 => Some(gl::UNSIGNED_BYTE),
_ => None
}
}