X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fdatatype.cpp;h=4dd0b89fc2f8a2e7bd6c86bd75e9fd3465c4cbc3;hb=26634147dfbb5be9a4046a0d50b3b1d6857ad68d;hp=c43b8f44315432847e8d93ba55776ebb434d770f;hpb=e5881460cb0c2541fda9ff0b823d5ca1e0ecb986;p=libs%2Fgl.git diff --git a/source/core/datatype.cpp b/source/core/datatype.cpp index c43b8f44..4dd0b89f 100644 --- a/source/core/datatype.cpp +++ b/source/core/datatype.cpp @@ -88,11 +88,30 @@ namespace GL { GLenum get_gl_type(DataType type) { - const MappedType *ptr = lower_bound(type_map, type_map+type_map_size, type, type_compare); - if(ptr->type!=type) + const MappedType *end = type_map+type_map_size; + const MappedType *ptr = lower_bound(type_map, end, type, type_compare); + if(ptr==end || ptr->type!=type) throw invalid_argument("get_gl_type"); return ptr->gl_type; } +DataType from_gl_type(GLenum gl_type) +{ + for(unsigned i=0; i>12)&3)+1; + unsigned cols = ((type>>14)&4)+1; + if(rows>1 && cols>1 && rows!=cols) + static Require _req(NV_non_square_matrices); + if((type&0x200) && get_type_size(type)/(rows*cols)==8) + static Require _req(ARB_gpu_shader_fp64); +} + } // namespace GL } // namespace Msp