diff options
author | Brian Paul <[email protected]> | 2009-03-02 17:52:30 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-03-02 17:52:30 -0700 |
commit | 433f2ab2ec4685328c3ee4802fab84fd12671eb3 (patch) | |
tree | 2553c70290d5aabc3ad38dcc561c2ef55a0e72c5 | |
parent | d652d26a975a884fecd9c407e77b7259fb291906 (diff) |
mesa: more tex image debug/dumping code
-rw-r--r-- | src/mesa/main/debug.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index fcef093ac35..fdd10dd3074 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -23,6 +23,7 @@ */ #include "mtypes.h" +#include "colormac.h" #include "context.h" #include "hash.h" #include "imports.h" @@ -274,6 +275,27 @@ write_texture_image(struct gl_texture_object *texObj) case MESA_FORMAT_ARGB8888: write_ppm(s, img->Data, img->Width, img->Height, 4, 2, 1, 0); break; + case MESA_FORMAT_RGB888: + write_ppm(s, img->Data, img->Width, img->Height, 3, 2, 1, 0); + break; + case MESA_FORMAT_RGB565: + { + GLubyte *buf2 = (GLubyte *) _mesa_malloc(img->Width * img->Height * 3); + GLint i; + for (i = 0; i < img->Width * img->Height; i++) { + GLint r, g, b; + GLushort s = ((GLushort *) img->Data)[i]; + r = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); + g = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); + b = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); + buf2[i*3+1] = r; + buf2[i*3+2] = g; + buf2[i*3+3] = b; + } + write_ppm(s, buf2, img->Width, img->Height, 3, 2, 1, 0); + _mesa_free(buf2); + } + break; default: printf("XXXX unsupported mesa tex format %d in %s\n", img->TexFormat->MesaFormat, __FUNCTION__); |