diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug.h | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_stack.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 16 |
4 files changed, 21 insertions, 16 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 0af69d8c8f0..1b984425b59 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -169,18 +169,18 @@ void debug_print_blob( const char *name, #endif -void _debug_break(void) +#ifndef debug_break +void debug_break(void) { -#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC) - __asm("int3"); -#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC) - _asm {int 3}; +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) + DebugBreak(); #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) EngDebugBreak(); #else abort(); #endif } +#endif #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 33e7cb3419e..5e88f3ebb1a 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -125,19 +125,16 @@ void debug_print_format(const char *msg, unsigned fmt ); #endif -void _debug_break(void); - - /** * Hard-coded breakpoint. */ #ifdef DEBUG #if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC) #define debug_break() __asm("int3") -#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC) -#define debug_break() do { _asm {int 3} } while(0) +#elif defined(PIPE_CC_MSVC) +#define debug_break() __debugbreak() #else -#define debug_break() _debug_break() +void debug_break(void); #endif #else /* !DEBUG */ #define debug_break() ((void)0) diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c index 76068a65091..e5d61907c0e 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++ b/src/gallium/auxiliary/util/u_debug_stack.c @@ -49,7 +49,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, #if defined(PIPE_CC_GCC) frame_pointer = ((const void **)__builtin_frame_address(1)); -#elif defined(PIPE_CC_MSVC) +#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) __asm { mov frame_pointer, ebp } diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 1ecde7a9125..9268a9bb7ee 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -319,11 +319,21 @@ util_iround(float f) -#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) /** * Find first bit set in word. Least significant bit is 1. * Return 0 if no bits set. */ +#if defined(_MSC_VER) && _MSC_VER >= 1300 +static INLINE +unsigned long ffs( unsigned long u ) +{ + unsigned long i; + if(_BitScanForward(&i, u)) + return i + 1; + else + return 0; +} +#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) static INLINE unsigned ffs( unsigned u ) { @@ -339,9 +349,7 @@ unsigned ffs( unsigned u ) return i; } -#endif - -#ifdef __MINGW32__ +#elif defined(__MINGW32__) #define ffs __builtin_ffs #endif |