aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/mipmap.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-10 08:28:58 +0200
committermarha <marha@users.sourceforge.net>2011-10-10 08:28:58 +0200
commitbaf98f9bb36f956245d83ecd04f90625d6d68d2b (patch)
treec4af86b7cdb9c57cc539fa0764050865233e3617 /mesalib/src/mesa/main/mipmap.c
parent7fae5492e3ef8e5fa15f742be4c2a15b9782e89a (diff)
parentafbd3947071a33f59dda122f1ac396442a02c128 (diff)
downloadvcxsrv-baf98f9bb36f956245d83ecd04f90625d6d68d2b.tar.gz
vcxsrv-baf98f9bb36f956245d83ecd04f90625d6d68d2b.tar.bz2
vcxsrv-baf98f9bb36f956245d83ecd04f90625d6d68d2b.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/mipmap.c')
-rw-r--r--mesalib/src/mesa/main/mipmap.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index f04a98b03..46d71bb22 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -43,7 +43,13 @@
static GLint
bytes_per_pixel(GLenum datatype, GLuint comps)
{
- GLint b = _mesa_sizeof_packed_type(datatype);
+ GLint b;
+
+ if (datatype == GL_UNSIGNED_INT_8_24_REV_MESA ||
+ datatype == GL_UNSIGNED_INT_24_8_MESA)
+ return 4;
+
+ b = _mesa_sizeof_packed_type(datatype);
assert(b >= 0);
if (_mesa_type_is_packed(datatype))
@@ -717,6 +723,36 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
}
}
+ else if (datatype == GL_UNSIGNED_INT_24_8_MESA && comps == 2) {
+ GLuint i, j, k;
+ const GLuint *rowA = (const GLuint *) srcRowA;
+ const GLuint *rowB = (const GLuint *) srcRowB;
+ GLuint *dst = (GLuint *) dstRow;
+ /* note: averaging stencil values seems weird, but what else? */
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ GLuint z = (((rowA[j] >> 8) + (rowA[k] >> 8) +
+ (rowB[j] >> 8) + (rowB[k] >> 8)) / 4) << 8;
+ GLuint s = ((rowA[j] & 0xff) + (rowA[k] & 0xff) +
+ (rowB[j] & 0xff) + (rowB[k] & 0xff)) / 4;
+ dst[i] = z | s;
+ }
+ }
+ else if (datatype == GL_UNSIGNED_INT_8_24_REV_MESA && comps == 2) {
+ GLuint i, j, k;
+ const GLuint *rowA = (const GLuint *) srcRowA;
+ const GLuint *rowB = (const GLuint *) srcRowB;
+ GLuint *dst = (GLuint *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ GLuint z = ((rowA[j] & 0xffffff) + (rowA[k] & 0xffffff) +
+ (rowB[j] & 0xffffff) + (rowB[k] & 0xffffff)) / 4;
+ GLuint s = (((rowA[j] >> 24) + (rowA[k] >> 24) +
+ (rowB[j] >> 24) + (rowB[k] >> 24)) / 4) << 24;
+ dst[i] = z | s;
+ }
+ }
+
else {
_mesa_problem(NULL, "bad format in do_row()");
}