mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-12 16:18:01 +00:00
ref_gl: rewrite ARB workaround to check EXT/OES names, notify user that function found with different name
This commit is contained in:
parent
bee81e9723
commit
c1d1aa6787
@ -551,22 +551,46 @@ 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;
|
||||||
|
|
||||||
// HACK: fix ARB names
|
// HACK: fix ARB names
|
||||||
char *str = Q_strstr( func->name, "ARB" );
|
const char *str = Q_strstr( func->name, "ARB" );
|
||||||
if(str)
|
Q_strncpy( name, func->name, MAX_STRING );
|
||||||
|
|
||||||
|
if( str )
|
||||||
{
|
{
|
||||||
string name;
|
name[str - func->name] = '\0'; // cut func suffix
|
||||||
|
// if this was glFuncARB, try glFunc
|
||||||
Q_strncpy( name, func->name, MAX_STRING );
|
|
||||||
name[str - func->name] = '\0';
|
|
||||||
*func->func = gEngfuncs.GL_GetProcAddress( name );
|
*func->func = gEngfuncs.GL_GetProcAddress( name );
|
||||||
|
|
||||||
if( !*func->func )
|
|
||||||
GL_SetExtension( r_ext, false );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// one or more functions are invalid, extension will be disabled
|
{
|
||||||
|
// set pointer to func name end to cut it correctly
|
||||||
|
str = func->name + Q_strlen( func->name );
|
||||||
|
name[str - func->name] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// try glFuncEXT
|
||||||
|
if( !*func->func )
|
||||||
|
{
|
||||||
|
Q_strncat( name, "EXT", MAX_STRING );
|
||||||
|
*func->func = gEngfuncs.GL_GetProcAddress( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef XASH_GLES
|
||||||
|
// try glFuncOES
|
||||||
|
if( !*func->func )
|
||||||
|
{
|
||||||
|
name[str - func->name] = '\0'; // cut EXT from previous try
|
||||||
|
Q_strncat( name, "OES", MAX_STRING );
|
||||||
|
*func->func = gEngfuncs.GL_GetProcAddress( name );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if( !*func->func )
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user