|
|
@ -551,46 +551,52 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char |
|
|
|
// functions are cleared before all the extensions are evaluated
|
|
|
|
// functions are cleared before all the extensions are evaluated
|
|
|
|
if(( *func->func = (void *)gEngfuncs.GL_GetProcAddress( func->name )) == NULL ) |
|
|
|
if(( *func->func = (void *)gEngfuncs.GL_GetProcAddress( func->name )) == NULL ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
string name; |
|
|
|
string name; |
|
|
|
|
|
|
|
char *end; |
|
|
|
|
|
|
|
size_t i = 0; |
|
|
|
|
|
|
|
#ifdef XASH_GLES |
|
|
|
|
|
|
|
const char *suffixes[] = { "", "EXT", "OES" }; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
const char *suffixes[] = { "", "EXT" }; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// HACK: fix ARB names
|
|
|
|
// HACK: fix ARB names
|
|
|
|
const char *str = Q_strstr( func->name, "ARB" ); |
|
|
|
Q_strncpy( name, func->name, sizeof( name )); |
|
|
|
Q_strncpy( name, func->name, MAX_STRING ); |
|
|
|
if(( end = Q_strstr( name, "ARB" ))) |
|
|
|
|
|
|
|
|
|
|
|
if( str ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
name[str - func->name] = '\0'; // cut func suffix
|
|
|
|
*end = '\0'; |
|
|
|
// if this was glFuncARB, try glFunc
|
|
|
|
|
|
|
|
*func->func = gEngfuncs.GL_GetProcAddress( name ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else // I need Q_strstrnul
|
|
|
|
{ |
|
|
|
{ |
|
|
|
// set pointer to func name end to cut it correctly
|
|
|
|
end = name + Q_strlen( name ); |
|
|
|
str = func->name + Q_strlen( func->name ); |
|
|
|
i++; // skip empty suffix
|
|
|
|
name[str - func->name] = '\0'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// try glFuncEXT
|
|
|
|
for( ; i < sizeof( suffixes ) / sizeof( suffixes[0] ); i++ ) |
|
|
|
if( !*func->func ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_strncat( name, "EXT", MAX_STRING ); |
|
|
|
void *f; |
|
|
|
*func->func = gEngfuncs.GL_GetProcAddress( name ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef XASH_GLES |
|
|
|
Q_strncat( name, suffixes[i], sizeof( name )); |
|
|
|
// try glFuncOES
|
|
|
|
|
|
|
|
if( !*func->func ) |
|
|
|
if(( f = gEngfuncs.GL_GetProcAddress( name ))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
name[str - func->name] = '\0'; // cut EXT from previous try
|
|
|
|
// GL_GetProcAddress prints errors about missing functions, so tell user that we found it with different name
|
|
|
|
Q_strncat( name, "OES", MAX_STRING ); |
|
|
|
gEngfuncs.Con_Printf( S_NOTE "found %s\n", name ); |
|
|
|
*func->func = gEngfuncs.GL_GetProcAddress( name ); |
|
|
|
|
|
|
|
|
|
|
|
*func->func = f; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
else |
|
|
|
if( !*func->func ) |
|
|
|
{ |
|
|
|
|
|
|
|
*end = '\0'; // cut suffix, try next
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// not found...
|
|
|
|
|
|
|
|
if( i == sizeof( suffixes ) / sizeof( suffixes[0] )) |
|
|
|
|
|
|
|
{ |
|
|
|
GL_SetExtension( r_ext, false ); |
|
|
|
GL_SetExtension( r_ext, false ); |
|
|
|
else // GL_GetProcAddress prints errors about missing functions, so tell user that we found it with different name
|
|
|
|
} |
|
|
|
gEngfuncs.Con_Printf( S_NOTE "found %s\n", name ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|