diff options
author | marha <marha@users.sourceforge.net> | 2011-08-30 08:04:44 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-08-30 08:08:15 +0200 |
commit | 82ce0534a7bc89f1ed93b4b952b30ceb3d94210d (patch) | |
tree | a2b73894a436b1158cf0e8e2f2ea946478529d12 /mesalib/src/mesa/main/debug.c | |
parent | 01df5d59e56a1b060568f8cad2e89f7eea22fc70 (diff) | |
download | vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.tar.gz vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.tar.bz2 vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.zip |
mesa git update 30 aug 2011
Diffstat (limited to 'mesalib/src/mesa/main/debug.c')
-rw-r--r-- | mesalib/src/mesa/main/debug.c | 93 |
1 files changed, 50 insertions, 43 deletions
diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index b1fc096f2..2bb37452d 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -353,11 +353,10 @@ dump_texture(struct gl_texture_object *texObj, GLuint writeImages) for (j = 0; j < numFaces; j++) { struct gl_texture_image *texImg = texObj->Image[j][i]; if (texImg) { - printf(" Face %u level %u: %d x %d x %d, format %s at %p\n", + printf(" Face %u level %u: %d x %d x %d, format %s\n", j, i, texImg->Width, texImg->Height, texImg->Depth, - _mesa_get_format_name(texImg->TexFormat), - texImg->Data); + _mesa_get_format_name(texImg->TexFormat)); if (writeImages == WRITE_ALL || (writeImages == WRITE_ONE && !written)) { write_texture_image(texObj, j, i); @@ -566,58 +565,66 @@ _mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h, * Quick and dirty function to "print" a texture to stdout. */ void -_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img) +_mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img) { #if CHAN_TYPE != GL_UNSIGNED_BYTE _mesa_problem(NULL, "PrintTexture not supported"); #else + const GLint slice = 0; + GLint srcRowStride; GLuint i, j, c; - const GLubyte *data = (const GLubyte *) img->Data; + GLubyte *data; + + ctx->Driver.MapTextureImage(ctx, img, slice, + 0, 0, img->Width, img->Height, GL_MAP_READ_BIT, + &data, &srcRowStride); if (!data) { printf("No texture data\n"); - return; } + else { + /* XXX add more formats or make into a new format utility function */ + switch (img->TexFormat) { + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + c = 1; + break; + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + c = 2; + break; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + c = 3; + break; + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_ARGB8888: + c = 4; + break; + default: + _mesa_problem(NULL, "error in PrintTexture\n"); + return; + } - /* XXX add more formats or make into a new format utility function */ - switch (img->TexFormat) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: - c = 1; - break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - c = 2; - break; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: - c = 3; - break; - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: - c = 4; - break; - default: - _mesa_problem(NULL, "error in PrintTexture\n"); - return; - } + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { + if (c==1) + printf("%02x ", data[0]); + else if (c==2) + printf("%02x%02x ", data[0], data[1]); + else if (c==3) + printf("%02x%02x%02x ", data[0], data[1], data[2]); + else if (c==4) + printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + data += (srcRowStride - img->Width) * c; + } + /* XXX use img->ImageStride here */ + printf("\n"); - for (i = 0; i < img->Height; i++) { - for (j = 0; j < img->Width; j++) { - if (c==1) - printf("%02x ", data[0]); - else if (c==2) - printf("%02x%02x ", data[0], data[1]); - else if (c==3) - printf("%02x%02x%02x ", data[0], data[1], data[2]); - else if (c==4) - printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); - data += (img->RowStride - img->Width) * c; } - /* XXX use img->ImageStride here */ - printf("\n"); } + + ctx->Driver.UnmapTextureImage(ctx, img, slice); #endif } |