|
|
@ -576,55 +576,51 @@ static void SetFullscreenModeFromCommandLine( void ) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void R_CollectRendererNames( void ) |
|
|
|
static void R_CollectRendererNames( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char *renderers[] = DEFAULT_RENDERERS; |
|
|
|
// ordering is important!
|
|
|
|
int i, cur; |
|
|
|
static const char *shortNames[] = |
|
|
|
|
|
|
|
|
|
|
|
cur = 0; |
|
|
|
|
|
|
|
for( i = 0; i < DEFAULT_RENDERERS_LEN; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
string temp; |
|
|
|
|
|
|
|
void *dll, *pfn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
R_GetRendererName( temp, sizeof( temp ), renderers[i] ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dll = COM_LoadLibrary( temp, false, true ); |
|
|
|
|
|
|
|
if( !dll ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Reportf( "R_CollectRendererNames: can't load library %s: %s\n", temp, COM_GetLibraryError() ); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pfn = COM_GetProcAddress( dll, GET_REF_API ); |
|
|
|
|
|
|
|
if( !pfn ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Reportf( "R_CollectRendererNames: can't find API entry point in %s\n", temp ); |
|
|
|
#if XASH_REF_GL_ENABLED |
|
|
|
COM_FreeLibrary( dll ); |
|
|
|
"gl", |
|
|
|
continue; |
|
|
|
#endif |
|
|
|
} |
|
|
|
#if XASH_REF_NANOGL_ENABLED |
|
|
|
|
|
|
|
"gles1", |
|
|
|
Q_strncpy( ref.shortNames[cur], renderers[i], sizeof( ref.shortNames[cur] )); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_GLWES_ENABLED |
|
|
|
|
|
|
|
"gles2", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_GL4ES_ENABLED |
|
|
|
|
|
|
|
"gl4es", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_SOFT_ENABLED |
|
|
|
|
|
|
|
"soft", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME ); |
|
|
|
// ordering is important here too!
|
|
|
|
if( !pfn ) // just in case
|
|
|
|
static const char *readableNames[ARRAYSIZE( shortNames )] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Reportf( "R_CollectRendererNames: can't find GetHumanReadableName export in %s\n", temp ); |
|
|
|
#if XASH_REF_GL_ENABLED |
|
|
|
Q_strncpy( ref.readableNames[cur], renderers[i], sizeof( ref.readableNames[cur] )); |
|
|
|
"OpenGL", |
|
|
|
} |
|
|
|
#endif |
|
|
|
else |
|
|
|
#if XASH_REF_NANOGL_ENABLED |
|
|
|
{ |
|
|
|
"GLES1 (NanoGL)", |
|
|
|
REF_HUMANREADABLE_NAME GetHumanReadableName = (REF_HUMANREADABLE_NAME)pfn; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_GLWES_ENABLED |
|
|
|
GetHumanReadableName( ref.readableNames[cur], sizeof( ref.readableNames[cur] )); |
|
|
|
"GLES2 (gl-wes-v2)", |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_GL4ES_ENABLED |
|
|
|
Con_Printf( "Found renderer %s: %s\n", ref.shortNames[cur], ref.readableNames[cur] ); |
|
|
|
"GL4ES", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if XASH_REF_SOFT_ENABLED |
|
|
|
|
|
|
|
"Software", |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
cur++; |
|
|
|
ref.numRenderers = ARRAYSIZE( shortNames ); |
|
|
|
COM_FreeLibrary( dll ); |
|
|
|
ref.shortNames = shortNames; |
|
|
|
} |
|
|
|
ref.readableNames = readableNames; |
|
|
|
ref.numRenderers = cur; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
qboolean R_Init( void ) |
|
|
|
qboolean R_Init( void ) |
|
|
@ -678,30 +674,28 @@ qboolean R_Init( void ) |
|
|
|
// 1. Command line `-ref` argument.
|
|
|
|
// 1. Command line `-ref` argument.
|
|
|
|
// 2. `ref_dll` cvar.
|
|
|
|
// 2. `ref_dll` cvar.
|
|
|
|
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
|
|
|
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
|
|
|
requested[0] = '\0'; |
|
|
|
requested[0] = 0; |
|
|
|
if( !Sys_GetParmFromCmdLine( "-ref", requested ) && COM_CheckString( r_refdll->string ) ) |
|
|
|
|
|
|
|
// r_refdll is set to empty by default, so we can change hardcoded defaults just in case
|
|
|
|
|
|
|
|
Q_strncpy( requested, r_refdll->string, sizeof( requested ) ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( requested[0] ) |
|
|
|
if( !success && Sys_GetParmFromCmdLine( "-ref", requested )) |
|
|
|
success = R_LoadRenderer( requested ); |
|
|
|
success = R_LoadRenderer( requested ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !success && COM_CheckString( r_refdll->string )) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Q_strncpy( requested, r_refdll->string, sizeof( requested )); |
|
|
|
|
|
|
|
success = R_LoadRenderer( requested ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( !success ) |
|
|
|
if( !success ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
// cycle through renderers that we collected in CollectRendererNames
|
|
|
|
for( i = 0; i < ref.numRenderers && !success; i++ ) |
|
|
|
for( i = 0; i < ref.numRenderers; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
// skip renderer that was requested but failed to load
|
|
|
|
// skip renderer that was requested but failed to load
|
|
|
|
if( !Q_strcmp( requested, ref.shortNames[i] )) |
|
|
|
if( !Q_strcmp( requested, ref.shortNames[i] )) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
success = R_LoadRenderer( ref.shortNames[i] ); |
|
|
|
success = R_LoadRenderer( ref.shortNames[i] ); |
|
|
|
|
|
|
|
|
|
|
|
// yay, found working one
|
|
|
|
|
|
|
|
if( success ) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|