From: Jonathan White Date: Mon, 23 Jun 2008 22:24:58 +0000 (-0600) Subject: gallium: code for PIPE_SUBSYSTEM_WINDOWS_USER X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc73d15a9a1cc830781f8f3ef81507bfff79b7f9;p=mesa.git gallium: code for PIPE_SUBSYSTEM_WINDOWS_USER --- diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c index b1106a5e55f..7b28900a25d 100644 --- a/src/gallium/auxiliary/util/p_debug.c +++ b/src/gallium/auxiliary/util/p_debug.c @@ -30,14 +30,28 @@ #include + #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY + #include #include + +#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif +#include + #else + #include #include + #endif + + #include "pipe/p_compiler.h" #include "pipe/p_util.h" #include "pipe/p_debug.h" @@ -74,6 +88,17 @@ void _debug_vprintf(const char *format, va_list ap) #else /* TODO: Implement debug print for WINCE */ #endif +#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) + /* EngDebugPrint does not handle float point arguments, so we need to use + * 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) || util_strchr(buf + len, '\n')) { + OutputDebugStringA(buf); + buf[0] = '\0'; + } #else vfprintf(stderr, format, ap); #endif