summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-04-15 18:11:47 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-04-15 18:11:47 +0900
commita68f664124592829a3b715388e6cfa43f82900c8 (patch)
tree2ce8e86fde5b1244ca5af925124e5d43dd731e9c /src
parent3c4f1ba5a2edefd69b2c47abaf534fb3af3f259d (diff)
gallium: Cache one line worth of debug output on windows.
The windbg connection seems synchronous, so this speeds up when printing little text at a time (e.g., tgsi output).
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/p_debug.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
index f9366467cd..c195f61820 100644
--- a/src/gallium/auxiliary/util/p_debug.c
+++ b/src/gallium/auxiliary/util/p_debug.c
@@ -59,10 +59,15 @@ void _debug_vprintf(const char *format, va_list ap)
#ifdef WIN32
#ifndef WINCE
/* EngDebugPrint does not handle float point arguments, so we need to use
- * our own vsnprintf implementation */
- char buf[512 + 1];
- util_vsnprintf(buf, sizeof(buf), format, ap);
- _EngDebugPrint("%s", buf);
+ * our own vsnprintf implementation. It is also very slow, so buffer until
+ * we find a newline. */
+ static char buf[512 + 1] = {'\0'};
+ size_t len = strlen(buf);
+ int ret = util_vsnprintf(buf + len, sizeof(buf) - len, format, ap);
+ if(ret > (int)(sizeof(buf) - len - 1) || strchr(buf + len, '\n')) {
+ _EngDebugPrint("%s", buf);
+ buf[0] = '\0';
+ }
#else
/* TODO: Implement debug print for WINCE */
#endif