mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-30 07:41:16 +00:00
Better altivec cvar handling. Should fix crashes at startup, or curious
people that toggle it on at runtime on a G3.
This commit is contained in:
parent
dd4dce194e
commit
ff9c89f8fe
4 changed files with 42 additions and 11 deletions
|
@ -2353,6 +2353,24 @@ out:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void Com_DetectAltivec(void)
|
||||||
|
{
|
||||||
|
// Only detect if user hasn't forcibly disabled it.
|
||||||
|
if (com_altivec->integer) {
|
||||||
|
static qboolean altivec = qfalse;
|
||||||
|
static qboolean detected = qfalse;
|
||||||
|
if (!detected) {
|
||||||
|
altivec = Sys_DetectAltivec();
|
||||||
|
detected = qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!altivec) {
|
||||||
|
Cvar_Set( "com_altivec", "0" ); // we don't have it! Disable support!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Com_Init
|
Com_Init
|
||||||
|
@ -2510,9 +2528,11 @@ void Com_Init( char *commandLine ) {
|
||||||
|
|
||||||
com_fullyInitialized = qtrue;
|
com_fullyInitialized = qtrue;
|
||||||
|
|
||||||
#if idppc_altivec
|
// always set the cvar, but only print the info if it makes sense.
|
||||||
|
Com_DetectAltivec();
|
||||||
|
#if idppc
|
||||||
Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled");
|
Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Com_Printf ("--- Common Initialization Complete ---\n");
|
Com_Printf ("--- Common Initialization Complete ---\n");
|
||||||
}
|
}
|
||||||
|
@ -2713,6 +2733,12 @@ void Com_Frame( void ) {
|
||||||
} while ( msec < minMsec );
|
} while ( msec < minMsec );
|
||||||
Cbuf_Execute ();
|
Cbuf_Execute ();
|
||||||
|
|
||||||
|
if (com_altivec->modified)
|
||||||
|
{
|
||||||
|
Com_DetectAltivec();
|
||||||
|
com_altivec->modified = qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
lastTime = com_frameTime;
|
lastTime = com_frameTime;
|
||||||
|
|
||||||
// mess with msec if needed
|
// mess with msec if needed
|
||||||
|
|
|
@ -1033,6 +1033,8 @@ unsigned int Sys_ProcessorCount( void );
|
||||||
|
|
||||||
int Sys_MonkeyShouldBeSpanked( void );
|
int Sys_MonkeyShouldBeSpanked( void );
|
||||||
|
|
||||||
|
qboolean Sys_DetectAltivec( void );
|
||||||
|
|
||||||
/* This is based on the Adaptive Huffman algorithm described in Sayood's Data
|
/* This is based on the Adaptive Huffman algorithm described in Sayood's Data
|
||||||
* Compression book. The ranks are not actually stored, but implicitly defined
|
* Compression book. The ranks are not actually stored, but implicitly defined
|
||||||
* by the location of a node within a doubly-linked list */
|
* by the location of a node within a doubly-linked list */
|
||||||
|
|
|
@ -377,12 +377,11 @@ static void illegal_instruction(int sig)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void Sys_DetectAltivec(void)
|
qboolean Sys_DetectAltivec( void )
|
||||||
{
|
{
|
||||||
// Only detect if user hasn't forcibly disabled it.
|
|
||||||
if (com_altivec->integer) {
|
|
||||||
#if idppc_altivec
|
|
||||||
qboolean altivec = qfalse;
|
qboolean altivec = qfalse;
|
||||||
|
|
||||||
|
#if idppc_altivec
|
||||||
#ifdef MACOS_X
|
#ifdef MACOS_X
|
||||||
long feat = 0;
|
long feat = 0;
|
||||||
OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat);
|
OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat);
|
||||||
|
@ -401,12 +400,9 @@ static void Sys_DetectAltivec(void)
|
||||||
}
|
}
|
||||||
signal(SIGILL, handler);
|
signal(SIGILL, handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!altivec) {
|
|
||||||
Cvar_Set( "com_altivec", "0" ); // we don't have it! Disable support!
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
return altivec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Init(void)
|
void Sys_Init(void)
|
||||||
|
|
|
@ -1176,6 +1176,13 @@ void Sys_Init( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qboolean Sys_DetectAltivec( void )
|
||||||
|
{
|
||||||
|
return qfalse; // never altivec on Windows...at least for now. :)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
int totalMsec, countMsec;
|
int totalMsec, countMsec;
|
||||||
|
|
Loading…
Reference in a new issue