Mesa (master): mesa: implement depth unpacking for GL_FLOAT_32_UNSIGNED_INT_24_8_REV

Marek Olšák mareko at kemper.freedesktop.org
Sun Jul 10 19:44:50 UTC 2011


Module: Mesa
Branch: master
Commit: bfb63b7d62ccd9618a110f9f5297f87574384058
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfb63b7d62ccd9618a110f9f5297f87574384058

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Jun 21 05:09:24 2011 +0200

mesa: implement depth unpacking for GL_FLOAT_32_UNSIGNED_INT_24_8_REV

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/pack.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index c284c7d..d42ae7b 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -4827,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;
@@ -4903,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);




More information about the mesa-commit mailing list