diff options
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_debug.c')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.c | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.c b/mesalib/src/gallium/auxiliary/util/u_debug.c index 2d6193039..df1d8e68c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug.c @@ -30,7 +30,6 @@ #include "pipe/p_config.h" #include "pipe/p_compiler.h" -#include "os/os_stream.h" #include "util/u_debug.h" #include "pipe/p_format.h" #include "pipe/p_state.h" @@ -43,6 +42,7 @@ #include "util/u_prim.h" #include "util/u_surface.h" +#include <stdio.h> #include <limits.h> /* CHAR_BIT */ #include <ctype.h> /* isalnum */ @@ -274,11 +274,7 @@ void _debug_assert_fail(const char *expr, const char *function) { _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr); -#if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER) - if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE)) -#else if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE)) -#endif os_abort(); else _debug_printf("continuing...\n"); @@ -453,42 +449,6 @@ void debug_dump_image(const char *prefix, unsigned stride, const void *data) { -#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY - static unsigned no = 0; - char filename[256]; - WCHAR wfilename[sizeof(filename)]; - ULONG_PTR iFile = 0; - struct { - unsigned format; - unsigned cpp; - unsigned width; - unsigned height; - } header; - unsigned char *pMap = NULL; - unsigned i; - - util_snprintf(filename, sizeof(filename), "\\??\\c:\\%03u%s.raw", ++no, prefix); - for(i = 0; i < sizeof(filename); ++i) - wfilename[i] = (WCHAR)filename[i]; - - pMap = (unsigned char *)EngMapFile(wfilename, sizeof(header) + height*width*cpp, &iFile); - if(!pMap) - return; - - header.format = format; - header.cpp = cpp; - header.width = width; - header.height = height; - memcpy(pMap, &header, sizeof(header)); - pMap += sizeof(header); - - for(i = 0; i < height; ++i) { - memcpy(pMap, (unsigned char *)data + stride*i, cpp*width); - pMap += cpp*width; - } - - EngUnmapFile(iFile); -#elif defined(PIPE_OS_UNIX) /* write a ppm file */ char filename[256]; FILE *f; @@ -534,7 +494,6 @@ void debug_dump_image(const char *prefix, else { fprintf(stderr, "Can't open %s for writing\n", filename); } -#endif } /* FIXME: dump resources, not surfaces... */ @@ -636,7 +595,6 @@ debug_dump_surface_bmp(struct pipe_context *pipe, const char *filename, struct pipe_surface *surface) { -#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT struct pipe_transfer *transfer; struct pipe_resource *texture = surface->texture; @@ -647,7 +605,6 @@ debug_dump_surface_bmp(struct pipe_context *pipe, debug_dump_transfer_bmp(pipe, filename, transfer); pipe->transfer_destroy(pipe, transfer); -#endif } void @@ -655,7 +612,6 @@ debug_dump_transfer_bmp(struct pipe_context *pipe, const char *filename, struct pipe_transfer *transfer) { -#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT float *rgba; if (!transfer) @@ -679,7 +635,6 @@ debug_dump_transfer_bmp(struct pipe_context *pipe, FREE(rgba); error1: ; -#endif } void @@ -687,8 +642,7 @@ debug_dump_float_rgba_bmp(const char *filename, unsigned width, unsigned height, float *rgba, unsigned stride) { -#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT - struct os_stream *stream; + FILE *stream; struct bmp_file_header bmfh; struct bmp_info_header bmih; unsigned x, y; @@ -714,12 +668,12 @@ debug_dump_float_rgba_bmp(const char *filename, bmih.biClrUsed = 0; bmih.biClrImportant = 0; - stream = os_file_stream_create(filename); + stream = fopen(filename, "wb"); if(!stream) goto error1; - os_stream_write(stream, &bmfh, 14); - os_stream_write(stream, &bmih, 40); + fwrite(&bmfh, 14, 1, stream); + fwrite(&bmih, 40, 1, stream); y = height; while(y--) { @@ -731,14 +685,13 @@ debug_dump_float_rgba_bmp(const char *filename, pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]); pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]); pixel.rgbAlpha = float_to_ubyte(ptr[x*4 + 3]); - os_stream_write(stream, &pixel, 4); + fwrite(&pixel, 1, 4, stream); } } - os_stream_close(stream); + fclose(stream); error1: ; -#endif } #endif |