Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / gallium / include / pipe / p_debug.h
index 097fc7c0b1846b41d818fa66bac7150e80bc3842..a5816c3cbb70f8958050132ee6386b49d69bfe0b 100644 (file)
@@ -59,6 +59,12 @@ extern "C" {
 #endif
 #endif
 
+   
+/* MSVC bebore VC7 does not have the __FUNCTION__ macro */
+#if defined(_MSC_VER) && _MSC_VER < 1300
+#define __FUNCTION__ "???"
+#endif
+
 
 void _debug_vprintf(const char *format, va_list ap);
    
@@ -90,6 +96,8 @@ debug_printf(const char *format, ...)
    va_start(ap, format);
    _debug_vprintf(format, ap);
    va_end(ap);
+#else
+   (void) format; /* silence warning */
 #endif
 }
 
@@ -101,16 +109,19 @@ debug_printf(const char *format, ...)
 #endif
 
 
+#ifdef DEBUG
 /**
  * Dump a blob in hex to the same place that debug_printf sends its
  * messages.
  */
-#ifdef DEBUG
-void debug_print_blob( const char *name,
-                       const void *blob,
-                       unsigned size );
+void debug_print_blob( const char *name, const void *blob, unsigned size );
+
+/* Print a message along with a prettified format string
+ */
+void debug_print_format(const char *msg, unsigned fmt );
 #else
 #define debug_print_blob(_name, _blob, _size) ((void)0)
+#define debug_print_format(_msg, _fmt) ((void)0)
 #endif
 
 
@@ -121,10 +132,10 @@ void _debug_break(void);
  * Hard-coded breakpoint.
  */
 #ifdef DEBUG
-#if (defined(__i386__) || defined(__386__)) && defined(__GNUC__)
+#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
 #define debug_break() __asm("int3")
-#elif (defined(__i386__) || defined(__386__)) && defined(__MSC__)
-#define debug_break()  _asm {int 3}
+#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
+#define debug_break()  do { _asm {int 3} } while(0)
 #else
 #define debug_break() _debug_break()
 #endif
@@ -278,7 +289,7 @@ boolean
 debug_get_bool_option(const char *name, boolean dfault);
 
 long
-debug_get_unsigned_option(const char *name, long dfault);
+debug_get_num_option(const char *name, long dfault);
 
 unsigned long
 debug_get_flags_option(const char *name, 
@@ -302,11 +313,33 @@ void *
 debug_realloc(const char *file, unsigned line, const char *function,
               void *old_ptr, size_t old_size, size_t new_size );
 
+unsigned long
+debug_memory_begin(void);
+
 void 
-debug_memory_reset(void);
+debug_memory_end(unsigned long beginning);
+
+
+#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
+
+void
+debug_profile_start(void);
 
 void 
-debug_memory_report(void);
+debug_profile_stop(void);
+
+#endif
+
+
+#ifdef DEBUG
+void debug_dump_image(const char *prefix,
+                      unsigned format, unsigned cpp,
+                      unsigned width, unsigned height,
+                      unsigned pitch,
+                      const void *data);
+#else
+#define debug_dump_image(prefix, format, cpp, width, height, pitch, data) ((void)0)
+#endif
 
 
 #ifdef __cplusplus