Move code to enable FP exceptions into debug.c (set MESA_DEBUG=fpexceptions).

Get rid of MESA_DEBUG preprocessor symbol, just use DEBUG instead.
This commit is contained in:
Brian Paul 2005-11-10 05:10:25 +00:00
parent a8446f72f4
commit 1984aabe83
3 changed files with 14 additions and 16 deletions

View file

@ -149,7 +149,7 @@ void _mesa_print_info( void )
*/
static void add_debug_flags( const char *debug )
{
#ifdef MESA_DEBUG
#ifdef DEBUG
if (_mesa_strstr(debug, "varray"))
MESA_VERBOSE |= VERBOSE_VARRAY;
@ -184,6 +184,18 @@ static void add_debug_flags( const char *debug )
*/
if (_mesa_strstr(debug, "flush"))
MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH;
#if defined(_FPU_GETCW) && defined(_FPU_SETCW)
if (_mesa_strstr(debug, "fpexceptions")) {
/* raise FP exceptions */
fpu_control_t mask;
_FPU_GETCW(mask);
mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM
| _FPU_MASK_OM | _FPU_MASK_UM);
_FPU_SETCW(mask);
}
#endif
#else
(void) debug;
#endif

View file

@ -1265,20 +1265,6 @@ _mesa_init_default_imports(__GLimports *imports, void *driverCtx)
static GLboolean initialized = GL_FALSE;
if (!initialized) {
init_sqrt_table();
#if defined(_FPU_GETCW) && defined(_FPU_SETCW)
{
const char *debug = _mesa_getenv("MESA_DEBUG");
if (debug && _mesa_strcmp(debug, "FP")==0) {
/* die on FP exceptions */
fpu_control_t mask;
_FPU_GETCW(mask);
mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM
| _FPU_MASK_OM | _FPU_MASK_UM);
_FPU_SETCW(mask);
}
}
#endif
initialized = GL_TRUE;
}

View file

@ -2929,7 +2929,7 @@ struct __GLcontextRec
extern const char *_mesa_prim_name[GL_POLYGON+4];
#ifdef MESA_DEBUG
#ifdef DEBUG
extern int MESA_VERBOSE;
extern int MESA_DEBUG_FLAGS;
# define MESA_FUNCTION __FUNCTION__