summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-08 09:02:36 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-08 09:02:36 -0600
commit25cfb68f0b3baf0e74d1f6a37afab46370f6711b (patch)
tree6b0e7252b9b006331cc1a6a531b05d6959d60477 /src/mesa
parent64359af07188c06dcc6a9a95ba05f7e8209a7379 (diff)
Change float depthScale param to _mesa_unpack_depth_span() to GLuint depthMax.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/image.c22
-rw-r--r--src/mesa/main/image.h6
-rw-r--r--src/mesa/main/texstore.c8
-rw-r--r--src/mesa/swrast/s_drawpix.c6
4 files changed, 22 insertions, 20 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index e5b9ce8280..ba46cdc1b1 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -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);*/
}
}
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index 990398a7c4..2a16989fa7 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -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 );
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 9b8a06df14..3b5151ed17 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -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,
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 1c9f64b275..0cf425e1c6 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -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,