summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2007-09-27 15:52:01 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2007-09-27 15:52:01 +0800
commit6254be9b7144821e044d3fbade514fa0358db693 (patch)
treeb7fc4d03328878c7699ef806430cdf2dfcdf8e46 /src
parentaa88d11e7d881f0dd4c02fcefceb4085bdb3cf8a (diff)
mesa: make sure the gotten value isn't greater than the
max depth buffer value on 64bit system. fix bug #12095
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast/s_span.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index bbde0025f4..f1e58bd3d8 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -64,8 +64,11 @@ _swrast_span_default_attribs(GLcontext *ctx, SWspan *span)
const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
if (ctx->DrawBuffer->Visual.depthBits <= 16)
span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F);
- else
- span->z = (GLint) (ctx->Current.RasterPos[2] * depthMax + 0.5F);
+ else {
+ GLfloat tmpf = ctx->Current.RasterPos[2] * depthMax;
+ tmpf = MIN2(tmpf, depthMax);
+ span->z = (GLint)tmpf;
+ }
span->zStep = 0;
span->interpMask |= SPAN_Z;
}