diff options
author | marha <marha@users.sourceforge.net> | 2011-07-11 09:02:33 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-07-11 09:02:33 +0200 |
commit | 4611d27b8966b26b8ac63514a461f31c3172c31c (patch) | |
tree | 5de36cfa4517b997cb703cb1eced374c9db1f2b1 /mesalib/src/mesa/main/pack.c | |
parent | dbe01a4f78f09723b327d1d8522bfa5026c4f6e0 (diff) | |
parent | 0b43e0b4ddbd9fdac70658164f3dbf653067a4de (diff) | |
download | vcxsrv-4611d27b8966b26b8ac63514a461f31c3172c31c.tar.gz vcxsrv-4611d27b8966b26b8ac63514a461f31c3172c31c.tar.bz2 vcxsrv-4611d27b8966b26b8ac63514a461f31c3172c31c.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/docs/GL3.txt
mesalib/src/glsl/linker.cpp
mesalib/src/mesa/main/depthstencil.c
mesalib/src/mesa/main/fbobject.c
mesalib/src/mesa/main/formats.c
mesalib/src/mesa/main/formats.h
mesalib/src/mesa/main/framebuffer.c
mesalib/src/mesa/main/mtypes.h
mesalib/src/mesa/main/pack.c
mesalib/src/mesa/main/readpix.c
mesalib/src/mesa/main/renderbuffer.c
mesalib/src/mesa/main/samplerobj.c
mesalib/src/mesa/main/shaderapi.c
mesalib/src/mesa/main/texenv.c
mesalib/src/mesa/main/texobj.c
mesalib/src/mesa/main/uniforms.c
mesalib/src/mesa/state_tracker/st_cb_clear.c
mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
mesalib/src/mesa/state_tracker/st_cb_readpixels.c
mesalib/src/mesa/state_tracker/st_extensions.c
mesalib/src/mesa/state_tracker/st_format.c
mesalib/src/mesa/swrast/s_readpix.c
Diffstat (limited to 'mesalib/src/mesa/main/pack.c')
-rw-r--r-- | mesalib/src/mesa/main/pack.c | 83 |
1 files changed, 73 insertions, 10 deletions
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index 215bc7ba7..817d92912 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -1971,7 +1971,8 @@ extract_uint_indexes(GLuint n, GLuint indexes[], srcType == GL_INT ||
srcType == GL_UNSIGNED_INT_24_8_EXT ||
srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
+ srcType == GL_FLOAT ||
+ srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
switch (srcType) {
case GL_BITMAP:
@@ -2142,6 +2143,23 @@ extract_uint_indexes(GLuint n, GLuint indexes[], }
}
break;
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ {
+ GLuint i;
+ const GLuint *s = (const GLuint *) src;
+ if (unpack->SwapBytes) {
+ for (i = 0; i < n; i++) {
+ GLuint value = s[i*2+1];
+ SWAP4BYTE(value);
+ indexes[i] = value & 0xff; /* lower 8 bits */
+ }
+ }
+ else {
+ for (i = 0; i < n; i++)
+ indexes[i] = s[i*2+1] & 0xff; /* lower 8 bits */
+ }
+ }
+ break;
default:
_mesa_problem(NULL, "bad srcType in extract_uint_indexes");
@@ -4412,11 +4430,13 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n, srcType == GL_INT ||
srcType == GL_UNSIGNED_INT_24_8_EXT ||
srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
+ srcType == GL_FLOAT ||
+ srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
ASSERT(dstType == GL_UNSIGNED_BYTE ||
dstType == GL_UNSIGNED_SHORT ||
- dstType == GL_UNSIGNED_INT);
+ dstType == GL_UNSIGNED_INT ||
+ dstType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
/* only shift and offset apply to stencil */
transferOps &= IMAGE_SHIFT_OFFSET_BIT;
@@ -4488,6 +4508,15 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n, case GL_UNSIGNED_INT:
memcpy(dest, indexes, n * sizeof(GLuint));
break;
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ {
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i*2+1] = indexes[i] & 0xff; /* lower 8 bits */
+ }
+ }
+ break;
default:
_mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
}
@@ -4798,6 +4827,20 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n, }
}
break;
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ {
+ GLuint i;
+ const GLfloat *src = (const GLfloat *)source;
+ for (i = 0; i < n; i++) {
+ GLfloat value = src[i * 2];
+ if (srcPacking->SwapBytes) {
+ SWAP4BYTE(value);
+ }
+ depthValues[i] = value;
+ }
+ needClamp = GL_TRUE;
+ }
+ break;
case GL_FLOAT:
DEPTH_VALUES(GLfloat, 1*);
needClamp = GL_TRUE;
@@ -4874,9 +4917,18 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n, zValues[i] = (GLushort) (depthValues[i] * (GLfloat) depthMax);
}
}
+ else if (dstType == GL_FLOAT) {
+ /* Nothing to do. depthValues is pointing to dest. */
+ }
+ else if (dstType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV) {
+ GLfloat *zValues = (GLfloat*) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ zValues[i*2] = depthValues[i];
+ }
+ }
else {
- ASSERT(dstType == GL_FLOAT);
- /*ASSERT(depthMax == 1.0F);*/
+ ASSERT(0);
}
free(depthTemp);
@@ -5004,10 +5056,11 @@ _mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest, /**
- * Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8.
+ * Pack depth and stencil values as GL_DEPTH_STENCIL (GL_UNSIGNED_INT_24_8 etc)
*/
void
-_mesa_pack_depth_stencil_span(struct gl_context *ctx, GLuint n, GLuint *dest,
+_mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n,
+ GLenum dstType, GLuint *dest,
const GLfloat *depthVals,
const GLstencil *stencilVals,
const struct gl_pixelstore_attrib *dstPacking)
@@ -5037,9 +5090,19 @@ _mesa_pack_depth_stencil_span(struct gl_context *ctx, GLuint n, GLuint *dest, stencilVals = stencilCopy;
}
- for (i = 0; i < n; i++) {
- GLuint z = (GLuint) (depthVals[i] * 0xffffff);
- dest[i] = (z << 8) | (stencilVals[i] & 0xff);
+ switch (dstType) {
+ case GL_UNSIGNED_INT_24_8:
+ for (i = 0; i < n; i++) {
+ GLuint z = (GLuint) (depthVals[i] * 0xffffff);
+ dest[i] = (z << 8) | (stencilVals[i] & 0xff);
+ }
+ break;
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ for (i = 0; i < n; i++) {
+ ((GLfloat*)dest)[i*2] = depthVals[i];
+ dest[i*2+1] = stencilVals[i] & 0xff;
+ }
+ break;
}
if (dstPacking->SwapBytes) {
|