summaryrefslogtreecommitdiff
path: root/src/qgl_api.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2011-02-05 22:10:48 +0300
committerAndrey Nazarov <skuller@skuller.net>2011-02-05 23:34:40 +0300
commitffe5f8a1ae577ecbc60b7cc130c07135a662e21a (patch)
treeab5bd729270e408720cd901741b93c2eca5f9d8c /src/qgl_api.c
parentd638b00fb17e1abef14cac8f09c6f2c801a6b6f1 (diff)
Implement generic GL extension string parser.
Split QGL_ParseExtensionString into Com_ParseExtensionString, to be shared between QGL and GLX/WGL subsystems.
Diffstat (limited to 'src/qgl_api.c')
-rw-r--r--src/qgl_api.c42
1 files changed, 10 insertions, 32 deletions
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;
- }
+ // 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 mask;
+ return Com_ParseExtensionString( s, extnames );
}
void QGL_EnableLogging( qboolean enable )