summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pack.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-07-11 01:39:53 +0200
committerMarek Olšák <[email protected]>2011-07-11 03:04:17 +0200
commit01f48a979d85525acd060c8055ec835a1b56ea87 (patch)
tree8790bee28d87605fd473b19906dd6fc75876e500 /src/mesa/main/pack.c
parent91a52dae97379d118965567b5c11e393996baeb9 (diff)
mesa: implement packing of DEPTH_STENCIL & FLOAT_32_UNSIGNED_INT_24_8_REV combo
Tested with the new piglit fbo-depthstencil test.
Diffstat (limited to 'src/mesa/main/pack.c')
-rw-r--r--src/mesa/main/pack.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index d42ae7bf0f4..7de1d05b919 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -5056,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)
@@ -5089,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) {