Browse Source

ref_gl: rewrite ARB workaround to check EXT/OES names, notify user that function found with different name

pull/2/head
mittorn 1 year ago committed by Alibek Omarov
parent
commit
c1d1aa6787
  1. 38
      ref/gl/gl_opengl.c

38
ref/gl/gl_opengl.c

@ -551,22 +551,46 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char @@ -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
if((*func->func = (void *)gEngfuncs.GL_GetProcAddress( func->name )) == NULL )
{
// HACK: fix ARB names
char *str = Q_strstr( func->name, "ARB" );
if(str)
{
string name;
// HACK: fix ARB names
const char *str = Q_strstr( func->name, "ARB" );
Q_strncpy( name, func->name, MAX_STRING );
if( str )
{
name[str - func->name] = '\0'; // cut func suffix
// if this was glFuncARB, try glFunc
*func->func = gEngfuncs.GL_GetProcAddress( name );
}
else
{
// 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 )
GL_SetExtension( r_ext, false );
{
name[str - func->name] = '\0'; // cut EXT from previous try
Q_strncat( name, "OES", MAX_STRING );
*func->func = gEngfuncs.GL_GetProcAddress( name );
}
else
// one or more functions are invalid, extension will be disabled
#endif
if( !*func->func )
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

Loading…
Cancel
Save