From ffe5f8a1ae577ecbc60b7cc130c07135a662e21a Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Sat, 5 Feb 2011 22:10:48 +0300 Subject: Implement generic GL extension string parser. Split QGL_ParseExtensionString into Com_ParseExtensionString, to be shared between QGL and GLX/WGL subsystems. --- src/qgl_api.c | 44 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) (limited to 'src/qgl_api.c') diff --git a/src/qgl_api.c b/src/qgl_api.c index e9503f3..0ee81a8 100644 --- a/src/qgl_api.c +++ b/src/qgl_api.c @@ -1137,40 +1137,18 @@ void QGL_InitExtensions( unsigned mask ) { #undef GPA -// must match defines in qgl_api.h! -static const char *const extnames[] = { - "GL_EXT_compiled_vertex_array", - "GL_ARB_multitexture", - "GL_EXT_texture_filter_anisotropic", - "GL_ARB_fragment_program", - "GL_ARB_vertex_buffer_object" -}; - -static const int numextnames = sizeof( extnames ) / sizeof( extnames[0] ); - unsigned QGL_ParseExtensionString( const char *s ) { - unsigned mask = 0; - const char *p; - size_t l1, l2; - int i; - - while( *s ) { - p = Q_strchrnul( s, ' ' ); - l1 = p - s; - for( i = 0; i < numextnames; i++ ) { - l2 = strlen( extnames[i] ); - if( l1 == l2 && !memcmp( s, extnames[i], l1 ) ) { - mask |= 1 << i; - break; - } - } - if( !*p ) { - break; - } - s = p + 1; - } - - return mask; + // must match defines in qgl_api.h! + static const char *const extnames[] = { + "GL_EXT_compiled_vertex_array", + "GL_ARB_multitexture", + "GL_EXT_texture_filter_anisotropic", + "GL_ARB_fragment_program", + "GL_ARB_vertex_buffer_object", + NULL + }; + + return Com_ParseExtensionString( s, extnames ); } void QGL_EnableLogging( qboolean enable ) -- cgit v1.2.3