summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-09-08 13:55:05 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-09-08 13:55:05 +0000
commitf36954ec3c25b673fc275877938e2dea48ec5682 (patch)
tree736dec05665d2c05ce45b03a279bada11da64d8b /src/mesa
parentf4ff4d36ed320b1551e1f41ee8f52e449c89a626 (diff)
fix precision problem in depth clearing (bug 4395)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_depth.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 9f17bb17aa..a80b8ec120 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -1273,13 +1273,11 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb,
/**
* Clear the depth buffer.
- * XXX this is no longer a swrast function!!!
*/
void
_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
{
- const GLuint clearValue
- = (GLuint) (ctx->Depth.Clear * ctx->DrawBuffer->_DepthMaxF);
+ GLuint clearValue;
GLint x, y, width, height;
if (!rb || !ctx->Depth.Mask) {
@@ -1287,6 +1285,14 @@ _swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
return;
}
+ /* compute integer clearing value */
+ if (ctx->Depth.Clear == 1.0) {
+ clearValue = ctx->DrawBuffer->_DepthMax;
+ }
+ else {
+ clearValue = (GLuint) (ctx->Depth.Clear * ctx->DrawBuffer->_DepthMaxF);
+ }
+
assert(rb->_BaseFormat == GL_DEPTH_COMPONENT);
/* compute region to clear */