aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/debug.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-09 08:46:41 +0100
committermarha <marha@users.sourceforge.net>2012-02-09 08:46:41 +0100
commit535951cba015f2a2b63292e0ca983d0d6e736b71 (patch)
tree8c0e0364a27f250e926abe165b82ca12e5a841bf /mesalib/src/mesa/main/debug.c
parentebb6162f9cbc1af0fac0b670b5aa38c8bb7a7446 (diff)
parent474621addc25cb22865c54b70ffbec07c82eb04c (diff)
downloadvcxsrv-535951cba015f2a2b63292e0ca983d0d6e736b71.tar.gz
vcxsrv-535951cba015f2a2b63292e0ca983d0d6e736b71.tar.bz2
vcxsrv-535951cba015f2a2b63292e0ca983d0d6e736b71.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/debug.c')
-rw-r--r--mesalib/src/mesa/main/debug.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c
index 72aa8cb4f..71d7f1ac6 100644
--- a/mesalib/src/mesa/main/debug.c
+++ b/mesalib/src/mesa/main/debug.c
@@ -554,8 +554,35 @@ _mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h,
else if (format == GL_LUMINANCE_ALPHA && type == GL_UNSIGNED_BYTE) {
write_ppm(filename, image, w, h, 2, 1, 0, 0, invert);
}
+ else if (format == GL_RED && type == GL_UNSIGNED_BYTE) {
+ write_ppm(filename, image, w, h, 1, 0, 0, 0, invert);
+ }
+ else if (format == GL_RGBA && type == GL_FLOAT) {
+ /* convert floats to ubyte */
+ GLubyte *buf = (GLubyte *) malloc(w * h * 4 * sizeof(GLubyte));
+ const GLfloat *f = (const GLfloat *) image;
+ GLuint i;
+ for (i = 0; i < w * h * 4; i++) {
+ UNCLAMPED_FLOAT_TO_UBYTE(buf[i], f[i]);
+ }
+ write_ppm(filename, buf, w, h, 4, 0, 1, 2, invert);
+ free(buf);
+ }
+ else if (format == GL_RED && type == GL_FLOAT) {
+ /* convert floats to ubyte */
+ GLubyte *buf = (GLubyte *) malloc(w * h * sizeof(GLubyte));
+ const GLfloat *f = (const GLfloat *) image;
+ GLuint i;
+ for (i = 0; i < w * h; i++) {
+ UNCLAMPED_FLOAT_TO_UBYTE(buf[i], f[i]);
+ }
+ write_ppm(filename, buf, w, h, 1, 0, 0, 0, invert);
+ free(buf);
+ }
else {
- _mesa_problem(NULL, "Unsupported format/type in _mesa_dump_image()");
+ _mesa_problem(NULL,
+ "Unsupported format 0x%x / type 0x%x in _mesa_dump_image()",
+ format, type);
}
}