summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_pack.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-13 08:49:34 -0700
committerBrian Paul <[email protected]>2012-02-15 14:07:43 -0700
commit82ddd1129e76b8bb978497df2940d1449a848551 (patch)
treefd446f8a05d60b5e94240b1cb8204c98b1c05039 /src/mesa/main/format_pack.c
parent5e81d3b85300077a0df1f1d77646a7e939d32a7f (diff)
mesa: add MESA_FORMAT_Z32_FLOAT_X24S8 case in format unpack code
Added in _mesa_pack_uint_24_8_depth_stencil_row(). This could be hit by something like glDrawPixels(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8) into a MESA_FORMAT_Z32_FLOAT_X24S8 buffer. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main/format_pack.c')
-rw-r--r--src/mesa/main/format_pack.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
index ea1d95ee9e9..e20e361c842 100644
--- a/src/mesa/main/format_pack.c
+++ b/src/mesa/main/format_pack.c
@@ -2530,6 +2530,19 @@ _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n,
}
}
break;
+ case MESA_FORMAT_Z32_FLOAT_X24S8:
+ {
+ const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
+ GLuint *destu = (GLuint *) dst;
+ GLfloat *destf = (GLfloat *) dst;
+ GLint i;
+ for (i = 0; i < n; i++) {
+ GLfloat z = (src[i] >> 8) * scale;
+ destf[i * 2 + 0] = z;
+ destu[i * 2 + 1] = src[i] & 0xff;
+ }
+ }
+ break;
default:
_mesa_problem(NULL, "bad format %s in _mesa_pack_ubyte_s_row",
_mesa_get_format_name(format));