mesa: add MESA_FORMAT_Z32_FLOAT_X24S8 case in format unpack code
authorBrian Paul <brianp@vmware.com>
Mon, 13 Feb 2012 15:49:34 +0000 (08:49 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 15 Feb 2012 21:07:43 +0000 (14:07 -0700)
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 <jfonseca@vmware.com>
src/mesa/main/format_pack.c

index ea1d95ee9e90804191aa5f7243b589f9d7e6c02c..e20e361c842a3f64d82fc0d83f021761c6c350d8 100644 (file)
@@ -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));