Change float depthScale param to _mesa_unpack_depth_span() to GLuint depthMax.
authorBrian <brian.paul@tungstengraphics.com>
Sun, 8 Jul 2007 15:02:36 +0000 (09:02 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Sun, 8 Jul 2007 15:02:36 +0000 (09:02 -0600)
src/mesa/main/image.c
src/mesa/main/image.h
src/mesa/main/texstore.c
src/mesa/swrast/s_drawpix.c

index e5b9ce8..ba46cdc 100644 (file)
@@ -3889,12 +3889,12 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
  * The glPixelTransfer (scale/bias) params will be applied.
  *
  * \param dstType  one of GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GL_FLOAT
- * \param depthScale  scale factor (max value) for returned GLushort or
- *                    GLuint values (ignored for GLfloat).
+ * \param depthMax  max value for returned GLushort or GLuint values
+ *                  (ignored for GLfloat).
  */
 void
 _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
-                         GLenum dstType, GLvoid *dest, GLfloat depthScale,
+                         GLenum dstType, GLvoid *dest, GLuint depthMax,
                          GLenum srcType, const GLvoid *source,
                          const struct gl_pixelstore_attrib *srcPacking )
 {
@@ -3919,7 +3919,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
       }
       if (srcType == GL_UNSIGNED_SHORT
           && dstType == GL_UNSIGNED_INT
-          && depthScale == (GLfloat) 0xffffffff) {
+          && depthMax == 0xffffffff) {
          const GLushort *src = (const GLushort *) source;
          GLuint *dst = (GLuint *) dest;
          GLuint i;
@@ -3967,7 +3967,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
          break;
       case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
          if (dstType == GL_UNSIGNED_INT &&
-             depthScale == (GLfloat) 0xffffff &&
+             depthMax == 0xffffff &&
              ctx->Pixel.DepthScale == 1.0 &&
              ctx->Pixel.DepthBias == 0.0) {
             const GLuint *src = (const GLuint *) source;
@@ -4045,16 +4045,16 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
    if (dstType == GL_UNSIGNED_INT) {
       GLuint *zValues = (GLuint *) dest;
       GLuint i;
-      if (depthScale <= (GLfloat) 0xffffff) {
+      if (depthMax <= 0xffffff) {
          /* no overflow worries */
          for (i = 0; i < n; i++) {
-            zValues[i] = (GLuint) (depthValues[i] * depthScale);
+            zValues[i] = (GLuint) (depthValues[i] * (GLfloat) depthMax);
          }
       }
       else {
          /* need to use double precision to prevent overflow problems */
          for (i = 0; i < n; i++) {
-            GLdouble z = depthValues[i] * depthScale;
+            GLdouble z = depthValues[i] * (GLfloat) depthMax;
             if (z >= (GLdouble) 0xffffffff)
                zValues[i] = 0xffffffff;
             else
@@ -4065,14 +4065,14 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
    else if (dstType == GL_UNSIGNED_SHORT) {
       GLushort *zValues = (GLushort *) dest;
       GLuint i;
-      ASSERT(depthScale <= 65535.0);
+      ASSERT(depthMax <= 0xffff);
       for (i = 0; i < n; i++) {
-         zValues[i] = (GLushort) (depthValues[i] * depthScale);
+         zValues[i] = (GLushort) (depthValues[i] * (GLfloat) depthMax);
       }
    }
    else {
       ASSERT(dstType == GL_FLOAT);
-      ASSERT(depthScale == 1.0F);
+      /*ASSERT(depthMax == 1.0F);*/
    }
 }
 
index 990398a..2a16989 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.2
+ * Version:  7.1
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -181,7 +181,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
 
 extern void
 _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
-                         GLenum dstType, GLvoid *dest, GLfloat depthScale,
+                         GLenum dstType, GLvoid *dest, GLuint depthMax,
                          GLenum srcType, const GLvoid *source,
                          const struct gl_pixelstore_attrib *srcPacking );
 
index 9b8a06d..3b5151e 100644 (file)
@@ -1077,7 +1077,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS)
 GLboolean
 _mesa_texstore_z32(TEXSTORE_PARAMS)
 {
-   const GLfloat depthScale = (GLfloat) 0xffffffff;
+   const GLuint depthScale = 0xffffffff;
    (void) dims;
    ASSERT(dstFormat == &_mesa_texformat_z32);
    ASSERT(dstFormat->TexelBytes == sizeof(GLuint));
@@ -1124,7 +1124,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
 GLboolean
 _mesa_texstore_z16(TEXSTORE_PARAMS)
 {
-   const GLfloat depthScale = 65535.0f;
+   const GLuint depthScale = 0xffff;
    (void) dims;
    ASSERT(dstFormat == &_mesa_texformat_z16);
    ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
@@ -2319,6 +2319,8 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
 GLboolean
 _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
 {
+   const GLuint depthScale = 0xffffff;
+
    ASSERT(dstFormat == &_mesa_texformat_z24_s8);
    ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
    ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT);
@@ -2357,7 +2359,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
             _mesa_unpack_depth_span(ctx, srcWidth,
                                     GL_UNSIGNED_INT, /* dst type */
                                     dstRow, /* dst addr */
-                                    (GLfloat) 0xffffff, /* depthScale */
+                                    depthScale,
                                     srcType, src, srcPacking);
             /* get the 8-bit stencil values */
             _mesa_unpack_stencil_span(ctx, srcWidth,
index 1c9f64b..0cf425e 100644 (file)
@@ -484,7 +484,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
    }
    else {
       /* General case */
-      const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
+      const GLuint depthMax = ctx->DrawBuffer->_DepthMax;
       GLint skipPixels = 0;
 
       /* in case width > MAX_WIDTH do the copy in chunks */
@@ -695,7 +695,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    const GLint imgX = x, imgY = y;
    const GLboolean scaleOrBias
       = ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
-   const GLfloat depthScale = ctx->DrawBuffer->_DepthMaxF;
+   const GLuint depthMax = ctx->DrawBuffer->_DepthMax;
    const GLuint stencilMask = ctx->Stencil.WriteMask[0];
    const GLuint stencilType = (STENCIL_BITS == 8) ? 
       GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
@@ -783,7 +783,7 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
                /* general case */
                GLuint zValues[MAX_WIDTH];  /* 16 or 32-bit Z value storage */
                _mesa_unpack_depth_span(ctx, width,
-                                       depthRb->DataType, zValues, depthScale,
+                                       depthRb->DataType, zValues, depthMax,
                                        type, depthStencilSrc, &clippedUnpack);
                if (zoom) {
                   _swrast_write_zoomed_z_span(ctx, imgX, imgY, width, x,