summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intelcom>2007-09-27 10:44:45 -0600
committerBrian <[email protected]>2007-09-27 10:44:45 -0600
commit2a86a449ca0b3765ee13735d77e1be121f06cabc (patch)
tree4d5cf5de0b3b5f4205ea4338604f11d17cfd5e35 /src/mesa/swrast
parent44f032db61c2de52fba031ea2c289cbb256c3453 (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/mesa/swrast')
-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 097d2c7b51c..5814400b0fe 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -61,8 +61,11 @@ _swrast_span_default_z( 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;
}